Skip to main content
Snippets of code that can be used to implement flows inside MiniPay
Make sure you are using Typescript v5 or above and Viem v2 or above.

Get the connected user’s address without any Library

To use the code snippets below, install the following packages:

Check USDm Balance of an address

Check If a transaction succeeded

Estimate Gas for a transaction (in Celo)

Estimate Gas for a transaction (in USDm)

Estimate Gas Price for a transaction (in Celo)

Estimate Gas Price for a transaction (in USDm)

Calculate USDm to be spent for transaction fees

Resolve Minipay phone numbers to Addresses

Install the @celo/identity package:

Step 1: Set up your issuer

The issuer is the account registering attestations. When a user requests attestation registration, verify they own the identifier (e.g., SMS verification for phone numbers).

Step 2: Check and top up ODIS quota

Step 3: Derive the obfuscated identifier

Get the obfuscated identifier from the plaintext identifier by querying ODIS:

Step 4: Look up account addresses

Query the FederatedAttestations contract to look up account addresses owned by an identifier:

Request an ERC20 token transfer

USDT and USDC on Celo use 6 decimals, not 18. Pass tokenDecimals as 6 when transferring either token. Using 18 will send 1,000,000,000,000× more than intended. USDm uses 18 decimals.