ln-accounting 10.0.7 → 10.0.9

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/esplora/get_esplora_vout.js +0 -1
  3. package/package.json +23 -8
  4. package/report/get_accounting_report.js +4 -1
  5. package/.gitattributes +0 -1
  6. package/.tm_properties +0 -1
  7. package/.travis.yml +0 -15
  8. package/blockstream/get_blockstream_tx.js +0 -94
  9. package/blockstream/get_blockstream_vout.js +0 -80
  10. package/blockstream/index.js +0 -4
  11. package/test/blockstream/test_get_blockstream_tx.js +0 -111
  12. package/test/fiat/test_get_coincap_historic_rate.js +0 -86
  13. package/test/fiat/test_get_coindesk_historic_rate.js +0 -80
  14. package/test/fiat/test_get_coingecko_historic_rate.js +0 -89
  15. package/test/fiat/test_get_fiat_values.js +0 -74
  16. package/test/fiat/test_get_historic_rate.js +0 -77
  17. package/test/harmony/test_categorize_records.js +0 -156
  18. package/test/harmony/test_chain_fees_as_records.js +0 -40
  19. package/test/harmony/test_chain_receives_as_records.js +0 -73
  20. package/test/harmony/test_chain_sends_as_records.js +0 -55
  21. package/test/harmony/test_formatted_notes.js +0 -32
  22. package/test/harmony/test_forwards_as_records.js +0 -52
  23. package/test/harmony/test_harmonize.js +0 -24
  24. package/test/harmony/test_invoices_as_records.js +0 -77
  25. package/test/harmony/test_notes_for_chain_transaction.js +0 -43
  26. package/test/harmony/test_payments_as_records.js +0 -159
  27. package/test/harmony/test_records_with_fiat.js +0 -112
  28. package/test/records/test_get_all_invoices.js +0 -105
  29. package/test/records/test_get_all_payments.js +0 -274
  30. package/test/report/test_parse_amount.js +0 -57
@@ -1,43 +0,0 @@
1
- const {equal} = require('node:assert').strict;
2
- const test = require('node:test');
3
-
4
- const notesForChainTx = require('./../../harmony/notes_for_chain_transaction');
5
-
6
- const tests = [
7
- {
8
- args: {
9
- output_addresses: ['a', 'b'],
10
- transaction: '010000000001010cb9318f1cbe8688e71ca9e61a9b2e361d1fb47adf92ee4152d274f15cca2ebd00000000232200206f569f1dcbb18b78883398b66a52c7c50938119ed4567cc3c2e5bb6d7b36c65000000000016d26000000000000160014362a2872a1c9988ef71c31bb332dfff68d895f0d0347304402207651e5bfabb17ec044f7e3cafc4817df07c3d81a72cdcdc4706f20bf0a1ff01302206b08d9f5ac317279b30b597dd91ddddc07d9f6c82b42a47e4453ff2ae9d6eafa01006a8201208763a914d1a70126ff7a149ca6f9b638db084480440ff8428821000000000000000000000000000000000000000000000000000000000000000000677503fbfa17b175210280a5a994052abe443adb74851387b389386306c690a94ddf3bfd71234cd2a72b68acfbfa1700',
11
- },
12
- description: 'Notes for timeout sweep are returned',
13
- expected: {notes: 'Submarine swap failure, swept out to a b'},
14
- },
15
- {
16
- args: {
17
- output_addresses: ['a', 'b'],
18
- transaction: '020000000001010cb9318f1cbe8688e71ca9e61a9b2e361d1fb47adf92ee4152d274f15cca2ebd000000000000000000018826000000000000160014362a2872a1c9988ef71c31bb332dfff68d895f0d0347304402203f4e9e57ac637980d380ecd634db6ff42a7def7086f0e08391c51a595bbd67cb022036010e360ef844381a6d271505d809e4cc9ca783dc6859aeae02f1de04df2c78012000000000000000000000000000000000000000000000000000000000000000006a8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc68821020ffb4c13e0f3547a1c9b98fe8b0430643b6a4c5f49985f3dbe11564898f7040e67750327fc17b1752102e8442ed17709432b996d70838a686cbd990f19c559ea0d04e319d27ceb135b9568acfbfa1700',
19
- },
20
- description: 'Notes for successful sweep are returned',
21
- expected: {notes: 'Submarine swap success, swept out to a b'},
22
- },
23
- {
24
- args: {output_addresses: ['a', 'b']},
25
- description: 'Notes are returned',
26
- expected: {notes: 'Outputs to a b'},
27
- },
28
- {
29
- args: {description: 'description', output_addresses: ['a', 'b']},
30
- description: 'Notes with description are returned',
31
- expected: {notes: 'description - Outputs to a b'},
32
- },
33
- ];
34
-
35
- tests.forEach(({args, description, expected}) => {
36
- return test(description, (t, end) => {
37
- const {notes} = notesForChainTx(args);
38
-
39
- equal(notes, expected.notes, 'Notes for chain transaction');
40
-
41
- return end();
42
- });
43
- });
@@ -1,159 +0,0 @@
1
- const {deepEqual} = require('node:assert').strict;
2
- const test = require('node:test');
3
-
4
- const {paymentsAsRecords} = require('./../../harmony');
5
-
6
- const date = new Date().toISOString();
7
-
8
- const tests = [
9
- {
10
- args: {
11
- payments: [{
12
- created_at: date,
13
- destination: 'destination',
14
- fee: 1,
15
- id: 'id',
16
- secret: 'secret',
17
- tokens: 2,
18
- }],
19
- },
20
- description: 'Payments as records',
21
- expected: {
22
- records: [
23
- {
24
- amount: -2,
25
- category: 'payments',
26
- created_at: date,
27
- id: 'id',
28
- notes: 'secret',
29
- to_id: 'destination',
30
- type: 'spend',
31
- },
32
- {
33
- amount: -1,
34
- category: 'payments',
35
- created_at: date,
36
- id: 'id:fee',
37
- notes: 'Routing fee',
38
- type: 'fee:network',
39
- },
40
- ],
41
- },
42
- },
43
- {
44
- args: {
45
- payments: [{
46
- created_at: date,
47
- destination: 'destination',
48
- fee: 1,
49
- id: 'id',
50
- request: 'lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d73gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ecky03ylcqca784w',
51
- secret: 'secret',
52
- tokens: 2,
53
- }],
54
- },
55
- description: 'Payments as records',
56
- expected: {
57
- records: [
58
- {
59
- amount: -2,
60
- category: 'payments',
61
- created_at: date,
62
- id: 'id',
63
- notes: 'Please consider supporting this project',
64
- to_id: 'destination',
65
- type: 'spend',
66
- },
67
- {
68
- amount: -1,
69
- category: 'payments',
70
- created_at: date,
71
- id: 'id:fee',
72
- notes: 'Routing fee',
73
- type: 'fee:network',
74
- },
75
- ],
76
- },
77
- },
78
- {
79
- args: {
80
- payments: [{
81
- created_at: date,
82
- destination: 'destination',
83
- fee: 1,
84
- id: 'id',
85
- request: 'request',
86
- secret: 'secret',
87
- tokens: 2,
88
- }],
89
- },
90
- description: 'Payments as records when the request is weird',
91
- expected: {
92
- records: [
93
- {
94
- amount: -2,
95
- category: 'payments',
96
- created_at: date,
97
- id: 'id',
98
- notes: 'secret',
99
- to_id: 'destination',
100
- type: 'spend',
101
- },
102
- {
103
- amount: -1,
104
- category: 'payments',
105
- created_at: date,
106
- id: 'id:fee',
107
- notes: 'Routing fee',
108
- type: 'fee:network',
109
- },
110
- ],
111
- },
112
- },
113
- {
114
- args: {
115
- payments: [{
116
- created_at: date,
117
- destination: 'destination',
118
- fee: 1,
119
- id: 'id',
120
- request: 'request',
121
- secret: 'secret',
122
- tokens: 2,
123
- }],
124
- public_key: 'destination'
125
- },
126
- description: 'Circular payments are represented',
127
- expected: {
128
- records: [
129
- {
130
- amount: -2,
131
- category: 'payments',
132
- created_at: date,
133
- id: 'id',
134
- notes: '[To Self] secret',
135
- to_id: 'destination',
136
- type: 'spend',
137
- },
138
- {
139
- amount: -1,
140
- category: 'payments',
141
- created_at: date,
142
- id: 'id:fee',
143
- notes: 'Circular payment routing fee',
144
- type: 'fee:network',
145
- },
146
- ],
147
- },
148
- },
149
- ];
150
-
151
- tests.forEach(({args, description, expected}) => {
152
- return test(description, (t, end) => {
153
- const {records} = paymentsAsRecords(args);
154
-
155
- deepEqual(records, expected.records, 'Forwards formatted as records');
156
-
157
- return end();
158
- });
159
- });
@@ -1,112 +0,0 @@
1
- const {deepEqual} = require('node:assert').strict;
2
- const test = require('node:test');
3
- const {throws} = require('node:assert').strict;
4
-
5
- const {recordsWithFiat} = require('./../../harmony');
6
-
7
- const date = new Date().toISOString();
8
-
9
- const tests = [
10
- {
11
- args: {
12
- currency: 'BTC',
13
- fiat: [{date, cents: 123456}],
14
- records: [{
15
- amount: 1e8,
16
- category: 'category',
17
- created_at: date,
18
- id: 'id',
19
- type: 'type',
20
- }],
21
- },
22
- description: 'Add fiat values to records',
23
- expected: {
24
- records: [{
25
- amount: 1e8,
26
- asset: 'BTC',
27
- category: 'category',
28
- created_at: date,
29
- external_id: '',
30
- fiat_amount: 1234.56,
31
- from_id: '',
32
- id: 'id',
33
- notes: '',
34
- to_id: '',
35
- type: 'type',
36
- }],
37
- },
38
- },
39
- {
40
- args: {
41
- currency: 'BTC',
42
- fiat: [{date, cents: 123456}],
43
- records: [{
44
- category: 'category',
45
- created_at: date,
46
- type: 'type',
47
- }],
48
- },
49
- description: 'Add fiat values to records',
50
- expected: {
51
- records: [{
52
- amount: 0,
53
- asset: 'BTC',
54
- category: 'category',
55
- created_at: date,
56
- external_id: '',
57
- fiat_amount: 0,
58
- from_id: '',
59
- id: '',
60
- notes: '',
61
- to_id: '',
62
- type: 'type',
63
- }],
64
- },
65
- },
66
- {
67
- args: {
68
- currency: 'BTC',
69
- fiat: [],
70
- records: [{
71
- category: 'category',
72
- created_at: date,
73
- type: 'type',
74
- }],
75
- },
76
- description: 'No fiat is known',
77
- expected: {
78
- records: [{
79
- amount: 0,
80
- asset: 'BTC',
81
- category: 'category',
82
- created_at: date,
83
- external_id: '',
84
- fiat_amount: undefined,
85
- from_id: '',
86
- id: '',
87
- notes: '',
88
- to_id: '',
89
- type: 'type',
90
- }],
91
- },
92
- },
93
- {
94
- args: {},
95
- description: 'Records are required',
96
- error: 'ExpectedArrayOfRecordsToMapToFiatRecords',
97
- },
98
- ];
99
-
100
- tests.forEach(({args, description, error, expected}) => {
101
- return test(description, (t, end) => {
102
- if (!!error) {
103
- throws(() => recordsWithFiat(args), new Error(error), 'Got error');
104
- } else {
105
- const {records} = recordsWithFiat(args);
106
-
107
- deepEqual(records, expected.records, 'Fiat added to records');
108
- }
109
-
110
- return end();
111
- });
112
- });
@@ -1,105 +0,0 @@
1
- const {deepEqual} = require('node:assert').strict;
2
- const {rejects} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {getAllInvoices} = require('./../../records');
6
-
7
- const tests = [
8
- {
9
- args: {},
10
- description: 'LND is required',
11
- error: [400, 'ExpectedLndToGetAllInvoices'],
12
- },
13
- {
14
- args: {lnd: {default: {listInvoices: ({}, cbk) => cbk('err')}}},
15
- description: 'Errors from LND are passed back',
16
- error: [503, 'UnexpectedGetInvoicesError', {err: 'err'}],
17
- },
18
- {
19
- args: {
20
- lnd: {
21
- default: {
22
- listInvoices: (args, cbk) => {
23
- if (!!args.index_offset) {
24
- return cbk(null, {
25
- first_index_offset: '1',
26
- invoices: [],
27
- last_index_offset: '1',
28
- });
29
- }
30
-
31
- return cbk(null, {
32
- first_index_offset: '2',
33
- invoices: [{
34
- add_index: '0',
35
- amt_paid_msat: '1000',
36
- amt_paid_sat: '1',
37
- cltv_expiry: 1,
38
- creation_date: 1,
39
- description_hash: Buffer.alloc(32),
40
- expiry: 1,
41
- features: {},
42
- htlcs: [],
43
- memo: '',
44
- payment_addr: Buffer.alloc(32),
45
- payment_request: 'request',
46
- private: false,
47
- r_hash: Buffer.alloc(32),
48
- r_preimage: Buffer.alloc(32),
49
- settle_date: 1,
50
- settled: true,
51
- state: 'SETTLED',
52
- value: '1',
53
- value_msat: '1000',
54
- }],
55
- last_index_offset: '5',
56
- });
57
- },
58
- },
59
- },
60
- },
61
- description: 'Invoices are returned',
62
- expected: {
63
- invoices: [{
64
- chain_address: undefined,
65
- cltv_delta: 1,
66
- confirmed_at: '1970-01-01T00:00:01.000Z',
67
- confirmed_index: undefined,
68
- created_at: '1970-01-01T00:00:01.000Z',
69
- description: '',
70
- description_hash: '0000000000000000000000000000000000000000000000000000000000000000',
71
- expires_at: '1970-01-01T00:00:02.000Z',
72
- features: [],
73
- id: '0000000000000000000000000000000000000000000000000000000000000000',
74
- index: 0,
75
- is_canceled: undefined,
76
- is_confirmed: true,
77
- is_held: undefined,
78
- is_private: false,
79
- is_push: undefined,
80
- mtokens: '1000',
81
- payment: undefined,
82
- payments: [],
83
- received: 1,
84
- received_mtokens: '1000',
85
- request: 'request',
86
- secret: '0000000000000000000000000000000000000000000000000000000000000000',
87
- tokens: 1,
88
- }],
89
- },
90
- },
91
- ];
92
-
93
- tests.forEach(({args, description, error, expected}) => {
94
- return test(description, async () => {
95
- if (!!error) {
96
- await rejects(getAllInvoices(args), error, 'Got expected error');
97
- } else {
98
- const {invoices} = await getAllInvoices(args);
99
-
100
- deepEqual(invoices, expected.invoices, 'Got expected result');
101
- }
102
-
103
- return;
104
- });
105
- });
@@ -1,274 +0,0 @@
1
- const {deepEqual} = require('node:assert').strict;
2
- const {rejects} = require('node:assert').strict;
3
- const test = require('node:test');
4
-
5
- const {getAllPayments} = require('./../../records');
6
-
7
- const tests = [
8
- {
9
- args: {},
10
- description: 'LND is required',
11
- error: [400, 'ExpectedLndToGetAllPayments'],
12
- },
13
- {
14
- args: {lnd: {default: {listPayments: ({}, cbk) => cbk('err')}}},
15
- description: 'Errors from LND are passed back',
16
- error: [503, 'UnexpectedGetPaymentsError', {err: 'err'}],
17
- },
18
- {
19
- args: {
20
- lnd: {
21
- default: {
22
- listPayments: (args, cbk) => {
23
- if (!!args.index_offset) {
24
- return cbk(null, {
25
- first_index_offset: '1',
26
- payments: [],
27
- last_index_offset: '1',
28
- });
29
- }
30
-
31
- return cbk(null, {
32
- first_index_offset: '2',
33
- payments: [{
34
- creation_date: '1',
35
- creation_time_ns: '0',
36
- failure_reason: 'FAILURE_REASON_TIMEOUT',
37
- fee_msat: '1000',
38
- fee_sat: '1',
39
- htlcs: [{
40
- attempt_time_ns: '1000000',
41
- failure: {
42
- channel_update: {
43
- base_fee: '1000',
44
- chain_hash: Buffer.alloc(32),
45
- chan_id: '1',
46
- channel_flags: 1,
47
- extra_opaque_data: Buffer.alloc(1),
48
- fee_rate: 1,
49
- htlc_maximum_msat: '1000',
50
- htlc_minimum_msat: '1000',
51
- message_flags: 1,
52
- signature: Buffer.alloc(71),
53
- time_lock_delta: 1,
54
- timestamp: 1,
55
- },
56
- code: 'UNREADABLE_FAILURE',
57
- failure_source_index1: 1,
58
- height: 1,
59
- htlc_msat: '1000',
60
- },
61
- resolve_time_ns: '1000000',
62
- route: {
63
- hops: [
64
- {
65
- amt_to_forward_msat: '1000',
66
- chan_id: '1',
67
- chan_capacity: 1,
68
- expiry: 1,
69
- fee_msat: '1000',
70
- mpp_record: {
71
- payment_addr: Buffer.alloc(32),
72
- total_amt_msat: '1000',
73
- },
74
- pub_key: Buffer.alloc(33).toString('hex'),
75
- tlv_payload: true,
76
- },
77
- {
78
- amt_to_forward_msat: '1000',
79
- chan_id: '1',
80
- chan_capacity: 1,
81
- expiry: 1,
82
- fee_msat: '1000',
83
- mpp_record: {
84
- payment_addr: Buffer.alloc(32),
85
- total_amt_msat: '1000',
86
- },
87
- pub_key: Buffer.alloc(33).toString('hex'),
88
- tlv_payload: true,
89
- },
90
- ],
91
- total_amt: '1',
92
- total_amt_msat: '1000',
93
- total_fees: '1',
94
- total_fees_msat: '1000',
95
- total_time_lock: 1,
96
- },
97
- status: 'FAILED',
98
- }],
99
- path: [Buffer.alloc(33).toString('hex'), Buffer.alloc(33).toString('hex')],
100
- payment_hash: Buffer.alloc(32).toString('hex'),
101
- payment_index: '1',
102
- payment_preimage: Buffer.alloc(32, 1).toString('hex'),
103
- payment_request: 'lntb1500n1pdn4czkpp5ugdqer05qrrxuchrzkcue94th9w2xzasp9qm7d0yxcgp4uh4kn4qdpa2fjkzep6yprkcmmzv9kzqsmj09c8gmmrw4e8yetwvdujq5n9va6kcct5d9hkucqzysdlghdpua7uvjjkcfj49psxtlqzkp5pdncffdfk2cp3mp76thrl29qhqgzufm503pjj96586n5w6edgw3n66j4rxxs707y4zdjuhyt6qqe5weu4',
104
- status: 'SUCCEEDED',
105
- value: '1',
106
- value_msat: '1000',
107
- value_sat: '1',
108
- }],
109
- last_index_offset: '5',
110
- });
111
- },
112
- },
113
- },
114
- },
115
- description: 'Payments are returned',
116
- expected: {
117
- payments: [{
118
- attempts: [{
119
- confirmed_at: undefined,
120
- created_at: '1970-01-01T00:00:00.001Z',
121
- failed_at: '1970-01-01T00:00:00.001Z',
122
- is_confirmed: false,
123
- is_failed: true,
124
- is_pending: false,
125
- route: {
126
- fee: 1,
127
- fee_mtokens: '1000',
128
- hops: [
129
- {
130
- channel: '0x0x1',
131
- fee: 1,
132
- fee_mtokens: '1000',
133
- forward: 1,
134
- forward_mtokens: '1000',
135
- public_key: Buffer.alloc(33).toString('hex'),
136
- timeout: 1,
137
- },
138
- {
139
- channel: '0x0x1',
140
- fee: 1,
141
- fee_mtokens: '1000',
142
- forward: 1,
143
- forward_mtokens: '1000',
144
- public_key: Buffer.alloc(33).toString('hex'),
145
- timeout: 1,
146
- },
147
- ],
148
- mtokens: '1000',
149
- payment: Buffer.alloc(32).toString('hex'),
150
- timeout: 1,
151
- tokens: 1,
152
- total_mtokens: '1000',
153
- },
154
- }],
155
- confirmed_at: undefined,
156
- created_at: '1970-01-01T00:00:01.000Z',
157
- destination: Buffer.alloc(33).toString('hex'),
158
- fee: 1,
159
- fee_mtokens: '1000',
160
- hops: [Buffer.alloc(33).toString('hex')],
161
- id: Buffer.alloc(32).toString('hex'),
162
- index: 1,
163
- is_confirmed: true,
164
- is_outgoing: true,
165
- mtokens: '1000',
166
- request: 'lntb1500n1pdn4czkpp5ugdqer05qrrxuchrzkcue94th9w2xzasp9qm7d0yxcgp4uh4kn4qdpa2fjkzep6yprkcmmzv9kzqsmj09c8gmmrw4e8yetwvdujq5n9va6kcct5d9hkucqzysdlghdpua7uvjjkcfj49psxtlqzkp5pdncffdfk2cp3mp76thrl29qhqgzufm503pjj96586n5w6edgw3n66j4rxxs707y4zdjuhyt6qqe5weu4',
167
- safe_fee: 1,
168
- safe_tokens: 1,
169
- secret: Buffer.alloc(32, 1).toString('hex'),
170
- tokens: 1,
171
- }],
172
- },
173
- },
174
- {
175
- args: {
176
- after: new Date().toISOString(),
177
- lnd: {
178
- default: {
179
- listPayments: (args, cbk) => {
180
- if (!!args.index_offset) {
181
- return cbk(null, {
182
- first_index_offset: '1',
183
- payments: [],
184
- last_index_offset: '1',
185
- });
186
- }
187
-
188
- return cbk(null, {
189
- first_index_offset: '2',
190
- payments: [{
191
- creation_date: '1',
192
- creation_time_ns: '0',
193
- failure_reason: 'FAILURE_REASON_TIMEOUT',
194
- fee_msat: '1000',
195
- fee_sat: '1',
196
- htlcs: [{
197
- attempt_time_ns: '1000000',
198
- failure: {
199
- channel_update: {
200
- base_fee: '1000',
201
- chain_hash: Buffer.alloc(32),
202
- chan_id: '1',
203
- channel_flags: 1,
204
- extra_opaque_data: Buffer.alloc(1),
205
- fee_rate: 1,
206
- htlc_maximum_msat: '1000',
207
- htlc_minimum_msat: '1000',
208
- message_flags: 1,
209
- signature: Buffer.alloc(71),
210
- time_lock_delta: 1,
211
- timestamp: 1,
212
- },
213
- code: 'UNREADABLE_FAILURE',
214
- failure_source_index1: 1,
215
- height: 1,
216
- htlc_msat: '1000',
217
- },
218
- resolve_time_ns: '1000000',
219
- route: {
220
- hops: [{
221
- amt_to_forward_msat: '1000',
222
- chan_id: '1',
223
- chan_capacity: 1,
224
- expiry: 1,
225
- fee_msat: '1000',
226
- mpp_record: {
227
- payment_addr: Buffer.alloc(32),
228
- total_amt_msat: '1000',
229
- },
230
- pub_key: Buffer.alloc(33).toString('hex'),
231
- tlv_payload: true,
232
- }],
233
- total_amt: '1',
234
- total_amt_msat: '1000',
235
- total_fees: '1',
236
- total_fees_msat: '1000',
237
- total_time_lock: 1,
238
- },
239
- status: 'FAILED',
240
- }],
241
- path: [Buffer.alloc(33).toString('hex'), Buffer.alloc(33).toString('hex')],
242
- payment_hash: Buffer.alloc(32).toString('hex'),
243
- payment_index: '1',
244
- payment_preimage: Buffer.alloc(32).toString('hex'),
245
- payment_request: 'lntb1500n1pdn4czkpp5ugdqer05qrrxuchrzkcue94th9w2xzasp9qm7d0yxcgp4uh4kn4qdpa2fjkzep6yprkcmmzv9kzqsmj09c8gmmrw4e8yetwvdujq5n9va6kcct5d9hkucqzysdlghdpua7uvjjkcfj49psxtlqzkp5pdncffdfk2cp3mp76thrl29qhqgzufm503pjj96586n5w6edgw3n66j4rxxs707y4zdjuhyt6qqe5weu4',
246
- status: 'FAILED',
247
- value: '1',
248
- value_msat: '1000',
249
- value_sat: '1',
250
- }],
251
- last_index_offset: '5',
252
- });
253
- },
254
- },
255
- },
256
- },
257
- description: 'Payments are returned with after condition',
258
- expected: {payments: []},
259
- },
260
- ];
261
-
262
- tests.forEach(({args, description, error, expected}) => {
263
- return test(description, async () => {
264
- if (!!error) {
265
- await rejects(getAllPayments(args), error, 'Got expected error');
266
- } else {
267
- const {payments} = await getAllPayments(args);
268
-
269
- deepEqual(payments, expected.payments, 'Got expected result');
270
- }
271
-
272
- return;
273
- });
274
- });