@@ -309,9 +309,10 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
309
309
utxo . assetId . toString ( ) === context . avaxAssetID ,
310
310
) ;
311
311
312
- const { importedInputs, importedAmounts } = filteredUtxos . reduce < {
312
+ const { importedInputs, importedAmounts, inputUtxos } = filteredUtxos . reduce < {
313
313
importedInputs : TransferableInput [ ] ;
314
314
importedAmounts : Record < string , bigint > ;
315
+ inputUtxos : Utxo [ ] ;
315
316
} > (
316
317
( acc , utxo ) => {
317
318
const { sigIndicies : inputSigIndices } =
@@ -342,9 +343,10 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
342
343
[ assetId ] :
343
344
( acc . importedAmounts [ assetId ] ?? 0n ) + utxo . output . amount ( ) ,
344
345
} ,
346
+ inputUtxos : [ ...acc . inputUtxos , utxo ] ,
345
347
} ;
346
348
} ,
347
- { importedInputs : [ ] , importedAmounts : { } } ,
349
+ { importedInputs : [ ] , importedAmounts : { } , inputUtxos : [ ] } ,
348
350
) ;
349
351
350
352
if ( importedInputs . length === 0 ) {
@@ -397,6 +399,9 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
397
399
context ,
398
400
) ;
399
401
402
+ // Note: We don't use the `inputUTXOs` from `spendResults`
403
+ // for the `UnsignedTx` because we want to use the original
404
+ // UTXOs that were imported.
400
405
const { changeOutputs, inputs } = spendResults ;
401
406
402
407
return new UnsignedTx (
@@ -411,7 +416,7 @@ export const newImportTx: TxBuilderFn<NewImportTxProps> = (
411
416
Id . fromString ( sourceChainId ) ,
412
417
importedInputs . sort ( TransferableInput . compare ) ,
413
418
) ,
414
- filteredUtxos ,
419
+ inputUtxos ,
415
420
addressMaps ,
416
421
) ;
417
422
} ;
0 commit comments