@@ -74,7 +74,7 @@ const TokenTab = () => {
74
74
</ div >
75
75
)
76
76
} else {
77
- return ( < > </ > )
77
+ return < > </ >
78
78
}
79
79
}
80
80
@@ -106,42 +106,42 @@ const TokenTab = () => {
106
106
console . debug ( `[dApp][Tokens_Tab][mint] changeAddress -> ${ changeAddress } ` )
107
107
108
108
const wasmChangeAddress = getAddressFromBytes ( wasm , changeAddress )
109
- const usedAddresses = await api ?. getUsedAddresses ( )
110
- const usedAddress = getAddressFromBytes ( wasm , usedAddresses [ 0 ] )
111
- const pubkeyHash = getPubKeyHash ( wasm , usedAddress )
112
- const wasmNativeScript = getNativeScript ( wasm , pubkeyHash )
113
-
114
- // magic should happen here
115
- txBuilder . add_mint_asset_and_output_min_required_coin (
116
- wasmNativeScript ,
117
- getAssetName ( wasm , clearTokenName ) ,
118
- quantityInt ,
119
- getTransactionOutputBuilder ( wasm , wasmChangeAddress ) ,
120
- )
121
-
122
- console . debug ( `[dApp][Tokens_Tab][mint] getting UTxOs` )
123
- const hexInputUtxos = await api ?. getUtxos ( )
124
-
125
- console . debug ( `[dApp][Tokens_Tab][mint] preparing wasmUTxOs` )
126
- const wasmUtxos = wasm . TransactionUnspentOutputs . new ( )
127
- for ( const hexInputUtxo of hexInputUtxos ) {
128
- const wasmUtxo = wasm . TransactionUnspentOutput . from_bytes ( hexToBytes ( hexInputUtxo ) )
129
- wasmUtxos . add ( wasmUtxo )
130
- }
109
+ try {
110
+ const usedAddresses = await api ?. getUsedAddresses ( )
111
+ const usedAddress = getAddressFromBytes ( wasm , usedAddresses [ 0 ] )
112
+ const pubkeyHash = getPubKeyHash ( wasm , usedAddress )
113
+ const wasmNativeScript = getNativeScript ( wasm , pubkeyHash )
114
+
115
+ // magic should happen here
116
+ txBuilder . add_mint_asset_and_output_min_required_coin (
117
+ wasmNativeScript ,
118
+ getAssetName ( wasm , clearTokenName ) ,
119
+ quantityInt ,
120
+ getTransactionOutputBuilder ( wasm , wasmChangeAddress ) ,
121
+ )
131
122
132
- console . debug ( `[dApp][Tokens_Tab][mint] adding inputs` )
133
- txBuilder . add_inputs_from ( wasmUtxos , wasm . CoinSelectionStrategyCIP2 . LargestFirstMultiAsset )
134
- txBuilder . add_required_signer ( pubkeyHash )
135
- txBuilder . add_change_if_needed ( wasmChangeAddress )
123
+ console . debug ( `[dApp][Tokens_Tab][mint] getting UTxOs` )
124
+ const hexInputUtxos = await api ?. getUtxos ( )
136
125
137
- const unsignedTransactionHex = bytesToHex ( txBuilder . build_tx ( ) . to_bytes ( ) )
138
- console . debug ( `[dApp][Tokens_Tab][mint] signing the tx` )
126
+ console . debug ( `[dApp][Tokens_Tab][mint] preparing wasmUTxOs` )
127
+ const wasmUtxos = wasm . TransactionUnspentOutputs . new ( )
128
+ for ( const hexInputUtxo of hexInputUtxos ) {
129
+ const wasmUtxo = wasm . TransactionUnspentOutput . from_bytes ( hexToBytes ( hexInputUtxo ) )
130
+ wasmUtxos . add ( wasmUtxo )
131
+ }
132
+
133
+ console . debug ( `[dApp][Tokens_Tab][mint] adding inputs` )
134
+ txBuilder . add_inputs_from ( wasmUtxos , wasm . CoinSelectionStrategyCIP2 . LargestFirstMultiAsset )
135
+ txBuilder . add_required_signer ( pubkeyHash )
136
+ txBuilder . add_change_if_needed ( wasmChangeAddress )
137
+
138
+ const unsignedTransactionHex = bytesToHex ( txBuilder . build_tx ( ) . to_bytes ( ) )
139
+ console . debug ( `[dApp][Tokens_Tab][mint] signing the tx` )
139
140
140
- try {
141
141
const transactionHex = await api ?. signTx ( { tx : unsignedTransactionHex , returnTx : true } )
142
142
console . debug ( `[dApp][Tokens_Tab][mint] TransactionHex: ${ transactionHex } ` )
143
143
const txId = await api . submitTx ( transactionHex )
144
- console . debug ( `[dApp][Tokens_Tab][mint] Transaction successfully submitted: ${ txId } ` )
144
+ console . log ( `[dApp][Tokens_Tab][mint] Transaction successfully submitted: ${ txId } ` )
145
145
} catch ( error ) {
146
146
handleError ( error )
147
147
console . error ( error )
0 commit comments