0xbageltoes / weaverfi

The NPM package to query DeFi.

Home Page:https://weaver.fi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WeaverFi Banner

The NPM package to query DeFi.

CodeQL Version Downloads

NodeJS TypeScript

Twitter Shield

Contributing

Contribution guidelines can be found here.

Usage

Install the package using the following:

npm i weaverfi

Importing the package can be done through the following:

import weaver from 'weaverfi'

Other options to suit different app configurations:

import WeaverFi from 'weaverfi'
import { WeaverFi } from 'weaverfi'
const weaver = require('weaverfi').default

The WeaverFi object (or weaver if you prefer to import it that way) contains some global methods such as WeaverFi.getAllProjects(), WeaverFi.getAllTokens() or WeaverFi.getAllTokenPrices().

Each supported chain has its own methods that can be used as WeaverFi.ETH.getWalletBalance(wallet), for example.

Global Methods Available

  • getAllChains()
  • getAllChainInfo()
  • getAllProjects()
  • getAllTokens()
  • getAllTokenPrices()
  • getNativeTokenPrices()
  • fetchPrices()
  • getAllBalances(wallet)

Chain Methods Available

  • query(address, abi, method, args)
  • isAddress(address)
  • getTXCount(address)
  • getWalletBalance(wallet)
  • getProjectBalance(wallet, project)
  • getAllProjectBalances(wallet)
  • getNFTBalance(wallet)
  • getTokens()
  • getTokenLogo(symbol)
  • getGasEstimates()
  • getInfo()
  • getProjects()
  • getTokenPrices()
  • getTokenPrice(address)
  • updateTokenPrice(priceData)
  • fetchPrices()

The ETH chain also contains the resolveENS(name), lookupENS(address) and fetchAvatarENS(name) methods.

Chains Supported

  • ETH (Ethereum)
  • BSC (Binance Smart Chain)
  • POLY (Polygon)
  • FTM (Fantom)
  • AVAX (Avalanche)
  • ONE (Harmony)
  • CRONOS (Cronos)
  • OP (Optimism)
  • ARB (Arbitrum)

Types

Any extra types used within the SDK are located in the types.ts file.

If needed, these can be imported from weaverfi/dist/types. Example:

import type { ChainID, Address, Token } from 'weaverfi/dist/types';

About

The NPM package to query DeFi.

https://weaver.fi

License:MIT License


Languages

Language:TypeScript 99.4%Language:JavaScript 0.6%