Read methods
Read methods do not manipulate user balances on CEX, you can use them without users' approval.
General
Connect the wallet
provider.request({ method: "connect" });You can check if cede.store is connected by using the provider's embedded method getIsUnlocked.
const isUnlocked = provider.getIsUnlocked();Disconnect the wallet
You are now able to disconnect the wallet by using the disconnect method.
provider.disconnect();Fast onboarding
In case the user has cede.store installed, but the vault is not setup yet, the connect method will throw a
Not initialized error.
Instead of handling this error, using the onboard parameter, the dApp can decide to redirect the user to the fast
onboarding flow.
provider.request({ method: "connect", params: { onboard: true } });How does it work?
Fetch vaults with CEX accounts
In order to fetch all available vaults with CEX accounts, you should use:
- method:
vaults - params:
{}, can be ommited - response structure:
Promise<VaultItem[]>, see VaultItem for details.
This method returns all vaults. You can also call the vaultAccounts method with a vaultId parameter to retrieve
information on a single vault.
await provider.request({method: "vaults"});Try it yourself:
Fetch active vault ID
To fetch the user's active vault, you should use:
- method:
activeVault - params:
{}, can be ommited - response structure:
Promise<string>.
await provider.request({method: "activeVault"});Try it yourself:
Get the environment
As cede.store supports demo environment without real CEX keys, you can use this method to check if the user is in the demo environment.
- method:
getEnvironment - params:
{}, can be ommited - response structure:
Promise<"DEMO" | "PROD">.
await provider.request({method: "getEnvironment"});Try it yourself:
Fetch supported exchanges
In order to fetch all supported exchanges, you should use:
- method:
supportedExchanges - params:
{}, can be ommited - response structure:
Promise<ExchangeInfo[]>, see ExchangeInfo for details.
await provider.request({method: "supportedExchanges"});Try it yourself:
User's exchange account
User's transactions
To fetch user's transactions on a given exchange, use:
- method:
transactions - params:
{
vaultId: string,
accountIds?: string[],
tokenSymbol?: string,
txType?: "deposit" | "withdrawal" | "trade",
startTime?: number,
pageCount?: number,
pageIndex?: number
}- response structure:
Promise<Transaction[]>, see Transaction for details.
await provider.request({
method: "transactions", params: {
vaultId: "740351-125805-530845-212023-888168",
accountIds: ["Binance-1", "MyCoinbase"],
tokenSymbol: "ETH", // optional
txType: "deposit", // optional
startTime: 1618560000000, // optional
pageCount: 10, // optional
pageIndex: 1 // optional
}
});Try it yourself:
User's fungible balances
To fetch user's balances on a given exchange, use the balances method:
- method:
balances - params:
{ vaultId: string; accountId?: string[], walletTypes?: WalletType[] }, check WalletType for details - response structure:
Promise<GroupedBalancesByAccount>, see GroupedBalancesByAccount for details.
await provider.request({
method: "balances",
params: {
vaultId: "740351-125805-530845-212023-888168",
accountId: ["Binance 1"],
walletTypes: ["spot", "margin"], // optional
}
});Try it yourself:
User's NFTs
To fetch user's NFTs on a given exchange, use:
- method:
nfts - params:
{ accountId: string } - response structure:
Promise<{ nfts: Nft[]; total: number; }>, see Nft for details.
await provider.request({
method: "nfts",
params: {
accountId: "binance-125805-530845-212023-888168",
}
});Try it yourself:
Exchange's public data
Despite the fact that this is a public API, some exchanges require authentication. Therefore, accountId parameter is
needed even in public methods.
Exchange market pairs
To fetch all available market pairs on a given exchange, use:
- method:
getMarketPairs - params:
{ accountId: string; } - response structure:
Promise<MarketPair[]>, see MarketPair for details.
await provider.request({
method: "getMarketPairs",
params: {
accountId: "binance-125805-530845-212023-888168",
}
});Try it yourself:
Prices
If you need to get the average prices with all values provided in dollars, use:
- method:
getPrices - response structure:
Promise<{[tokenSymbol: string]: number}>.
await provider.request({
method: "getPrices",
});Try it yourself:
Get market rate
If you look for precise market rate on a given market pair, use:
- method:
getMarketRate - params:
{ accountId: string; pairSymbol: string } - response structure:
Promise<MarketRate>, see MarketRate for details.
await provider.request({
method: "getMarketRate",
params: {
accountId: "binance-125805-530845-212023-888168",
pairSymbol: "ETH/USDT"
}
});Try it yourself:
Deposit
Depositable tokens
To fetch all depositable tokens on a given exchange and token, use:
- method:
depositableTokens - params:
{ accountId: string } - response structure:
Promise<DepositableToken[]>, see DepositableToken for details.
await provider.request({
method: "depositableTokens",
params: {
accountId: "kraken-125805-530845-212023-888168",
}
});Try it yourself:
Depositable chains
To fetch all available deposit networks/chains on a given exchange and token, use:
- method:
getNetworks - params:
{ accountId: string; tokenSymbol: string, opts: { toDeposit?: boolean, toWithdraw?: boolean } } - response structure:
Promise<MarketNetwork[]>, see MarketNetwork for details.
At present, we offer unified network names and chainIds (EIP-155) only for 6 exchanges. If the chain is not EVM or the
exchange is not yet mapped, chainId is equal to -1. Please use the "name" property from the response as a label to
show to the user, and the "network" property for the "deposit" method.
await provider.request({
method: "getNetworks",
params: {
accountId: "binance-125805-530845-212023-888168",
tokenSymbol: "1INCH",
opts: {
toDeposit: true
}
}
});Try it yourself:
Deposit
To fetch the deposit address for a given exchange, token and network/chain, use:
- method:
deposit - params:
{
accountId: string;
tokenSymbol: string;
network: string; // optional on some CEXs (Coinbase)
}- response structure:
Promise<DepositAddress>, see DepositAddress for details.
await provider.request({
method: "deposit",
params: {
accountId: "binance-125805-530845-212023-888168",
tokenSymbol: "BTC",
network: "bitcoin" // use the "network" value from "depositableChains" response
}
});Try it yourself:
Withdraw
Withdrawable tokens
To fetch all withdrawable tokens on a given exchange and token, use:
- method:
withdrawableTokens - params:
{ accountId: string, network?: string }- if you want to get balances for a specific network, you can pass the network as a parameter. If not, the method will return the balances for all available networks. - response structure:
Promise<GroupedBalances[]>, see GroupedBalances for details.
await provider.request({
method: "withdrawableTokens",
params: {
accountId: "kraken-125805-530845-212023-888168",
network: "ethereum"
}
});Try it yourself:
Withdrawable chains
To fetch all available withdraw networks/chains on a given exchange and token, use:
- method:
getNetworks - params:
{ accountId: string; tokenSymbol: string } - response structure:
Promise<MarketNetwork[]>, see MarketNetwork for details.
await provider.request({
method: "getNetworks",
params: {
accountId: "kraken-125805-530845-212023-888168",
tokenSymbol: "BTC",
opts: {
toWithdraw: true
}
}
});Try it yourself:
Withdraw by ID
To retrieve a withdrawal by its ID, use:
- method:
getWithdrawalById - params:
{
accountId: string;
withdrawalId: string;
tokenSymbol: string;
timestamp: number;
}Some exchanges require a time window to retrieve withdrawals, that's why the timestamp parameter is mandatory. We set the window to +-1 second from the provided timestamp.
- response structure:
Promise<Transaction>, see Transaction for details.
await provider.request({
method: "getWithdrawalById",
params: {
accountId: "coinbase-125805-530845-212023-888168",
withdrawalId: "123456789",
tokenSymbol: "AVAX",
timestamp: 1695649587093,
}
});Trade
Open orders
To fetch all open orders on a given exchange, use:
- method:
openOrders - params:
{
accountId: string;
pairSymbol?: string; // optional
since?: number; // optional
limit?: number; // optional
}- response structure :
Promise<Order[]>, see Order for details.
await window.cede.request({
method: "openOrders",
params: {
accountId: "binance-125805-530845-212023-888168",
},
});Try it yourself:
Retrieve an order
To retrieve an order on a given exchange, use:
- method:
retrieveOrder - params:
{
accountId: string;
pairSymbol: string;
orderId: string;
}- response structure :
Promise<Order>, see Order for details.
await window.cede.request({
method: "retrieveOrder",
params: {
accountId: "binance-125805-530845-212023-888168",
orderId: "13961687298",
pairSymbol: "ETH/USDT",
},
});