@33cn/chain33-rpc-api
TypeScript icon, indicating that this package has built-in type declarations

1.5.30 • Public • Published

chain33 接口调用工具

开始使用

npm i @33cn/chain33-rpc-api -S

工具中不包含promise和fetch的pollyfill, 请根据使用环境自行引入

https://github.com/matthew-andrews/isomorphic-fetch

npm install --save isomorphic-fetch es6-promise

#####使用示例:获取节点的最新高度:

import BtyBaseSdk from 'chain33-rpc-api'
// 新建一个BtyBaseSdk实例,设置默认请求节点和请求错误处理函数(可选,如果不设置可以在方法返回的promise用catch捕获到错误)
let chain33Rpc = new BtyBaseSdk('https://testnet.bityuan.com/api', (error) => {
   console.log('catch error ' + error)
})
// 获取节点的最新高度
chain33Rpc.getLasterHeader().then(res => {
   if (res.error) throw new Error(res.error)
   const { height } = res.result
   console.log('height', height)
})
// 传入url参数指定请求节点
chain33Rpc.getLasterHeader('https://mainnet.bityuan.com/api').then(res => {
   if (res.error) throw new Error(res.error)
   const { height } = res.result
   console.log('height', height)
})

其它工具

测试用例

  • 创建地址

    • 18jUpfSuYCk2iQu8ZqB3d6hNWNWA4ty3Xs
    • 154fdmaKJHawbKzzbXJFXN4Uq5iCHuYFgW
  • 多重签名账户地址

    • "3Ko3NXqnc7HbKVzX7CmHh1hxaT2HyyGb6k",
    • "3N6xUeeo2CghiYhGZNeVfGs4ZVU7Q23WQj",
    • "35bZddFf69H8h4Ww7BnZWsPtWETu5MHyBQ", (有交易)
    • "3AAmTZighdcpputVjXTeTL7co27vfVyBLy",
    • "3DiR3zRtTRjJqxHdsGEob7zUor9qvSZaES" (有交易)
  • owner地址

    • "1QqKdsXqX8movNcMVQWibyxArMf56iaE1"
    • "1UXJBrGKBEbVAqThg6ZhhRNVxgpw19FQ8"
  • 多重签名下交易hash

    • "1e306aa0a2cf0467a8beea3d7b24efba11261e8dfa6be5c998bb740142d0cbde"
    • "e14bcb5e1e5a1fe52c6181330480a49508f30aa46f41cd8741295e947b48bded"

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.5.302latest

Version History

VersionDownloads (Last 7 Days)Published
1.5.302
1.5.292
1.5.281
1.5.271
1.5.261
1.5.251
1.5.241
1.5.231
1.5.221
1.5.211
1.5.201
1.5.191
1.5.181
1.5.171
1.5.161
1.5.151
1.5.142
1.5.131
1.5.121
1.5.111
1.5.102
1.5.91
1.5.81
1.5.71
1.5.61
1.5.51
1.5.41

Package Sidebar

Install

npm i @33cn/chain33-rpc-api

Weekly Downloads

31

Version

1.5.30

License

ISC

Unpacked Size

183 kB

Total Files

41

Last publish

Collaborators

  • zoeying
  • litterboy
  • normanko
  • cristilyc
  • viken0408
  • yanchenta
  • madongsheng
  • hhfz
  • yanyanhong