Monitored Tokens
The Monitored Tokens feature in the Programmable Wallet aims to empower developers with enhanced control over viewing token balances and transactions. This feature enables developers to easily manage and filter out tokens unrelated to their use case from our API responses, thereby selectively screening which tokens end-users can see, providing a more streamlined and personalized experience.
By utilizing the API endpoint POST config/entity/monitoredTokens
, developers can easily add tokens via their unique token IDs. This guide will walk you through the steps to interact with the Monitored Tokens feature, including retrieving token IDs, adding tokens, and using API endpoints to get transaction and wallet balances for specific tokens.
By default, there are no Monitored Tokens. This means that the system will monitor all tokens as no filter exists. Calling
GET /entity/config/monitoredTokens
before configuring, it will return 204, a no-content response.
Update Monitored Token List
To add tokens to the monitored token list, follow these steps:
-
Retrieve the Token ID: Programmable wallet currently supports native coins, ERC-20, ERC-721, and ERC-1155.
- Each token deposited into the programmable wallet generates a specific token ID, which developers can obtain through the following methods:
- Deposit Callback: The callback response will include the corresponding token ID when a token is deposited.
- Querying Wallet Balance:
GET /wallets/{id}/balances
orGET /wallets/{id}/nfts
will retrieve the tokens in the wallet and their related token IDs. - Querying Transaction:
GET /transactions
also retrieves the token IDs for inbound or outbound transactions.
- Each token deposited into the programmable wallet generates a specific token ID, which developers can obtain through the following methods:
-
Add tokens into the monitored token list: Once you have the token ID, make a
POST config/entity/monitoredTokens
request with the token IDs specified in the required field.
Remove Monitored Tokens
To remove tokens from Monitored Tokens, use POST /config/entity/monitoredTokens/delete
to remove specific tokens. Specify the token IDs you want to delete, and they will be excluded from the list.
Update Monitor
To replace tokens with Monitored Tokens, use PUT /config/entity/monitoredTokens
to entirely replace the existing monitored token list by specifying the tokens you want to monitor. The previous list will be overwritten with the new tokens provided.
Change scope for Monitored Tokens
By default, all ERC-20, ERC-721, and ERC-1155 tokens deposited into your wallets are monitored and will be returned in GET /wallets/{id}/balances
, GET /wallets/{id}/nfts
, GET /transactions
APIs, and webhook callbacks.
However, after adding tokens to Monitored Tokens, the Monitored Tokens scope is set to SELECTED by default, which means only the provided tokens will be returned in the above APIs and callbacks. To revert to monitoring all tokens, call PUT /config/entity/monitoredTokens/scope
and set the scope to MONITOR_ALL.
It’s important to note that even when the monitored token scope is set with SELECTED, developers can view all tokens in the wallet balance and transactions. This can be achieved by setting the includeAll field to True (default value is False) in the GET /wallets/{id}/balances
, GET /wallets/{id}/nfts
, GET /transactions
APIs. By doing so, the API responses will include details for all tokens in the wallet, irrespective of whether they are part of the monitored token list.
Updated 4 months ago