Skip to content

Commit

Permalink
fix: use token decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
williamluke4 committed Sep 27, 2024
1 parent c57c3be commit bffdc7d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/dialogs/send-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
FormMessage,
} from "../ui/form";
import { Input } from "../ui/input";
import { useVoucherDetails } from "../pools/hooks";

const FormSchema = z.object({
voucherAddress: z.string().refine(isAddress, "Invalid voucher address"),
Expand Down Expand Up @@ -73,16 +74,18 @@ const SendForm = (props: {
const amount = form.watch("amount");
const debouncedAmount = useDebounce(amount, 500);
const debouncedRecipientAddress = useDebounce(recipientAddress, 500);
const {data:voucherDetails} = useVoucherDetails(voucherAddress)
const simulateContract = useSimulateContract({
address: voucherAddress,
abi: erc20Abi,
functionName: "transfer",
args: [
debouncedRecipientAddress,
parseUnits(debouncedAmount?.toString() ?? "", 6),
parseUnits(debouncedAmount?.toString() ?? "", voucherDetails!.decimals!),
],
query: {
enabled: Boolean(
voucherDetails?.decimals &&
debouncedAmount &&
debouncedRecipientAddress &&
voucherAddress &&
Expand Down

0 comments on commit bffdc7d

Please sign in to comment.