Skip to content

docs(readme): add USDT Payment example and fix Transaction args decimal scaling - #77

Open
samuelchimmy wants to merge 1 commit into
celo-org:mainfrom
samuelchimmy:samuelchimmy/usdt-payment-example
Open

docs(readme): add USDT Payment example and fix Transaction args decimal scaling#77
samuelchimmy wants to merge 1 commit into
celo-org:mainfrom
samuelchimmy:samuelchimmy/usdt-payment-example

Conversation

@samuelchimmy

Copy link
Copy Markdown

What changed

README.md — one commit, two targeted fixes

Fix 1: Transaction example args decimal clarification

The existing Transaction example passes args: ["0x717...", 1] — a raw uint256 value of 1. For cUSD (18 decimals) this is 0.000000000000000001 cUSD, not 1 cUSD. This is misleading for any developer copying the example.

Changed to 1_000_000_000_000_000_000n (1 cUSD in wei) and added inline comments explaining:

  • How to scale for cUSD (18 decimals)
  • How to scale for USDT (0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e, 6 decimals → 1_000_000n)

Fix 2: Add USDT Payment example

The Payment section has one example using cUSD. The Identity props table already lists token: "CELO" | "cUSD" | "USDT" showing USDT is a supported token type, but there is no Payment example showing how to use it.

Added a ### Example with USDT subsection immediately after the existing PaymentBasic example with:

  • USDT mainnet address as a named constant with a decimal comment
  • Complete working PaymentUSDT component following the exact same pattern as PaymentBasic
  • A one-line explanation that amount is passed as a human-readable string

Why

The Transaction example with args: [address, 1] is the kind of mistake that causes real fund loss — a developer copying it and substituting their own token address would send a transaction that appears to succeed but transfers a negligible amount. The corrected value makes the scaling requirement explicit.

The USDT Payment example closes a gap between the props documentation (which mentions USDT) and the usage examples (which only show cUSD).

How to verify

  1. Search for 1_000_000_000_000_000_000n in README.md — should appear in the Transaction example with accompanying decimal comments
  2. Search for PaymentUSDT — the complete component should appear under ### Example with USDT
  3. Search for 48065fbBE — USDT address should appear in both the Transaction comment and the PaymentUSDT constant
  4. USDT address verified at celoscan.io/token/0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant