dicegameapi
v1.0.14
Published
用法:
Downloads
1
Readme
gameapi
用法:
const network = {
blockchain:'eos',
protocol:'https',
host:'api-kylin.eosasia.one',
port:443,
chainId:"5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191"
}
const config = {
baseUrl:"",
walletType:"scatter", // required:false default:scatter values: scatter、tokenpacket、meetone
dappName:"dapp", // required:true
initTimeout:5000, // required:false default:5000 connect to scatter timeout
to:"" // Smart Contract
}
import GameApi from 'dicegameapi'
const Api = new GameApi(network,config)
// connect
Api.connect((connected)=>{})
// getIdentity
Api.getIdentity((error,account)=>{})
// forgetIdentity
Api.forgetIdentity()
// getBalance
Api.getBalance(accountName,(error,response)=>{})
// transfer
let params = {
from: string,
to: string,
count: number|string,
precision:4,
memo: string (eg:"57--")
}
Api.transfer(params,(error,response)=>{})
// transferWithRef
let params = {
from: string,
to: string,
count: number|string, // 投注金额
num:"57", // 投注数
refer: string, // 推荐人
seed: string // 种子
}
Api.transferWithRef(params,(error,response)=>{})
/**
* 每小时排行榜
* timestamp:整点时间戳(精确到秒)
*/
Api.getHoursSort(timestamp)
.then((response)=>{})
.catch(error=>{})
// 获取分红的余额
Api.getChessBalance(accountName,(error,response)=>{})
// 查询当前分红奖池EOS余额
Api.getShareOutEOS((error,response)=>{})
// 查询总质押金额
Api.getTotalStake((error,response)=>{})
// 查询当前用户质押金额
Api.getCurrentStake(accountName,(error,response)=>{})
// 查询我的CHESS代币金额
Api.getMyChessBalance(accountName,(error,response)=>{})
// 查询我的赎回中的CHESS代币金额
Api.getMyUnstakeBalance(accountName,(error,response)=>{})
// CHESS代币总流通量
Api.getChessTotalCirculation((error,response)=>{})
// 查询我的可领取分红余额
Api.getMyEnableShareBalance(accountName,(error,response)=>{})
// 查询往期分红记录
let params = {
lower_bound:1547568000, // N天前整点分红时间的UTC(每天上午十点整数)
upper_bound:1547571600, // 下一个整点分红时间的UTC
limit:10 // 查询条数
}
Api.getHistoryShareBalance(params,(error,response)=>{})
// 抵押(stake)操作
let params = {
accountName:"", // type string
amount:100 // type number
}
Api.stake(params,(error,response)=>{})
// 赎回(unstake)操作
let params = {
accountName:"", // type string
amount:100 // type number
}
Api.unStake(params,(error,response)=>{})
// 领取分红(claim)操作
Api.getClaim(accountName,(error,response)=>{})