1.0.2 • Published 3 years ago
defillama-api v1.0.2
Defillama API
A javascript wrapper around the defillama api. Complete with docs and tests.
Install
npm install defillama-apiGet started
import defillama from "defillama-api";
const response = await defillama.tvl.protocols();
const data = await response.json();API documentation
API overview
The defillama api consists of different categories. Each of these categories can be acccessed with their matching name.
Categories
- TVL
- coins
- stablecoins
- yields
- abi-decoder
- bridges
- volumes
- fees and revenue
Mapping
TVL
defillama.tvl.protocols()- /protocolsdefillama.tvl.protocol(protocol)- /protocols/{protocol}defillama.tvl.current(protocol)- /tvl/{protocol}defillama.tvl.chainsHistorical()- /v2/historicalChainTvldefillama.tvl.chainHistorical(chain)- /v2/historicalChainTvl/{chain}defillama.tvl.charts()- /chartsdefillama.tvl.chainCharts(chain)- /charts/{chain}defillama.tvl.chains()- /chains
coins
defillama.coins.pricesCurrent()- /protocolsdefillama.coins.pricesFirst(protocol)- /protocols/{protocol}defillama.coins.pricesHistorical(protocol)- /tvl/{protocol}defillama.coins.chart()- /v2/historicalChainTvldefillama.coins.percentage(chain)- /v2/historicalChainTvl/{chain}defillama.coins.block()- /charts
stablecoins
defillama.stablecoins.all(params)- /stablecoinsdefillama.stablecoins.chartAll(params)- /stablecoincharts/alldefillama.stablecoins.historyChain(chain, params)- /stablecoincharts/{chain}defillama.stablecoins.historyAsset(stablecoinId)- /stablecoin/{stablecoinId}defillama.stablecoins.overviewChains(chain)- /stablecoinchainsdefillama.stablecoins.historyPrices()- /stablecoinprices
yields
defillama.yields.pools()- /poolsdefillama.yields.chartPool(pool)- /chart/{pool}
abi-decoder
defillama.abiDecoder.getABI(params)- /fetch/signaturedefillama.abiDecoder.getVerboseABI(chain, address, params)- /fetch/contract/{chain}/{address}
bridges
defillama.bridges.all(params)- /bridgesdefillama.bridges.summary(bridgeId)- /bridge/{bridgeId}defillama.bridges.historyVolume(chain, params)- /bridgevolume/{chain}defillama.bridges.statsDay(timestamp, chain, params)- /bridgedaystats/{timestamp}/{chain}defillama.bridges.transactions(id, params)- /transactions/{id}
volumes
defillama.volumes.dexsAll(params)- /overview/dexsdefillama.volumes.dexsChain(chain, params)- /overview/dexs/{chain}defillama.volumes.dexsProtocol(protocol, params)- /summary/dexs/{protocol}defillama.volumes.dexsOptions(params)- /overview/optionsdefillama.volumes.dexsOptionsChain(chain, params)- /overview/options/{chain}defillama.volumes.dexsOptionsProtocol(protocol, params)- /summary/options/{protocol}
fees and revenue
defillama.feesRevenue.all(params)- /overview/feesdefillama.feesRevenue.chain(chain, params)- /overview/fees/{chain}defillama.feesRevenue.protocol(protocol, params)- /summary/fees/{protocol}
Contributing
Defillama is shipping fast and things will change, if you see new or changed things, feel free to open an issue and/or contribute.
Other things that need to happen:
- Add CI.
- If needed, more tests.