@@ -6,7 +6,7 @@ import React, { useEffect, useState } from 'react';
66import axios from 'axios' ;
77
88//Mui imports
9- import { Box , Typography } from '@mui/material' ;
9+ import { Box , Checkbox , FormControlLabel , Typography } from '@mui/material' ;
1010
1111//Local components
1212import useStore from '../store/store' ;
@@ -19,6 +19,7 @@ import CopyTextField from '../components/CopyTextField';
1919export default function Profile ( ) {
2020 const { lucid, currentUser, mintAccount, changeAlertInfo, changeWalletAccountDetails } = useStore ( ) ;
2121 const accounts = useStore ( ( state ) => state . accounts ) ;
22+ const [ overrideTx , setOverrideTx ] = useState < boolean > ( false ) ;
2223
2324 useEffect ( ( ) => {
2425 useStore . getState ( ) ;
@@ -27,8 +28,8 @@ export default function Profile() {
2728
2829 const getUserAccountDetails = ( ) => {
2930 switch ( currentUser ) {
30- case "User A " : return accounts . userA ;
31- case "User B " : return accounts . userB ;
31+ case "Alice " : return accounts . alice ;
32+ case "Bob " : return accounts . bob ;
3233 case "Connected Wallet" : return accounts . walletUser ;
3334 } ;
3435 } ;
@@ -38,10 +39,10 @@ export default function Profile() {
3839 const [ sendRecipientAddress , setsendRecipientAddress ] = useState ( 'address' ) ;
3940
4041 const onSend = async ( ) => {
41- if ( getUserAccountDetails ( ) ?. status === 'Frozen' ) {
42+ if ( getUserAccountDetails ( ) ?. status === 'Frozen' && ! overrideTx ) {
4243 changeAlertInfo ( {
4344 severity : 'error' ,
44- message : 'Cannot send WST with frozen account .' ,
45+ message : 'Cannot send WST with frozen address .' ,
4546 open : true ,
4647 link : ''
4748 } ) ;
@@ -51,7 +52,7 @@ export default function Profile() {
5152 changeAlertInfo ( { severity : 'info' , message : 'Transaction processing' , open : true , link : '' } ) ;
5253 const accountInfo = getUserAccountDetails ( ) ;
5354 if ( ! accountInfo ) {
54- console . error ( "No valid send account found! Cannot send." ) ;
55+ console . error ( "No valid send address found! Cannot send." ) ;
5556 return ;
5657 }
5758 lucid . selectWallet . fromSeed ( accountInfo . mnemonic ) ;
@@ -61,6 +62,7 @@ export default function Profile() {
6162 quantity : sendTokenAmount ,
6263 recipient : sendRecipientAddress ,
6364 sender : accountInfo . address ,
65+ submit_failing_tx : overrideTx
6466 } ;
6567 try {
6668 const response = await axios . post (
@@ -77,7 +79,7 @@ export default function Profile() {
7779 const txId = await signAndSentTx ( lucid , tx ) ;
7880 await updateAccountBalance ( sendRecipientAddress ) ;
7981 await updateAccountBalance ( accountInfo . address ) ;
80- changeAlertInfo ( { severity : 'success' , message : 'Transaction sent successfully!' , open : true , link : `https://preview.cardanoscan .io/transaction /${ txId . inputs [ 0 ] . transaction_id } ` } ) ;
82+ changeAlertInfo ( { severity : 'success' , message : 'Transaction sent successfully!' , open : true , link : `https://preview.cexplorer .io/tx /${ txId } ` } ) ;
8183 } catch ( error ) {
8284 console . error ( 'Send failed:' , error ) ;
8385 }
@@ -111,6 +113,12 @@ export default function Profile() {
111113 label = "Recipient’s Address"
112114 fullWidth = { true }
113115 />
116+ < FormControlLabel
117+ control = { < Checkbox size = "small" checked = { overrideTx } onChange = { x => setOverrideTx ( x . target . checked ) } /> }
118+ label = "⚠️ Force send failing transaction"
119+ sx = { { mb : 2 } }
120+ />
121+
114122 </ Box > ;
115123
116124 const receiveContent = < Box >
@@ -125,8 +133,9 @@ export default function Profile() {
125133 < div className = "page" >
126134 < Box sx = { { display : 'flex' , justifyContent : 'space-between' , alignItems : 'end' , marginBottom : '16px' } } >
127135 < Box >
128- < Typography variant = 'h4' > Account Balance</ Typography >
129- < Typography variant = 'h1' > { getUserAccountDetails ( ) ?. balance } WST</ Typography >
136+ < Typography variant = 'h4' > Address Balance</ Typography >
137+ < Typography variant = 'h1' > { getUserAccountDetails ( ) ?. balance . wst } WST</ Typography >
138+ < Typography variant = 'h5' > { getUserAccountDetails ( ) ?. balance . ada } Ada</ Typography >
130139 </ Box >
131140 < Typography variant = 'h5' > { getUserAccountDetails ( ) ?. address . slice ( 0 , 15 ) } </ Typography >
132141 </ Box >
0 commit comments