diff --git a/frontend/src/components/CancelTransferBtn.tsx b/frontend/src/components/CancelTransferBtn.tsx index 00387d20..df3764e3 100644 --- a/frontend/src/components/CancelTransferBtn.tsx +++ b/frontend/src/components/CancelTransferBtn.tsx @@ -1,18 +1,18 @@ import React from 'react'; -import {useContractWrite} from "@starknet-react/core"; -import {TREASURY_ADDRESS} from "../lib/config"; -import {Contract} from "starknet"; +import { useContractWrite } from "@starknet-react/core"; +import { TREASURY_ADDRESS } from "../lib/config"; +import { Contract } from "starknet"; import TreasuryABI from "../lib/treasury_abi.json"; interface CancelTransferButtonProps { transferId: number; } -const CancelTransferBtn: React.FC = ({transferId}) => { +const CancelTransferBtn: React.FC = ({ transferId }) => { const contract = new Contract(TreasuryABI, TREASURY_ADDRESS) - const { writeAsync , error } = useContractWrite({ + const { writeAsync, error } = useContractWrite({ calls: [ contract.populateTransaction["cancel_transfer"](transferId) ], diff --git a/frontend/src/components/StatusTransfer.tsx b/frontend/src/components/StatusTransfer.tsx index eabcc845..ac84da66 100644 --- a/frontend/src/components/StatusTransfer.tsx +++ b/frontend/src/components/StatusTransfer.tsx @@ -1,16 +1,16 @@ -import React, {useEffect} from "react"; +import React, { useEffect } from "react"; import { useAccount, useContractRead, useNetwork } from "@starknet-react/core"; import TreasuryABI from "../lib/treasury_abi.json"; import CancelTransferBtn from "./CancelTransferBtn"; -import {formatBalance} from "../lib/erc20"; -import {TREASURY_ADDRESS} from "../lib/config"; +import { formatBalance } from "../lib/erc20"; +import { TREASURY_ADDRESS } from "../lib/config"; const StatusTransfer = () => { const { address } = useAccount() - const {data, isLoading, refetch} = useContractRead({ + const { data, isLoading, refetch } = useContractRead({ functionName: 'get_live_transfers', address: TREASURY_ADDRESS, abi: TreasuryABI, @@ -18,11 +18,11 @@ const StatusTransfer = () => { retry: false }) - const renderCancelBtn = (status, transfer_id) => + const renderCancelBtn = (status, transfer_id) => getTransferStatus(status) == 'PENDING' && address && - + - const {chain: {network}} = useNetwork() + const { chain: { network } } = useNetwork() const handleAddress = address => { const sub_domain = network === 'sepolia' ? 'sepolia.' : '' @@ -55,7 +55,7 @@ const StatusTransfer = () => {
{getHoursLeft(transfer_item.cooldown_end.toString())}
{getTransferStatus(transfer_item.status)}
- { renderCancelBtn(transfer_item?.status, transfer_item?.id) } + {renderCancelBtn(transfer_item?.status, transfer_item?.id)}
@@ -70,23 +70,23 @@ const StatusTransfer = () => { useEffect(() => { refetch() - },[]) + }, []) return (
Transfer status
{isLoading ? ( -
Loading...
- ) :( -
-
+
Loading...
+ ) : ( +
+
-
- {renderData()} +
+ {renderData()} +
-
- )} + )}
) }