Created
July 10, 2021 00:10
-
-
Save Quexington/2621365712f11dd17dcaf6d5bb1506d9 to your computer and use it in GitHub Desktop.
Wallet Utility Pseudo Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ chialisp wallet load my_smart_wallet.py | |
MySmartWallet loaded successfully. | |
$ chialisp wallet inspect -s 500000 -e 500005 | |
Successfully scanned blocks 500000 through 500005 | |
No coin store was initialized, here's the results: | |
"my_smart_wallet": [ | |
{ | |
"coin": { | |
"parent_coin_info": "e47125968b3b71049fbc4802d1e40a71ea1359decfabacf70b34588037d4ff0c", | |
"puzzle_hash": "3e6d69ed7d8863ce013b0d4915e34f0fffd2f321285e4d49e022b0f74c0e6081", | |
"amount": 42069 | |
}, | |
...other CoinRecord jazz... | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The wallet parent class can handle all of the same stuff as the command line utilty but in a programmatic way | |
class MySmartWallet(Wallet): | |
def __init__(): | |
# Do initialization of this object | |
# Define common settings | |
# Configure CoinStore for more or less fields? | |
def new_block( | |
additions: List[CoinRecord], | |
removals: List[CoinRecord], | |
height: uint32, | |
transaction_generator: SerializedProgram, | |
current_coin_store: CoinStore, | |
etc: Any, | |
) -> List[CoinRecord]: | |
INTERESTING_PUZZLE_HASH = "3e6d69ed7d8863ce013b0d4915e34f0fffd2f321285e4d49e022b0f74c0e6081" | |
interesting_coins = [] | |
for addition in additions: | |
if addition.coin.puzzle_hash == INTERESTING_PUZZLE_HASH: | |
interestion_coins.append(addition) | |
return interesting_coins | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment