Skip to content

Commit 12281b2

Browse files
feat(abstract-utxo): test explicit internal recipients
Issue: BTC-1791
1 parent dc31772 commit 12281b2

File tree

3 files changed

+47
-2
lines changed

3 files changed

+47
-2
lines changed

modules/abstract-utxo/test/transaction/descriptor/fixtures/parseWithRecipient.json renamed to modules/abstract-utxo/test/transaction/descriptor/fixtures/parseWithExternalRecipient.json

File renamed without changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"outputs": [
3+
{
4+
"address": "bc1qvn279lx29cg843u77p3c37npay7w4uc4xw5d92xxa92z8gd3lkuq4w8477",
5+
"amount": "400000",
6+
"external": true
7+
},
8+
{
9+
"address": "bc1q2yau645jl7k577lmanqn9a0ulcgcqm0wrrmx09dppd3kcwguvyzqk86umj",
10+
"amount": "400000",
11+
"external": false
12+
}
13+
],
14+
"changeOutputs": [
15+
{
16+
"address": "bc1q2yau645jl7k577lmanqn9a0ulcgcqm0wrrmx09dppd3kcwguvyzqk86umj",
17+
"amount": "400000",
18+
"external": false
19+
}
20+
],
21+
"explicitExternalOutputs": [],
22+
"explicitExternalSpendAmount": "0",
23+
"implicitExternalOutputs": [
24+
{
25+
"address": "bc1qvn279lx29cg843u77p3c37npay7w4uc4xw5d92xxa92z8gd3lkuq4w8477",
26+
"amount": "400000",
27+
"external": true
28+
}
29+
],
30+
"implicitExternalSpendAmount": "400000",
31+
"missingOutputs": [
32+
{
33+
"address": "bc1q2yau645jl7k577lmanqn9a0ulcgcqm0wrrmx09dppd3kcwguvyzqk86umj",
34+
"amount": "400000",
35+
"external": true
36+
}
37+
]
38+
}

modules/abstract-utxo/test/transaction/descriptor/parse.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ describe('parse', function () {
6060
describe('toBase', function () {
6161
it('should return the correct BaseParsedTransactionOutputs', async function () {
6262
await assertEqualFixture('parseWithoutRecipients.json', toPlainObject(getBaseParsedTransaction([])));
63-
await assertEqualFixture('parseWithRecipient.json', toPlainObject(getBaseParsedTransaction([psbt.txOutputs[0]])));
6463
await assertEqualFixture(
65-
'parseWithRecipient.json',
64+
'parseWithExternalRecipient.json',
65+
toPlainObject(getBaseParsedTransaction([psbt.txOutputs[0]]))
66+
);
67+
await assertEqualFixture(
68+
'parseWithInternalRecipient.json',
69+
toPlainObject(getBaseParsedTransaction([psbt.txOutputs[1]]))
70+
);
71+
await assertEqualFixture(
72+
'parseWithExternalRecipient.json',
6673
// max recipient: ignore actual value
6774
toPlainObject(getBaseParsedTransaction([toMaxOutput(psbt.txOutputs[0])]))
6875
);

0 commit comments

Comments
 (0)