Skip to content

Commit

Permalink
improve transfer disabled status
Browse files Browse the repository at this point in the history
  • Loading branch information
JayJay1024 committed Oct 30, 2023
1 parent 31536e7 commit 3397a8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/apps/src/components/transfer-action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { useTransfer } from "@/hooks/use-transfer";
import { isAddress } from "viem";

interface Props {
fee: { value: bigint } | undefined;
recipient: Address | undefined;
transferable: bigint | undefined;
transferValue: TransferValue;
onTransfer: () => void;
}

export default function TransferAction({ recipient, transferValue, onTransfer }: Props) {
export default function TransferAction({ recipient, transferable, transferValue, onTransfer }: Props) {
const { sourceAllowance, sourceValue, targetValue, bridgeClient, fee, approve } = useTransfer();
const [busy, setBusy] = useState(false);
const { chain } = useNetwork();
Expand Down Expand Up @@ -55,6 +55,8 @@ export default function TransferAction({ recipient, transferValue, onTransfer }:
bridgeClient &&
fee?.value &&
transferValue.formatted &&
transferable !== undefined &&
transferValue.formatted <= transferable &&
isAddress(recipient || "")
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/src/components/transfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export default function Transfer() {

{/* action */}
<TransferAction
fee={fee}
transferable={transferable}
transferValue={deferredTransferValue}
recipient={recipient || address}
onTransfer={setIsOpenTrue}
Expand Down

0 comments on commit 3397a8f

Please sign in to comment.