-
Notifications
You must be signed in to change notification settings - Fork 302
Expand file tree
/
Copy pathdescriptorWallet.ts
More file actions
32 lines (27 loc) · 1.06 KB
/
descriptorWallet.ts
File metadata and controls
32 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import assert from 'assert';
import * as testutils from '@bitgo/wasm-utxo/testutils';
import { getDescriptorMapFromWallet, isDescriptorWallet } from '../../../src/descriptor';
import { UtxoWallet } from '../../../src/wallet';
import { toBip32Triple } from '../../../src/keychains';
import { policyAllowAll } from '../../../src/descriptor/validatePolicy';
const { getDefaultXPubs, getDescriptorMap } = testutils.descriptor;
describe('isDescriptorWalletData', function () {
const descriptorMap = getDescriptorMap('Wsh2Of3');
it('should return true for valid DescriptorWalletData', function () {
const wallet: UtxoWallet = {
coinSpecific() {
return {
descriptors: [...descriptorMap.entries()].map(([name, descriptor]) => ({
name,
value: descriptor.toString(),
})),
};
},
} as unknown as UtxoWallet;
assert(isDescriptorWallet(wallet));
assert.strictEqual(
getDescriptorMapFromWallet(wallet, toBip32Triple(getDefaultXPubs()), policyAllowAll).size,
descriptorMap.size
);
});
});