@@ -85,7 +85,7 @@ export default function Home() {
8585 console . error ( "Recipient Address not cleared." ) ;
8686 return ;
8787 }
88- changeAlertInfo ( { severity : 'info' , message : 'Processing Mint Request' , open : true , } ) ;
88+ changeAlertInfo ( { severity : 'info' , message : 'Processing Mint Request' , open : true , link : '' } ) ;
8989 lucid . selectWallet . fromSeed ( mintAccount . mnemonic ) ;
9090 const requestData = {
9191 asset_name : Buffer . from ( 'WST' , 'utf8' ) . toString ( 'hex' ) , // Convert "WST" to hex
@@ -109,22 +109,26 @@ export default function Home() {
109109 // await signAndSentTx(lucid, tx);
110110 const txBuilder = await makeTxSignBuilder ( lucid . wallet ( ) , tx . toTransaction ( ) ) . complete ( ) ;
111111 const cmlTx = txBuilder . toTransaction ( )
112- console . log ( "TxBody: " + cmlTx . body ( ) . to_json ( ) ) ;
112+ // console.log("TxBody: " + cmlTx.body().to_json());
113113 const witnessSet = txBuilder . toTransaction ( ) . witness_set ( ) ;
114114 const expectedScriptDataHash : CML . ScriptDataHash | undefined = CML . calc_script_data_hash ( witnessSet . redeemers ( ) ! , CML . PlutusDataList . new ( ) , lucid . config ( ) . costModels ! , witnessSet . languages ( ) ) ;
115- console . log ( 'Calculated Script Data Hash:' , expectedScriptDataHash ?. to_hex ( ) ) ;
115+ // console.log('Calculated Script Data Hash:', expectedScriptDataHash?.to_hex());
116116 const cmlTxBodyClone = CML . TransactionBody . from_cbor_hex ( cmlTx ! . body ( ) . to_cbor_hex ( ) ) ;
117- console . log ( "TxBody: " + cmlTxBodyClone . to_json ( ) ) ;
118- console . log ( 'Preclone script hash:' , cmlTxBodyClone . script_data_hash ( ) ?. to_hex ( ) ) ;
117+ // console.log("TxBody: " + cmlTxBodyClone.to_json());
118+ const txIDinAlert = await cmlTxBodyClone . to_json ( ) ;
119+ const txIDObject = JSON . parse ( txIDinAlert ) ;
120+ // console.log('Preclone script hash:', cmlTxBodyClone.script_data_hash()?.to_hex());
119121 cmlTxBodyClone . set_script_data_hash ( expectedScriptDataHash ! ) ;
120- console . log ( 'Postclone script hash:' , cmlTxBodyClone . script_data_hash ( ) ?. to_hex ( ) ) ;
122+ // console.log('Postclone script hash:', cmlTxBodyClone.script_data_hash()?.to_hex());
121123 const cmlClonedTx = CML . Transaction . new ( cmlTxBodyClone , cmlTx ! . witness_set ( ) , true , cmlTx ! . auxiliary_data ( ) ) ;
122124 const cmlClonedSignedTx = await makeTxSignBuilder ( lucid . wallet ( ) , cmlClonedTx ) . sign . withWallet ( ) . complete ( ) ;
123125
124126 const txId = await cmlClonedSignedTx . submit ( ) ;
125127 await lucid . awaitTx ( txId ) ;
126128
127- changeAlertInfo ( { severity : 'success' , message : 'Successful new WST mint' , open : true , } ) ;
129+ changeAlertInfo ( { severity : 'success' , message : 'Successful new WST mint. View the transaction here:' , open : true , link : `https://preview.cardanoscan.io/transaction/${ txIDObject . inputs [ 0 ] . transaction_id } ` } ) ;
130+
131+
128132 await fetchUserDetails ( ) ;
129133 } catch ( error ) {
130134 console . error ( 'Minting failed:' , error ) ;
@@ -134,7 +138,7 @@ export default function Home() {
134138 const onSend = async ( ) => {
135139 lucid . selectWallet . fromSeed ( mintAccount . mnemonic ) ;
136140 console . log ( 'send tokens' ) ;
137- changeAlertInfo ( { severity : 'info' , message : 'Transaction processing' , open : true , } ) ;
141+ changeAlertInfo ( { severity : 'info' , message : 'Transaction processing' , open : true , link : '' } ) ;
138142 const requestData = {
139143 asset_name : Buffer . from ( 'WST' , 'utf8' ) . toString ( 'hex' ) , // Convert "WST" to hex
140144 issuer : mintAccount . address ,
@@ -154,7 +158,7 @@ export default function Home() {
154158 ) ;
155159 console . log ( 'Send response:' , response . data ) ;
156160 const tx = await lucid . fromTx ( response . data . cborHex ) ;
157- await signAndSentTx ( lucid , tx ) ;
161+ const txId = await signAndSentTx ( lucid , tx ) ;
158162 const newAccountBalance = await getWalletBalance ( sendRecipientAddress ) ;
159163 const recipientWalletKey = ( Object . keys ( accounts ) as ( keyof Accounts ) [ ] ) . find (
160164 ( key ) => accounts [ key ] . address === sendRecipientAddress
@@ -165,7 +169,7 @@ export default function Home() {
165169 balance : newAccountBalance ,
166170 } ) ;
167171 }
168- changeAlertInfo ( { severity : 'success' , message : 'Transaction sent successfully!' , open : true , } ) ;
172+ changeAlertInfo ( { severity : 'success' , message : 'Transaction sent successfully!' , open : true , link : `https://preview.cardanoscan.io/transaction/ ${ txId . inputs [ 0 ] . transaction_id } ` } ) ;
169173 await fetchUserDetails ( ) ;
170174 } catch ( error ) {
171175 console . error ( 'Send failed:' , error ) ;
@@ -175,10 +179,11 @@ export default function Home() {
175179 const onFreeze = async ( ) => {
176180 console . log ( 'freeze an account' ) ;
177181 lucid . selectWallet . fromSeed ( mintAccount . mnemonic ) ;
178- changeAlertInfo ( { severity : 'info' , message : 'Freeze request processing' , open : true , } ) ;
182+ changeAlertInfo ( { severity : 'info' , message : 'Freeze request processing' , open : true , link : '' } ) ;
179183 const requestData = {
180184 issuer : mintAccount . address ,
181185 blacklist_address : freezeAccountNumber ,
186+ reason : freezeReason ,
182187 } ;
183188 try {
184189 const response = await axios . post (
@@ -192,8 +197,8 @@ export default function Home() {
192197 ) ;
193198 console . log ( 'Freeze response:' , response . data ) ;
194199 const tx = await lucid . fromTx ( response . data . cborHex ) ;
195- await signAndSentTx ( lucid , tx ) ;
196- changeAlertInfo ( { severity : 'success' , message : 'Account successfully frozen' , open : true , } ) ;
200+ const txId = await signAndSentTx ( lucid , tx ) ;
201+ changeAlertInfo ( { severity : 'success' , message : 'Account successfully frozen' , open : true , link : `https://preview.cardanoscan.io/transaction/ ${ txId . inputs [ 0 ] . transaction_id } ` } ) ;
197202 const frozenWalletKey = ( Object . keys ( accounts ) as ( keyof Accounts ) [ ] ) . find (
198203 ( key ) => accounts [ key ] . address === freezeAccountNumber
199204 ) ;
@@ -220,7 +225,7 @@ export default function Home() {
220225 const onUnfreeze = async ( ) => {
221226 console . log ( 'unfreeze an account' ) ;
222227 lucid . selectWallet . fromSeed ( mintAccount . mnemonic ) ;
223- changeAlertInfo ( { severity : 'info' , message : 'Unfreeze request processing' , open : true , } ) ;
228+ changeAlertInfo ( { severity : 'info' , message : 'Unfreeze request processing' , open : true , link : '' } ) ;
224229 const requestData = {
225230 issuer : mintAccount . address ,
226231 blacklist_address : unfreezeAccountNumber ,
@@ -237,8 +242,8 @@ export default function Home() {
237242 ) ;
238243 console . log ( 'Unfreeze response:' , response . data ) ;
239244 const tx = await lucid . fromTx ( response . data . cborHex ) ;
240- await signAndSentTx ( lucid , tx ) ;
241- changeAlertInfo ( { severity : 'success' , message : 'Account successfully unfrozen' , open : true , } ) ;
245+ const txId = await signAndSentTx ( lucid , tx ) ;
246+ changeAlertInfo ( { severity : 'success' , message : 'Account successfully unfrozen' , open : true , link : `https://preview.cardanoscan.io/transaction/ ${ txId . inputs [ 0 ] . transaction_id } ` } ) ;
242247 const unfrozenWalletKey = ( Object . keys ( accounts ) as ( keyof Accounts ) [ ] ) . find (
243248 ( key ) => accounts [ key ] . address === freezeAccountNumber
244249 ) ;
@@ -265,10 +270,11 @@ export default function Home() {
265270 const onSeize = async ( ) => {
266271 console . log ( 'seize account funds' ) ;
267272 lucid . selectWallet . fromSeed ( mintAccount . mnemonic ) ;
268- changeAlertInfo ( { severity : 'info' , message : 'WST seizure processing' , open : true , } ) ;
273+ changeAlertInfo ( { severity : 'info' , message : 'WST seizure processing' , open : true , link : '' } ) ;
269274 const requestData = {
270275 issuer : mintAccount . address ,
271276 target : seizeAccountNumber ,
277+ reason : seizeReason ,
272278 } ;
273279 try {
274280 const response = await axios . post (
@@ -282,7 +288,7 @@ export default function Home() {
282288 ) ;
283289 console . log ( 'Seize response:' , response . data ) ;
284290 const tx = await lucid . fromTx ( response . data . cborHex ) ;
285- await signAndSentTx ( lucid , tx ) ;
291+ const txId = await signAndSentTx ( lucid , tx ) ;
286292 const newAccountBalance = await getWalletBalance ( seizeAccountNumber ) ;
287293 const seizeWalletKey = ( Object . keys ( accounts ) as ( keyof Accounts ) [ ] ) . find (
288294 ( key ) => accounts [ key ] . address === seizeAccountNumber
@@ -293,7 +299,7 @@ export default function Home() {
293299 balance : newAccountBalance ,
294300 } ) ;
295301 }
296- changeAlertInfo ( { severity : 'success' , message : 'Funds successfully seized' , open : true , } ) ;
302+ changeAlertInfo ( { severity : 'success' , message : 'Funds successfully seized' , open : true , link : `https://preview.cardanoscan.io/transaction/ ${ txId . inputs [ 0 ] . transaction_id } ` } ) ;
297303 await fetchUserDetails ( ) ;
298304 } catch ( error ) {
299305 console . error ( 'Seize failed:' , error ) ;
0 commit comments