Compare commits
No commits in common. "b0e7da9f86457abc9a74d813d1ce4c9b05777d10" and "0925c79ff8ceafcfe947572a9e6a6dbe2952c09f" have entirely different histories.
b0e7da9f86
...
0925c79ff8
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ghost-dao-interface",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.3.7",
|
"version": "0.3.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -18,8 +18,7 @@ import {
|
|||||||
import { ss58Decode, ss58Address } from "@polkadot-labs/hdkd-helpers";
|
import { ss58Decode, ss58Address } from "@polkadot-labs/hdkd-helpers";
|
||||||
import { toHex } from "@polkadot-api/utils";
|
import { toHex } from "@polkadot-api/utils";
|
||||||
import { decodeAddress } from "@polkadot/util-crypto";
|
import { decodeAddress } from "@polkadot/util-crypto";
|
||||||
import { useTransactionConfirmations } from "wagmi";
|
import { useBlockNumber, useTransactionConfirmations } from "wagmi";
|
||||||
import { getBlockNumber } from "@wagmi/core";
|
|
||||||
import { keccak256 } from "viem";
|
import { keccak256 } from "viem";
|
||||||
import { u64, u128 } from "scale-ts";
|
import { u64, u128 } from "scale-ts";
|
||||||
|
|
||||||
@ -79,13 +78,23 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
const [convertedReceiver, setConvertedReceiver] = useState(undefined);
|
const [convertedReceiver, setConvertedReceiver] = useState(undefined);
|
||||||
const [amount, setAmount] = useState("");
|
const [amount, setAmount] = useState("");
|
||||||
const [rotation, setRotation] = useState(0);
|
const [rotation, setRotation] = useState(0);
|
||||||
const [blockNumber, setBlockNumber] = useState(0);
|
|
||||||
|
|
||||||
const sliceString = (string, first, second) => {
|
const sliceString = (string, first, second) => {
|
||||||
return string.slice(0, first) + "..." + string.slice(second);
|
return string.slice(0, first) + "..." + string.slice(second);
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialStoredTransactions = localStorage.getItem(STORAGE_PREFIX);
|
const initialStoredTransactions = localStorage.getItem(STORAGE_PREFIX);
|
||||||
|
// const initialStoredTransactions = JSON.stringify([
|
||||||
|
// {
|
||||||
|
// sessionIndex: 124,
|
||||||
|
// transactionHash: "0x637276eccfa0787de396877a1a259964334fb52cb5111ea84bb28f0006f06276",
|
||||||
|
// receiverAddress: "sfK147dy2NapxEKwrTLLxTkmhw15kkoJeEKrg77oLFRmUQZDb",
|
||||||
|
// amount: "10000000000000000000",
|
||||||
|
// chainId: 11155111,
|
||||||
|
// blockNumber: 9033063,
|
||||||
|
// timestamp: Date.now()
|
||||||
|
// }
|
||||||
|
// ]);
|
||||||
const [storedTransactions, setStoredTransactions] = useState(
|
const [storedTransactions, setStoredTransactions] = useState(
|
||||||
initialStoredTransactions ? JSON.parse(initialStoredTransactions) : []
|
initialStoredTransactions ? JSON.parse(initialStoredTransactions) : []
|
||||||
);
|
);
|
||||||
@ -138,8 +147,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
const finalityDelay = Number(evmNetwork?.finality_delay ?? 0n);
|
const finalityDelay = Number(evmNetwork?.finality_delay ?? 0n);
|
||||||
const incomingFee = Number(evmNetwork?.incoming_fee ?? 0n) / 10000000;
|
const incomingFee = Number(evmNetwork?.incoming_fee ?? 0n) / 10000000;
|
||||||
|
|
||||||
getBlockNumber(config).then(block => setBlockNumber(block));
|
const { data: blockNumber } = useBlockNumber({ watch: true });
|
||||||
|
|
||||||
const { gatekeeperAddress } = useGatekeeperAddress(chainId);
|
const { gatekeeperAddress } = useGatekeeperAddress(chainId);
|
||||||
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
const { symbol: ghstSymbol } = useTokenSymbol(chainId, "GHST");
|
||||||
const {
|
const {
|
||||||
@ -237,20 +245,6 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
return storedTransactions.filter(obj => obj.chainId === chainId);
|
return storedTransactions.filter(obj => obj.chainId === chainId);
|
||||||
}, [storedTransactions, chainId]);
|
}, [storedTransactions, chainId]);
|
||||||
|
|
||||||
const selfApplauseUrl = useMemo(() => {
|
|
||||||
if (!currentRecord) return '';
|
|
||||||
|
|
||||||
const amount = new DecimalBigNumber(BigInt(currentRecord.amount), 18).toString();
|
|
||||||
let url = "https://lite.ghostchain.io/#/applause?";
|
|
||||||
url += `networkId=${chainId}&`;
|
|
||||||
url += `sessionIndex=${currentRecord.sessionIndex}&`;
|
|
||||||
url += `amount=${amount}&`;
|
|
||||||
url += `receiver=${currentRecord.receiverAddress}&`;
|
|
||||||
url += `transactionHash=${currentRecord.transactionHash}`;
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}, [currentRecord]);
|
|
||||||
|
|
||||||
const removeStoredRecord = useCallback(() => {
|
const removeStoredRecord = useCallback(() => {
|
||||||
const newStoredTransactions = storedTransactions.filter((_, index) => index !== activeTxIndex)
|
const newStoredTransactions = storedTransactions.filter((_, index) => index !== activeTxIndex)
|
||||||
setStoredTransactions(newStoredTransactions);
|
setStoredTransactions(newStoredTransactions);
|
||||||
@ -407,7 +401,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
width: "35px",
|
width: "35px",
|
||||||
height: "35px",
|
height: "35px",
|
||||||
transition: "transform 0.7s ease-in-out",
|
transition: "transform 0.7s ease-in-out",
|
||||||
transform: `rotateX(${currentRecord.step == 1 ? rotation : 0}deg)`
|
transform: `rotateX(${rotation}deg)`
|
||||||
}}
|
}}
|
||||||
viewBox="0 0 25 25"
|
viewBox="0 0 25 25"
|
||||||
component={ThumbUpIcon}
|
component={ThumbUpIcon}
|
||||||
@ -417,7 +411,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
width: "35px",
|
width: "35px",
|
||||||
height: "35px",
|
height: "35px",
|
||||||
transition: "transform 0.7s ease-in-out",
|
transition: "transform 0.7s ease-in-out",
|
||||||
transform: `rotateX(${currentRecord.step == 1 ? rotation : 0}deg)`
|
transform: `rotateX(${rotation}deg)`
|
||||||
}}
|
}}
|
||||||
viewBox="0 0 25 25"
|
viewBox="0 0 25 25"
|
||||||
component={ThumbDownAltIcon}
|
component={ThumbDownAltIcon}
|
||||||
@ -475,25 +469,6 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{(currentRecord?.step ?? 0) < 3 && currentSession > (currentRecord?.sessionIndex ?? 0) + 2 &&
|
|
||||||
<Box display="flex" flexDirection="column" gap="5px">
|
|
||||||
<PrimaryButton
|
|
||||||
fullWidth
|
|
||||||
onClick={() => window.open(
|
|
||||||
selfApplauseUrl,
|
|
||||||
'_blank',
|
|
||||||
'noopener,noreferrer'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
Self Applause
|
|
||||||
</PrimaryButton>
|
|
||||||
|
|
||||||
<Typography variant="body2" sx={{ fontStyle: "italic" }}>
|
|
||||||
Your transaction seems to be stuck, possibly because of a problem with some inactive validators on the network.
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
}
|
|
||||||
|
|
||||||
<Box display="flex" flexDirection="column" gap="5px" padding="0.6rem 0">
|
<Box display="flex" flexDirection="column" gap="5px" padding="0.6rem 0">
|
||||||
<Box display="flex" flexDirection="row" justifyContent="space-between">
|
<Box display="flex" flexDirection="row" justifyContent="space-between">
|
||||||
<Box display="flex" flexDirection="row">
|
<Box display="flex" flexDirection="row">
|
||||||
@ -532,7 +507,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
|
|||||||
textOverflow: "ellipsis",
|
textOverflow: "ellipsis",
|
||||||
color: clapped
|
color: clapped
|
||||||
? theme.colors.primary[300]
|
? theme.colors.primary[300]
|
||||||
: disabled
|
: clapped
|
||||||
? theme.colors.feedback.error
|
? theme.colors.feedback.error
|
||||||
: theme.colors.gray[10]
|
: theme.colors.gray[10]
|
||||||
}}
|
}}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user