npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

crypto-plant-utils-test-stage

v0.0.17

Published

~~~~ import {EpochPriceRank as _EpochPriceRank,initializeEnv} from 'xxx'

Downloads

1

Readme

使用说明

####1. 纪元涨跌幅排名系列api

  import {EpochPriceRank as _EpochPriceRank,initializeEnv} from 'xxx'

  initializeEnv(97) // 97/56  必须先初始化环境,否则影响后续合约配置

  const EpochPriceRank = new _EpochPriceRank()

  // EpochPriceRank.funcRequestEpoch().then((res) => console.info(res))
  // EpochPriceRank.funcGetCurrentEpoch().then((res) => console.info(res))
  // EpochPriceRank.funcHistoryEpochsOf(0,0).then((res) => console.info(res))
  // EpochPriceRank.funcGetHistoryEpochAt(0).then((res) => console.info(res))
  // EpochPriceRank.funcGetAssetLen().then((res) => console.info(res))
  // EpochPriceRank.funcGetAssetsIDs().then((res) => console.info(res))
  // EpochPriceRank.funcGetResourceBalanceOf(account).then((res) => console.info(res))
(1) 开启一个新纪元

入口函数:EpochPriceRank.funcRequestEpoch(account)

需要参数:
account:string

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcRequestEpoch(account)

  // your code...
}

调用方式二:
EpochPriceRank.funcRequestEpoch(account).then((res) => {
  // your code...
})

返回值:true/false 开启纪元成功/失败
(2) 查询当前纪元状态

入口函数:EpochPriceRank.funcGetCurrentEpoch()

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetCurrentEpoch()

  // your code...
}

调用方式二:
EpochPriceRank.funcGetCurrentEpoch().then((res) => {
  // your code...
})

返回值:
{
    currBlockNumber:	当前区块编号,纪元倒计时区块可以使用
    current:
      {
        startBlock:	纪元开始区块
        endBlock:	纪元结束区块
        rank:	    涨幅排序第几的是最终税金获得者
        assetIdx:	rank的资产位置
        startPrice:	纪元开始时价格
        endPrice:	纪元结束时价格
        change:	涨跌幅
        epoch:	纪元编号
      }
}
(3) 批量查询历史纪元数据

入口函数:EpochPriceRank.funcHistoryEpochsOf(startIndex,endIndex)

需要参数:
startIndex: number
endIndex: number--------->默认0

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcHistoryEpochsOf(startIndex,endIndex)

  // your code...
}

调用方式二:
EpochPriceRank.funcHistoryEpochsOf(startIndex,endIndex).then((res) => {
  // your code...
})

返回值:
[{
    startBlock:	纪元开始区块
    endBlock:	纪元结束区块
    rank:	涨幅排序第几的是最终税金获得者
    assetIdx:	rank的资产位置
    startPrice:	纪元开始时价格
    endPrice:	纪元结束时价格
    change:	涨跌幅
    epoch:	纪元编号
}]
(4) 查询指定纪元信息

入口函数:EpochPriceRank.funcGetHistoryEpochAt(idx)

需要参数:
idx:number

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetHistoryEpochAt(idx)

  // your code...
}

调用方式二:
EpochPriceRank.funcGetHistoryEpochAt(idx).then((res) => {
  // your code...
})

返回值:
{
    startBlock:	纪元开始区块
    endBlock:	纪元结束区块
    rank:	涨幅排序第几的是最终税金获得者
    assetIdx:	rank的资产位置
    startPrice:	纪元开始时价格
    endPrice:	纪元结束时价格
    change:	涨跌幅
    epoch:	纪元编号
}
(5) 历史纪元总数

入口函数:EpochPriceRank.funcGetEpochLen()

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetEpochLen()

  // your code...
}

调用方式二:
EpochPriceRank.funcGetEpochLen().then((res) => {
  // your code...
})

返回值:
一个数字
(6) 查询资产数量

入口函数:EpochPriceRank.funcGetAssetLen()

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetAssetLen()

  // your code...
}

调用方式二:
EpochPriceRank.funcGetAssetLen().then((res) => {
  // your code...
})

返回值:
一个数字
(7) 查询所有的资产ID

入口函数:EpochPriceRank.funcGetAssets()

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetAssets()

  // your code...
}

调用方式二:
EpochPriceRank.funcGetAssets().then((res) => {
  // your code...
})

返回值:
[number,number,...]
(8) 查询用户资源余额

入口函数:EpochPriceRank.funcGetAssets(account)

需要参数:
account:string

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetAssets(account)

  // your code...
}

调用方式二:
EpochPriceRank.funcGetAssets(account).then((res) => {
  // your code...
})

返回值:
[number,number,...]
(9) 注册(生成游戏编号)

入口函数:EpochPriceRank.funcRegisterGameAcc(account)

需要参数:
account:string

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcRegisterGameAcc(account)

  // your code...
}

调用方式二:
EpochPriceRank.funcRegisterGameAcc(account).then((res) => {
  // your code...
})

返回值:
[hash, status]
(10) 查询用户类型和编号

入口函数:EpochPriceRank.funcGetPlayerInfo(account)

需要参数:
account:string

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetPlayerInfo(account)

  // your code...
}

调用方式二:
EpochPriceRank.funcGetPlayerInfo(account).then((res) => {
  // your code...
})

返回值:
{
    types:0/1/2/3, 
    playerNo:number
}
(11) 查询用户编号

入口函数:EpochPriceRank.funcGetPlayerNo(account)

需要参数:
account:string

调用方式一:
const func = async () => {
  const res = await EpochPriceRank.funcGetPlayerNo(account)

  // your code...
}

调用方式二:
EpochPriceRank.funcGetPlayerNo(account).then((res) => {
  // your code...
})

返回值:
一个数字