To interact with the Cede SDK, you need to create an instance of the SDK and register at least one exchange instance. Refer to the General info section for details.
Depositable tokens
To fetch all depositable tokens on a given exchange, use:
method: getDepositableTokens
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the depositable tokens.auth
- The authentication object for the exchange. See authentication section for details.
response structure: Promise<DepositableToken[]>
, see DepositableToken for
details.
Some exchanges do not provide directly the list of networks for all tokens. To get all deposit networks for a specific token, see Depositable Networks section.
const depositableTokens = await cedeSDK.api.getDepositableTokens({ exchangeInstanceId, auth });
Depositable networks
To fetch all available deposit networks/chains on a given exchange and token, use:
method: getNetworks
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the networks.auth
- The authentication object for the exchange. See authentication section for details.tokenSymbol
-string
, optional
Filters the networks by token. If not provided, all networks will be fetched.opts.toDeposit
-boolean
, optional
Filters the networks by deposit availability.opts.toWithdraw
-boolean
, optional
Filters the networks by withdrawal availability.opts.requestPriority
-1 | 2 | 3
, optional
The request priority for the request.
Default:2
(medium).
response structure: Promise<MarketNetwork[]>
, see MarketNetwork
for details and
Supported Networks for the list of supported networks.
We offer unified network names and chainIds (EIP-155) for all exchanges, see Supported
Networks and the MarketNetwork
type for details.
const availableNetworks = await cedeSDK.api.getNetworks({
exchangeInstanceId,
auth,
tokenSymbol: "1INCH",
opts: {
toDeposit: true
}
});
Deposit
To fetch the deposit address for a given exchange, token and network, use:
method: getDepositAddress
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the deposit address.auth
- The authentication object for the exchange. See authentication section for details.tokenSymbol
-string
The token's symbol.network
-string
The network's ID. See Supported Networks for the list of supported networks.
response structure: Promise<DepositAddress>
, see DepositAddress for details.
const address = await cedeSDK.api.getDepositAddress({
exchangeInstanceId,
auth,
tokenSymbol: "1INCH",
network: "polygon"
});
On Deposit Callback
Once you've send tokens to the CEX, you can execute a callback function when the deposit is detected by CEX. To register a callback, use the following method:
method: onDeposit
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the deposit address.auth
- The authentication object for the exchange. See authentication section for details.tokenSymbol
-string
The token's symbol.txHash
-string
The transaction hash of token transfer.txStatus
-string
The transaction status to trigger the callback.
Values:ok
,pending
,failed
,cancelled
. "ok" is used by default.callback
-(transaction: PureTransaction) => void
The callback function to execute when the deposit is detected. See PureTransaction for details.intervalMs
-number
, optional
The polling interval in milliseconds to detect the deposit.
Default:5000
(5 seconds).maxDuration
-number
, optional
The maximum duration in milliseconds to detect the deposit.
Default:600000
(10 minutes).
response structure: void
onDeposit({
exchangeInstanceId,
auth,
tokenSymbol: "USDT",
txHash: "0xf9e10c965a3b8d1edaa2c6ec5b83db7346aa50881cc4417e4e549c9535f87622",
callback: (data) => {
console.log("Deposit event", data);
},
});