New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chain33-rpc-api

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain33-rpc-api - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

2

dist/index.d.ts

@@ -229,3 +229,3 @@ import HttpProvider from './HttpProvider';

isSync(url?: string): Promise<any>;
callPromiseAPI(apiName: string, params?: any, url?: string): Promise<any>;
callPromiseAPI(apiName: string, params?: any, url?: string, prefix?: string): Promise<any>;
}

@@ -403,3 +403,3 @@ "use strict";

}
callPromiseAPI(apiName, params = {}, url = '') {
callPromiseAPI(apiName, params = {}, url = '', prefix = 'Chain33') {
return this.httpProvider.doFetch({

@@ -410,3 +410,3 @@ url,

jsonrpc: '2.0',
method: `Chain33.${apiName}`,
method: `${prefix}.${apiName}`,
params: [params],

@@ -413,0 +413,0 @@ },

{
"name": "chain33-rpc-api",
"version": "1.3.0",
"version": "1.3.1",
"description": "chain33 rpc 接口封装",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -20,1 +20,22 @@ # chain33 接口调用工具

+ npm i bluebird
#####使用示例:获取节点的最新高度:
```
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)
})
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc