From 6e64a5658177ad8cbee4c56567f28ff59c33f03b Mon Sep 17 00:00:00 2001 From: Jade Of Wallstreet Date: Sun, 24 May 2026 13:27:17 +0100 Subject: [PATCH] docs(readme): add USDT Payment example and fix Transaction args decimal comment --- README.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 217b2d5..582c58a 100644 --- a/README.md +++ b/README.md @@ -338,6 +338,56 @@ export const PaymentBasic = () => { }; ``` +### Example with USDT + +USDT on Celo uses 6 decimals. Pass the amount as a human-readable string (e.g. `"1.5"`) — the `Payment` component handles unit conversion internally using the token's decimals. Use the USDT token address, not the cUSD address. + +```tsx +import { useState } from "react"; +import { Payment, PaymentError, PaymentDialog } from "@composer-kit/ui/payment"; +import { celo } from "viem/chains"; + +// USDT on Celo mainnet — 6 decimals +const USDT_ADDRESS = "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e"; + +export const PaymentUSDT = () => { + const [isOpen, setIsOpen] = useState(false); + const [txHash, setTxHash] = useState(""); + + return ( +
+ { + setTxHash(hash); + setIsOpen(false); + }} + onError={(error) => { + console.error("Payment error", error); + }} + recipientAddress="0x717F8A0b80CbEDe59EcA195F1E3D8E142C84d4d6" + tokenAddress={USDT_ADDRESS} + > + + setIsOpen(!isOpen)} + open={isOpen} + /> + + + {txHash &&

{txHash}

} +
+ ); +}; +``` + ## Swap The `Swap` component allows users to exchange tokens seamlessly with a simple interface. @@ -489,8 +539,11 @@ export const TransactionBasic = () => { outputs: [{ name: "", type: "bool" }], }, ], + // cUSD on Celo mainnet (18 decimals) + // To send 1 cUSD: use 1_000_000_000_000_000_000n (18 decimal places) + // To send 1 USDT (0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e): use 1_000_000n (6 decimal places) address: "0x765de816845861e75a25fca122bb6898b8b1282a", - args: ["0x717F8A0b80CbEDe59EcA195F1E3D8E142C84d4d6", 1], + args: ["0x717F8A0b80CbEDe59EcA195F1E3D8E142C84d4d6", 1_000_000_000_000_000_000n], functionName: "transfer", }} >