Use Cases
Withdraw

Integrate Withdrawal Feature in your dApp

ℹ️

Estimated feature integration time: ~2 hours*

Prerequisites

The following steps are required. If you haven't done so already, please follow the steps in the prerequisites guide:

  • Implement logic for extension detection and connection
  • Implement logic for vaults & accounts selection
  • Subscribe to cede.store events
  1. Retrieve withdrawable token list from our Provider API and display to the user:
const withdrawableTokens = await provider.request({
  method: "withdrawableTokens",
  params: {
    accountId: "kraken-125805-530845-212023-888168",
  },
});
  1. When the user selects a token, you can retrieve available withdrawal chains for the token:
const withdrawableChains = await provider.request({
  method: "getNetworks",
  params: {
    accountId: "kraken-125805-530845-212023-888168",
    tokenSymbol: "BTC",
    opts: {
      toWithdraw: true,
    },
  },
});
  1. When the user select a network, you can prepare the withdrawal:
const result = await provider.request({
  method: "prepareWithdrawal",
  params: {
    accountId: "binance-125805-530845-212023-888168",
    tokenSymbol: "ETH",
    network: "polygon",
    amount: "0.126",
  },
});
  1. When the user selects a chain, you can initiate a withdrawal:
await provider.request({
  method: "withdrawToDefi",
  params: {
    accountId: "binance-125805-530845-212023-888168",
    tokenSymbol: "ETH",
    network: "polygon", // use the "network" value from "withdrawableChains" response or the "method" return from prepareWithdrawal
    amount: "0.126",
    address: "0x0d500b1d9e8ef31e21c99d1db3a6444d3adf1270",
  },
});
  1. Retreive withdrawal information by withdrawal ID:
await provider.request({
  method: "getWithdrawalById",
  params: {
    accountId: "binance-125805-530845-212023-888168",
    withdrawalId: "1234567890",
    tokenSymbol: "ETH",
  },
});

* The estimated integration time is for a project that already has UI components for a similar DeFi send feature.