@@ -148,10 +148,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
148148 this . _transactionOutputs . forEach ( ( output ) => {
149149 const amount = CardanoWasm . BigNum . from_str ( output . amount ) ;
150150 outputs . add (
151- CardanoWasm . TransactionOutput . new (
152- CardanoWasm . Address . from_bech32 ( output . address ) ,
153- CardanoWasm . Value . new ( amount )
154- )
151+ CardanoWasm . TransactionOutput . new ( util . getWalletAddress ( output . address ) , CardanoWasm . Value . new ( amount ) )
155152 ) ;
156153 totalAmountToSend = totalAmountToSend . checked_add ( amount ) ;
157154 } ) ;
@@ -160,7 +157,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
160157 // estimate fee
161158 // add extra output for the change
162159 if ( this . _changeAddress && this . _senderBalance ) {
163- const changeAddress = CardanoWasm . Address . from_bech32 ( this . _changeAddress ) ;
160+ const changeAddress = util . getWalletAddress ( this . _changeAddress ) ;
164161 const utxoBalance = CardanoWasm . BigNum . from_str ( this . _senderBalance ) ;
165162
166163 const adjustment = BigNum . from_str ( '2000000' ) ;
@@ -188,7 +185,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
188185 this . _multiAssets . forEach ( ( asset ) => {
189186 let txOutputBuilder = CardanoWasm . TransactionOutputBuilder . new ( ) ;
190187 // changeAddress is the root address, which is where we want the tokens assets to be sent to
191- const toAddress = CardanoWasm . Address . from_bech32 ( this . _changeAddress ) ;
188+ const toAddress = util . getWalletAddress ( this . _changeAddress ) ;
192189 txOutputBuilder = txOutputBuilder . with_address ( toAddress ) ;
193190 let txOutputAmountBuilder = txOutputBuilder . next ( ) ;
194191 const assetName = CardanoWasm . AssetName . new ( Buffer . from ( asset . asset_name , 'hex' ) ) ;
@@ -301,7 +298,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
301298 const quantity = assets ! . get ( assetName ) ;
302299 let txOutputBuilder = CardanoWasm . TransactionOutputBuilder . new ( ) ;
303300 const outputAmount = CardanoWasm . BigNum . from_str ( output . amount ) ;
304- const toAddress = CardanoWasm . Address . from_bech32 ( output . address ) ;
301+ const toAddress = util . getWalletAddress ( output . address ) ;
305302 txOutputBuilder = txOutputBuilder . with_address ( toAddress ) ;
306303 let txOutputAmountBuilder = txOutputBuilder . next ( ) ;
307304 const multiAsset = CardanoWasm . MultiAsset . new ( ) ;
@@ -314,14 +311,14 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
314311 } else {
315312 outputs . add (
316313 CardanoWasm . TransactionOutput . new (
317- CardanoWasm . Address . from_bech32 ( output . address ) ,
314+ util . getWalletAddress ( output . address ) ,
318315 CardanoWasm . Value . new ( CardanoWasm . BigNum . from_str ( output . amount ) )
319316 )
320317 ) ;
321318 }
322319 } ) ;
323320 if ( this . _changeAddress && this . _senderBalance ) {
324- const changeAddress = CardanoWasm . Address . from_bech32 ( this . _changeAddress ) ;
321+ const changeAddress = util . getWalletAddress ( this . _changeAddress ) ;
325322 const utxoBalance = CardanoWasm . BigNum . from_str ( this . _senderBalance ) ;
326323
327324 const adjustment = BigNum . from_str ( '2000000' ) ;
@@ -348,7 +345,7 @@ export abstract class TransactionBuilder extends BaseTransactionBuilder {
348345 this . _multiAssets . forEach ( ( asset ) => {
349346 let txOutputBuilder = CardanoWasm . TransactionOutputBuilder . new ( ) ;
350347 // changeAddress is the root address, which is where we want the tokens assets to be sent to
351- const toAddress = CardanoWasm . Address . from_bech32 ( this . _changeAddress ) ;
348+ const toAddress = util . getWalletAddress ( this . _changeAddress ) ;
352349 txOutputBuilder = txOutputBuilder . with_address ( toAddress ) ;
353350 let txOutputAmountBuilder = txOutputBuilder . next ( ) ;
354351 const assetName = CardanoWasm . AssetName . new ( Buffer . from ( asset . asset_name , 'hex' ) ) ;
0 commit comments