Write methods
Write methods manipulate user balances on CEX, every time you call one of these methods, the notification popup will appear with the desired action requesting users' approval.
Fast Onboarding
Add CEX
This method opens the extension in the current tab and starts the CEX creation flow.
- method:
addCex
- params:
{
exchangeId: string; // optional
callbackUrl: string; // optional
}
exchangeId
is optional. If not provided the user will be able to choose the CEX from the list of supported CEX.
callbackUrl
is optional. It should contain a valid url (❌ cede.store - ✅ https://cede.store (opens in a new tab)). If provided, the user
will be redirected to the given url at the end of the flow. If not, the user will be redirected to the page that has
initiated the request.
- response structure : None, the user will be redirected to the DApp at the end of the flow.
await provider.request({
method: "addCex",
params: {},
});
Try it yourself:
Fund management
Market order
In order to execute a market order, use:
- method:
createOrder
- params:
{
accountId: string;
pairSymbol: string;
orderSide: "sell" | "buy";
orderType: "market" | "limit";
amount: string;
price: string;
}
- response structure :
Promise<Order>
, see Order for details.
await provider.request({
method: "createOrder",
params: {
accountId: "binance-125805-530845-212023-888168",
pairSymbol: "ETH/USDT",
orderSide: "buy",
orderType: "market",
amount: "0.1",
price: "1821"
},
});
Limit order
In order to execute a limit order, use:
- method:
limitOrder
- params:
{
accountId: string;
pairSymbol: string;
orderSide: "buy" | "sell";
price: string;
amount: string; // in base token units
}
- response structure :
Promise<Order>
, see Order for details.
await provider.request({
method: "limitOrder",
params: {
accountId: "binance-125805-530845-212023-888168",
pairSymbol: "ETH/USDT",
orderSide: "buy",
orderType: "limit",
price: "1890",
amount: "0.1"
},
});
Edit order
If you already have an open order, you can edit its parameters:
- price
- amount
- type (limit/market)
- side (buy/sell)
In order to edit an order, use:
- method:
editOrder
- params:
{
accountId: string;
pairSymbol: string;
orderId: string;
orderType?: "limit" | "market"; // optional
orderSide?: "buy" | "sell"; // optional
price?: string; // optional
amount?: string; // optional
}
- response structure :
Promise<Order>
, see Order for details.
await provider.request({
method: "editOrder",
params: {
accountId: "binance-125805-530845-212023-888168",
orderId: "13961687298",
pairSymbol: "ETH/USDT",
orderSide: "buy",
orderType: "limit",
price: "1770",
amount: "0.1"
},
});
Cancel order
In order to cancel an order, use:
- method:
cancelOrder
- params:
{
accountId: string;
pairSymbol: string;
orderId: string;
}
- response structure :
Promise<"canceled" | "already_filled">
.
await provider.request({
method: "cancelOrder",
params: {
accountId: "binance-125805-530845-212023-888168",
orderId: "13961687298",
pairSymbol: "ETH/USDT",
},
});
Withdraw
In order to withdraw funds, use:
- method:
withdrawToDefi
- params:
{
accountId: string,
tokenSymbol: string,
network: string,
amount: string,
address: string,
code?: string
}
- response structure:
Promise<Transaction>
, see Transaction for details.
await provider.request({
method: "withdrawToDefi",
params: {
accountId: "binance-125805-530845-212023-888168",
tokenSymbol: "ETH",
network: "polygon",
amount: "0.126",
address: "0x0d500b1d9e8ef31e21c99d1db3a6444d3adf1270",
},
});