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.
Internal Transfer Routes
To retrieve all internal transfer routes for a given exchange, use:
method: internalTransferRoutes
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to fetch the internal transfer routes.auth
- The authentication object for the exchange. See authentication section for details.
response structure: Promise<Record<WalletType, WalletType[]>>>
. The response is an object where the key is the
source wallet type and the value is an array of destination wallet types. See
WalletType for details.
const internalTransferRoutes = await cedeSDK.api.internalTransferRoutes({ exchangeInstanceId, auth });
Internal Transfer
To execute an internal transfer between two wallet types on a given exchange, use:
method: internalTransfer
params:
exchangeInstanceId
-string
The exchange instance ID for which you want to execute the internal transfer.auth
- The authentication object for the exchange. See authentication section for details.amount
-number
The amount to transfer.tokenSymbol
-string
The token's symbol.fromWalletType
-WalletType
The source wallet type.toWalletType
-WalletType
The destination wallet type.pairSymbolFrom
-string
(optional)
The source pair symbol. Used only for isolated margin, as you need to specify the market to transfer from.pairSymbolTo
-string
(optional)
The destination pair symbol. Used only for isolated margin, as you need to specify the market to transfer to.
response structure: Promise<{ transferId: string; }>
, where transferId
is the ID of the transfer.
Special case for Kucoin:
- If you're transferring from or to futures, you'll need to combine both balances from
coin_m_futures
andusd_m_futures
to show the amount available to transfer. Kucoin API doesn't allow to transfer to a specific type to futures.
const transfer = await cedeSDK.api.internalTransfer({
exchangeInstanceId,
auth,
amount: 100,
tokenSymbol: "USDC",
fromWalletType: WalletType.SPOT,
toWalletType: WalletType.FUTURES
});
Wallet Type Mapping
To see how the cede wallet types are mapped to the exchange wallet types, use:
method: getWalletTypeMapping
params:
exchangeInstanceId
-string
The exchange instance ID.auth
- The authentication object for the exchange. See authentication section for details.
response structure: Promise<Record<WalletType, string>>
. The response is an object where the key is the source
wallet type and the value is the wallet type name. See WalletType for details.
const walletTypeMapping = await cedeSDK.api.getWalletTypeMapping({ exchangeInstanceId, auth });