Use Cases
Deposit

Integrate Deposit 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 depositable token list from our Provider API and display to the user:
const depositableTokens = await provider.request({
  method: "depositableTokens",
  params: {
    accountId: "kraken-125805-530845-212023-888168",
  },
});
console.log({ depositableTokens });
// [
//   {
//     tokenSymbol: "ETH",
//     networks: [
//       {
//         name: "Ethereum",
//         network: "ethereum",
//         withdrawFee: "0.00061",
//         withdrawMin: "0.0098",
//         withdrawMax: "10000000000",
//         depositEnabled: true,
//         withdrawalEnabled: true,
//         chainId: 1,
//       },
//       {
//         name: "Arbitrum One",
//         network: "arbitrumone",
//         withdrawFee: "0.0001",
//         withdrawMin: "0.0008",
//         withdrawMax: "9999999",
//         depositEnabled: true,
//         withdrawalEnabled: true,
//         chainId: 42161,
//       },
//     ],
//   },
//   {
//     tokenSymbol: "BTC",
//     networks: [
//       {
//         name: "BNB Smart Chain",
//         network: "bsc",
//         withdrawFee: "0.0000039",
//         withdrawMin: "0.0000078",
//         withdrawMax: "10000000000",
//         depositEnabled: true,
//         withdrawalEnabled: true,
//         chainId: 56,
//       },
//     ],
//   },
// ];
  1. When the user selects a token, you can retrieve available deposit chains for the token:
const depositableChains = await provider.request({
  method: "getNetworks",
  params: {
    accountId: "kraken-125805-530845-212023-888168",
    tokenSymbol: "BTC",
    opts: {
      toDeposit: true,
    },
  },
});
console.log({ depositableChains });
// [
// {
//   name: "Ethereum",
//   network: "ethereum",
//   withdrawFee: "0.00061",
//   withdrawMin: "0.0098",
//   withdrawMax: "10000000000",
//   depositEnabled: true,
//   withdrawalEnabled: true,
//   chainId: 1,
// },
// {
//   name: "Arbitrum One",
//   network: "arbitrumone",
//   withdrawFee: "0.0001",
//   withdrawMin: "0.0008",
//   withdrawMax: "9999999",
//   depositEnabled: true,
//   withdrawalEnabled: true,
//   chainId: 42161,
// },
// ]
  1. When the user selects a chain, you can retrieve deposit address for the token and chain:
const depositAddress = await provider.request({
  method: "deposit",
  params: {
    vaultId: "740351-125805-530845-212023-888168",
    accountName: "Kraken 1",
    tokenSymbol: "BTC",
    network: "Bitcoin", // use the "network" value from "depositableChains" response
  },
});
console.log({ depositAddress });
// {
//   "address": "38qBNk335MXzC5bS3pT16ouArBypiJ7xki",
//   "network": "bitcoin",
//   "tokenSymbol": "BTC"
// }

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