npm i @yfi/sdk
To use the SDK, you will need to instantiate a Yearn object with your desired configuration;
import { Yearn } from "@yfi/sdk";
import { JsonRpcProvider } from "@ethersproject/providers";
// Ethereum mainnet
const chainId = 1;
// It is recommended to use Alchemy for your Web3 provider when using the Yearn SDK.
const rpcUrl = "https://eth-mainnet.alchemyapi.io/v2/secret-id-here";
const yearn = new Yearn(chainId, {
provider: new JsonRpcProvider(rpcUrl)
});
Autogenerated documentation can be found here.
- Code style follows prettier conventions (
yarn lint
). Commit messages follow Conventional Commits. - PR conventions should follow our guidelines outlined at https://github.com/yearn/yearn-sdk/wiki/PR-conventions
- Get write access to the package on npmjs - https://www.npmjs.com/package/@yfi/sdk
- Login to npm -
npm login
- Install np - https://www.npmjs.com/package/np
- Checkout and pull the master branch
- Run
yarn build
- Run
np
and follow the instructions
- Install yalc - https://www.npmjs.com/package/yalc
- Run
yarn build
- Run
yalc publish
- Clone the website repo, configure the enviornment and open a terminal in it - https://github.com/yearn/yearn-finance-v3
- Run
yalc add @yfi/sdk
- Run
yarn install
- Run
yarn start