-
-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(connect): get address multisig sorted by pubkey
- Loading branch information
Showing
1 changed file
with
119 additions
and
0 deletions.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
packages/connect/e2e/__fixtures__/getAddressMultisigPubkeysOrder.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,119 @@ | ||
import { MultisigPubkeysOrder } from '@trezor/protobuf/src/messages'; | ||
|
||
// https://github.com/trezor/trezor-firmware/blob/main/tests/device_tests/bitcoin/test_getaddress.py | ||
|
||
const nodeInternal = { | ||
// trezorctl btc get-public-node -n m/45h/0 | ||
node: 'xpub69numS2foCPDWvbnTE95o7m92kWr1CFoSA91EHAADBDHcaQw6VwrDFbg5KUGGnyLdKjJ3ohRG4BHQNzpM1kBbVPKkBQB5j221NcvByaWDz2', | ||
address_n: [0, 0], | ||
}; | ||
|
||
const nodeExternal = { | ||
// trezorctl btc get-public-node -n m/45h/1 | ||
node: 'xpub69numS2foCPDZmjusERkaVyVhRAQXzCjpYExzFSEHCV8615UzJDnCeHDU8av9eXoaWR5CESEymVz1KBhpgFCpLg22jA6msZ4VGWaUXcSSDy', | ||
address_n: [0, 0], | ||
}; | ||
const pubkeysOrder1 = [nodeInternal, nodeExternal]; | ||
|
||
const pubkeysOrder2 = [nodeExternal, nodeInternal]; | ||
|
||
const multisigUnsorted1 = { | ||
pubkeys: pubkeysOrder1, | ||
signatures: ['', ''], | ||
m: 2, | ||
pubkeys_order: MultisigPubkeysOrder.PRESERVED, | ||
}; | ||
|
||
const multisigUnsorted2 = { | ||
pubkeys: pubkeysOrder2, | ||
signatures: ['', ''], | ||
m: 2, | ||
pubkeys_order: MultisigPubkeysOrder.PRESERVED, | ||
}; | ||
|
||
const multisigSorted1 = { | ||
pubkeys: pubkeysOrder1, | ||
signatures: ['', ''], | ||
m: 2, | ||
pubkeys_order: MultisigPubkeysOrder.LEXICOGRAPHIC, | ||
}; | ||
|
||
const multisigSorted2 = { | ||
pubkeys: pubkeysOrder2, | ||
signatures: ['', ''], | ||
m: 2, | ||
pubkeys_order: MultisigPubkeysOrder.LEXICOGRAPHIC, | ||
}; | ||
|
||
const addressUnsorted1 = '3DKeup4KhFpvJPpqnPRdZMte73YZC3v8dS'; | ||
const addressUnsorted2 = '3DpiomhFpTzGJZNksqn67pW5AUV1xHBMG1'; | ||
|
||
// trezorctl btc get-address -n m/45h/0/0/0 -m 2 -x xpub1 -x xpub2 --multisig-sort-pubkeys | ||
export default { | ||
method: 'getAddress', | ||
setup: { | ||
mnemonic: 'mnemonic_all', | ||
settings: { | ||
safety_checks: 2, | ||
}, | ||
}, | ||
tests: [ | ||
{ | ||
description: 'show multisig address unsorted (1)', | ||
params: { | ||
path: "m/45'/0/0/0", | ||
multisig: multisigUnsorted1, | ||
scriptType: 'SPENDMULTISIG', | ||
showOnTrezor: true, | ||
}, | ||
result: { | ||
address: addressUnsorted1, | ||
}, | ||
}, | ||
{ | ||
description: 'show multisig address unsorted (1)', | ||
params: { | ||
path: "m/45'/0/0/0", | ||
multisig: multisigUnsorted2, | ||
scriptType: 'SPENDMULTISIG', | ||
showOnTrezor: true, | ||
}, | ||
result: { | ||
address: addressUnsorted2, | ||
}, | ||
}, | ||
{ | ||
description: 'show multisig address sorted (1)', | ||
params: { | ||
path: "m/45'/0/0/0", | ||
multisig: multisigSorted1, | ||
scriptType: 'SPENDMULTISIG', | ||
showOnTrezor: true, | ||
}, | ||
result: { | ||
address: addressUnsorted1, | ||
}, | ||
}, | ||
{ | ||
description: 'show multisig address sorted (1)', | ||
params: { | ||
path: "m/45'/0/0/0", | ||
multisig: multisigSorted2, | ||
scriptType: 'SPENDMULTISIG', | ||
showOnTrezor: true, | ||
}, | ||
result: { | ||
address: addressUnsorted1, | ||
}, | ||
legacyResults: [ | ||
// https://github.com/trezor/trezor-firmware/pull/4351 | ||
{ | ||
rules: ['<2.8.7'], | ||
payload: { | ||
address: addressUnsorted2, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; |