Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types)!: use Mnemonic type from crypto.rs #471

Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b2ec73b
add mnemonic type
Alex6323 May 22, 2023
b35b895
try from
Alex6323 May 23, 2023
215e6cd
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 May 23, 2023
4166575
update changelog
Alex6323 May 23, 2023
9d7e0fb
fix doc comment
Alex6323 May 23, 2023
c7ff0bb
move Mnemonic type to mnemonic module; introduce MnemonicLike trait
Alex6323 May 23, 2023
c558eca
format
Alex6323 May 24, 2023
b0640a7
fix ci
Alex6323 May 24, 2023
e1a845b
update changelog
Alex6323 May 24, 2023
fdf033e
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 May 25, 2023
2d69c33
impl MemonicLike for word list
Alex6323 May 25, 2023
a066603
add test
Alex6323 May 31, 2023
4d585b2
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 May 31, 2023
26e43d2
improve test
Alex6323 Jun 1, 2023
9d8b94a
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 1, 2023
1e60246
Mnemonic type in response
Alex6323 Jun 1, 2023
a8de867
giant dynamic museum toddler :sunglasses:
Alex6323 Jun 2, 2023
01477b1
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 2, 2023
8524c5e
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 5, 2023
4ccfe80
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 5, 2023
91ec56d
review suggestions
Alex6323 Jun 5, 2023
0c1c2f0
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 7, 2023
04a123a
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jun 29, 2023
8723e8b
Merge branch 'develop' into feat/types/zeroize-on-drop-mnemonic-type
Alex6323 Jul 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bindings/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use derivative::Derivative;
use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder};
pub use iota_sdk;
use iota_sdk::{
client::secret::{SecretManager, SecretManagerDto},
client::secret::{mnemonic::Mnemonic, SecretManager, SecretManagerDto},
wallet::{wallet::Wallet, ClientOptions},
};
use serde::Deserialize;
Expand Down Expand Up @@ -79,6 +79,7 @@ pub(crate) trait OmittedDebug {
f.write_str("<omitted>")
}
}
impl OmittedDebug for Mnemonic {}
impl OmittedDebug for String {}
impl OmittedDebug for SecretManagerDto {}
impl<T: OmittedDebug> OmittedDebug for Option<T> {
Expand Down
14 changes: 5 additions & 9 deletions bindings/core/src/method_handler/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use iota_sdk::{
client::{hex_public_key_to_bech32_address, hex_to_bech32, verify_mnemonic, Client},
client::{hex_public_key_to_bech32_address, hex_to_bech32, secret::mnemonic::Mnemonic, Client},
types::block::{
address::{dto::AddressDto, Address, Ed25519Address, ToBech32Ext},
output::{AliasId, FoundryId, NftId},
Expand All @@ -11,7 +11,6 @@ use iota_sdk::{
Block,
},
};
use zeroize::Zeroize;

use crate::{method::UtilsMethod, response::Response, Result};

Expand All @@ -30,10 +29,8 @@ pub(crate) fn call_utils_method_internal(method: UtilsMethod) -> Result<Response
UtilsMethod::ParseBech32Address { address } => Response::ParsedBech32Address(AddressDto::from(address.inner())),
UtilsMethod::IsAddressValid { address } => Response::Bool(Address::is_valid_bech32(&address)),
UtilsMethod::GenerateMnemonic => Response::GeneratedMnemonic(Client::generate_mnemonic()?),
UtilsMethod::MnemonicToHexSeed { mut mnemonic } => {
let response = Response::MnemonicHexSeed(Client::mnemonic_to_hex_seed(&mnemonic)?);
mnemonic.zeroize();
response
UtilsMethod::MnemonicToHexSeed { mnemonic } => {
Response::MnemonicHexSeed(Client::mnemonic_to_hex_seed(&mnemonic.try_into()?))
}
UtilsMethod::BlockId { block } => {
let block = Block::try_from_dto_unverified(&block)?;
Expand Down Expand Up @@ -63,9 +60,8 @@ pub(crate) fn call_utils_method_internal(method: UtilsMethod) -> Result<Response
let address = Ed25519Address::try_from(&address)?;
Response::Bool(signature.is_valid(&msg, &address).is_ok())
}
UtilsMethod::VerifyMnemonic { mut mnemonic } => {
verify_mnemonic(&mnemonic)?;
mnemonic.zeroize();
UtilsMethod::VerifyMnemonic { mnemonic } => {
let _ = Mnemonic::try_from(mnemonic)?;
Response::Ok
}
};
Expand Down
3 changes: 2 additions & 1 deletion bindings/core/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use iota_sdk::{
client::{
api::{PreparedTransactionDataDto, SignedTransactionDataDto},
node_manager::node::Node,
secret::mnemonic::Mnemonic,
NetworkInfoDto, NodeInfoWrapper,
},
types::{
Expand Down Expand Up @@ -246,7 +247,7 @@ pub enum Response {
Faucet(String),
/// Response for:
/// - [`GenerateMnemonic`](crate::method::UtilsMethod::GenerateMnemonic)
GeneratedMnemonic(#[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] String),
GeneratedMnemonic(#[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))] Mnemonic),
/// Response for
/// - [`GetLedgerNanoStatus`](crate::method::SecretManagerMethod::GetLedgerNanoStatus)
#[cfg(feature = "ledger_nano")]
Expand Down
10 changes: 6 additions & 4 deletions bindings/core/tests/secrets_debug.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use iota_sdk::client::secret::SecretManagerDto;
use iota_sdk::client::secret::{mnemonic::MnemonicLike, SecretManagerDto};
use iota_sdk_bindings_core::{ClientMethod, Response, UtilsMethod, WalletOptions};

#[test]
Expand All @@ -27,20 +27,22 @@ fn method_interface_secrets_debug() {
);
}

let mnemonic = "giant dynamic museum toddler six deny defense ostrich bomb access mercy blood explain muscle shoot shallow glad autumn author calm heavy hawk abuse rally";

let client_method = UtilsMethod::MnemonicToHexSeed {
mnemonic: "mnemonic".to_string(),
mnemonic: mnemonic.to_string(),
};
assert_eq!(
format!("{:?}", client_method),
"MnemonicToHexSeed { mnemonic: <omitted> }"
);

let wallet_method = UtilsMethod::VerifyMnemonic {
mnemonic: "mnemonic".to_string(),
mnemonic: mnemonic.to_string(),
};
assert_eq!(format!("{:?}", wallet_method), "VerifyMnemonic { mnemonic: <omitted> }");

let response = Response::GeneratedMnemonic("mnemonic".to_string());
let response = Response::GeneratedMnemonic(mnemonic.to_owned().to_mnemonic().unwrap());
assert_eq!(format!("{:?}", response), "GeneratedMnemonic(<omitted>)");

let wallet_options = WalletOptions {
Expand Down
4 changes: 2 additions & 2 deletions bindings/core/tests/secrets_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use iota_sdk_bindings_core::{CallMethod, Response, Result, SecretManagerMethod};
#[tokio::test]
async fn generate_ed25519_addresses() -> Result<()> {
let secret_manager = SecretManager::try_from_mnemonic(
"endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river",
"endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river".to_owned(),
)?;

let method = SecretManagerMethod::GenerateEd25519Addresses {
Expand All @@ -29,7 +29,7 @@ async fn generate_ed25519_addresses() -> Result<()> {
#[tokio::test]
async fn generate_evm_addresses() -> Result<()> {
let secret_manager = SecretManager::try_from_mnemonic(
"endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river",
"endorse answer radar about source reunion marriage tag sausage weekend frost daring base attack because joke dream slender leisure group reason prepare broken river".to_owned(),
)?;

let method = SecretManagerMethod::GenerateEvmAddresses {
Expand Down
43 changes: 22 additions & 21 deletions cli/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use chrono::{DateTime, NaiveDateTime, Utc};
use clap::Parser;
use dialoguer::{console::Term, theme::ColorfulTheme, Input, Password, Select};
use iota_sdk::{
client::verify_mnemonic,
client::secret::mnemonic::Mnemonic,
wallet::{Account, Wallet},
};
use tokio::{
Expand Down Expand Up @@ -107,7 +107,7 @@ pub async fn bytes_from_hex_or_file(hex: Option<String>, file: Option<String>) -
})
}

pub async fn enter_or_generate_mnemonic() -> Result<String, Error> {
pub async fn enter_or_generate_mnemonic() -> Result<Mnemonic, Error> {
let choices = ["Generate a new mnemonic", "Enter a mnemonic"];
let selected_choice = Select::with_theme(&ColorfulTheme::default())
.with_prompt("Select how to provide a mnemonic")
Expand All @@ -124,7 +124,7 @@ pub async fn enter_or_generate_mnemonic() -> Result<String, Error> {
Ok(mnemnonic)
}

pub async fn generate_mnemonic() -> Result<String, Error> {
pub async fn generate_mnemonic() -> Result<Mnemonic, Error> {
let mnemonic = iota_sdk::client::generate_mnemonic()?;
println_log_info!("Mnemonic has been generated.");
let choices = [
Expand All @@ -141,7 +141,7 @@ pub async fn generate_mnemonic() -> Result<String, Error> {

if [0, 2].contains(&selected_choice) {
println!("YOUR MNEMONIC:");
println!("{}", mnemonic);
println!("{}", mnemonic.as_str());
}
if [1, 2].contains(&selected_choice) {
write_mnemonic_to_file(DEFAULT_MNEMONIC_FILE_PATH, &mnemonic).await?;
Expand All @@ -157,20 +157,22 @@ pub async fn generate_mnemonic() -> Result<String, Error> {
Ok(mnemonic)
}

pub fn enter_mnemonic() -> Result<String, Error> {
pub fn enter_mnemonic() -> Result<Mnemonic, Error> {
loop {
let input = Input::<String>::new()
.with_prompt("Enter your mnemonic")
.interact_text()?;
if verify_mnemonic(&input).is_err() {
println_log_error!("Invalid mnemonic. Please enter a bip-39 conform mnemonic.");
} else {
return Ok(input);

match Mnemonic::try_from(input) {
Err(e) => {
println_log_error!("Invalid mnemonic: {e:?}\nPlease enter a bip-39 conform mnemonic.");
}
Ok(mnemonic) => return Ok(mnemonic),
}
}
}

pub async fn import_mnemonic(path: &str) -> Result<String, Error> {
pub async fn import_mnemonic(path: &str) -> Result<Mnemonic, Error> {
let mut mnemonics = read_mnemonics_from_file(path).await?;
if mnemonics.is_empty() {
println_log_error!("No valid mnemonics found in '{path}'.");
Expand All @@ -194,27 +196,26 @@ pub async fn import_mnemonic(path: &str) -> Result<String, Error> {
}
}

async fn write_mnemonic_to_file(path: &str, mnemonic: &str) -> Result<(), Error> {
async fn write_mnemonic_to_file(path: &str, mnemonic: &Mnemonic) -> Result<(), Error> {
let mut file = OpenOptions::new().create(true).append(true).open(path).await?;
file.write_all(format!("{mnemonic}\n").as_bytes()).await?;
file.write_all(format!("{}\n", mnemonic.as_str()).as_bytes()).await?;

Ok(())
}

async fn read_mnemonics_from_file(path: &str) -> Result<Vec<String>, Error> {
async fn read_mnemonics_from_file(path: &str) -> Result<Vec<Mnemonic>, Error> {
let file = OpenOptions::new().read(true).open(path).await?;
let mut lines = BufReader::new(file).lines();
let mut mnemonics = Vec::new();
let mut line_index = 1;
while let Some(line) = lines.next_line().await? {
// we allow surrounding whitespace in the file
let trimmed = line.trim();
if verify_mnemonic(trimmed).is_ok() {
mnemonics.push(trimmed.to_string());
} else {
return Err(Error::Miscellaneous(format!(
"Invalid mnemonic in file '{path}' at line '{line_index}'."
)));
match Mnemonic::try_from(line) {
Ok(mnemonic) => mnemonics.push(mnemonic),
Err(err) => {
return Err(Error::Miscellaneous(format!(
"Invalid mnemonic in file '{path}' at line '{line_index}':\n{err:?}"
)));
}
}
line_index += 1;
}
Expand Down
3 changes: 3 additions & 0 deletions sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Multiple prepare methods returning `PreparedTransactionData`: `prepare_consolidate_outputs`, `prepare_vote`, `prepare_stop_participating`, `prepare_increase_voting_power`, `prepare_decrease_voting_power`, `prepare_decrease_native_token_supply` and `prepare_burn`;
- Multiple prepare methods returning `PreparedMintTokenTransaction`: `prepare_mint_native_token` and `prepare_increase_native_token_supply`;
- Stronghold snapshot migration from v2 to v3;
- `Mnemonic` type which derives `Zeroize` and `ZeroizeOnDrop`;

### Changed

Expand Down Expand Up @@ -79,6 +80,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Made certain `prepare_` methods public: `prepare_mint_nfts`, `prepare_send_native_tokens`, `prepare_send_nft` and `prepare_create_alias_output`;
- `Address`-like types now implement `ToBech32Ext` for `to_bech32` and similar fns;
- Add constructors for `SendNftParams`, `SendAmountParams`, `SendNativeTokensParams`, `MintNftParams`;
- `WalletInner::generate_mnemonic` returns a `Mnemonic` instead of a `String`;

### Removed

Expand All @@ -92,6 +94,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Excess `SecretManager` address generation methods;
- `Bech32Addresses` and `RawAddresses`;
- `Client::get_addresses`;
- `WalletInner::verify_mnemonic` (because verification is done now when trying to create a `Mnemonic`);

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/01_generate_addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async fn main() -> Result<()> {
.await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

// Generate addresses with default account index and range
let addresses = secret_manager
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/block/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/block/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let block = client
.block()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<()> {
dotenvy::dotenv().ok();

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

// Generates an address offline.
let address = secret_manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async fn main() -> Result<()> {
dotenvy::dotenv().ok();

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let prepared_transaction_data = read_prepared_transaction_from_file(PREPARED_TRANSACTION_FILE_NAME)?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/expiration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let addresses = secret_manager
.generate_ed25519_addresses(GetAddressesOptions::from_client(&client).await?.with_range(0..2))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/foundry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/micro_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let addresses = secret_manager
.generate_ed25519_addresses(GetAddressesOptions::from_client(&client).await?.with_range(0..2))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/native_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let addresses = secret_manager
.generate_ed25519_addresses(GetAddressesOptions::from_client(&client).await?.with_range(0..2))
Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/nft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let token_supply = client.get_token_supply().await?;

Expand Down
2 changes: 1 addition & 1 deletion sdk/examples/client/output/recursive_alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> Result<()> {
let client = Client::builder().with_node(&node_url)?.finish().await?;

let secret_manager =
SecretManager::try_from_mnemonic(&std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;
SecretManager::try_from_mnemonic(std::env::var("NON_SECURE_USE_OF_DEVELOPMENT_MNEMONIC_1").unwrap())?;

let address = secret_manager
.generate_ed25519_addresses(GetAddressesOptions::from_client(&client).await?.with_range(0..1))
Expand Down
Loading