-
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.
Remove ed25519 address generation from wallet (#1586)
* rm ed25519 address generation from wallet * rename fn * rm with_address * update bindings * handle builder address cases * unused import * re-add address to wallet options * fix tests * re-enable placeholder test * move tests * nodejs: address to wallet options * revert going through json file for address * revert unrelated change * Update sdk/tests/client/secret_manager/address_generation.rs Co-authored-by: Thoralf-M <[email protected]> * recipient Co-authored-by: DaughterOfMars <[email protected]> * bad wildcards * PR suggestion * import * example doc Co-authored-by: DaughterOfMars <[email protected]> * fix example * rename generate methods * Core: add SecretManager:GenerateEd25519AddressAsBech32 method * update examples and tests * Core: simplify SecretManager:GenerateEd25519AddressAsBech32 method * Python: update binding * nit * core: undo rename; update docs * add todo * Python: nits * NodeJs: add binding method * nit * sdk: undo rename; format * core: import * NodeJs: method suffix * fix test * nit * remove single address generation binding * Python: small fix --------- Co-authored-by: Thoralf-M <[email protected]> Co-authored-by: Thibault Martinez <[email protected]> Co-authored-by: DaughterOfMars <[email protected]> Co-authored-by: Thibault Martinez <[email protected]>
- Loading branch information
1 parent
ee51d3e
commit 85d30ef
Showing
37 changed files
with
380 additions
and
463 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
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
48 changes: 48 additions & 0 deletions
48
bindings/nodejs/tests/secret_manager/secret_manager.spec.ts
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,48 @@ | ||
// Copyright 2023 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import 'reflect-metadata'; | ||
|
||
import { describe, it, expect } from '@jest/globals'; | ||
import { | ||
CoinType, | ||
SecretManager, | ||
Utils, | ||
} from '../../lib/'; | ||
|
||
describe('SecretManager', () => { | ||
it('generate IOTA Ed25519 address', async () => { | ||
const mnemonicSecretManager = { | ||
mnemonic: "acoustic trophy damage hint search taste love bicycle foster cradle brown govern endless depend situate athlete pudding blame question genius transfer van random vast" | ||
}; | ||
|
||
let bech32_hrp = Utils.iotaMainnetProtocolParameters().bech32Hrp; | ||
|
||
const secretManager = SecretManager.create(mnemonicSecretManager); | ||
const addresses = await secretManager.generateEd25519Addresses({ | ||
coinType: CoinType.IOTA, | ||
bech32Hrp: bech32_hrp, | ||
}); | ||
|
||
expect(addresses[0]).toEqual('iota1qpg2xkj66wwgn8p2ggnp7p582gj8g6p79us5hve2tsudzpsr2ap4skprwjg'); | ||
|
||
}, 20000); | ||
|
||
it('generate Shimmer Ed25519 address', async () => { | ||
const mnemonicSecretManager = { | ||
mnemonic: "acoustic trophy damage hint search taste love bicycle foster cradle brown govern endless depend situate athlete pudding blame question genius transfer van random vast" | ||
}; | ||
|
||
let bech32_hrp = Utils.shimmerMainnetProtocolParameters().bech32Hrp; | ||
|
||
const secretManager = SecretManager.create(mnemonicSecretManager); | ||
const addresses = await secretManager.generateEd25519Addresses({ | ||
coinType: CoinType.Shimmer, | ||
bech32Hrp: bech32_hrp, | ||
range: { start: 0, end: 1 }, | ||
}); | ||
|
||
expect(addresses[0]).toEqual('smr1qzev36lk0gzld0k28fd2fauz26qqzh4hd4cwymlqlv96x7phjxcw6ckj80y'); | ||
|
||
}, 20000); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2023 IOTA Stiftung | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from iota_sdk import MnemonicSecretManager, SecretManager, CoinType, Utils | ||
|
||
|
||
def test_secret_manager_address_generation_iota(): | ||
secret_manager = SecretManager(MnemonicSecretManager( | ||
"acoustic trophy damage hint search taste love bicycle foster cradle brown govern endless depend situate athlete pudding blame question genius transfer van random vast")) | ||
|
||
bech32_hrp = Utils.iota_mainnet_protocol_parameters().bech32_hrp | ||
address = secret_manager.generate_ed25519_address(CoinType.IOTA, bech32_hrp) | ||
|
||
assert 'iota1qpg2xkj66wwgn8p2ggnp7p582gj8g6p79us5hve2tsudzpsr2ap4skprwjg' == address | ||
|
||
|
||
def test_secret_manager_address_generation_shimmer(): | ||
secret_manager = SecretManager(MnemonicSecretManager( | ||
"acoustic trophy damage hint search taste love bicycle foster cradle brown govern endless depend situate athlete pudding blame question genius transfer van random vast")) | ||
|
||
bech32_hrp = Utils.shimmer_mainnet_protocol_parameters().bech32_hrp | ||
address = secret_manager.generate_ed25519_address(CoinType.SHIMMER, bech32_hrp) | ||
|
||
assert 'smr1qzev36lk0gzld0k28fd2fauz26qqzh4hd4cwymlqlv96x7phjxcw6ckj80y' == 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
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
Oops, something went wrong.