@@ -74,7 +74,7 @@ export class ExportInPTxBuilder extends AtomicTransactionBuilder {
7474 this . transaction . _rawSignedBytes = rawBytes ;
7575 }
7676
77- this . computeAddressesIndexFromParsed ( ) ;
77+ this . computeAddressesIndex ( true ) ;
7878
7979 // Use parsed credentials if available, otherwise create new ones based on sigIndices
8080 // The sigIndices from the parsed transaction (stored in addressesIndex) determine
@@ -87,7 +87,7 @@ export class ExportInPTxBuilder extends AtomicTransactionBuilder {
8787 const sigIndices = utxo . addressesIndex ?? [ ] ;
8888 // Use sigIndices-based method if we have valid sigIndices from parsed transaction
8989 if ( sigIndices . length >= utxoThreshold && sigIndices . every ( ( idx ) => idx >= 0 ) ) {
90- return this . createCredentialForUtxoWithSigIndices ( utxo , utxoThreshold , sigIndices ) ;
90+ return this . createCredentialForUtxo ( utxo , utxoThreshold , sigIndices ) ;
9191 }
9292 return this . createCredentialForUtxo ( utxo , utxoThreshold ) ;
9393 } ) ;
@@ -97,7 +97,7 @@ export class ExportInPTxBuilder extends AtomicTransactionBuilder {
9797 const utxoThreshold = utxo . threshold || this . transaction . _threshold ;
9898 const sigIndices = utxo . addressesIndex ?? [ ] ;
9999 if ( sigIndices . length >= utxoThreshold && sigIndices . every ( ( idx ) => idx >= 0 ) ) {
100- return this . createAddressMapForUtxoWithSigIndices ( utxo , utxoThreshold , sigIndices ) ;
100+ return this . createAddressMapForUtxo ( utxo , utxoThreshold , sigIndices ) ;
101101 }
102102 return this . createAddressMapForUtxo ( utxo , utxoThreshold ) ;
103103 } ) ;
@@ -156,19 +156,21 @@ export class ExportInPTxBuilder extends AtomicTransactionBuilder {
156156 }
157157
158158 const assetId = utils . flareIdString ( this . transaction . _assetId ) . toString ( ) ;
159- const fromAddresses = this . transaction . _fromAddresses . map ( ( addr ) => Buffer . from ( addr ) ) ;
159+ const allFromAddresses = this . transaction . _fromAddresses . map ( ( addr ) => Buffer . from ( addr ) ) ;
160160 const transferableOutput = TransferableOutput . fromNative (
161161 assetId ,
162162 this . transaction . _amount ,
163- fromAddresses ,
163+ allFromAddresses ,
164164 this . transaction . _locktime ,
165165 this . transaction . _threshold
166166 ) ;
167167
168+ const signingAddresses = this . getSigningAddresses ( ) ;
169+
168170 const exportTx = pvm . e . newExportTx (
169171 {
170172 feeState,
171- fromAddressesBytes : this . transaction . _fromAddresses . map ( ( addr ) => Buffer . from ( addr ) ) ,
173+ fromAddressesBytes : signingAddresses ,
172174 destinationChainId : this . transaction . _network . cChainBlockchainID ,
173175 outputs : [ transferableOutput ] ,
174176 utxos : nativeUtxos ,
@@ -183,15 +185,16 @@ export class ExportInPTxBuilder extends AtomicTransactionBuilder {
183185 let correctedExportTx : pvmSerial . ExportTx = innerTx ;
184186
185187 if ( changeOutputs . length > 0 ) {
188+ const allWalletAddresses = this . transaction . _fromAddresses . map ( ( addr ) => Buffer . from ( addr ) ) ;
189+
186190 const correctedChangeOutputs = changeOutputs . map ( ( output ) => {
187191 const transferOut = output . output as TransferOutput ;
188- const originalOwners = transferOut . outputOwners ;
189192
190193 const assetIdStr = utils . flareIdString ( Buffer . from ( output . assetId . toBytes ( ) ) . toString ( 'hex' ) ) . toString ( ) ;
191194 return TransferableOutput . fromNative (
192195 assetIdStr ,
193196 transferOut . amount ( ) ,
194- originalOwners . addrs . map ( ( addr ) => Buffer . from ( addr . toBytes ( ) ) ) ,
197+ allWalletAddresses ,
195198 this . transaction . _locktime ,
196199 this . transaction . _threshold
197200 ) ;
@@ -227,11 +230,11 @@ export class ExportInPTxBuilder extends AtomicTransactionBuilder {
227230 this . transaction . _utxos = utxosWithIndex ;
228231
229232 const txCredentials = utxosWithIndex . map ( ( utxo ) =>
230- this . createCredentialForUtxoWithSigIndices ( utxo , utxo . threshold , utxo . actualSigIndices )
233+ this . createCredentialForUtxo ( utxo , utxo . threshold , utxo . actualSigIndices )
231234 ) ;
232235
233236 const addressMaps = utxosWithIndex . map ( ( utxo ) =>
234- this . createAddressMapForUtxoWithSigIndices ( utxo , utxo . threshold , utxo . actualSigIndices )
237+ this . createAddressMapForUtxo ( utxo , utxo . threshold , utxo . actualSigIndices )
235238 ) ;
236239
237240 const fixedUnsignedTx = new UnsignedTx (
0 commit comments