跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.lfg.rich/llms.txt

Use this file to discover all available pages before exploring further.

构建机器人、仪表盘、自定义发行页面、交易工具或钱包集成时,可以使用这些协议示例。

协议合约示例

查看用于估算、买入、卖出、借贷、borrowMore 和还款的 Viem、Ethers 与 Python/Web3.py 示例。

合约参考

查看已部署合约地址和 ABI 页面。

API 参考

查看代币、交易、K 线和协议配置的公共 REST API 端点。

获取最新代币

const res = await fetch('https://lfg.rich/api/bsc/tokens?sort=latest&page=1&limit=20');
const json = await res.json();

if (!json.success) {
  throw new Error('Failed to fetch tokens');
}

console.log(json.data);

获取一个代币及其交易

const tokenAddress = '0x29Ede1E1254419Fe5a3c803fC2b015042075A49A';

const [tokenRes, tradesRes] = await Promise.all([
  fetch(`https://lfg.rich/api/bsc/tokens/${tokenAddress}`),
  fetch(`https://lfg.rich/api/bsc/tokens/${tokenAddress}/trades?page=1&limit=25`)
]);

const token = await tokenRes.json();
const trades = await tradesRes.json();

console.log(token.data);
console.log(trades.data);

获取 K 线

const tokenAddress = '0x29Ede1E1254419Fe5a3c803fC2b015042075A49A';

const res = await fetch(
  `https://lfg.rich/api/bsc/tokens/${tokenAddress}/candles?interval=5m&limit=100`
);

const json = await res.json();
console.log(json.data);

获取协议配置

const res = await fetch('https://lfg.rich/api/bsc/tokens/config/contracts');
const json = await res.json();

console.log(json.data);