|
| 1 | +# cede.store |
| 2 | + |
| 3 | +## Wallet module for connecting cede.store Wallet SDK to web3-onboard |
| 4 | + |
| 5 | +cede.store is a non-custodial browser extension designed to store CEX (centralized exchange) API keys and to sign CEX requests from the client-side. It allows users to manage their cryptos in their CEX through a unified interface. |
| 6 | + |
| 7 | +Any dApp can integrate cede.store in order to track and/or manage a user's CEX assets. In this way, we offer the dApp a way to monitor and manage a user's CEX assets while remaining non-custodial and maintaining the same user experience as any DeFi browser wallet. |
| 8 | + |
| 9 | +See [cede.store Wallet Developer Docs](https://docs.cede.store) |
| 10 | + |
| 11 | +### Install |
| 12 | + |
| 13 | +<Tabs values={['yarn', 'npm']}> |
| 14 | +<TabPanel value="yarn"> |
| 15 | + |
| 16 | +```sh copy |
| 17 | +yarn add @web3-onboard/cede-store |
| 18 | +``` |
| 19 | + |
| 20 | + </TabPanel> |
| 21 | + <TabPanel value="npm"> |
| 22 | + |
| 23 | +```sh copy |
| 24 | +npm install @web3-onboard/cede-store |
| 25 | +``` |
| 26 | + |
| 27 | + </TabPanel> |
| 28 | +</Tabs> |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +```typescript |
| 33 | +import Onboard from '@web3-onboard/core' |
| 34 | +import cedeStoreWalletModule from '@web3-onboard/cede-store' |
| 35 | + |
| 36 | +const cedeStoreWallet = cedeStoreWalletModule() |
| 37 | + |
| 38 | +const onboard = Onboard({ |
| 39 | + // ... other Onboard options |
| 40 | + wallets: [ |
| 41 | + cedeStoreWallet |
| 42 | + //... other wallets |
| 43 | + ] |
| 44 | +}) |
| 45 | + |
| 46 | +const connectedWallets = await onboard.connectWallet() |
| 47 | +console.log(connectedWallets) |
| 48 | +``` |
| 49 | + |
| 50 | +## Vault management |
| 51 | + |
| 52 | +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, on a mobile or on a Ledger (more coming soon...). We can compare Vaults with the [Keyring concept](https://www.wispwisp.com/index.php/2020/12/25/how-metamask-stores-your-wallet-secret/) of Metamask. |
| 53 | + |
| 54 | +A user can have multiple vaults with different CEX accounts inside. |
| 55 | +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. |
| 56 | + |
| 57 | +Let's say the user has three vaults: a main one with full access (track, trade, withdraw) to all his CEX, one just for tracking and one just for trading. |
| 58 | +If the user does not know the reputation of the dApp he is using, the most logical solution would be to give access |
| 59 | +only to the tracking vault so the dApp will not be able to initiate trade requests. |
| 60 | + |
| 61 | +## CEX connection |
| 62 | + |
| 63 | +All requests are divided into two categories: |
| 64 | + |
| 65 | +- private requests |
| 66 | +- public requests |
| 67 | + |
| 68 | +All public data, such as prices, volumes, historical data are collected from different exchanges and provided with our API. |
| 69 | + |
| 70 | +All private requests, such as user balances, trades, open positions are coming from cede.store (from the user's machine). |
| 71 | + |
| 72 | +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. |
| 73 | + |
| 74 | +## Example of a workflow (fetch user's balances and transactions) |
| 75 | + |
| 76 | +```typescript |
| 77 | +// get available vaults and accounts |
| 78 | +const { vaultPreview } = provider.getVaultPreviews() |
| 79 | +console.log(vaultPreview) |
| 80 | + |
| 81 | +// Fetch user's balances from Binance and Coinbase |
| 82 | +const vaultId = vaultPreview[0].id |
| 83 | +await provider.request({ |
| 84 | + method: 'balances', |
| 85 | + params: { |
| 86 | + vaultId, |
| 87 | + accountNames: ['Binance 1', 'Coinbase 1'] |
| 88 | + } |
| 89 | +}) |
| 90 | + |
| 91 | +// Fetch user's transactions |
| 92 | +await provider.request({ |
| 93 | + method: 'transactions', |
| 94 | + params: { |
| 95 | + vaultId |
| 96 | + } |
| 97 | +}) |
| 98 | +``` |
0 commit comments