0.28.0 • Published 2 years ago

@undefiorg/defarm v0.28.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

DeFarm

Decode Defi Farm for human readable.

Features

  • ALPACA: fetchLendsBySymbols
  • CAKE: fetchFarmsWithAPRBySymbols
  • CAKE: fetchTokenUSDPricesBySymbols
  • ALPACA: USER Get user's active position with addition info.
  • CAKE: USER fetchPoolReward

TODO

  • ALPACA: USER Get account tx to get investment information.

Installation

npm

Development

npm dev

Test

npm test
npm test-dev

Release

npm login
npm run release

Example: USD Price

CAKE price from pancakeswap

import { pancakeswap } from '@undefiorg/defarm'
const results = await pancakeswap.fetchTokenUSDPricesBySymbols(['CAKE'])
console.log(results)

ALPACA, ETH, BNB prices from pancakeswap

import { pancakeswap } from '@undefiorg/defarm'
const results = await pancakeswap.fetchTokenUSDPricesBySymbols(['ALPACA', 'ETH', 'BNB'])
console.log(results)

ibALPACA price from pancakeswap

import { alpaca } from '@undefiorg/defarm'

// It's a good idea to check for supported symbols before calling fetchTokenUSDPricesBySymbols
const supportedSymbols = alpaca.getSupportedUSDSymbols()
console.log(supportedSymbols)

// Better use to fetch only supported `ibToken` prices
const [ibALPACA] = await alpaca.fetchTokenUSDPricesBySymbols(['ibALPACA'])
console.log(results)

Example: Farm's info

ALPACA lend info w/ price

import { alpaca } from '@undefiorg/defarm'
const results = await alpaca.fetchLendsBySymbols(['ALPACA'])
console.log(results)

CAKE-BNB pool info w/ price + APR

import { pancakeswap } from '@undefiorg/defarm'
const results = await pancakeswap.fetchFarmsWithAPRBySymbols(['CAKE-BNB LP'])
console.log(results)

Example: User's info

Get user balance

import { alpaca } from '@undefiorg/defarm'
const balances = await alpaca.fetchUserBalance('0x8155430e4860e791aeddb43e4764d15de7e0def1')
console.log(results)

Get user related farm info

import { alpaca } from '@undefiorg/defarm'
const lends = await alpaca.fetchUserLends('0x8155430e4860e791aeddb43e4764d15de7e0def1')
const stakes = await alpaca.fetchUserStakes('0x8155430e4860e791aeddb43e4764d15de7e0def1')

TODO

0.27.2

2 years ago

0.28.0

2 years ago

0.27.1

2 years ago

0.26.0

2 years ago

0.25.0

3 years ago

0.24.0

3 years ago

0.21.0

3 years ago

0.23.0

3 years ago

0.22.0

3 years ago

0.20.0

3 years ago

0.14.2

3 years ago

0.17.0

3 years ago

0.18.0

3 years ago

0.13.0

3 years ago

0.13.1

3 years ago

0.12.2

3 years ago

0.10.0

3 years ago

0.10.1

3 years ago

0.10.2

3 years ago

0.3.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.7.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago