Link.deposit
Check out our Link reference tool to understand how Link
methods work without having to write any code.
SDK v1.3.30+ used with Link UI supports different ways to deposit ETH and whitelisted ERC20 tokens, for example, USDC, GODS or IMX tokens.
Right now, Immutable X only supports ETH and whitelisted ERC20 tokens.
Immutable X is not prescriptive in how marketplaces handle the deposit process. There are several optional parameters you can use for your marketplace, to influence the user journey for the deposit.
Available parameters:
{
type: ETH,
amount?: PositiveNumberStringC
}
{
amount: PositiveNumberStringC
}
{
type: ERC20,
tokenAddress: EthAddress,
symbol: string,
amount?: PositiveNumberStringC
}
Usage
If a marketplace provides only amount, or ETH type with amount, the system will deposit in ETH. This can be used when a marketplace only wants to allow deposits in ETH and / or wants to style the deposit form with their own branding.
link.deposit({
amount: '0.1',
});
// or
link.deposit({
type: 'ETH',
amount: '0.1',
});
If a marketplace provides token information and amount, users will be asked to confirm the deposit. This can be used when users are provided with a shortcut like "deposit 1 GODS token", or if the marketplace wants to style the deposit form for branding purposes.
link.deposit({
amount: '10',
type: 'ERC20',
symbol: 'USDC',
tokenAddress: '0x07865c6e87b9f70255377e024ace6630c1eaa37f',
});
If a marketplace provides only token information, users will be asked to provide an amount and confirm the deposit. This can be used when users are provided with a shortcut like "deposit GODS" or, again, to add brand-specific styling to the form.
link.deposit({
type: 'ERC20',
symbol: 'GODS',
tokenAddress: '0x4c04c39fb6d2b356ae8b06c47843576e32a1963e',
});
If a marketplace provides no parameters, users will be asked to select a currency and the amount before confirming the deposit. This can be used if marketplaces prefer to rely on currencies and forms with Immutable branding.
link.deposit();
Errors
See error responses here.