-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.0' into refactor-MetadataFeature
- Loading branch information
Showing
84 changed files
with
1,512 additions
and
1,434 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,24 @@ | ||
# Copyright 2023 IOTA Stiftung | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This example generates an address for an account. | ||
# This example generates an address for a wallet. | ||
|
||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
from iota_sdk import Wallet | ||
from iota_sdk import StrongholdSecretManager, SecretManager | ||
|
||
# This example uses secrets in environment variables for simplicity which | ||
# should not be done in production. | ||
load_dotenv() | ||
|
||
for env_var in ['WALLET_DB_PATH', 'STRONGHOLD_PASSWORD']: | ||
for env_var in ['STRONGHOLD_SNAPSHOT_PATH', 'STRONGHOLD_PASSWORD']: | ||
if env_var not in os.environ: | ||
raise Exception(f'.env {env_var} is undefined, see .env.example') | ||
|
||
wallet = Wallet(os.environ.get('WALLET_DB_PATH')) | ||
secret_manager = SecretManager(StrongholdSecretManager( | ||
os.environ.get('STRONGHOLD_SNAPSHOT_PATH'), os.environ['STRONGHOLD_PASSWORD'])) | ||
|
||
wallet.set_stronghold_password(os.environ["STRONGHOLD_PASSWORD"]) | ||
|
||
account = wallet.get_account('Alice') | ||
|
||
address = account.generate_ed25519_addresses(1)[0] | ||
print('Address:', address.address) | ||
address = secret_manager.generate_ed25519_addresses(1)[0] | ||
print('Address:', address) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
# Copyright 2023 IOTA Stiftung | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# This example gets the balance of an account. | ||
# This example gets the balance of a wallet. | ||
|
||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
from iota_sdk import SyncOptions, Wallet | ||
from iota_sdk import SyncOptions, Wallet, WalletOptions | ||
|
||
# This example uses secrets in environment variables for simplicity which | ||
# should not be done in production. | ||
load_dotenv() | ||
|
||
if 'WALLET_DB_PATH' not in os.environ: | ||
raise Exception(".env WALLET_DB_PATH is undefined, see .env.example") | ||
for env_var in ['WALLET_DB_PATH', 'FAUCET_URL']: | ||
if env_var not in os.environ: | ||
raise Exception(f'.env {env_var} is undefined, see .env.example') | ||
|
||
wallet = Wallet(os.environ.get('WALLET_DB_PATH')) | ||
wallet = Wallet(WalletOptions(storage_path=os.environ.get('WALLET_DB_PATH'))) | ||
|
||
account = wallet.get_account('Alice') | ||
|
||
addresses = account.addresses() | ||
print('Addresses:', addresses) | ||
address = wallet.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. | ||
balance = account.sync(SyncOptions(sync_only_most_basic_outputs=True)) | ||
balance = wallet.sync(SyncOptions(sync_only_most_basic_outputs=True)) | ||
print('Balance', balance) | ||
|
||
# Use the faucet to send tokens to your address. | ||
print('Fill your address with the Faucet: https://faucet.testnet.shimmer.network/') | ||
print(f'Fill your address with the Faucet: {os.environ["FAUCET_URL"]}') |
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
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
Oops, something went wrong.