Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@badger-dao/sdk

Badger-Finance8.6kMIT1.23.0TypeScript support: included

Badger Protocol Typescript SDK

badger, defi, sdk

readme

Badger SDK

BadgerDAO is a decentralized autonomous organization focused on bringing Bitcoin to DeFi. The Badger SDK provides easy access to the Badger Protocol on any chain, as well as fast access to the Badger API for JavaScript applcations.

Version License Service Tests semantic-release: angular

Documentation

Installation

Install the package:

yarn add @badger-dao/sdk

Getting Started

Utilizing the SDK requires an RPC provider:

import BadgerSDK, { Network } from '@badger-dao/sdk';

const sdk = new BadgerSDK({
  network: Network.Ethereum,
  provider: 'https://eth-archival.gateway.pokt.network/v1/lb/<APP_ID>',
  graphURL: '<Graph API URl>', // optional
});

Or, utilizing the API requires only a network input:

import { BadgerAPI, Network } from '@badger-dao/sdk';

const api = new BadgerAPI({ network: Network.Ethereum });

await api.loadPrices();

Badger subgraph is also available for use:

import { BadgerGraph, Network } from '@badger-dao/sdk';

const subgraph = new BadgerGraph({
  network: Network.Ethereum,
  baseURL: '<Graph API URl>', // optional
});

await subgraph.loadSetts({
  orderBy: 'id',
  orderDirection: 'asc',
});

Development

Consider to use package lock file, while installing node dependencies:

yarn install --frozen-lockfile
# This will auto-generete contracts and the graph code
# for further development
yarn init:sdk

General knowledge for contributing to the repository is kept in Documentation.

Some topics covered include:

Releasing new version

Releases are determined by the commit messages. Commits beginning with fix: will release a new patch version, commits beginning with feat: will release a new minor version, and commits beginning with BREAKING CHANGE: will release a new major version. The action will run on a push to main.

changelog

1.23.0 (2023-05-31)

Features

  • badger sdk accepting graph api url (86b67cb)

1.22.1 (2023-02-24)

Bug Fixes

  • clean tests output, add export for governance module (ec7cf12)

1.22.0 (2023-02-16)

Features

  • featch governance addr from registry (90fda07)

1.21.1 (2022-12-25)

Bug Fixes

  • update governance types for relevant TimeLock events (e5cf870)

1.21.0 (2022-12-19)

Bug Fixes

Features

  • update governance contract abi with relevant data (bf3badd)

1.20.8 (2022-12-15)

Bug Fixes

1.20.7 (2022-12-12)

Bug Fixes

  • allow null in decodedCallData if empty (e75cde9)

1.20.6 (2022-12-12)

Bug Fixes

1.20.5 (2022-12-06)

Bug Fixes

1.20.4 (2022-12-06)

Bug Fixes

1.20.2 (2022-12-05)

Bug Fixes

  • governance typing, plus decoded data (4035f93)

1.20.1 (2022-11-29)

Bug Fixes

  • correct typo in param for governance list in api service (d92e7bb)

1.20.0 (2022-11-21)

Features

  • governance proposals methods in api service (d374fb7)

1.19.1 (2022-11-10)

Bug Fixes

1.19.0 (2022-11-09)

Features

  • add governance service to sdk (2dd2e09)

1.18.15 (2022-10-28)

Bug Fixes

  • update vault deposit attempt (1a863a8)

1.18.14 (2022-10-19)

Bug Fixes

  • update connector init paths (2d9baaf)

1.18.13 (2022-09-26)

Bug Fixes

1.18.12 (2022-09-22)

Bug Fixes

  • avoid overwriting production vaults with development definitions (755a042)

1.18.11 (2022-09-15)

Bug Fixes

  • allow development vaults on load (8040260)

1.18.10 (2022-09-13)

Bug Fixes

  • allow registry acl lookups (574f6a9)

1.18.9 (2022-09-13)

Bug Fixes

  • update vault snapshot base object (fc92bb3)

1.18.8 (2022-09-12)

Bug Fixes

1.18.7 (2022-09-12)

Bug Fixes

1.18.6 (2022-09-10)

Bug Fixes

1.18.5 (2022-09-08)

Bug Fixes

  • update api mocks for harvest endpoints (7a5b428)

1.18.4 (2022-09-08)

Bug Fixes

  • update mocks witch yield txs (09d81fb)

1.18.3 (2022-09-08)

Bug Fixes

  • add created at block to query (6504bdc)

1.18.2 (2022-09-08)

Bug Fixes

1.18.1 (2022-09-07)

Bug Fixes

1.18.0 (2022-09-07)

Bug Fixes

  • update snapshots (ff4685c)
  • update tests snapshot with real txs (d12be9b)

Features

  • add txs string to vault performance events (2f632ab)

1.17.11 (2022-09-07)

Bug Fixes

  • update interfaces to support multi versioned api (1ecc0ee)

1.17.10 (2022-09-01)

Bug Fixes

1.17.9 (2022-09-01)

Bug Fixes

1.17.8 (2022-09-01)

Bug Fixes

  • update overrides inputs + update mocks (7f42082)

1.17.7 (2022-09-01)

Bug Fixes

  • support call overrides on read methods (e92b0b2)

1.17.6 (2022-08-24)

Bug Fixes

  • utilize read only provider (6a87312)

1.17.5 (2022-08-23)

Bug Fixes

  • update vault method inputs (74f2d51)

1.17.4 (2022-08-22)

Bug Fixes

1.17.3 (2022-08-18)

Bug Fixes

  • check for registry before attempting to load vaults (20f4f3b)

1.17.2 (2022-08-12)

Bug Fixes

  • align ethers + 0xsequence dependencies (f71dffa)
  • rollback sequence packages (921cf10)

1.17.1 (2022-08-11)

Bug Fixes

1.17.0 (2022-08-10)

Bug Fixes

  • make metadata required for registryVaults (c632ebf)

Features

  • remove old registry, replace it with V2, typings etc (7a0c770)

1.16.11 (2022-08-08)

Bug Fixes

1.16.10 (2022-08-08)

Bug Fixes

1.16.9 (2022-08-08)

Bug Fixes

1.16.8 (2022-08-08)

Bug Fixes

  • allow method to mock sdk provider (261e358)
  • separate yield data (5be40c1)

1.16.7 (2022-07-31)

Bug Fixes

  • update interface + lint (621fb6d)

1.16.6 (2022-07-29)

Bug Fixes

  • remove 404 bad handling (ad27437)

1.16.5 (2022-07-22)

Bug Fixes

  • append version path to value query (4b46eab)

1.16.4 (2022-07-22)

Bug Fixes

  • check if error is caused by user rejection (570148e)
  • show prompt only if contract call doesn't fail (7b87c75)

1.16.3 (2022-07-19)

Bug Fixes

  • update dig gmocks, update inputs (b92495f)

1.16.2 (2022-07-14)

Bug Fixes

  • allow flexible base url (68fd3d0)

1.16.1 (2022-07-14)

Bug Fixes

1.16.0 (2022-07-14)

Features

  • add v3 charting endpoint (b51995c)

1.15.21 (2022-07-14)

Bug Fixes

1.15.20 (2022-07-12)

Bug Fixes

  • use spread for overrides (2243497)

1.15.19 (2022-07-12)

Bug Fixes

  • reinstate connector logic (be52241)

1.15.18 (2022-07-12)

Bug Fixes

1.15.17 (2022-07-12)

Bug Fixes

  • update vault cap look up query (26f9d68)

1.15.16 (2022-07-12)

Bug Fixes

  • allow allowance fallback (b807053)

1.15.15 (2022-07-09)

Bug Fixes

  • prevent immediate initialization (677f3df)

1.15.14 (2022-07-05)

Bug Fixes

  • change connector resolver (500a79e)

1.15.13 (2022-06-30)

Bug Fixes

  • update query filter size (878a9cf)

1.15.12 (2022-06-28)

Bug Fixes

1.15.11 (2022-06-28)

Bug Fixes

  • add vault + price snapshot support (fa91b77)

1.15.10 (2022-06-27)

Bug Fixes

1.15.9 (2022-06-27)

Bug Fixes

  • add vault harvest query support (e2ebcd5)

1.15.8 (2022-06-24)

Bug Fixes

  • utlize proper rpc for token changes (4551ee0)

1.15.7 (2022-06-24)

Bug Fixes

  • check withdraw amounts (81edef0)
  • rename fields + update methods (42ec6fe)
  • update naming, improve estimate function (fb276d9)

1.15.6 (2022-06-23)

Bug Fixes

  • update example for release trigger (24b56dc)

1.15.5 (2022-06-23)

Bug Fixes

  • add initial ibbtc integration methods (18d8eca)

1.15.4 (2022-06-21)

Bug Fixes

1.15.3 (2022-06-20)

Bug Fixes

  • add registryVaults interfaces to index for exp (2ab2436)
  • add regV2 metadata in vaults service calls (a096a7b)
  • import statement (d7b1d29)

1.15.2 (2022-06-20)

Bug Fixes

  • upgrade claim for ui usage (e86d56f)

1.15.1 (2022-06-19)

Bug Fixes

1.15.0 (2022-06-19)

Features

  • add date fields to gql scheme for vaults (8035661)

1.14.2 (2022-06-16)

Bug Fixes

1.14.1 (2022-06-14)

Bug Fixes

  • add client field to regV2 metadata (8d95031)

1.14.0 (2022-06-08)

Features

  • expose rich ui compatible deposit + withdraw (3f5013f)

1.13.4 (2022-06-07)

Bug Fixes

  • update account interface extension fields (f92f14f)

1.13.3 (2022-06-06)

Bug Fixes

  • add total supply at epoch (26a79a6)

1.13.2 (2022-06-06)

Bug Fixes

  • citadel support ovverride (e6618ed)

1.13.1 (2022-06-05)

Bug Fixes

  • update entry field name (f708ac9)

1.13.0 (2022-06-03)

Bug Fixes

Features

  • registryV2 service integration (673afb6)

1.12.1 (2022-06-03)

Bug Fixes

  • update citadel locker addr (09e4434)

1.12.0 (2022-06-03)

Features

1.11.3 (2022-05-23)

Bug Fixes

1.11.2 (2022-05-23)

Bug Fixes

1.11.1 (2022-05-16)

Bug Fixes

  • add digg balance to account interface (c536720)

1.11.0 (2022-05-12)

Features

  • add digg balance to user boost data interface (78c5172)

1.10.5 (2022-05-09)

Bug Fixes

  • add initial citadel api interface (67ccc4f)

1.10.4 (2022-05-09)

Bug Fixes

  • enable token service allowance checks and increases (50965bd)

1.10.3 (2022-05-09)

Bug Fixes

  • update protocols enumeration (74c774f)

1.10.2 (2022-05-06)

Bug Fixes

  • update citadel locker address (1e38932)

1.10.1 (2022-05-06)

Bug Fixes

  • update time frame options (3e59a49)

1.10.0 (2022-05-05)

Features

  • citadel last epoch ix method (e125304)

1.9.8 (2022-05-05)

Bug Fixes

1.9.7 (2022-05-04)

Bug Fixes

  • add citadel account endpoint (b1542c3)

1.9.6 (2022-05-04)

Bug Fixes

  • add getCumulativeClaimedRewards method (603b17c)
  • add getCumulativeClaimedRewards method (400a030)

1.9.5 (2022-05-04)

Bug Fixes

  • add has registry check (a6275d0)
  • remove code deb + add mocks gen (f3bd5d8)

1.9.4 (2022-05-03)

Bug Fixes

1.9.3 (2022-05-02)

Bug Fixes

  • add mocks generation + better handle mock failure logging (9dd6607)

1.9.2 (2022-05-02)

Bug Fixes

  • add citadel summary api support (34409a7)

1.9.1 (2022-05-02)

Bug Fixes

  • update citadel public vars (06e9063)

1.9.0 (2022-04-30)

Features

  • citadel rw data enum, lil service cleanup (bf8fc0e)

1.8.3 (2022-04-28)

Bug Fixes

  • extend citadel treasury summary (ae158ed)

1.8.2 (2022-04-28)

Bug Fixes

1.8.1 (2022-04-28)

Bug Fixes

1.8.0 (2022-04-27)

Features

  • extand citadel rewards with new data, upd abi (6d57c25)

1.7.4 (2022-04-26)

Bug Fixes

1.7.3 (2022-04-26)

Bug Fixes

1.7.2 (2022-04-25)

Bug Fixes

  • add funding rate support (7a56645)

1.7.1 (2022-04-24)

Bug Fixes

1.7.0 (2022-04-22)

Features

  • citadel: citadel service (6e140fa)

1.6.1 (2022-04-21)

Bug Fixes

  • add citadel base api patch (69c954d)

1.6.0 (2022-04-15)

Features

1.5.9 (2022-04-14)

Bug Fixes

  • vaults list harvest and deployed at script (ce52e61)

1.5.8 (2022-04-13)

Bug Fixes

1.5.7 (2022-04-08)

Bug Fixes

  • include dirs to npm publish for mocks.pkg (c04ae17)

1.5.6 (2022-04-08)

Bug Fixes

  • sync sdk and sdk.mocks versions (c603bc7)

1.5.5 (2022-04-08)

Bug Fixes

  • degrade semantic relese bot, for old monorepo plugin (c82caf4)

1.5.4 (2022-04-08)

Bug Fixes

  • git flow for build-mocks (67e8bc0)
  • update main branch on build-mocks (7c0341a)

1.5.3 (2022-04-08)

Bug Fixes

  • semantic release for mocks.pkg (166fb6d)

1.5.1 (2022-04-05)

Bug Fixes

  • add error logging for request failures + remove load schedule query param (126fc34)

1.5.0 (2022-04-05)

Features

  • @badger-dao/sdk-mocks package (1a5a161)
  • cache done, loading method, env rpc nodes (3582858)
  • eth args cfg complited, typo fixed, roadmap update (8cd9df3)
  • mocks.gen for eth cfg, readme, hook, ignore mehtods (db55494)
  • processor entry, configs for methods args, cache layer etc (c661ec0)
  • upd cls map, eth cfg, fs with mkdir, fixes (69b2b42)

1.4.1 (2022-03-28)

Bug Fixes

  • add missing aum fee to strategy (83f4ee5)

1.4.0 (2022-03-28)

Features

  • implement returing strategy addr from getVaultStrategy (068b41b)

1.3.11 (2022-03-27)

Bug Fixes

1.3.10 (2022-03-25)

Bug Fixes

1.3.9 (2022-03-24)

Bug Fixes

1.3.8 (2022-03-24)

Bug Fixes

  • add rewards initial prep + harvest caller (0289b2e)

1.3.7 (2022-03-24)

Bug Fixes

  • remove vault version check (2f70206)

1.3.6 (2022-03-24)

Bug Fixes

  • allow unregistered vault queries (ceab137)

1.3.5 (2022-03-24)

Bug Fixes

  • token service fragile method update (3ce77c3)

1.3.4 (2022-03-22)

Bug Fixes

1.3.3 (2022-03-22)

Bug Fixes

  • update snapshot for strategy tracking (9a87688)

1.3.2 (2022-03-21)

Bug Fixes

  • add historic snapshot apr (ff23904)

1.3.1 (2022-03-21)

Bug Fixes

  • update vault projection interface (c1571cc)

1.3.0 (2022-03-21)

Bug Fixes

  • update vaultdto imports (45bb67f)

Features

  • enable contracts exports (be9b768)

1.2.13 (2022-03-20)

Bug Fixes

  • add support for pending harvests (6f85d67)

1.2.12 (2022-03-20)

Bug Fixes

  • add vault performance tests (5abbe44)

1.2.11 (2022-03-15)

Bug Fixes

  • address bsc graph name edge case (45184be)

1.2.10 (2022-03-14)

Bug Fixes

  • update chart vault snapshot interface (01f35e1)

1.2.9 (2022-03-14)

Bug Fixes

  • add vault apr to chart + add event parse test (4d08662)

1.2.8 (2022-03-14)

Bug Fixes

  • add vault interaction functions (196dd4a)

1.2.7 (2022-03-14)

Bug Fixes

1.2.6 (2022-03-11)

Bug Fixes

  • completion percent for reward schedules (bcc301f)
  • extend rw schedules with completion percent (ffd4736)
  • spelling typo (89ec8a9)

1.2.5 (2022-03-11)

Bug Fixes

  • export vault interface + remove duplicate postfix (acaf104)

1.2.4 (2022-03-11)

Bug Fixes

  • update charts endpoint params + update value source vars (cea3620)

1.2.3 (2022-03-10)

Bug Fixes

  • add strategy balance to fragment (67eb6cb)
  • revert reference graph api (69c4c17)

1.2.2 (2022-03-09)

Bug Fixes

  • change dca boolean to generalized behavior (36fa4b9)

1.2.1 (2022-03-07)

Bug Fixes

1.2.0 (2022-03-07)

Bug Fixes

  • disable commit hooks for ci (e55ab36)
  • Remove unused chain parameter from /metrics (aa546a1)
  • Use path parameter for address in /proofs (eff19a4)

Features

  • complete support for badfer api-v2 (29c258d)

1.1.3 (2022-03-02)

Bug Fixes

1.1.2 (2022-03-02)

Bug Fixes

  • allow updating network + provider, add options constructors (f42d192)

1.1.1 (2022-03-01)

Bug Fixes

  • allow updating network + provider, add options constructors (8a4c2bc)

1.1.0 (2022-02-28)

Bug Fixes

  • format release action yaml properly (35c1029)

Features

  • use semantic-release and gha to automate releases to npm (658c420)

1.0.0 (2022-02-28)

Bug Fixes

  • add initialization error handling (0ebe6a2)
  • broken config on init (5ed2821)
  • compilation failure (cab8c18)
  • format release action yaml properly (35c1029)
  • remove dist import (c765a00)
  • remove lib import (0fe81ae)
  • update ci, refactor types (ffc7ece)
  • update gitignore, fix config initializations (fb42507)

Features

  • add registry check (0039131)
  • enable sdk lazy init (5dea0b7)
  • load vaults information from chain (2dc0ec0)
  • sdk: Add method to list harvests and tree events (31337ba)
  • support new leaderboards api (bc313ab)
  • update vault performance response (9a046da)
  • use semantic-release and gha to automate releases to npm (658c420)