RegisterToken
Description
Function to register any asset that is not supported by default. The token will then be supported throughout the SDK - eg. it will be returned in the assets
field of the RetrieveUser
function if the user has a non-zero balance of the token.
Please note that by default, we support native tokens that have been outlined in Assets.
Details
Signature
RegisterToken(name, symbol, chain, image, contractAddress, decimal, tokenStandard)
Arguments
Parameter | Type | Definition |
---|---|---|
| String | Name of the currency, eg. "USD Coin" |
| String | Symbol for the currency, eg. "USDC" |
| String | Chain on which the contract is deployed. eg. for USDC on ETH, pass in |
| String | Link to png image of the token. Max size is 50KB |
| String | Contract address of the ERC20 token, eg. for USDC on ETH, it is 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 |
| Number | Number of decimal places of precision for the asset. eg. 18 for ETH |
| Object | Specify the token standard. eg: |
Return Value
Instance of the new Asset
Example
First, create an instance of the token by calling RegisterToken
:
Then, pass in the custom token(s) you have created while initializing the MetafiProvider:
And voila! Your token will now be accessible throughout the wallet.
Last updated