update balance

pull/2748/head
Aniket-Engg 2 years ago committed by Aniket
parent 70a1c7e372
commit 0c6223a21c
  1. 15
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -34,10 +34,7 @@ export function UniversalDappUI (props: UdappProps) {
useEffect(() => {
if (props.instance.address) {
props.blockchain.getBalanceInEther(props.instance.address, (err, balInEth) => {
if (!err) setContractBal(balInEth)
})
updateBalance()
// @ts-ignore
let address = (props.instance.address.slice(0, 2) === '0x' ? '' : '0x') + props.instance.address.toString('hex')
@ -52,6 +49,16 @@ export function UniversalDappUI (props: UdappProps) {
}
}, [props.instance.contractData])
props.blockchain.event.register('transactionExecuted', (error, from, to, data, call, txResult, timestamp, _payload) => {
if (!error) updateBalance()
})
const updateBalance = () => {
props.blockchain.getBalanceInEther(props.instance.address, (err, balInEth) => {
if (!err) setContractBal(balInEth)
})
}
const sendData = () => {
setLlIError('')
const fallback = txHelper.getFallbackInterface(contractABI)

Loading…
Cancel
Save