Integrations
Blocknative Web3-Onboard

Blocknative Web3-Onboard

This is a guide on how to integrate the cede.store wallet if your project is using the Web3-Onboard (opens in a new tab) library for connecting wallets. If you're not using the Blocknative Web3-Onboard library, please check the Native connection.

Install

npm install @web3-onboard/cede-store

Usage

import cedeStoreWalletModule from "@web3-onboard/cede-store";
import Onboard from "@web3-onboard/core";
 
// You have to provide at least one chain
const chains = [
  {
    id: "0x1",
    token: "ETH",
    label: "Ethereum Mainnet",
    rpcUrl: "https://mainnet.infura.io/v3/",
  },
];
 
const cedeStoreWallet = cedeStoreWalletModule();
 
const onboard = Onboard({
  // ... other Onboard options
  wallets: [
    cedeStoreWallet,
    //... other wallets
  ],
  chains,
});
 
const connectedWallets = await onboard.connectWallet();
console.log(connectedWallets);

Try it yourself:


Vault management

Vaults allow creating bundles of CEX accounts. The extension connects with CEX through CEX API keys and everything is stored in the Local Storage of the browser. Mobile and Ledger storage are coming soon. We can compare Vaults with the Keyring concept (opens in a new tab) of Metamask.

A user can have multiple vaults with different CEX accounts inside. This system allows the user to give a dApp custom access to his accounts depending on the degree of trust he has in the dApp in question.

Let’s say a user has two vaults: a main one with highly sensitive accounts, that have trading/withdraw permissions, another one with less sensitive data, and accounts with permissions limited to tracking. If they do not know or trust a dApp, they can give access to the less critical vault alone, so that the dApp will not be able to initiate unwanted trade requests.


CEX connection

All requests are divided into two categories:

  • private requests
  • public requests

All public data, such as prices, volumes, historical data are collected from different exchanges and provided with our API.

All private requests, such as user balances, trades, open positions are coming from cede.store (from the user's machine).

You can access both public and private data through the extension's API. Cede.store handles all exchanges requests, as well as API keys secure storage.


Example of a workflow (fetch user's balances and transactions)

// get available vaults and accounts
const { vaultPreview } = provider.getVaultPreviews();
console.log(vaultPreview);
 
// Fetch user's balances from Binance and Coinbase
const vaultId = vaultPreview[0].id;
await provider.request({
  method: "balances",
  params: {
    vaultId,
    accountNames: ["Binance 1", "Coinbase 1"],
  },
});
 
// Fetch user's transactions
await provider.request({
  method: "transactions",
  params: {
    vaultId,
  },
});

Continue

When you've integrated the cede.store successfully, you can continue with the documentation by checking the Read methods part.