UNPKG

@yfi/sdk

Version:

Interaction framework for the yearn protocol

70 lines (48 loc) 2.13 kB
<span> <img align="right" src="https://raw.githubusercontent.com/yearn/yearn-sdk/master/.github/media/sdk.png" height="150" /> </span> # Yearn SDK [![CI](https://github.com/nymmrx/yearn-sdk/workflows/CI/badge.svg)](https://github.com/nymmrx/yearn-sdk/actions?query=workflow%3ACI) [![Styled With Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://prettier.io/) ## Getting Started ### Installation ``` npm i @yfi/sdk ``` ### Configuration/Usage 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) }); ``` ## Documentation Autogenerated documentation can be found [here](https://yearn.github.io/yearn-sdk). ## Helpful links - 🌐 [Live site](https://yearn.finance) - ⚖️ [Governance forum](https://gov.yearn.finance) - 📑 [Documentation](https://docs.yearn.finance) ## Contributing - Code style follows prettier conventions (`yarn lint`). Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). - PR conventions should follow our guidelines outlined at https://github.com/yearn/yearn-sdk/wiki/PR-conventions ## Releasing the SDK to npmjs - 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 ## Debug the website with a local copy of the sdk - 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`