An open API service indexing awesome lists of open source software.

https://github.com/yearn/yearn-sdk

🦧 SDK for the yearn.finance platform. WIP
https://github.com/yearn/yearn-sdk

defi ethereum sdk yearn

Last synced: over 1 year ago
JSON representation

🦧 SDK for the yearn.finance platform. WIP

Awesome Lists containing this project

README

          



# 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`