- Ethereum (ETH), Polygon (MATIC), and Avalanche (AVAX), both Testnet and Mainnet
- ERC-20 tokens
- ERC-721 and ERC-1155 NFTs (non-fungible tokens)
1. Check the Wallet’s Balance
Before sending funds across wallets, you will need to do two more things:- Ensure the wallet has received the USDC or MATIC tokens.
- Obtain the token ID for the received USDC or MATIC. The token ID is an assigned identifier that will be used for the token transfer in the upcoming step.
GET /wallets/{id}/balances
providing the ID of Wallet One from the previous step.
Response Body
2. Gas Fees (EOA Wallets Only)
Details
Details
In Web3, refers to transaction fees that are always
paid in the native currency of the blockchain network. For example, if you send
an ERC-20 token on the Ethereum network, you must pay the transaction fee in
Ether (ETH). Similarly, on the Polygon network, the fee would be in MATIC. To
ensure smooth transactions, it is important to have a sufficient amount of the
native token in your wallet.To gather tokens for gas and send MATIC from wallet to wallet, we recommend
using the Polygon
. When you visit the faucet’s website, you will be
prompted to provide your wallet’s address. To acquire it, make a request to
GET /wallets as
shown below noting down Wallet One’s address wallets[0].address.Response Body
3. Transfer Tokens
Now, you can make on-chain transfers from wallet to wallet. This is done by making a request toPOST /developer/transactions/transfer
with the following request body parameters.
idempotencyKey: Universally unique identifier (UUID v4) idempotency key. This key is utilized to ensure exactly-one execution of a mutating requests.tokenId: Token ID for the token that will be transferred. In this case, you will provide the MATIC token ID from the previous step.walletId: Wallet ID of the source wallet where the token amount will be transferred from. In this case, you will provide Wallet One’s IDwallets[0].idfrom step one.destinationAddress: Wallet address that will receive the tokens. In this case, use Wallet Two’s addresswallets[1].idfrom step one.amounts: The amount of tokens to be sent. In this case, we will use a minimal amount.feeLevel: A dynamic blockchain fee level setting (LOW, MEDIUM, or HIGH) that will be used to pay gas for the transaction. Calculated based on network traffic, supply of validators, and demand for transaction verification. Estimates for each fee level can be obtained through the estimate fee API call.entitySecretCiphertext: The Entity Secret Ciphertext is an RSA encryption value generated from your Entity Secret and Circle’s public key. This asymmetrically encrypted value is sent in API requests like wallet creation or transaction initiation to ensure secure critical actions. This process enables secure usage of the Entity Secret to ensure it cannot be easily accessed or misused.
Response Body
4. Check the Transfer State
Transfers are a type of blockchain and, therefore, are asynchronous. To ensure the transfer has successfully reached its destination, make a request toGET /transactions/{id}
using the ID from the transfer in the previous step.
Response Body
transaction.state is COMPLETE you can rest assured that the token
has moved from wallet one to wallet two.
You can also check the transaction using the txHash on
Polygon Amoy explorer and inspect the balance of
each wallet using
GET /wallets/{id}/balances.