@@ -55,7 +55,45 @@ describe('WalletUtil', () => {
55
55
]
56
56
] ;
57
57
const resolver = createInputResolver ( {
58
- transactions : { outgoing : { signed$ : of ( ) } } ,
58
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
59
+ utxo : { available$ : of ( utxo ) }
60
+ } ) ;
61
+ expect (
62
+ await resolver . resolveInput ( {
63
+ index : 0 ,
64
+ txId : Cardano . TransactionId ( '0f3abbc8fc19c2e61bab6059bf8a466e6e754833a08a62a6c56fe0e78f19d9d5' )
65
+ } )
66
+ ) . toEqual ( {
67
+ address : 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ,
68
+ value : { coins : 50_000_000n }
69
+ } ) ;
70
+ expect (
71
+ await resolver . resolveInput ( {
72
+ index : 0 ,
73
+ txId : Cardano . TransactionId ( '0f3abbc8fc19c2e61bab6059bf8a466e6e754833a08a62a6c56fe0e78f19d9d4' )
74
+ } )
75
+ ) . toBeNull ( ) ;
76
+ } ) ;
77
+
78
+ it ( 'resolveInput resolves inputs from tx history' , async ( ) => {
79
+ const utxo : Cardano . Utxo [ ] = [ ] ;
80
+ const resolver = createInputResolver ( {
81
+ transactions : {
82
+ history$ : of ( [
83
+ {
84
+ body : {
85
+ outputs : [
86
+ {
87
+ address : Cardano . PaymentAddress ( 'addr_test1vr8nl4u0u6fmtfnawx2rxfz95dy7m46t6dhzdftp2uha87syeufdg' ) ,
88
+ value : { coins : 50_000_000n }
89
+ }
90
+ ]
91
+ } ,
92
+ id : Cardano . TransactionId ( '0f3abbc8fc19c2e61bab6059bf8a466e6e754833a08a62a6c56fe0e78f19d9d5' )
93
+ } as Cardano . HydratedTx
94
+ ] ) ,
95
+ outgoing : { signed$ : of ( ) }
96
+ } ,
59
97
utxo : { available$ : of ( utxo ) }
60
98
} ) ;
61
99
expect (
@@ -97,7 +135,7 @@ describe('WalletUtil', () => {
97
135
} as Cardano . HydratedTx ;
98
136
99
137
const resolver = createInputResolver ( {
100
- transactions : { outgoing : { signed$ : of ( ) } } ,
138
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
101
139
utxo : { available$ : of ( [ ] ) }
102
140
} ) ;
103
141
@@ -134,7 +172,7 @@ describe('WalletUtil', () => {
134
172
const signedTxs = mocks . queryTransactionsResult . pageResults . map ( toSignedTx ) ;
135
173
136
174
const resolver = createInputResolver ( {
137
- transactions : { outgoing : { signed$ : of ( signedTxs ) } } ,
175
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( signedTxs ) } } ,
138
176
utxo : { available$ : of ( ) }
139
177
} ) ;
140
178
expect (
@@ -273,7 +311,10 @@ describe('WalletUtil', () => {
273
311
]
274
312
] ;
275
313
const resolver = combineInputResolvers (
276
- createInputResolver ( { transactions : { outgoing : { signed$ : of ( ) } } , utxo : { available$ : of ( utxo ) } } ) ,
314
+ createInputResolver ( {
315
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
316
+ utxo : { available$ : of ( utxo ) }
317
+ } ) ,
277
318
createBackendInputResolver ( createMockChainHistoryProvider ( ) )
278
319
) ;
279
320
@@ -315,7 +356,10 @@ describe('WalletUtil', () => {
315
356
} as Cardano . HydratedTx ;
316
357
317
358
const resolver = combineInputResolvers (
318
- createInputResolver ( { transactions : { outgoing : { signed$ : of ( ) } } , utxo : { available$ : of ( [ ] ) } } ) ,
359
+ createInputResolver ( {
360
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
361
+ utxo : { available$ : of ( [ ] ) }
362
+ } ) ,
319
363
createBackendInputResolver ( createMockChainHistoryProvider ( [ tx ] ) )
320
364
) ;
321
365
@@ -395,7 +439,10 @@ describe('WalletUtil', () => {
395
439
] ;
396
440
397
441
const resolver = combineInputResolvers (
398
- createInputResolver ( { transactions : { outgoing : { signed$ : of ( ) } } , utxo : { available$ : of ( utxo ) } } ) ,
442
+ createInputResolver ( {
443
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
444
+ utxo : { available$ : of ( utxo ) }
445
+ } ) ,
399
446
createBackendInputResolver ( createMockChainHistoryProvider ( [ tx ] ) )
400
447
) ;
401
448
@@ -456,7 +503,10 @@ describe('WalletUtil', () => {
456
503
457
504
it ( 'resolveInput resolves to null if the input can not be found' , async ( ) => {
458
505
const resolver = combineInputResolvers (
459
- createInputResolver ( { transactions : { outgoing : { signed$ : of ( ) } } , utxo : { available$ : of ( [ ] ) } } ) ,
506
+ createInputResolver ( {
507
+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
508
+ utxo : { available$ : of ( [ ] ) }
509
+ } ) ,
460
510
createBackendInputResolver ( createMockChainHistoryProvider ( ) )
461
511
) ;
462
512
0 commit comments