Boring Vault UI SDK

Quick Start

Get started with the Boring Vault UI SDK

Installation

First install the dependencies

npm install ethers boring-vault-ui-sdk

If you have installed ethers in your project already, you can skip the ethers installation.

Set-up the Provider

Interactions to and from a boring vault are done through a parent context/provider that defines and sets up all relevant functionalities. The library additionally exposes some render components, however only the context is necessary to interact with the vault, within which a fully custom UI may be built.

Example

import { ethers } from "ethers";
import { BoringVaultV1Provider } from 'boring-vault-ui';


// 1. Create an ethers provider
const ethersInfuraProvider = new ethers.InfuraProvider(
  "mainnet",
  process.env.INFURA_API_KEY
);

// 2. Wrap your app with the BoringVaultV1Provider
function App() {
  return (
    <BoringVaultV1Provider
      vaultDecimals={18}
      ethersProvider={ethersInfuraProvider}
      vaultContract="0xc79cC44DC8A91330872D7815aE9CFB04405952ea"
      tellerContract="0xbBe07e335235b5be21d9Ef413fc52aA250a6C125"
      accountantContract="0xc6f89cc0551c944CEae872997A4060DC95622D8F"
      lensContract="0xe12Eef08bfef01579D22895CD790F32d94faA54A"
      depositTokens={[
        {
          address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
          decimals: 18,
        },
        {
          address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
          decimals: 6,
        },
      ]}
      baseAsset={{
        address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        decimals: 18,
      }}
    >
      ...
    </BoringVaultV1Provider>
  );
}

Inputs

Note all Contract input addresses will be provided by the Seven Seas team.

PropTypeDefault
vaultDecimals
number
-
baseToken
{ address: string; decimals: number; }
-
depositTokens
Array<{ address: string; decimals: number; }>
-
ethersProvider
ethers.Provider
-
lensContract
string
-
accountantContract
string
-
tellerContract
string
-
vaultContract
string
-

isBoringV1ContextReady

This function denotes if the context is ready for usage.

Inputs

  • None

Outputs

  • Boolean denoting if the context is ready to use
import { useBoringVaultV1 } from 'boring-vault-ui';

const { isBoringV1ContextReady } = useBoringVaultV1();

console.warn("Is the Boring Context Ready: ", isBoringV1ContextReady ? "Yes" : "No");

// Output: Is the Boring Context Ready: Yes

On this page