The NPM package to query DeFi.
Contribution guidelines can be found here.
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.
getAllChains()
getAllChainInfo()
getAllProjects()
getAllTokens()
getAllTokenPrices()
getNativeTokenPrices()
checkPrices()
getAllBalances(wallet)
query(address, abi, method, args)
queryBlocks(address, abi, event, querySize, args)
isAddress(address)
getTXCount(address)
getWalletBalance(wallet)
getProjectBalance(wallet, project)
getAllProjectBalances(wallet)
getNFTBalance(wallet)
getTokens()
getTokenLogo(symbol)
getGasEstimates()
getInfo()
getProjects()
getTokenPrices()
getTokenPrice(address, decimals)
updateTokenPrice(priceData)
checkPrices()
setCustomRpcEndpoints(rpcs)
getProviders()
The ETH chain also contains the resolveENS(name)
, lookupENS(address)
and fetchAvatarENS(name)
methods.
- ETH (Ethereum)
- BSC (Binance Smart Chain)
- POLY (Polygon)
- FTM (Fantom)
- AVAX (Avalanche)
- CRONOS (Cronos)
- OP (Optimism)
- ARB (Arbitrum)
The WeaverFi package also exports its typings, found in the types.ts
file.
If needed, these can be imported as follows:
import type { ChainID, Address, Token } from 'weaverfi';