diff --git a/sdk/examples/how_tos/account/create.rs b/sdk/examples/how_tos/account/create.rs index ca9217f50a..78ad399c7f 100644 --- a/sdk/examples/how_tos/account/create.rs +++ b/sdk/examples/how_tos/account/create.rs @@ -4,7 +4,7 @@ //! In this example we will create an account output. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example and that funds are available by running +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example and that funds are available by running //! the `get_funds` example! //! //! Rename `.env.example` to `.env` first, then run the command: diff --git a/sdk/examples/how_tos/account/destroy.rs b/sdk/examples/how_tos/account/destroy.rs index 32c110c0b4..a3d83bda43 100644 --- a/sdk/examples/how_tos/account/destroy.rs +++ b/sdk/examples/how_tos/account/destroy.rs @@ -4,7 +4,7 @@ //! In this example we will try to destroy the first account output there is in the account. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/accounts_and_addresses/check_balance.rs b/sdk/examples/how_tos/accounts_and_addresses/check_balance.rs index fbbcc41668..e9ec8f0095 100644 --- a/sdk/examples/how_tos/accounts_and_addresses/check_balance.rs +++ b/sdk/examples/how_tos/accounts_and_addresses/check_balance.rs @@ -1,10 +1,10 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -//! In this example we sync the account and get the balance. +//! In this example we sync the wallet and get the balance. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/accounts_and_addresses/consolidate_outputs.rs b/sdk/examples/how_tos/accounts_and_addresses/consolidate_outputs.rs index c228688c06..08fb4a564d 100644 --- a/sdk/examples/how_tos/accounts_and_addresses/consolidate_outputs.rs +++ b/sdk/examples/how_tos/accounts_and_addresses/consolidate_outputs.rs @@ -1,11 +1,11 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -//! In this example we will consolidate basic outputs from an account with only an AddressUnlockCondition by sending +//! In this example we will consolidate basic outputs from a wallet with only an AddressUnlockCondition by sending //! them to the same address again. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh @@ -40,7 +40,7 @@ async fn main() -> Result<()> { // List unspent outputs before consolidation. // The output we created with example `03_get_funds` and the basic output from `09_mint_native_tokens` have only one // unlock condition and it is an `AddressUnlockCondition`, and so they are valid for consolidation. They have the - // same `AddressUnlockCondition`(the first address of the account), so they will be consolidated into one + // same `AddressUnlockCondition`(the address of the wallet), so they will be consolidated into one // output. let outputs = wallet.unspent_outputs(None).await?; println!("Outputs BEFORE consolidation:"); diff --git a/sdk/examples/how_tos/accounts_and_addresses/create_address.rs b/sdk/examples/how_tos/accounts_and_addresses/create_address.rs deleted file mode 100644 index 3cd40dac03..0000000000 --- a/sdk/examples/how_tos/accounts_and_addresses/create_address.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -//! In this example we will generate addresses for an already existing wallet. -//! -//! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! -//! -//! Rename `.env.example` to `.env` first, then run the command: -//! ```sh -//! cargo run --release --all-features --example create_address` -//! ``` - -use iota_sdk::{wallet::Result, Wallet}; - -// The number of addresses to generate -const NUM_ADDRESSES_TO_GENERATE: u32 = 5; - -#[tokio::main] -async fn main() -> Result<()> { - // This example uses secrets in environment variables for simplicity which should not be done in production. - dotenvy::dotenv().ok(); - - let wallet = Wallet::builder() - .with_storage_path(&std::env::var("WALLET_DB_PATH").unwrap()) - .finish() - .await?; - let account = wallet.get_account("Alice").await?; - - // Provide the stronghold password - wallet - .set_stronghold_password(std::env::var("STRONGHOLD_PASSWORD").unwrap()) - .await?; - - let explorer_url = std::env::var("EXPLORER_URL").ok(); - let address_url = explorer_url.map(|url| format!("{url}/addr/")).unwrap_or_default(); - - println!("Current addresses:"); - for address in account.addresses().await { - println!(" - {address_url}{}", address.address()); - } - - // Generate some addresses - let new_addresses = account - .generate_ed25519_addresses(NUM_ADDRESSES_TO_GENERATE, None) - .await?; - println!("Generated {} new addresses:", new_addresses.len()); - let account_addresses = account.addresses().await; - for new_address in new_addresses.iter() { - assert!(account_addresses.contains(new_address)); - println!(" - {address_url}{}", new_address.address()); - } - Ok(()) -} diff --git a/sdk/examples/how_tos/advanced_transactions/send_micro_transaction.rs b/sdk/examples/how_tos/advanced_transactions/send_micro_transaction.rs index 92de18f6a7..ff511714df 100644 --- a/sdk/examples/how_tos/advanced_transactions/send_micro_transaction.rs +++ b/sdk/examples/how_tos/advanced_transactions/send_micro_transaction.rs @@ -4,7 +4,7 @@ //! In this example we will send an amount below the minimum storage deposit. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/native_tokens/burn.rs b/sdk/examples/how_tos/native_tokens/burn.rs index b0c950920b..15d0985236 100644 --- a/sdk/examples/how_tos/native_tokens/burn.rs +++ b/sdk/examples/how_tos/native_tokens/burn.rs @@ -6,9 +6,9 @@ //! output that minted it. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! -//! You may provide a TOKEN_ID that is available in the account. You can check this by running the +//! You may provide a TOKEN_ID that is available in the wallet. You can check this by running the //! `get_balance` example. You can create a new native token by running the `create_native_token` example. //! //! Rename `.env.example` to `.env` first, then run the command: @@ -22,7 +22,7 @@ use iota_sdk::{ Wallet, U256, }; -// The minimum available native token amount to search for in the account +// The minimum available native token amount to search for in the wallet const MIN_AVAILABLE_AMOUNT: u64 = 11; // The amount of the native token to burn const BURN_AMOUNT: u64 = 1; diff --git a/sdk/examples/how_tos/native_tokens/create.rs b/sdk/examples/how_tos/native_tokens/create.rs index 103a4a9883..c47b7f8275 100644 --- a/sdk/examples/how_tos/native_tokens/create.rs +++ b/sdk/examples/how_tos/native_tokens/create.rs @@ -4,7 +4,7 @@ //! In this example we will create a native token. //! //! Make sure that `example.stronghold` and `example.walletdb` already exist by -//! running the `create_account` example! +//! running the `create_wallet` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh @@ -39,7 +39,7 @@ async fn main() -> Result<()> { .set_stronghold_password(std::env::var("STRONGHOLD_PASSWORD").unwrap()) .await?; - // We can first check if we already have an account output in our account, because an account can have many foundry + // We can first check if we already have an account output in our wallet, because an account can have many foundry // outputs and therefore we can reuse an existing one if balance.accounts().is_empty() { // If we don't have an account, we need to create one diff --git a/sdk/examples/how_tos/native_tokens/destroy_foundry.rs b/sdk/examples/how_tos/native_tokens/destroy_foundry.rs index b46653b0f3..a324f366db 100644 --- a/sdk/examples/how_tos/native_tokens/destroy_foundry.rs +++ b/sdk/examples/how_tos/native_tokens/destroy_foundry.rs @@ -1,11 +1,11 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -//! In this example we will try to destroy the first foundry there is in the account. This is only possible if its +//! In this example we will try to destroy the first foundry there is in the wallet. This is only possible if its //! circulating supply is 0 and no native tokens were burned. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh @@ -30,7 +30,7 @@ async fn main() -> Result<()> { let foundry_count = balance.foundries().len(); println!("Foundries before destroying: {foundry_count}"); - // We try to destroy the first foundry in the account + // We try to destroy the first foundry in the wallet if let Some(foundry_id) = balance.foundries().first() { let token_id = TokenId::from(*foundry_id); diff --git a/sdk/examples/how_tos/native_tokens/melt.rs b/sdk/examples/how_tos/native_tokens/melt.rs index 9c74275ab4..90bdcc34d0 100644 --- a/sdk/examples/how_tos/native_tokens/melt.rs +++ b/sdk/examples/how_tos/native_tokens/melt.rs @@ -4,9 +4,9 @@ //! In this example we will melt an existing native token with its foundry. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! -//! You may provide a TOKEN_ID that is available in the account. The foundry +//! You may provide a TOKEN_ID that is available in the wallet. The foundry //! output which minted it needs to be available as well. You can check this by //! running the `get_balance` example. You can create a new native token by running //! the `create_native_token` example. @@ -48,7 +48,7 @@ async fn main() -> Result<()> { let available_balance = native_token_balance.available(); println!("Balance before melting: {available_balance}"); } else { - println!("Couldn't find native token '{token_id}' in the account"); + println!("Couldn't find native token '{token_id}' in the wallet"); return Ok(()); } diff --git a/sdk/examples/how_tos/native_tokens/mint.rs b/sdk/examples/how_tos/native_tokens/mint.rs index d7ac780d0b..46a6ddfce9 100644 --- a/sdk/examples/how_tos/native_tokens/mint.rs +++ b/sdk/examples/how_tos/native_tokens/mint.rs @@ -4,9 +4,9 @@ //! In this example we will mint an existing native token with its foundry. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! -//! You may provide a TOKEN_ID that is available in the account. The foundry +//! You may provide a TOKEN_ID that is available in the wallet. The foundry //! output which minted it needs to be available as well. You can check this by //! running the `get_balance` example. You can create a new native token by running //! the `create_native_token` example. @@ -48,7 +48,7 @@ async fn main() -> Result<()> { let available_balance = native_token_balance.available(); println!("Balance before minting: {available_balance}"); } else { - println!("Couldn't find native token '{token_id}' in the account"); + println!("Couldn't find native token '{token_id}' in the wallet"); return Ok(()); } diff --git a/sdk/examples/how_tos/native_tokens/send.rs b/sdk/examples/how_tos/native_tokens/send.rs index c23c61c02b..d611442b05 100644 --- a/sdk/examples/how_tos/native_tokens/send.rs +++ b/sdk/examples/how_tos/native_tokens/send.rs @@ -4,7 +4,7 @@ //! In this example we will send native tokens. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/nft_collection/00_mint_issuer_nft.rs b/sdk/examples/how_tos/nft_collection/00_mint_issuer_nft.rs index 59e69fe1c9..d49d6d177a 100644 --- a/sdk/examples/how_tos/nft_collection/00_mint_issuer_nft.rs +++ b/sdk/examples/how_tos/nft_collection/00_mint_issuer_nft.rs @@ -4,7 +4,7 @@ //! In this example we will mint the issuer NFT for the NFT collection. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Make sure that the wallet already has some funds by running the //! `./how_tos/simple_transaction/request_funds.rs` example! diff --git a/sdk/examples/how_tos/nft_collection/01_mint_collection_nft.rs b/sdk/examples/how_tos/nft_collection/01_mint_collection_nft.rs index 4592ea1acc..b71ff05350 100644 --- a/sdk/examples/how_tos/nft_collection/01_mint_collection_nft.rs +++ b/sdk/examples/how_tos/nft_collection/01_mint_collection_nft.rs @@ -4,7 +4,7 @@ //! In this example we will mint some collection NFTs with issuer feature. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example. +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example. //! //! You have to provide the ISSUER_NFT_ID that was created by first running the //! `mint_issuer_nft` example! diff --git a/sdk/examples/how_tos/nfts/burn_nft.rs b/sdk/examples/how_tos/nfts/burn_nft.rs index 6e974aa23f..84a4ab2df5 100644 --- a/sdk/examples/how_tos/nfts/burn_nft.rs +++ b/sdk/examples/how_tos/nfts/burn_nft.rs @@ -4,7 +4,7 @@ //! In this example we will burn an existing nft output. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/nfts/mint_nft.rs b/sdk/examples/how_tos/nfts/mint_nft.rs index cae92a5534..be2a795532 100644 --- a/sdk/examples/how_tos/nfts/mint_nft.rs +++ b/sdk/examples/how_tos/nfts/mint_nft.rs @@ -4,7 +4,7 @@ //! In this example we will mint some NFTs. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/nfts/send_nft.rs b/sdk/examples/how_tos/nfts/send_nft.rs index d1740a10a9..4c24e104ff 100644 --- a/sdk/examples/how_tos/nfts/send_nft.rs +++ b/sdk/examples/how_tos/nfts/send_nft.rs @@ -4,7 +4,7 @@ //! In this example we will send an NFT. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/simple_transaction/request_funds.rs b/sdk/examples/how_tos/simple_transaction/request_funds.rs index 6a084a052a..2b19ae1d8f 100644 --- a/sdk/examples/how_tos/simple_transaction/request_funds.rs +++ b/sdk/examples/how_tos/simple_transaction/request_funds.rs @@ -1,10 +1,10 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -//! In this example we request funds from the faucet to the first address in the account. +//! In this example we request funds from the faucet to the first address in the wallet. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/how_tos/simple_transaction/simple_transaction.rs b/sdk/examples/how_tos/simple_transaction/simple_transaction.rs index 10c925b22e..16915f60b0 100644 --- a/sdk/examples/how_tos/simple_transaction/simple_transaction.rs +++ b/sdk/examples/how_tos/simple_transaction/simple_transaction.rs @@ -4,7 +4,7 @@ //! In this example we will issue a simple base coin transaction. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! Rename `.env.example` to `.env` first, then run the command: //! ```sh diff --git a/sdk/examples/wallet/17_check_unlock_conditions.rs b/sdk/examples/wallet/17_check_unlock_conditions.rs index db1555a14b..6a40bd3cfc 100644 --- a/sdk/examples/wallet/17_check_unlock_conditions.rs +++ b/sdk/examples/wallet/17_check_unlock_conditions.rs @@ -1,10 +1,10 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -//! In this example we check if an output has only an address unlock condition and that the address is from the account. +//! In this example we check if an output has only an address unlock condition and that the address is from the wallet. //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example! +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example! //! //! ```sh //! cargo run --release --all-features --example check_unlock_conditions diff --git a/sdk/examples/wallet/participation.rs b/sdk/examples/wallet/participation.rs index 810d1f4b9b..d55f4059ea 100644 --- a/sdk/examples/wallet/participation.rs +++ b/sdk/examples/wallet/participation.rs @@ -8,7 +8,7 @@ //! * if a voting occurred, stops the voting and destroys the voting output //! //! Make sure that `STRONGHOLD_SNAPSHOT_PATH` and `WALLET_DB_PATH` already exist by -//! running the `./how_tos/accounts_and_addresses/create_account.rs` example and there are funds on the first address +//! running the `./how_tos/accounts_and_addresses/create_wallet.rs` example and there are funds on the first address //! by running the `get_funds` example! //! //! Rename `.env.example` to `.env` first, then run the command: