Compare commits

...

2 Commits

Author SHA1 Message Date
cffaad6973
small fixes for more comfortable applause detection
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
2025-11-12 19:37:23 +03:00
772041d5ed
representation of onchain data fixes
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
2025-11-12 19:04:48 +03:00
2 changed files with 28 additions and 26 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "ghost-dao-interface", "name": "ghost-dao-interface",
"private": true, "private": true,
"version": "0.3.9", "version": "0.3.11",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -194,7 +194,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
const clapsNeeded = Math.floor(clapsInSessionLength * appluseThreshold / 100); const clapsNeeded = Math.floor(clapsInSessionLength * appluseThreshold / 100);
const step = finalization > 0 const step = finalization > 0
? 0 ? 0
: receivedClapsLength < clapsNeeded : receivedClapsLength < clapsNeeded && !transactionApplaused
? 1 ? 1
: !transactionApplaused : !transactionApplaused
? 2 ? 2
@ -272,29 +272,31 @@ const Bridge = ({ chainId, address, config, connect }) => {
} else { } else {
setIsPending(true); setIsPending(true);
const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount); try {
await ghstBalanceRefetch(); const txHash = await ghost(chainId, address, convertedReceiver, preparedAmount);
setReceiver(""); const transaction = {
setAmount(""); sessionIndex: currentSession ?? 0,
setIsPending(false); transactionHash: txHash,
receiverAddress: receiver,
amount: preparedAmount.toString(),
chainId: chainId,
blockNumber: Number(blockNumber),
timestamp: Date.now()
}
const transaction = { const newStoredTransactions = [...storedTransactions, transaction];
sessionIndex: currentSession ?? 0, setStoredTransactions(newStoredTransactions);
transactionHash: txHash, localStorage.setItem(STORAGE_PREFIX, JSON.stringify(newStoredTransactions));
receiverAddress: receiver,
amount: preparedAmount.toString(),
chainId: chainId,
blockNumber: Number(blockNumber),
timestamp: Date.now()
}
const newStoredTransactions = [...storedTransactions, transaction]; if (providerDetail) {
setStoredTransactions(newStoredTransactions); setActiveTxIndex(newStoredTransactions.length - 1)
localStorage.setItem(STORAGE_PREFIX, JSON.stringify(newStoredTransactions)); }
} finally {
if (providerDetail) { await ghstBalanceRefetch();
setActiveTxIndex(newStoredTransactions.length - 1) setReceiver("");
setAmount("");
setIsPending(false);
} }
} }
} }
@ -476,7 +478,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
</Box> </Box>
</Box> </Box>
{(currentRecord?.step ?? 0) < 3 && currentSession > (currentRecord?.sessionIndex ?? 0) + 2 && {(currentRecord?.step ?? 3) < 3 && (currentSession && currentRecord && currentSession > (currentRecord.sessionIndex ?? 0) + 2) &&
<Box display="flex" flexDirection="column" gap="5px"> <Box display="flex" flexDirection="column" gap="5px">
<PrimaryButton <PrimaryButton
fullWidth fullWidth
@ -513,7 +515,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
> >
{authorities?.map((authority, idx) => { {authorities?.map((authority, idx) => {
const authorityAddress = ss58Address(authority.asHex(), 1996); 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); const clapped = receivedClaps?.some(authId => authId === idx);
return ( return (
@ -775,7 +777,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
> >
{authorities?.map((authority, idx) => { {authorities?.map((authority, idx) => {
const authorityAddress = ss58Address(authority.asHex(), 1996); 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 ( return (
<Box <Box
@ -808,7 +810,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
</Box> </Box>
</>} /> </>} />
</Box>} </Box>}
<Typography fontSize="12px" lineHeight="15px">{clapsInSessionLength}</Typography> <Typography fontSize="12px" lineHeight="15px">{clapsInSessionLength} / {authorities?.length ?? 0}</Typography>
</Box> </Box>
</Box> </Box>
) )