Skip to content

Commit

Permalink
fix address generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Jan 10, 2024
1 parent e8e9013 commit ff8d597
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sdk/src/client/secret/mnemonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl Generate<ed25519::PublicKey> for MnemonicSecretManager {
async fn generate(&self, options: &Self::Options) -> crate::client::Result<ed25519::PublicKey> {
let chain = Bip44::new(options.coin_type)
.with_account(options.account_index)
.with_address_index(options.address_index)
.with_change(options.internal as _);

let public_key = chain
Expand Down Expand Up @@ -104,6 +105,7 @@ impl Generate<secp256k1_ecdsa::PublicKey> for MnemonicSecretManager {
async fn generate(&self, options: &Self::Options) -> crate::client::Result<secp256k1_ecdsa::PublicKey> {
let chain = Bip44::new(options.coin_type)
.with_account(options.account_index)
.with_address_index(options.address_index)
.with_change(options.internal as _);

let public_key = chain
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/client/stronghold/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl Generate<ed25519::PublicKey> for StrongholdAdapter {

let chain = Bip44::new(options.coin_type)
.with_account(options.account_index)
.with_address_index(options.address_index)
.with_change(options.internal as _);

let derive_location = Location::generic(
Expand Down Expand Up @@ -198,6 +199,7 @@ impl Generate<secp256k1_ecdsa::PublicKey> for StrongholdAdapter {

let chain = Bip44::new(options.coin_type)
.with_account(options.account_index)
.with_address_index(options.address_index)
.with_change(options.internal as _);

let derive_location = Location::generic(
Expand Down
2 changes: 1 addition & 1 deletion sdk/tests/client/addresses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async fn mnemonic_address_generation_iota() {

// account 1
let address = secret_manager
.generate::<Ed25519Address>(&PublicKeyOptions::new(IOTA_COIN_TYPE))
.generate::<Ed25519Address>(&PublicKeyOptions::new(IOTA_COIN_TYPE).with_account_index(1))
.await
.unwrap()
.to_bech32(IOTA_BECH32_HRP);
Expand Down

0 comments on commit ff8d597

Please sign in to comment.