-
Notifications
You must be signed in to change notification settings - Fork 15
API
ekko edited this page Oct 31, 2023
·
8 revisions
获取单个ERC20基本资料
import {getBaseData} from "dandao"
let baseData = await getBaseData(address:string, chainId:number)
baseData{
name: string,
chain_id: number,
symbol: string,
decimals: number,
totalSupply: string,
owner: string
contractAddr: string
}
批量获取ERC20基本资料
import {batchGetBaseData} from "dandao"
let baseDatas = await batchGetBaseData(address:string[], chainId:number)
baseDatas{
name: string,
chain_id: number,
symbol: string,
decimals: number,
totalSupply: string,
owner: string
contractAddr: string
}[]
批量获取ERC20合约详细信息
import {addContract} from "dandao"
let contracts = await addContract(addresses:string[], chainId:number)
contracts{
chain_id: number,
name: string,
symbol: string,
decimals: string | number,
total_supply: string | number,
owner: string,
address: string,
is_add_liquidity: number,
is_remove_liquidity: number,
is_get_swap_fee: number,
pools: string,
liquidity_pools: any,
reserve0: string | number,
first_price: string,
liquidity_total: string | number,
creator: string,
update_time: number,
create_time: number,
buy_fee?: number,
sell_fee?: number,
block_number?: number,
jsonPools?: any,
LiquidityPools?: any,
Token?: Token,
}[]
获取ERC20 holder
import {getAllHolder} from "dandao"
insertItem{
chain_id: number,
name: string,
symbol: string,
decimals: string | number,
total_supply: string | number,
owner: string,
address: string,
is_add_liquidity: number,
is_remove_liquidity: number,
is_get_swap_fee: number,
pools: string,
liquidity_pools: any,
reserve0: string | number,
first_price: string,
liquidity_total: string | number,
creator: string,
update_time: number,
create_time: number,
buy_fee?: number,
sell_fee?: number,
block_number?: number,
jsonPools?: any,
LiquidityPools?: any,
Token?: Token,
}
let holders = await getAllHolder(contract:insertItem, chainId:number)
holders{
address:string,
balance:string,
percent:number
}[]
快速获取ERC20 token 价格
import {fastGetPrice} from "dandao"
let price = await fastGetPrice(address:string, chainId:number)
price{
price:{
ETH:string,
[symbol]:string
}||undefind,
decimals:number
}
获取ERC20初始价格
import {getFirstPrice} from "dandao"
insertItem{
chain_id: number,
name: string,
symbol: string,
decimals: string | number,
total_supply: string | number,
owner: string,
address: string,
is_add_liquidity: number,
is_remove_liquidity: number,
is_get_swap_fee: number,
pools: string,
liquidity_pools: any,
reserve0: string | number,
first_price: string,
liquidity_total: string | number,
creator: string,
update_time: number,
create_time: number,
buy_fee?: number,
sell_fee?: number,
block_number?: number,
jsonPools?: any,
LiquidityPools?: any,
Token?: Token,
}
let result = await getFirstPrice(contract: insertItem)
result{
price: string,
poolBalance: string,
firstBlockNumber: number
}
快速获取 ERC20 token 卖出 ETH 数量
import {fastGetAmountOut} from "dandao"
let amoutOut= await fastGetAmountOut(address:string, amountOut:bigNumber string, chainId:number)
amoutOut: bigNumebr string || ""
快速获取 ETH 买入 ERC20 token 数量
import {fastGetAmountIn} from "dandao"
let amoutIn= await fastGetAmountIn(address:string, amountIn:bigNumber string, chainId:number)
amoutIn: bigNumebr string || ""
批量获取eth地址ens名称
import {batchQueryENSname} from "dandao"
let names = await batchQueryENSname(addresses:string[])
names: <string name || string undefind>[]
批量获取地址eth余额
import {batchCheckBalance} from "dandao"
let balances = await batchCheckBalance(addresses:string[], chainId:number)
balances{
contractAddr: string;
addr: string;
decimals: number;
balance: string;
}[]
批量获取地址ERC20余额
import {batchCheckERC20Balance} from "dandao"
checkERC20Item{
contractAddr: string,
owner: string
}
let balances = await batchCheckERC20Balance(checkERC20Items: checkERC20Item[], chainId: number)
balances{
contractAddr: string;
addr: string;
decimals: number;
balance: string;
}[]
批量mint铭文代币
import {batchMintEths} from "dandao"
let result = await batchMintEths(chainId: number, id:number(erc20的id), name:string, amt:number, count:number(需要mint的数量),privateKey:string)
result boolean