From 772041d5edbc93ccce84d86b78a4c444705a165e Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Wed, 12 Nov 2025 19:04:48 +0300 Subject: [PATCH] representation of onchain data fixes Signed-off-by: Uncle Fatso --- package.json | 2 +- src/containers/Bridge/Bridge.jsx | 50 +++++++++++++++++--------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 79b16cd..5c99a33 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.3.9", + "version": "0.3.10", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Bridge/Bridge.jsx b/src/containers/Bridge/Bridge.jsx index 559e09c..fde4867 100644 --- a/src/containers/Bridge/Bridge.jsx +++ b/src/containers/Bridge/Bridge.jsx @@ -272,29 +272,31 @@ const Bridge = ({ chainId, address, config, connect }) => { } else { setIsPending(true); - const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount); - await ghstBalanceRefetch(); + try { + const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount); - setReceiver(""); - setAmount(""); - setIsPending(false); + const transaction = { + sessionIndex: currentSession ?? 0, + transactionHash: txHash, + receiverAddress: receiver, + amount: preparedAmount.toString(), + chainId: chainId, + blockNumber: Number(blockNumber), + timestamp: Date.now() + } - const transaction = { - sessionIndex: currentSession ?? 0, - transactionHash: txHash, - receiverAddress: receiver, - amount: preparedAmount.toString(), - chainId: chainId, - blockNumber: Number(blockNumber), - timestamp: Date.now() - } + const newStoredTransactions = [...storedTransactions, transaction]; + setStoredTransactions(newStoredTransactions); + localStorage.setItem(STORAGE_PREFIX, JSON.stringify(newStoredTransactions)); - const newStoredTransactions = [...storedTransactions, transaction]; - setStoredTransactions(newStoredTransactions); - localStorage.setItem(STORAGE_PREFIX, JSON.stringify(newStoredTransactions)); - - if (providerDetail) { - setActiveTxIndex(newStoredTransactions.length - 1) + if (providerDetail) { + setActiveTxIndex(newStoredTransactions.length - 1) + } + } finally { + await ghstBalanceRefetch(); + setReceiver(""); + setAmount(""); + setIsPending(false); } } } @@ -476,7 +478,7 @@ const Bridge = ({ chainId, address, config, connect }) => { - {(currentRecord?.step ?? 0) < 3 && currentSession > (currentRecord?.sessionIndex ?? 0) + 2 && + {(currentRecord?.step ?? 0) < 3 && (currentSession && currentRecord && currentSession > (currentRecord.sessionIndex ?? 0) + 2) && { > {authorities?.map((authority, idx) => { const authorityAddress = ss58Address(authority.asHex(), 1996); - const disabled = clapsInSession?.at(idx)?.at(1)?.disabled; + const disabled = clapsInSession?.find((info => info.at(0) === idx))?.at(1)?.disabled; const clapped = receivedClaps?.some(authId => authId === idx); return ( @@ -775,7 +777,7 @@ const Bridge = ({ chainId, address, config, connect }) => { > {authorities?.map((authority, idx) => { const authorityAddress = ss58Address(authority.asHex(), 1996); - const clapInfo = clapsInSession?.at(idx)?.at(1); + const clapInfo = clapsInSession?.find((info => info.at(0) === idx))?.at(1); return ( { } /> } - {clapsInSessionLength} + {clapsInSessionLength} / {authorities?.length} )