Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add status transfer 2 #136

Closed
wants to merge 11 commits into from
6 changes: 3 additions & 3 deletions frontend/src/components/CancelTransferBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const CancelTransferBtn: React.FC<CancelTransferButtonProps> = ({transferId}) =>

const contract = new Contract(TreasuryABI, TREASURY_ADDRESS)
tensojka marked this conversation as resolved.
Show resolved Hide resolved

const { writeAsync: write_yes , error } = useContractWrite({
const { writeAsync , error } = useContractWrite({
calls: [
contract.populateTransaction["cancel_transfer"](transferId)
],
});

const handleCancelTransfer = async () => {
try {
await write_yes();
await writeAsync();
console.log(`Transfer ${transferId} cancelled successfully.`);
} catch (err) {
console.error(`Error cancelling transfer ${transferId}:`, err);
Expand All @@ -33,7 +33,7 @@ const CancelTransferBtn: React.FC<CancelTransferButtonProps> = ({transferId}) =>
type="button"
className='bg-blue-500 rounded-md text-white disabled:opacity-50 p-1 w-full'
onClick={handleCancelTransfer}>
cancel
Сancel
</button>
);
};
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/StatusTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
useAccount,
useContractRead
} from "@starknet-react/core";
import {TreasuryABI} from "../lib/treasuryABI";
import TreasuryABI from "../lib/treasury_abi.json";
import CancelTransferBtn from "./CancelTransferBtn";
import {formatBalance} from "../lib/erc20";
import {TREASURY_ADDRESS} from "../lib/config";
Expand All @@ -29,14 +29,13 @@ const StatusTransfer = () => {
}

return data.map((transfer_item, index) => {

return (
<div key={index} className="flex flex-wrap flex-row">
<div className='flex flex-wrap flex-row w-full'>
<div className="flex-1 w-1/2 basis-1/2 p-2 bg-slate-200 text-left text-gray-700 uppercase tracking-wider border-r border-slate-400">token</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reasoning behind the border-r here?

<div className="flex-1 w-1/2 basis-1/2 p-2 bg-slate-200 text-left text-gray-700 uppercase tracking-wider">reciver</div>
tensojka marked this conversation as resolved.
Show resolved Hide resolved
<div className="flex-1 w-1/2 basis-1/2 p-2 overflow-hidden">{transfer_item.token_addr.toString()}</div>
<div className="flex-1 w-1/2 basis-1/2 p-2 overflow-hidden">{transfer_item.receiver.toString()}</div>
<div className="flex-1 w-1/2 basis-1/2 p-2 overflow-hidden">{getFormatAddress(transfer_item.token_addr.toString())}</div>
<div className="flex-1 w-1/2 basis-1/2 p-2 overflow-hidden">{getFormatAddress(transfer_item.receiver.toString())}</div>
</div>
<div className='flex flex-wrap flex-row w-full'>
<div className="flex-1 w-1/4 basis-1/4 p-2 bg-slate-200 text-left text-gray-700 uppercase tracking-wider">amount</div>
Expand Down Expand Up @@ -111,4 +110,6 @@ const getTransferStatus = status => {

}

const getFormatAddress = address => address.slice(0, 12) + "..." + address.slice(-4)
tensojka marked this conversation as resolved.
Show resolved Hide resolved

export default StatusTransfer