]> git.codecow.com Git - libnemo.git/commitdiff
Update tests to call wallet load instead of wallet import.
authorChris Duncan <chris@zoso.dev>
Sun, 10 Aug 2025 02:19:41 +0000 (19:19 -0700)
committerChris Duncan <chris@zoso.dev>
Sun, 10 Aug 2025 02:19:41 +0000 (19:19 -0700)
README.md
test/test.blocks.mjs
test/test.derive-accounts.mjs
test/test.import-wallet.mjs
test/test.lock-unlock.mjs
test/test.tools.mjs

index 8b574c7f181e5e9ee6cb449f44cec180164b520c..56a38ee03b56b43ddb7e46bb09c7cd196c6492e8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -69,12 +69,12 @@ usage.
 import { Wallet } from 'libnemo'
 
 const wallet = await Wallet.create(password)
-const wallet = await Wallet.import(password, mnemonic, salt?)
-const wallet = await Wallet.import(password, seed)
+const wallet = await Wallet.load(password, mnemonic, salt?)
+const wallet = await Wallet.load(password, seed)
 
 const wallet = await Wallet.create(password)
-const wallet = await Wallet.import(password, seed)
-const wallet = await Wallet.import(password, mnemonic)
+const wallet = await Wallet.load(password, seed)
+const wallet = await Wallet.load(password, mnemonic)
 ```
 
 ```javascript
index 8c7b33194e493d7b9a870582040601c0cb1c4dbb..81fe264a8c7ce5126bf0643d94b3c1cf68290a74 100644 (file)
@@ -98,7 +98,7 @@ await Promise.all([
                const { ADDRESS_0, BIP39_SEED, BLAKE2B_ADDRESS_1, BLAKE2B_PUBLIC_1, BLAKE2B_SEED, OPEN_BLOCK, PASSWORD, PRIVATE_0, RECEIVE_BLOCK, SEND_BLOCK } = NANO_TEST_VECTORS\r
 \r
                await test('sign open block with BLAKE2b wallet', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', PASSWORD, BLAKE2B_SEED)\r
+                       const wallet = await Wallet.load('BLAKE2b', PASSWORD, BLAKE2B_SEED)\r
                        await assert.resolves(wallet.unlock(PASSWORD))\r
 \r
                        const block = new Block(BLAKE2B_ADDRESS_1, '0', OPEN_BLOCK.previous, OPEN_BLOCK.representative)\r
@@ -111,7 +111,7 @@ await Promise.all([
                })\r
 \r
                await test('sign open block with BIP-44 wallet', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', PASSWORD, BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', PASSWORD, BIP39_SEED)\r
                        await assert.resolves(wallet.unlock(PASSWORD))\r
 \r
                        const block = new Block(ADDRESS_0, '0', OPEN_BLOCK.previous, OPEN_BLOCK.representative)\r
@@ -123,7 +123,7 @@ await Promise.all([
                })\r
 \r
                await test('fail to sign open block with wallet when locked', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', PASSWORD, BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', PASSWORD, BIP39_SEED)\r
                        const block = new Block(ADDRESS_0, '0', OPEN_BLOCK.previous, OPEN_BLOCK.representative)\r
                                .receive(OPEN_BLOCK.link, OPEN_BLOCK.balance)\r
 \r
index 5a7745dfbf3f38304b2033aa959541cca7e47b0b..1fee8fd04d74bad78a0d84138b9aeb2a3b2bdc8a 100644 (file)
@@ -20,7 +20,7 @@ await Promise.all([
        suite('Derive accounts from BIP-44 wallet', async () => {\r
 \r
                await test('derive the first account from the given BIP-44 seed', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -36,7 +36,7 @@ await Promise.all([
                })\r
 \r
                await test('derive low indexed accounts from the given BIP-44 seed', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(1, 2)\r
 \r
@@ -52,7 +52,7 @@ await Promise.all([
                })\r
 \r
                await test('derive high indexed accounts from the given seed', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(0x70000000, 0x7000000f)\r
 \r
@@ -72,7 +72,7 @@ await Promise.all([
        suite('Derive accounts from BLAKE2b wallet', async () => {\r
 \r
                await test('derive the second account from the given BLAKE2b seed', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account(1)\r
 \r
@@ -90,7 +90,7 @@ await Promise.all([
                })\r
 \r
                await test('derive low indexed accounts from the given BLAKE2B seed', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(2, 3)\r
 \r
@@ -106,7 +106,7 @@ await Promise.all([
                })\r
 \r
                await test('derive high indexed accounts from the given seed', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BLAKE2B_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(0x70000000, 0x7000000f)\r
 \r
index e5b7ff176053d9b137b1c52dde2ed278256fcd53..784199c5ffe9b29a261ca8d55409e6fed9ca5fce 100644 (file)
@@ -24,7 +24,7 @@ await Promise.all([
        suite('Import wallets', async () => {\r
 \r
                await test('nano.org BIP-44 test vector mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -38,7 +38,7 @@ await Promise.all([
                })\r
 \r
                await test('nano.org BIP-44 test vector seed with no mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -54,7 +54,7 @@ await Promise.all([
                })\r
 \r
                await test('Trezor-derived BIP-44 entropy for 12-word mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_0)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_0)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -67,7 +67,7 @@ await Promise.all([
                })\r
 \r
                await test('Trezor-derived BIP-44 entropy for 15-word mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_1)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_1)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -80,7 +80,7 @@ await Promise.all([
                })\r
 \r
                await test('Trezor-derived BIP-44 entropy for 18-word mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_2)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_2)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -93,7 +93,7 @@ await Promise.all([
                })\r
 \r
                await test('Trezor-derived BIP-44 entropy for 21-word mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_3)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, CUSTOM_TEST_VECTORS.MNEMONIC_3)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -106,7 +106,7 @@ await Promise.all([
                })\r
 \r
                await test('BIP-44 zero-string entropy', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_0, TREZOR_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_0, TREZOR_TEST_VECTORS.PASSWORD)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(0, 3)\r
 \r
@@ -126,7 +126,7 @@ await Promise.all([
                })\r
 \r
                await test('BLAKE2b zero-string seed', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_0)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_0)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(0, 3)\r
 \r
@@ -148,7 +148,7 @@ await Promise.all([
                })\r
 \r
                await test('Trezor-derived BLAKE2b test vectors verified with third-party libraries', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_1)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_1)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const accounts = await wallet.accounts(0, 1)\r
 \r
@@ -167,14 +167,14 @@ await Promise.all([
                })\r
 \r
                await test('BLAKE2b seed creates identical wallet as its derived mnemonic', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_2)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_2)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const walletAccount = await wallet.account()\r
 \r
                        assert.ok(await wallet.verify(TREZOR_TEST_VECTORS.MNEMONIC_2))\r
                        assert.ok(await wallet.verify(TREZOR_TEST_VECTORS.ENTROPY_2))\r
 \r
-                       const imported = await Wallet.import('BLAKE2b', TREZOR_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_2)\r
+                       const imported = await Wallet.load('BLAKE2b', TREZOR_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_2)\r
                        await imported.unlock(TREZOR_TEST_VECTORS.PASSWORD)\r
                        const importedAccount = await imported.account()\r
 \r
@@ -187,7 +187,7 @@ await Promise.all([
                })\r
 \r
                await test('BLAKE2b mnemonic for maximum seed value', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_3)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_3)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
 \r
@@ -201,27 +201,27 @@ await Promise.all([
                })\r
 \r
                await test('Reject invalid seed', async () => {\r
-                       await assert.rejects(Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, '6CAF5A42BB8074314AAE20295975ECE663BE7AAD945A73613D193B0CC41C797'))\r
-                       await assert.rejects(Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, '6CAF5A42BB8074314AAE20295975ECE663BE7AAD945A73613D193B0CC41C79701'))\r
-                       await assert.rejects(Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0.replaceAll(/./g, 'x')))\r
+                       await assert.rejects(Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, '6CAF5A42BB8074314AAE20295975ECE663BE7AAD945A73613D193B0CC41C797'))\r
+                       await assert.rejects(Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, '6CAF5A42BB8074314AAE20295975ECE663BE7AAD945A73613D193B0CC41C79701'))\r
+                       await assert.rejects(Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0.replaceAll(/./g, 'x')))\r
                })\r
 \r
                await test('Reject invalid length seed', async () => {\r
-                       await assert.rejects(Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED + 'f'),\r
+                       await assert.rejects(Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED + 'f'),\r
                                `Expected a ${NANO_TEST_VECTORS.BIP39_SEED.length}-character seed, but received ${NANO_TEST_VECTORS.BIP39_SEED.length + 1}-character string.`)\r
-                       await assert.rejects(Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED.slice(0, -1)),\r
+                       await assert.rejects(Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED.slice(0, -1)),\r
                                `Expected a ${NANO_TEST_VECTORS.BIP39_SEED.length}-character seed, but received ${NANO_TEST_VECTORS.BIP39_SEED.length - 1}-character string.`)\r
                })\r
 \r
                await test('Reject seed containing non-hex characters', async () => {\r
-                       await assert.rejects(Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.SEED_0.replace(/./, 'g')),\r
+                       await assert.rejects(Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.SEED_0.replace(/./, 'g')),\r
                                'Seed contains invalid hexadecimal characters.')\r
-                       await assert.rejects(Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1.replace(/./, 'g')),\r
+                       await assert.rejects(Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1.replace(/./, 'g')),\r
                                'Seed contains invalid hexadecimal characters.')\r
                })\r
 \r
                await test('Import BIP-44 wallet from storage using a wallet-generated ID', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                        const restored = await Wallet.restore(wallet.id)\r
 \r
                        assert.ok('mnemonic' in restored)\r
@@ -242,7 +242,7 @@ await Promise.all([
                })\r
 \r
                await test('Import BLAKE2B wallet from storage using a wallet-generated ID', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0)\r
                        const restored = await Wallet.restore(wallet.id)\r
 \r
                        assert.ok('mnemonic' in restored)\r
@@ -263,7 +263,7 @@ await Promise.all([
                })\r
 \r
                await test('export wallet IDs from storage and reimport them', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                        const backups = await Wallet.export()\r
 \r
                        assert.ok(backups.some(record => record.id === wallet.id))\r
index 623e7dbdae8e4cfea2ee118b376633f68965d443..727cf0252d1fd314e62dbf08ce037a798e3413cd 100644 (file)
@@ -24,7 +24,7 @@ await Promise.all([
        suite('Lock and unlock wallets', async () => {\r
 \r
                await test('locking and unlocking a Bip44Wallet with a password', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
 \r
                        assert.ok('mnemonic' in wallet)\r
                        assert.ok('seed' in wallet)\r
@@ -41,7 +41,7 @@ await Promise.all([
                })\r
 \r
                await test('fail to unlock a Bip44Wallet with different passwords', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const lockResult = await wallet.lock()\r
 \r
@@ -58,7 +58,7 @@ await Promise.all([
                })\r
 \r
                await test('fail to unlock a Bip44Wallet with invalid input', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.MNEMONIC, NANO_TEST_VECTORS.PASSWORD)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
 \r
                        //@ts-expect-error\r
@@ -70,7 +70,7 @@ await Promise.all([
                })\r
 \r
                await test('locking and unlocking a Blake2bWallet with a password', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0)\r
 \r
                        assert.ok('mnemonic' in wallet)\r
                        assert.ok('seed' in wallet)\r
@@ -87,7 +87,7 @@ await Promise.all([
                })\r
 \r
                await test('fail to unlock a Blake2bWallet with different passwords', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1)\r
 \r
                        await assert.rejects(wallet.unlock(TREZOR_TEST_VECTORS.PASSWORD), { message: 'Failed to unlock wallet' })\r
                        assert.ok('mnemonic' in wallet)\r
@@ -101,7 +101,7 @@ await Promise.all([
                })\r
 \r
                await test('fail to unlock a Blake2bWallet with no input', async () => {\r
-                       const wallet = await Wallet.import('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1)\r
+                       const wallet = await Wallet.load('BLAKE2b', NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_1)\r
 \r
                        //@ts-expect-error\r
                        await assert.rejects(wallet.unlock(), { message: 'Failed to unlock wallet' })\r
index d90037b8c715c58569d557eea7664f8d791d614c..b9b1f5c65b9661dc6011a0fa5e808733e2edf32d 100644 (file)
@@ -137,7 +137,7 @@ await Promise.all([
                })\r
 \r
                await test('should verify a block using the public key', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
                        if (account.index == null) {\r
@@ -152,7 +152,7 @@ await Promise.all([
                })\r
 \r
                await test('should reject a block using the wrong public key', async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const account = await wallet.account()\r
                        if (account.index == null) {\r
@@ -178,7 +178,7 @@ await Promise.all([
                })\r
 \r
                await test('sweeper fails gracefully for ineligible accounts', { skip: true }, async () => {\r
-                       const wallet = await Wallet.import('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
+                       const wallet = await Wallet.load('BIP-44', NANO_TEST_VECTORS.PASSWORD, NANO_TEST_VECTORS.BIP39_SEED)\r
                        await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
                        const results = await Tools.sweep(rpc, wallet, NANO_TEST_VECTORS.ADDRESS_1)\r
 \r