-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implicit_account_creation_address method
- Loading branch information
1 parent
0b1ef16
commit b8c085e
Showing
4 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2023 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//! 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_wallet.rs` example and that funds are available by running | ||
//! the `get_funds` example! | ||
//! | ||
//! Rename `.env.example` to `.env` first, then run the command: | ||
//! ```sh | ||
//! cargo run --release --all-features --example implicit_account_creation | ||
//! ``` | ||
|
||
use iota_sdk::{ | ||
client::{constants::SHIMMER_COIN_TYPE, secret::SecretManager}, | ||
crypto::keys::bip44::Bip44, | ||
wallet::{ClientOptions, Result, Wallet}, | ||
}; | ||
|
||
#[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 secret_manager = SecretManager::try_from_mnemonic(std::env::var("MNEMONIC").unwrap())?; | ||
let client_options = ClientOptions::new().with_node("https://api.testnet.shimmer.network")?; | ||
|
||
let wallet = Wallet::builder() | ||
.with_secret_manager(secret_manager) | ||
.with_client_options(client_options) | ||
.with_storage_path("implicit_account_creation") | ||
.with_bip_path(Bip44::new(SHIMMER_COIN_TYPE)) | ||
.finish() | ||
.await?; | ||
|
||
let implicit_account_creation_address = wallet.implicit_account_creation_address().await?; | ||
|
||
println!("{implicit_account_creation_address}"); | ||
|
||
Ok(()) | ||
} |
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