From 60aa91fec2efce6e33503af2e046e6ec42513158 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Mon, 11 Dec 2023 16:04:21 +0100 Subject: [PATCH] removed some account references --- bindings/python/examples/exchange/1_create_account.py | 10 +++++----- .../python/examples/exchange/2_generate_address.py | 4 +--- bindings/python/examples/exchange/3_check_balance.py | 2 +- .../python/examples/how_tos/account_output/create.py | 2 +- .../python/examples/how_tos/account_output/destroy.py | 2 +- .../examples/how_tos/account_wallet/transaction.py | 3 +-- .../how_tos/accounts_and_addresses/check_balance.py | 2 +- .../accounts_and_addresses/consolidate_outputs.py | 2 +- .../advanced_transactions/advanced_transaction.py | 2 +- .../how_tos/advanced_transactions/claim_transaction.py | 2 +- .../advanced_transactions/send_micro_transaction.py | 2 +- bindings/python/examples/how_tos/native_tokens/burn.py | 2 +- .../python/examples/how_tos/native_tokens/create.py | 2 +- .../examples/how_tos/native_tokens/destroy_foundry.py | 2 +- bindings/python/examples/how_tos/native_tokens/melt.py | 2 +- bindings/python/examples/how_tos/native_tokens/mint.py | 2 +- bindings/python/examples/how_tos/native_tokens/send.py | 2 +- .../how_tos/nft_collection/00_mint_issuer_nft.py | 2 +- .../how_tos/nft_collection/01_mint_collection_nft.py | 2 +- bindings/python/examples/how_tos/nfts/burn_nft.py | 2 +- bindings/python/examples/how_tos/nfts/mint_nft.py | 2 +- bindings/python/examples/how_tos/nfts/send_nft.py | 2 +- .../how_tos/simple_transaction/simple_transaction.py | 2 +- bindings/python/iota_sdk/wallet/wallet.py | 2 +- 24 files changed, 28 insertions(+), 31 deletions(-) diff --git a/bindings/python/examples/exchange/1_create_account.py b/bindings/python/examples/exchange/1_create_account.py index 4b8a7790aa..a76d8201c0 100644 --- a/bindings/python/examples/exchange/1_create_account.py +++ b/bindings/python/examples/exchange/1_create_account.py @@ -8,7 +8,7 @@ from dotenv import load_dotenv from iota_sdk import (ClientOptions, CoinType, StrongholdSecretManager, - SyncOptions, Wallet, WalletOptions, Bip44) + SecretManager, SyncOptions, Wallet, WalletOptions, Bip44) # This example uses secrets in environment variables for simplicity which # should not be done in production. @@ -24,16 +24,16 @@ secret_manager = StrongholdSecretManager( os.environ.get('STRONGHOLD_SNAPSHOT_PATH'), os.environ['STRONGHOLD_PASSWORD']) +# Store the mnemonic in the Stronghold snapshot, this only needs to be +# done once. +SecretManager(secret_manager).store_mnemonic(os.environ['MNEMONIC']) + bib_path = Bip44( coin_type=CoinType.SHIMMER ) wallet_options = WalletOptions(None, None, bib_path, client_options, secret_manager, os.environ.get('WALLET_DB_PATH')) wallet = Wallet(wallet_options) -# Store the mnemonic in the Stronghold snapshot, this only needs to be -# done once. -wallet.store_mnemonic(os.environ['MNEMONIC']) - # Set sync_only_most_basic_outputs to True if not interested in outputs that are timelocked, # have a storage deposit return, expiration or are nft/account/foundry outputs. wallet.set_default_sync_options( diff --git a/bindings/python/examples/exchange/2_generate_address.py b/bindings/python/examples/exchange/2_generate_address.py index 0fd365e798..3abe078726 100644 --- a/bindings/python/examples/exchange/2_generate_address.py +++ b/bindings/python/examples/exchange/2_generate_address.py @@ -17,10 +17,8 @@ if env_var not in os.environ: raise Exception(f'.env {env_var} is undefined, see .env.example') -client_options = ClientOptions(nodes=[os.environ.get('NODE_URL')]) - secret_manager = SecretManager(StrongholdSecretManager( os.environ.get('STRONGHOLD_SNAPSHOT_PATH'), os.environ['STRONGHOLD_PASSWORD'])) address = secret_manager.generate_ed25519_addresses(1)[0] -print('Address:', address.address) +print('Address:', address) diff --git a/bindings/python/examples/exchange/3_check_balance.py b/bindings/python/examples/exchange/3_check_balance.py index b0a836dea7..c8c6b4d0c2 100644 --- a/bindings/python/examples/exchange/3_check_balance.py +++ b/bindings/python/examples/exchange/3_check_balance.py @@ -19,7 +19,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) address = wallet.address() -print('address:', address) +print('Address:', address) # Set sync_only_most_basic_outputs to True if not interested in outputs that are timelocked, # have a storage deposit return, expiration or are nft/account/foundry outputs. diff --git a/bindings/python/examples/how_tos/account_output/create.py b/bindings/python/examples/how_tos/account_output/create.py index e077c67a61..709396a468 100644 --- a/bindings/python/examples/how_tos/account_output/create.py +++ b/bindings/python/examples/how_tos/account_output/create.py @@ -15,7 +15,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() print(f'Accounts BEFORE: {balance.accounts}') diff --git a/bindings/python/examples/how_tos/account_output/destroy.py b/bindings/python/examples/how_tos/account_output/destroy.py index e90c55e33f..c322e40263 100644 --- a/bindings/python/examples/how_tos/account_output/destroy.py +++ b/bindings/python/examples/how_tos/account_output/destroy.py @@ -14,7 +14,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() # We try to destroy the first account in the account diff --git a/bindings/python/examples/how_tos/account_wallet/transaction.py b/bindings/python/examples/how_tos/account_wallet/transaction.py index 7c6320295e..89f4239586 100644 --- a/bindings/python/examples/how_tos/account_wallet/transaction.py +++ b/bindings/python/examples/how_tos/account_wallet/transaction.py @@ -12,12 +12,11 @@ if env_var not in os.environ: raise Exception(f".env {env_var} is undefined, see .env.example") -sync_options = SyncOptions(account=WalletSyncOptions(basic_outputs=True)) - wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) +sync_options = SyncOptions(account=WalletSyncOptions(basic_outputs=True)) balance = wallet.sync(sync_options) total_base_token_balance = balance.base_coin.total diff --git a/bindings/python/examples/how_tos/accounts_and_addresses/check_balance.py b/bindings/python/examples/how_tos/accounts_and_addresses/check_balance.py index 27160b5ce0..4c85509ddc 100644 --- a/bindings/python/examples/how_tos/accounts_and_addresses/check_balance.py +++ b/bindings/python/examples/how_tos/accounts_and_addresses/check_balance.py @@ -13,7 +13,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node _balance = wallet.sync() # Just calculate the balance with the known state diff --git a/bindings/python/examples/how_tos/accounts_and_addresses/consolidate_outputs.py b/bindings/python/examples/how_tos/accounts_and_addresses/consolidate_outputs.py index 8d26f90f17..940e6f8c12 100644 --- a/bindings/python/examples/how_tos/accounts_and_addresses/consolidate_outputs.py +++ b/bindings/python/examples/how_tos/accounts_and_addresses/consolidate_outputs.py @@ -17,7 +17,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) wallet.set_stronghold_password(os.environ['STRONGHOLD_PASSWORD']) -# Sync account to make sure account is updated with outputs from previous +# Sync wallet to make sure account is updated with outputs from previous # examples. wallet.sync() print('Account synced') diff --git a/bindings/python/examples/how_tos/advanced_transactions/advanced_transaction.py b/bindings/python/examples/how_tos/advanced_transactions/advanced_transaction.py index 9fd27e4e25..309cbac125 100644 --- a/bindings/python/examples/how_tos/advanced_transactions/advanced_transaction.py +++ b/bindings/python/examples/how_tos/advanced_transactions/advanced_transaction.py @@ -21,7 +21,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node response = wallet.sync() if 'STRONGHOLD_PASSWORD' not in os.environ: diff --git a/bindings/python/examples/how_tos/advanced_transactions/claim_transaction.py b/bindings/python/examples/how_tos/advanced_transactions/claim_transaction.py index 0ebca3b8c6..fe252f762d 100644 --- a/bindings/python/examples/how_tos/advanced_transactions/claim_transaction.py +++ b/bindings/python/examples/how_tos/advanced_transactions/claim_transaction.py @@ -16,7 +16,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node response = wallet.sync() # Only the unspent outputs in the account diff --git a/bindings/python/examples/how_tos/advanced_transactions/send_micro_transaction.py b/bindings/python/examples/how_tos/advanced_transactions/send_micro_transaction.py index 4868f2d9ac..f95aa8cde9 100644 --- a/bindings/python/examples/how_tos/advanced_transactions/send_micro_transaction.py +++ b/bindings/python/examples/how_tos/advanced_transactions/send_micro_transaction.py @@ -10,7 +10,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node response = wallet.sync() if 'STRONGHOLD_PASSWORD' not in os.environ: diff --git a/bindings/python/examples/how_tos/native_tokens/burn.py b/bindings/python/examples/how_tos/native_tokens/burn.py index 48d6efac81..7ad18ceb4e 100644 --- a/bindings/python/examples/how_tos/native_tokens/burn.py +++ b/bindings/python/examples/how_tos/native_tokens/burn.py @@ -8,7 +8,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() if 'STRONGHOLD_PASSWORD' not in os.environ: diff --git a/bindings/python/examples/how_tos/native_tokens/create.py b/bindings/python/examples/how_tos/native_tokens/create.py index 16f8bf8752..883f07926e 100644 --- a/bindings/python/examples/how_tos/native_tokens/create.py +++ b/bindings/python/examples/how_tos/native_tokens/create.py @@ -15,7 +15,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() # We can first check if we already have an account output in our account, because diff --git a/bindings/python/examples/how_tos/native_tokens/destroy_foundry.py b/bindings/python/examples/how_tos/native_tokens/destroy_foundry.py index b8aefd2a83..8682b1dad7 100644 --- a/bindings/python/examples/how_tos/native_tokens/destroy_foundry.py +++ b/bindings/python/examples/how_tos/native_tokens/destroy_foundry.py @@ -8,7 +8,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() print(f'Foundries before destroying: {len(balance.foundries)}') diff --git a/bindings/python/examples/how_tos/native_tokens/melt.py b/bindings/python/examples/how_tos/native_tokens/melt.py index 83526cbb40..dd66fd965d 100644 --- a/bindings/python/examples/how_tos/native_tokens/melt.py +++ b/bindings/python/examples/how_tos/native_tokens/melt.py @@ -10,7 +10,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() # Find first foundry and corresponding token id diff --git a/bindings/python/examples/how_tos/native_tokens/mint.py b/bindings/python/examples/how_tos/native_tokens/mint.py index 564e68aea1..517eab633a 100644 --- a/bindings/python/examples/how_tos/native_tokens/mint.py +++ b/bindings/python/examples/how_tos/native_tokens/mint.py @@ -10,7 +10,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() # Find first foundry and corresponding token id diff --git a/bindings/python/examples/how_tos/native_tokens/send.py b/bindings/python/examples/how_tos/native_tokens/send.py index 1e2e8e45db..d960dd1191 100644 --- a/bindings/python/examples/how_tos/native_tokens/send.py +++ b/bindings/python/examples/how_tos/native_tokens/send.py @@ -10,7 +10,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() token = [native_balance for native_balance in balance.native_tokens if int( diff --git a/bindings/python/examples/how_tos/nft_collection/00_mint_issuer_nft.py b/bindings/python/examples/how_tos/nft_collection/00_mint_issuer_nft.py index 3a4ce4fc8e..0aadd23767 100644 --- a/bindings/python/examples/how_tos/nft_collection/00_mint_issuer_nft.py +++ b/bindings/python/examples/how_tos/nft_collection/00_mint_issuer_nft.py @@ -15,7 +15,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node wallet.sync() # Issue the minting transaction and wait for its inclusion diff --git a/bindings/python/examples/how_tos/nft_collection/01_mint_collection_nft.py b/bindings/python/examples/how_tos/nft_collection/01_mint_collection_nft.py index ef097ff96d..25003d6b41 100644 --- a/bindings/python/examples/how_tos/nft_collection/01_mint_collection_nft.py +++ b/bindings/python/examples/how_tos/nft_collection/01_mint_collection_nft.py @@ -26,7 +26,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node wallet.sync() bech32_hrp = wallet.get_client().get_bech32_hrp() diff --git a/bindings/python/examples/how_tos/nfts/burn_nft.py b/bindings/python/examples/how_tos/nfts/burn_nft.py index 53730cd112..aa51158a18 100644 --- a/bindings/python/examples/how_tos/nfts/burn_nft.py +++ b/bindings/python/examples/how_tos/nfts/burn_nft.py @@ -14,7 +14,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() nftId = balance.nfts[0] diff --git a/bindings/python/examples/how_tos/nfts/mint_nft.py b/bindings/python/examples/how_tos/nfts/mint_nft.py index 8c84c2149b..adee0a54bd 100644 --- a/bindings/python/examples/how_tos/nfts/mint_nft.py +++ b/bindings/python/examples/how_tos/nfts/mint_nft.py @@ -15,7 +15,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node response = wallet.sync() outputs = [MintNftParams( diff --git a/bindings/python/examples/how_tos/nfts/send_nft.py b/bindings/python/examples/how_tos/nfts/send_nft.py index b67c801d2a..9908e5ca6a 100644 --- a/bindings/python/examples/how_tos/nfts/send_nft.py +++ b/bindings/python/examples/how_tos/nfts/send_nft.py @@ -15,7 +15,7 @@ wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) -# Sync account with the node +# Sync wallet with the node balance = wallet.sync() outputs = [SendNftParams( diff --git a/bindings/python/examples/how_tos/simple_transaction/simple_transaction.py b/bindings/python/examples/how_tos/simple_transaction/simple_transaction.py index 9c59b57a57..3e8492db02 100644 --- a/bindings/python/examples/how_tos/simple_transaction/simple_transaction.py +++ b/bindings/python/examples/how_tos/simple_transaction/simple_transaction.py @@ -10,7 +10,7 @@ wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) -# Sync account with the node +# Sync wallet with the node response = wallet.sync() if 'STRONGHOLD_PASSWORD' not in os.environ: diff --git a/bindings/python/iota_sdk/wallet/wallet.py b/bindings/python/iota_sdk/wallet/wallet.py index 69f72dbff3..af776926b4 100644 --- a/bindings/python/iota_sdk/wallet/wallet.py +++ b/bindings/python/iota_sdk/wallet/wallet.py @@ -737,7 +737,7 @@ def sign_transaction( def sign_and_submit_transaction( self, prepared_transaction_data: PreparedTransactionData) -> TransactionWithMetadata: - """Validate the transaction, sign it, submit it to a node and store it in the account. + """Validate the transaction, sign it, submit it to a node and store it in the wallet. """ return TransactionWithMetadata.from_dict(self._call_method( 'signAndSubmitTransaction', {