@sidhujag/sysweb3-keyring 1.0.547 → 1.0.549
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/cjs → cjs}/providers.js +1 -64
- package/cjs/providers.js.map +1 -0
- package/{dist/cjs → cjs}/transactions/ethereum.js +1 -16
- package/cjs/transactions/ethereum.js.map +1 -0
- package/package.json +2 -30
- package/{dist/types → types}/providers.d.ts +0 -8
- package/{dist/types → types}/transactions/ethereum.d.ts +2 -2
- package/{dist/types → types}/types.d.ts +2 -2
- package/coverage/clover.xml +0 -2875
- package/coverage/coverage-final.json +0 -29468
- package/coverage/lcov-report/base.css +0 -354
- package/coverage/lcov-report/block-navigation.js +0 -85
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -320
- package/coverage/lcov-report/prettify.css +0 -101
- package/coverage/lcov-report/prettify.js +0 -1008
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -191
- package/coverage/lcov-report/src/index.html +0 -276
- package/coverage/lcov-report/src/index.ts.html +0 -114
- package/coverage/lcov-report/src/initial-state.ts.html +0 -558
- package/coverage/lcov-report/src/keyring-manager.ts.html +0 -6279
- package/coverage/lcov-report/src/ledger/bitcoin_client/index.html +0 -178
- package/coverage/lcov-report/src/ledger/bitcoin_client/index.ts.html +0 -144
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/appClient.ts.html +0 -1560
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/bip32.ts.html +0 -276
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/buffertools.ts.html +0 -495
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/clientCommands.ts.html +0 -1138
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/index.html +0 -363
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/merkelizedPsbt.ts.html +0 -289
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/merkle.ts.html +0 -486
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/merkleMap.ts.html +0 -240
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/policy.ts.html +0 -342
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/psbtv2.ts.html +0 -2388
- package/coverage/lcov-report/src/ledger/bitcoin_client/lib/varint.ts.html +0 -453
- package/coverage/lcov-report/src/ledger/consts.ts.html +0 -177
- package/coverage/lcov-report/src/ledger/index.html +0 -216
- package/coverage/lcov-report/src/ledger/index.ts.html +0 -1371
- package/coverage/lcov-report/src/ledger/utils.ts.html +0 -102
- package/coverage/lcov-report/src/signers.ts.html +0 -591
- package/coverage/lcov-report/src/storage.ts.html +0 -198
- package/coverage/lcov-report/src/transactions/ethereum.ts.html +0 -5826
- package/coverage/lcov-report/src/transactions/index.html +0 -216
- package/coverage/lcov-report/src/transactions/index.ts.html +0 -93
- package/coverage/lcov-report/src/transactions/syscoin.ts.html +0 -1521
- package/coverage/lcov-report/src/trezor/index.html +0 -176
- package/coverage/lcov-report/src/trezor/index.ts.html +0 -2655
- package/coverage/lcov-report/src/types.ts.html +0 -1443
- package/coverage/lcov-report/src/utils/derivation-paths.ts.html +0 -486
- package/coverage/lcov-report/src/utils/index.html +0 -196
- package/coverage/lcov-report/src/utils/psbt.ts.html +0 -159
- package/coverage/lcov-report/test/helpers/constants.ts.html +0 -627
- package/coverage/lcov-report/test/helpers/index.html +0 -176
- package/coverage/lcov.info +0 -4832
- package/dist/cjs/providers.js.map +0 -1
- package/dist/cjs/transactions/ethereum.js.map +0 -1
- package/dist/package.json +0 -50
- package/examples/basic-usage.js +0 -140
- package/jest.config.js +0 -32
- package/readme.md +0 -201
- package/src/declare.d.ts +0 -7
- package/src/errorUtils.ts +0 -83
- package/src/hardware-wallet-manager.ts +0 -655
- package/src/index.ts +0 -12
- package/src/initial-state.ts +0 -108
- package/src/keyring-manager.ts +0 -2698
- package/src/ledger/bitcoin_client/index.ts +0 -19
- package/src/ledger/bitcoin_client/lib/appClient.ts +0 -405
- package/src/ledger/bitcoin_client/lib/bip32.ts +0 -61
- package/src/ledger/bitcoin_client/lib/buffertools.ts +0 -134
- package/src/ledger/bitcoin_client/lib/clientCommands.ts +0 -356
- package/src/ledger/bitcoin_client/lib/constants.ts +0 -12
- package/src/ledger/bitcoin_client/lib/merkelizedPsbt.ts +0 -65
- package/src/ledger/bitcoin_client/lib/merkle.ts +0 -136
- package/src/ledger/bitcoin_client/lib/merkleMap.ts +0 -49
- package/src/ledger/bitcoin_client/lib/policy.ts +0 -91
- package/src/ledger/bitcoin_client/lib/psbtv2.ts +0 -768
- package/src/ledger/bitcoin_client/lib/varint.ts +0 -120
- package/src/ledger/consts.ts +0 -3
- package/src/ledger/index.ts +0 -685
- package/src/ledger/types.ts +0 -74
- package/src/network-utils.ts +0 -99
- package/src/providers.ts +0 -345
- package/src/signers.ts +0 -158
- package/src/storage.ts +0 -63
- package/src/transactions/__tests__/integration.test.ts +0 -303
- package/src/transactions/__tests__/syscoin.test.ts +0 -409
- package/src/transactions/ethereum.ts +0 -2503
- package/src/transactions/index.ts +0 -2
- package/src/transactions/syscoin.ts +0 -542
- package/src/trezor/index.ts +0 -1050
- package/src/types.ts +0 -366
- package/src/utils/derivation-paths.ts +0 -133
- package/src/utils/psbt.ts +0 -24
- package/src/utils.ts +0 -191
- package/test/README.md +0 -158
- package/test/__mocks__/ledger-mock.js +0 -20
- package/test/__mocks__/trezor-mock.js +0 -75
- package/test/cleanup-summary.md +0 -167
- package/test/helpers/README.md +0 -78
- package/test/helpers/constants.ts +0 -79
- package/test/helpers/setup.ts +0 -714
- package/test/integration/import-validation.spec.ts +0 -588
- package/test/unit/hardware/ledger.spec.ts +0 -869
- package/test/unit/hardware/trezor.spec.ts +0 -828
- package/test/unit/keyring-manager/account-management.spec.ts +0 -970
- package/test/unit/keyring-manager/import-watchonly.spec.ts +0 -181
- package/test/unit/keyring-manager/import-wif.spec.ts +0 -126
- package/test/unit/keyring-manager/initialization.spec.ts +0 -782
- package/test/unit/keyring-manager/key-derivation.spec.ts +0 -996
- package/test/unit/keyring-manager/security.spec.ts +0 -505
- package/test/unit/keyring-manager/state-management.spec.ts +0 -375
- package/test/unit/network/network-management.spec.ts +0 -372
- package/test/unit/transactions/ethereum-transactions.spec.ts +0 -382
- package/test/unit/transactions/syscoin-transactions.spec.ts +0 -615
- package/tsconfig.json +0 -14
- /package/{dist/README.md → README.md} +0 -0
- /package/{dist/cjs → cjs}/errorUtils.js +0 -0
- /package/{dist/cjs → cjs}/errorUtils.js.map +0 -0
- /package/{dist/cjs → cjs}/hardware-wallet-manager.js +0 -0
- /package/{dist/cjs → cjs}/hardware-wallet-manager.js.map +0 -0
- /package/{dist/cjs → cjs}/index.js +0 -0
- /package/{dist/cjs → cjs}/index.js.map +0 -0
- /package/{dist/cjs → cjs}/initial-state.js +0 -0
- /package/{dist/cjs → cjs}/initial-state.js.map +0 -0
- /package/{dist/cjs → cjs}/keyring-manager.js +0 -0
- /package/{dist/cjs → cjs}/keyring-manager.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/index.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/index.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/appClient.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/appClient.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/bip32.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/bip32.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/buffertools.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/buffertools.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/clientCommands.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/clientCommands.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/constants.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/constants.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/merkelizedPsbt.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/merkelizedPsbt.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/merkle.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/merkle.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/merkleMap.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/merkleMap.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/policy.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/policy.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/psbtv2.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/psbtv2.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/varint.js +0 -0
- /package/{dist/cjs → cjs}/ledger/bitcoin_client/lib/varint.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/consts.js +0 -0
- /package/{dist/cjs → cjs}/ledger/consts.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/index.js +0 -0
- /package/{dist/cjs → cjs}/ledger/index.js.map +0 -0
- /package/{dist/cjs → cjs}/ledger/types.js +0 -0
- /package/{dist/cjs → cjs}/ledger/types.js.map +0 -0
- /package/{dist/cjs → cjs}/network-utils.js +0 -0
- /package/{dist/cjs → cjs}/network-utils.js.map +0 -0
- /package/{dist/cjs → cjs}/signers.js +0 -0
- /package/{dist/cjs → cjs}/signers.js.map +0 -0
- /package/{dist/cjs → cjs}/storage.js +0 -0
- /package/{dist/cjs → cjs}/storage.js.map +0 -0
- /package/{dist/cjs → cjs}/transactions/__tests__/integration.test.js +0 -0
- /package/{dist/cjs → cjs}/transactions/__tests__/integration.test.js.map +0 -0
- /package/{dist/cjs → cjs}/transactions/__tests__/syscoin.test.js +0 -0
- /package/{dist/cjs → cjs}/transactions/__tests__/syscoin.test.js.map +0 -0
- /package/{dist/cjs → cjs}/transactions/index.js +0 -0
- /package/{dist/cjs → cjs}/transactions/index.js.map +0 -0
- /package/{dist/cjs → cjs}/transactions/syscoin.js +0 -0
- /package/{dist/cjs → cjs}/transactions/syscoin.js.map +0 -0
- /package/{dist/cjs → cjs}/trezor/index.js +0 -0
- /package/{dist/cjs → cjs}/trezor/index.js.map +0 -0
- /package/{dist/cjs → cjs}/types.js +0 -0
- /package/{dist/cjs → cjs}/types.js.map +0 -0
- /package/{dist/cjs → cjs}/utils/derivation-paths.js +0 -0
- /package/{dist/cjs → cjs}/utils/derivation-paths.js.map +0 -0
- /package/{dist/cjs → cjs}/utils/psbt.js +0 -0
- /package/{dist/cjs → cjs}/utils/psbt.js.map +0 -0
- /package/{dist/cjs → cjs}/utils.js +0 -0
- /package/{dist/cjs → cjs}/utils.js.map +0 -0
- /package/{dist/types → types}/errorUtils.d.ts +0 -0
- /package/{dist/types → types}/hardware-wallet-manager.d.ts +0 -0
- /package/{dist/types → types}/index.d.ts +0 -0
- /package/{dist/types → types}/initial-state.d.ts +0 -0
- /package/{dist/types → types}/keyring-manager.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/index.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/appClient.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/bip32.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/buffertools.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/clientCommands.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/constants.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/merkelizedPsbt.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/merkle.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/merkleMap.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/policy.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/psbtv2.d.ts +0 -0
- /package/{dist/types → types}/ledger/bitcoin_client/lib/varint.d.ts +0 -0
- /package/{dist/types → types}/ledger/consts.d.ts +0 -0
- /package/{dist/types → types}/ledger/index.d.ts +0 -0
- /package/{dist/types → types}/ledger/types.d.ts +0 -0
- /package/{dist/types → types}/network-utils.d.ts +0 -0
- /package/{dist/types → types}/signers.d.ts +0 -0
- /package/{dist/types → types}/storage.d.ts +0 -0
- /package/{dist/types → types}/transactions/__tests__/integration.test.d.ts +0 -0
- /package/{dist/types → types}/transactions/__tests__/syscoin.test.d.ts +0 -0
- /package/{dist/types → types}/transactions/index.d.ts +0 -0
- /package/{dist/types → types}/transactions/syscoin.d.ts +0 -0
- /package/{dist/types → types}/trezor/index.d.ts +0 -0
- /package/{dist/types → types}/utils/derivation-paths.d.ts +0 -0
- /package/{dist/types → types}/utils/psbt.d.ts +0 -0
- /package/{dist/types → types}/utils.d.ts +0 -0
|
@@ -1,588 +0,0 @@
|
|
|
1
|
-
import { INetworkType } from '@sidhujag/sysweb3-network';
|
|
2
|
-
|
|
3
|
-
import { KeyringManager, KeyringAccountType } from '../../src';
|
|
4
|
-
import { FAKE_PASSWORD, PEACE_SEED_PHRASE } from '../helpers/constants';
|
|
5
|
-
import { setupMocks } from '../helpers/setup';
|
|
6
|
-
|
|
7
|
-
describe('Import Validation - Integration Tests', () => {
|
|
8
|
-
let keyringManager: KeyringManager;
|
|
9
|
-
let mockVaultStateGetter: jest.Mock;
|
|
10
|
-
let currentVaultState: any;
|
|
11
|
-
|
|
12
|
-
beforeEach(async () => {
|
|
13
|
-
setupMocks();
|
|
14
|
-
// Set up vault-keys that would normally be created by Pali's MainController
|
|
15
|
-
await setupTestVault(FAKE_PASSWORD);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
describe('UTXO Import Validation', () => {
|
|
19
|
-
const validMainnetZprvs = [
|
|
20
|
-
{
|
|
21
|
-
zprv: 'zprvAdGDwa3WySqQoVwVSbYRMKxDhSXpK2wW6wDjekCMdm7TaQ3igf52xRRjYghTvnFurtMm6CMgQivEDJs5ixGSnTtv8usFmkAoTe6XCF5hnpR',
|
|
22
|
-
description: 'BIP84 mainnet zprv',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
zprv: 'zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei5',
|
|
26
|
-
description: 'Standard test vector zprv',
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const validTestnetVprvs = [
|
|
31
|
-
{
|
|
32
|
-
vprv: 'vprv9Kq1NEwFrCd4Lw2kDNicFsKvDGkA5c1G7NJd35wrD5fNdeVJKjo73h6xZuepV4hJ3a2hUjNmn4XjuLhbsuSRHHtVuAL8hsj8n6BwtMiPzf8',
|
|
33
|
-
description: 'BIP84 testnet vprv',
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
describe('Mainnet imports', () => {
|
|
38
|
-
beforeEach(async () => {
|
|
39
|
-
// Set up UTXO mainnet vault state
|
|
40
|
-
currentVaultState = createMockVaultState({
|
|
41
|
-
activeAccountId: 0,
|
|
42
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
43
|
-
networkType: INetworkType.Syscoin,
|
|
44
|
-
chainId: 57,
|
|
45
|
-
});
|
|
46
|
-
mockVaultStateGetter = jest.fn(() => currentVaultState);
|
|
47
|
-
|
|
48
|
-
keyringManager = await KeyringManager.createInitialized(
|
|
49
|
-
PEACE_SEED_PHRASE,
|
|
50
|
-
FAKE_PASSWORD,
|
|
51
|
-
mockVaultStateGetter
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should validate and import mainnet zprv', async () => {
|
|
56
|
-
for (const { zprv, description } of validMainnetZprvs) {
|
|
57
|
-
const validation = keyringManager.validateZprv(zprv);
|
|
58
|
-
expect(validation.isValid).toBe(true);
|
|
59
|
-
expect(validation.message).toContain('valid');
|
|
60
|
-
|
|
61
|
-
const imported = await keyringManager.importAccount(
|
|
62
|
-
zprv,
|
|
63
|
-
description
|
|
64
|
-
);
|
|
65
|
-
expect(imported.isImported).toBe(true);
|
|
66
|
-
expect(imported.address.match(/^(sys1|tsys1)/)).toBeTruthy();
|
|
67
|
-
expect(imported.label).toBe(description);
|
|
68
|
-
|
|
69
|
-
// Update vault state with imported account
|
|
70
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id] =
|
|
71
|
-
{
|
|
72
|
-
id: imported.id,
|
|
73
|
-
label: imported.label,
|
|
74
|
-
address: imported.address,
|
|
75
|
-
xpub: imported.xpub,
|
|
76
|
-
xprv: imported.xprv,
|
|
77
|
-
isImported: true,
|
|
78
|
-
isTrezorWallet: false,
|
|
79
|
-
isLedgerWallet: false,
|
|
80
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
81
|
-
assets: { syscoin: [], ethereum: [] },
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should reject testnet vprv on mainnet', async () => {
|
|
87
|
-
for (const { vprv } of validTestnetVprvs) {
|
|
88
|
-
const validation = keyringManager.validateZprv(vprv);
|
|
89
|
-
expect(validation.isValid).toBe(false);
|
|
90
|
-
expect(validation.message).toContain('not compatible');
|
|
91
|
-
|
|
92
|
-
// The importAccount method should throw the network mismatch error
|
|
93
|
-
await expect(keyringManager.importAccount(vprv)).rejects.toThrow(
|
|
94
|
-
/not compatible|Network mismatch/
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should reject BIP44 xprv keys', async () => {
|
|
100
|
-
const xprv =
|
|
101
|
-
'xprvA2nrNbFZABcdryreWet9Ea4LvTJcGsqrMzxHx98MMrotbir7yrKCEXw7nadnHM8Dq38EGfSh6dqA9QWTyefMLEcBYJUuekgW4BYPJcr9E7j';
|
|
102
|
-
|
|
103
|
-
const validation = keyringManager.validateZprv(xprv);
|
|
104
|
-
expect(validation.isValid).toBe(false);
|
|
105
|
-
expect(validation.message).toContain(
|
|
106
|
-
'Only BIP84 keys (zprv/vprv) are supported'
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('Testnet imports', () => {
|
|
112
|
-
beforeEach(async () => {
|
|
113
|
-
// Set up UTXO testnet vault state
|
|
114
|
-
currentVaultState = createMockVaultState({
|
|
115
|
-
activeAccountId: 0,
|
|
116
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
117
|
-
networkType: INetworkType.Syscoin,
|
|
118
|
-
chainId: 5700,
|
|
119
|
-
});
|
|
120
|
-
mockVaultStateGetter = jest.fn(() => currentVaultState);
|
|
121
|
-
|
|
122
|
-
keyringManager = await KeyringManager.createInitialized(
|
|
123
|
-
PEACE_SEED_PHRASE,
|
|
124
|
-
FAKE_PASSWORD,
|
|
125
|
-
mockVaultStateGetter
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should validate and import testnet vprv', async () => {
|
|
130
|
-
for (const { vprv, description } of validTestnetVprvs) {
|
|
131
|
-
const validation = keyringManager.validateZprv(vprv);
|
|
132
|
-
expect(validation.isValid).toBe(true);
|
|
133
|
-
|
|
134
|
-
const imported = await keyringManager.importAccount(
|
|
135
|
-
vprv,
|
|
136
|
-
description
|
|
137
|
-
);
|
|
138
|
-
expect(imported.isImported).toBe(true);
|
|
139
|
-
expect(imported.address.match(/^(sys1|tsys1)/)).toBeTruthy();
|
|
140
|
-
|
|
141
|
-
// Update vault state with imported account
|
|
142
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id] =
|
|
143
|
-
{
|
|
144
|
-
id: imported.id,
|
|
145
|
-
label: imported.label,
|
|
146
|
-
address: imported.address,
|
|
147
|
-
xpub: imported.xpub,
|
|
148
|
-
xprv: imported.xprv,
|
|
149
|
-
isImported: true,
|
|
150
|
-
isTrezorWallet: false,
|
|
151
|
-
isLedgerWallet: false,
|
|
152
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
153
|
-
assets: { syscoin: [], ethereum: [] },
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it('should reject mainnet zprv on testnet', async () => {
|
|
159
|
-
for (const { zprv } of validMainnetZprvs) {
|
|
160
|
-
const validation = keyringManager.validateZprv(zprv);
|
|
161
|
-
expect(validation.isValid).toBe(false);
|
|
162
|
-
expect(validation.message).toContain('not compatible');
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
describe('Invalid key handling', () => {
|
|
168
|
-
beforeEach(async () => {
|
|
169
|
-
// Set up UTXO mainnet vault state
|
|
170
|
-
currentVaultState = createMockVaultState({
|
|
171
|
-
activeAccountId: 0,
|
|
172
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
173
|
-
networkType: INetworkType.Syscoin,
|
|
174
|
-
chainId: 57,
|
|
175
|
-
});
|
|
176
|
-
mockVaultStateGetter = jest.fn(() => currentVaultState);
|
|
177
|
-
|
|
178
|
-
keyringManager = await KeyringManager.createInitialized(
|
|
179
|
-
PEACE_SEED_PHRASE,
|
|
180
|
-
FAKE_PASSWORD,
|
|
181
|
-
mockVaultStateGetter
|
|
182
|
-
);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it('should reject malformed keys', async () => {
|
|
186
|
-
const invalidKeys = [
|
|
187
|
-
'not_a_key',
|
|
188
|
-
'zprvInvalidKey123',
|
|
189
|
-
'zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei', // Too short
|
|
190
|
-
'zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei5XXX', // Too long
|
|
191
|
-
];
|
|
192
|
-
|
|
193
|
-
for (const key of invalidKeys) {
|
|
194
|
-
const validation = keyringManager.validateZprv(key);
|
|
195
|
-
expect(validation.isValid).toBe(false);
|
|
196
|
-
|
|
197
|
-
await expect(keyringManager.importAccount(key)).rejects.toThrow();
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('should handle edge case with corrupted base58', async () => {
|
|
202
|
-
// Valid length but invalid base58 characters
|
|
203
|
-
const corruptedZprv =
|
|
204
|
-
'zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Ke!5';
|
|
205
|
-
|
|
206
|
-
await expect(
|
|
207
|
-
keyringManager.importAccount(corruptedZprv)
|
|
208
|
-
).rejects.toThrow();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('should reject EVM private keys on UTXO network', async () => {
|
|
212
|
-
const evmPrivateKeys = [
|
|
213
|
-
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
|
|
214
|
-
'4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318', // without 0x prefix
|
|
215
|
-
'0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
216
|
-
];
|
|
217
|
-
|
|
218
|
-
for (const evmKey of evmPrivateKeys) {
|
|
219
|
-
await expect(keyringManager.importAccount(evmKey)).rejects.toThrow(
|
|
220
|
-
'Cannot import EVM private key on UTXO network. Please switch to an EVM network first.'
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
describe('EVM Import Validation', () => {
|
|
228
|
-
beforeEach(async () => {
|
|
229
|
-
// Set up EVM vault state
|
|
230
|
-
currentVaultState = createMockVaultState({
|
|
231
|
-
activeAccountId: 0,
|
|
232
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
233
|
-
networkType: INetworkType.Ethereum,
|
|
234
|
-
chainId: 1,
|
|
235
|
-
});
|
|
236
|
-
mockVaultStateGetter = jest.fn(() => currentVaultState);
|
|
237
|
-
|
|
238
|
-
keyringManager = await KeyringManager.createInitialized(
|
|
239
|
-
PEACE_SEED_PHRASE,
|
|
240
|
-
FAKE_PASSWORD,
|
|
241
|
-
mockVaultStateGetter
|
|
242
|
-
);
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('should import valid private keys with 0x prefix', async () => {
|
|
246
|
-
const privateKeys = [
|
|
247
|
-
{
|
|
248
|
-
key: '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
|
|
249
|
-
expectedAddress: '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23',
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
key: '0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
253
|
-
expectedAddress: '0x2e988a386a799f506693793c6a5af6b54dfaabfb', // Corrected expected address
|
|
254
|
-
},
|
|
255
|
-
];
|
|
256
|
-
|
|
257
|
-
for (const { key, expectedAddress } of privateKeys) {
|
|
258
|
-
const imported = await keyringManager.importAccount(
|
|
259
|
-
key,
|
|
260
|
-
`Test ${expectedAddress}`
|
|
261
|
-
);
|
|
262
|
-
expect(imported.address.toLowerCase()).toBe(
|
|
263
|
-
expectedAddress.toLowerCase()
|
|
264
|
-
);
|
|
265
|
-
expect(imported.isImported).toBe(true);
|
|
266
|
-
|
|
267
|
-
// Update vault state with imported account
|
|
268
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = {
|
|
269
|
-
id: imported.id,
|
|
270
|
-
label: imported.label,
|
|
271
|
-
address: imported.address,
|
|
272
|
-
xpub: imported.xpub,
|
|
273
|
-
xprv: imported.xprv,
|
|
274
|
-
isImported: true,
|
|
275
|
-
isTrezorWallet: false,
|
|
276
|
-
isLedgerWallet: false,
|
|
277
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
278
|
-
assets: { syscoin: [], ethereum: [] },
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
it('should import valid private keys without 0x prefix', async () => {
|
|
284
|
-
const privateKey =
|
|
285
|
-
'4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318';
|
|
286
|
-
const expectedAddress = '0x2c7536E3605D9C16a7a3D7b1898e529396a65c23';
|
|
287
|
-
|
|
288
|
-
const imported = await keyringManager.importAccount(privateKey);
|
|
289
|
-
expect(imported.address.toLowerCase()).toBe(
|
|
290
|
-
expectedAddress.toLowerCase()
|
|
291
|
-
);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it('should reject invalid private keys', async () => {
|
|
295
|
-
const invalidKeys = [
|
|
296
|
-
'0xINVALID',
|
|
297
|
-
'0x123', // Too short
|
|
298
|
-
'0x' + 'f'.repeat(65), // Too long
|
|
299
|
-
'not_hex_at_all',
|
|
300
|
-
'0xGGGG', // Invalid hex chars
|
|
301
|
-
];
|
|
302
|
-
|
|
303
|
-
for (const key of invalidKeys) {
|
|
304
|
-
await expect(keyringManager.importAccount(key)).rejects.toThrow();
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
it('should reject UTXO keys on EVM network', async () => {
|
|
309
|
-
const zprvKeys = [
|
|
310
|
-
'zprvAdGDwa3WySqQoVwVSbYRMKxDhSXpK2wW6wDjekCMdm7TaQ3igf52xRRjYghTvnFurtMm6CMgQivEDJs5ixGSnTtv8usFmkAoTe6XCF5hnpR',
|
|
311
|
-
'vprv9Kq1NEwFrCd4Lw2kDNicFsKvDGkA5c1G7NJd35wrD5fNdeVJKjo73h6xZuepV4hJ3a2hUjNmn4XjuLhbsuSRHHtVuAL8hsj8n6BwtMiPzf8',
|
|
312
|
-
];
|
|
313
|
-
|
|
314
|
-
for (const zprv of zprvKeys) {
|
|
315
|
-
await expect(keyringManager.importAccount(zprv)).rejects.toThrow(
|
|
316
|
-
'Cannot import UTXO private key on EVM network. Please switch to a UTXO network (Bitcoin/Syscoin) first.'
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
describe('Cross-Network Import Scenarios', () => {
|
|
323
|
-
it('should maintain separate imported accounts per keyring instance', async () => {
|
|
324
|
-
// Set up EVM vault state
|
|
325
|
-
const evmVaultState = createMockVaultState({
|
|
326
|
-
activeAccountId: 0,
|
|
327
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
328
|
-
networkType: INetworkType.Ethereum,
|
|
329
|
-
chainId: 1,
|
|
330
|
-
});
|
|
331
|
-
const evmVaultStateGetter = jest.fn(() => evmVaultState);
|
|
332
|
-
|
|
333
|
-
// Create EVM keyring and import
|
|
334
|
-
const evmKeyring = await KeyringManager.createInitialized(
|
|
335
|
-
PEACE_SEED_PHRASE,
|
|
336
|
-
FAKE_PASSWORD,
|
|
337
|
-
evmVaultStateGetter
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
const evmImported = await evmKeyring.importAccount(
|
|
341
|
-
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
|
|
342
|
-
'EVM Import'
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
// Update EVM vault state
|
|
346
|
-
evmVaultState.accounts[KeyringAccountType.Imported][evmImported.id] = {
|
|
347
|
-
id: evmImported.id,
|
|
348
|
-
label: evmImported.label,
|
|
349
|
-
address: evmImported.address,
|
|
350
|
-
xpub: evmImported.xpub,
|
|
351
|
-
xprv: evmImported.xprv,
|
|
352
|
-
isImported: true,
|
|
353
|
-
isTrezorWallet: false,
|
|
354
|
-
isLedgerWallet: false,
|
|
355
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
356
|
-
assets: { syscoin: [], ethereum: [] },
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
// Set up UTXO vault state
|
|
360
|
-
const utxoVaultState = createMockVaultState({
|
|
361
|
-
activeAccountId: 0,
|
|
362
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
363
|
-
networkType: INetworkType.Syscoin,
|
|
364
|
-
chainId: 57,
|
|
365
|
-
});
|
|
366
|
-
const utxoVaultStateGetter = jest.fn(() => utxoVaultState);
|
|
367
|
-
|
|
368
|
-
// Create UTXO keyring and import
|
|
369
|
-
const utxoKeyring = await KeyringManager.createInitialized(
|
|
370
|
-
PEACE_SEED_PHRASE,
|
|
371
|
-
FAKE_PASSWORD,
|
|
372
|
-
utxoVaultStateGetter
|
|
373
|
-
);
|
|
374
|
-
|
|
375
|
-
const utxoImported = await utxoKeyring.importAccount(
|
|
376
|
-
'zprvAdGDwa3WySqQoVwVSbYRMKxDhSXpK2wW6wDjekCMdm7TaQ3igf52xRRjYghTvnFurtMm6CMgQivEDJs5ixGSnTtv8usFmkAoTe6XCF5hnpR',
|
|
377
|
-
'UTXO Import'
|
|
378
|
-
);
|
|
379
|
-
|
|
380
|
-
// Update UTXO vault state
|
|
381
|
-
utxoVaultState.accounts[KeyringAccountType.Imported][utxoImported.id] = {
|
|
382
|
-
id: utxoImported.id,
|
|
383
|
-
label: utxoImported.label,
|
|
384
|
-
address: utxoImported.address,
|
|
385
|
-
xpub: utxoImported.xpub,
|
|
386
|
-
xprv: utxoImported.xprv,
|
|
387
|
-
isImported: true,
|
|
388
|
-
isTrezorWallet: false,
|
|
389
|
-
isLedgerWallet: false,
|
|
390
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
391
|
-
assets: { syscoin: [], ethereum: [] },
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
// Verify they're independent
|
|
395
|
-
expect(evmImported.address.startsWith('0x')).toBe(true);
|
|
396
|
-
expect(utxoImported.address.match(/^(sys1|tsys1)/)).toBeTruthy();
|
|
397
|
-
|
|
398
|
-
// Each keyring should only see its own imported account via vault state
|
|
399
|
-
const evmAccounts = evmVaultState.accounts[KeyringAccountType.Imported];
|
|
400
|
-
const utxoAccounts = utxoVaultState.accounts[KeyringAccountType.Imported];
|
|
401
|
-
|
|
402
|
-
expect(Object.keys(evmAccounts)).toHaveLength(1);
|
|
403
|
-
expect(Object.keys(utxoAccounts)).toHaveLength(1);
|
|
404
|
-
});
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
describe('Import Security', () => {
|
|
408
|
-
beforeEach(async () => {
|
|
409
|
-
// Set up EVM vault state
|
|
410
|
-
currentVaultState = createMockVaultState({
|
|
411
|
-
activeAccountId: 0,
|
|
412
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
413
|
-
networkType: INetworkType.Ethereum,
|
|
414
|
-
chainId: 1,
|
|
415
|
-
});
|
|
416
|
-
mockVaultStateGetter = jest.fn(() => currentVaultState);
|
|
417
|
-
|
|
418
|
-
keyringManager = await KeyringManager.createInitialized(
|
|
419
|
-
PEACE_SEED_PHRASE,
|
|
420
|
-
FAKE_PASSWORD,
|
|
421
|
-
mockVaultStateGetter
|
|
422
|
-
);
|
|
423
|
-
});
|
|
424
|
-
|
|
425
|
-
it('should encrypt imported private keys', async () => {
|
|
426
|
-
const privateKey =
|
|
427
|
-
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318';
|
|
428
|
-
const imported = await keyringManager.importAccount(privateKey);
|
|
429
|
-
|
|
430
|
-
// Update vault state with imported account
|
|
431
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = {
|
|
432
|
-
id: imported.id,
|
|
433
|
-
label: imported.label,
|
|
434
|
-
address: imported.address,
|
|
435
|
-
xpub: imported.xpub,
|
|
436
|
-
xprv: imported.xprv,
|
|
437
|
-
isImported: true,
|
|
438
|
-
isTrezorWallet: false,
|
|
439
|
-
isLedgerWallet: false,
|
|
440
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
441
|
-
assets: { syscoin: [], ethereum: [] },
|
|
442
|
-
};
|
|
443
|
-
|
|
444
|
-
// Check vault state - xprv should be encrypted
|
|
445
|
-
const accountData =
|
|
446
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id];
|
|
447
|
-
expect(accountData.xprv).toBeDefined();
|
|
448
|
-
expect(accountData.xprv).not.toBe(privateKey);
|
|
449
|
-
expect(accountData.xprv.length).toBeGreaterThan(privateKey.length);
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
it('should require correct password to retrieve imported keys', async () => {
|
|
453
|
-
const privateKey =
|
|
454
|
-
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318';
|
|
455
|
-
const imported = await keyringManager.importAccount(privateKey);
|
|
456
|
-
|
|
457
|
-
// Update vault state with imported account
|
|
458
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = {
|
|
459
|
-
id: imported.id,
|
|
460
|
-
label: imported.label,
|
|
461
|
-
address: imported.address,
|
|
462
|
-
xpub: imported.xpub,
|
|
463
|
-
xprv: imported.xprv,
|
|
464
|
-
isImported: true,
|
|
465
|
-
isTrezorWallet: false,
|
|
466
|
-
isLedgerWallet: false,
|
|
467
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
468
|
-
assets: { syscoin: [], ethereum: [] },
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
// Correct password should work
|
|
472
|
-
const retrieved = await keyringManager.getPrivateKeyByAccountId(
|
|
473
|
-
imported.id,
|
|
474
|
-
KeyringAccountType.Imported,
|
|
475
|
-
FAKE_PASSWORD
|
|
476
|
-
);
|
|
477
|
-
expect(retrieved).toBe(privateKey);
|
|
478
|
-
|
|
479
|
-
// Wrong password should fail
|
|
480
|
-
await expect(
|
|
481
|
-
keyringManager.getPrivateKeyByAccountId(
|
|
482
|
-
imported.id,
|
|
483
|
-
KeyringAccountType.Imported,
|
|
484
|
-
'wrong_password'
|
|
485
|
-
)
|
|
486
|
-
).rejects.toThrow('Invalid password');
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
it('should not expose private keys in getAccountById', async () => {
|
|
490
|
-
const privateKey =
|
|
491
|
-
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318';
|
|
492
|
-
const imported = await keyringManager.importAccount(privateKey);
|
|
493
|
-
|
|
494
|
-
// Update vault state with imported account
|
|
495
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id] = {
|
|
496
|
-
id: imported.id,
|
|
497
|
-
label: imported.label,
|
|
498
|
-
address: imported.address,
|
|
499
|
-
xpub: imported.xpub,
|
|
500
|
-
xprv: imported.xprv,
|
|
501
|
-
isImported: true,
|
|
502
|
-
isTrezorWallet: false,
|
|
503
|
-
isLedgerWallet: false,
|
|
504
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
505
|
-
assets: { syscoin: [], ethereum: [] },
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
// Check that vault state DOES contain encrypted private key
|
|
509
|
-
const rawAccountData =
|
|
510
|
-
currentVaultState.accounts[KeyringAccountType.Imported][imported.id];
|
|
511
|
-
expect(rawAccountData.xprv).toBeDefined();
|
|
512
|
-
expect(rawAccountData.xprv).not.toBe(privateKey); // Should be encrypted, not raw
|
|
513
|
-
|
|
514
|
-
// Check that public API DOES NOT expose private key
|
|
515
|
-
const publicAccount = keyringManager.getAccountById(
|
|
516
|
-
imported.id,
|
|
517
|
-
KeyringAccountType.Imported
|
|
518
|
-
);
|
|
519
|
-
expect(publicAccount).toBeDefined();
|
|
520
|
-
expect(publicAccount).not.toHaveProperty('xprv'); // Security layer working!
|
|
521
|
-
expect(publicAccount).toHaveProperty('address');
|
|
522
|
-
|
|
523
|
-
// This proves: private key is stored securely but not exposed via public API
|
|
524
|
-
});
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
describe('Import State Management', () => {
|
|
528
|
-
it('should preserve imported accounts across lock/unlock', async () => {
|
|
529
|
-
// Set up EVM vault state
|
|
530
|
-
currentVaultState = createMockVaultState({
|
|
531
|
-
activeAccountId: 0,
|
|
532
|
-
activeAccountType: KeyringAccountType.HDAccount,
|
|
533
|
-
networkType: INetworkType.Ethereum,
|
|
534
|
-
chainId: 1,
|
|
535
|
-
});
|
|
536
|
-
mockVaultStateGetter = jest.fn(() => currentVaultState);
|
|
537
|
-
|
|
538
|
-
keyringManager = await KeyringManager.createInitialized(
|
|
539
|
-
PEACE_SEED_PHRASE,
|
|
540
|
-
FAKE_PASSWORD,
|
|
541
|
-
mockVaultStateGetter
|
|
542
|
-
);
|
|
543
|
-
|
|
544
|
-
// Import multiple accounts
|
|
545
|
-
const privateKeys = [
|
|
546
|
-
'0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318',
|
|
547
|
-
'0x1234567890123456789012345678901234567890123456789012345678901234',
|
|
548
|
-
];
|
|
549
|
-
|
|
550
|
-
const imported: any[] = [];
|
|
551
|
-
for (const key of privateKeys) {
|
|
552
|
-
const account = await keyringManager.importAccount(key);
|
|
553
|
-
if (account) {
|
|
554
|
-
imported.push(account);
|
|
555
|
-
|
|
556
|
-
// Update vault state with imported account
|
|
557
|
-
currentVaultState.accounts[KeyringAccountType.Imported][account.id] =
|
|
558
|
-
{
|
|
559
|
-
id: account.id,
|
|
560
|
-
label: account.label,
|
|
561
|
-
address: account.address,
|
|
562
|
-
xpub: account.xpub,
|
|
563
|
-
xprv: account.xprv,
|
|
564
|
-
isImported: true,
|
|
565
|
-
isTrezorWallet: false,
|
|
566
|
-
isLedgerWallet: false,
|
|
567
|
-
balances: { syscoin: 0, ethereum: 0 },
|
|
568
|
-
assets: { syscoin: [], ethereum: [] },
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
// Lock and unlock
|
|
574
|
-
keyringManager.lockWallet();
|
|
575
|
-
await keyringManager.unlock(FAKE_PASSWORD);
|
|
576
|
-
|
|
577
|
-
// All imported accounts should still exist
|
|
578
|
-
for (const account of imported) {
|
|
579
|
-
const retrieved = keyringManager.getAccountById(
|
|
580
|
-
account.id,
|
|
581
|
-
KeyringAccountType.Imported
|
|
582
|
-
);
|
|
583
|
-
expect(retrieved.address).toBe(account.address);
|
|
584
|
-
expect(retrieved.label).toBe(account.label);
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
});
|
|
588
|
-
});
|