@@ -55,7 +55,45 @@ describe('WalletUtil', () => {
5555 ]
5656 ] ;
5757 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+ } ,
5997 utxo : { available$ : of ( utxo ) }
6098 } ) ;
6199 expect (
@@ -97,7 +135,7 @@ describe('WalletUtil', () => {
97135 } as Cardano . HydratedTx ;
98136
99137 const resolver = createInputResolver ( {
100- transactions : { outgoing : { signed$ : of ( ) } } ,
138+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( ) } } ,
101139 utxo : { available$ : of ( [ ] ) }
102140 } ) ;
103141
@@ -134,7 +172,7 @@ describe('WalletUtil', () => {
134172 const signedTxs = mocks . queryTransactionsResult . pageResults . map ( toSignedTx ) ;
135173
136174 const resolver = createInputResolver ( {
137- transactions : { outgoing : { signed$ : of ( signedTxs ) } } ,
175+ transactions : { history$ : of ( [ ] ) , outgoing : { signed$ : of ( signedTxs ) } } ,
138176 utxo : { available$ : of ( ) }
139177 } ) ;
140178 expect (
@@ -273,7 +311,10 @@ describe('WalletUtil', () => {
273311 ]
274312 ] ;
275313 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+ } ) ,
277318 createBackendInputResolver ( createMockChainHistoryProvider ( ) )
278319 ) ;
279320
@@ -315,7 +356,10 @@ describe('WalletUtil', () => {
315356 } as Cardano . HydratedTx ;
316357
317358 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+ } ) ,
319363 createBackendInputResolver ( createMockChainHistoryProvider ( [ tx ] ) )
320364 ) ;
321365
@@ -395,7 +439,10 @@ describe('WalletUtil', () => {
395439 ] ;
396440
397441 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+ } ) ,
399446 createBackendInputResolver ( createMockChainHistoryProvider ( [ tx ] ) )
400447 ) ;
401448
@@ -456,7 +503,10 @@ describe('WalletUtil', () => {
456503
457504 it ( 'resolveInput resolves to null if the input can not be found' , async ( ) => {
458505 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+ } ) ,
460510 createBackendInputResolver ( createMockChainHistoryProvider ( ) )
461511 ) ;
462512
0 commit comments