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

eosjs-api

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eosjs-api - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

linkify.sh

4

package.json
{
"name": "eosjs-api",
"version": "1.0.9",
"version": "1.0.10",
"description": "Application programming interface to EOS blockchain nodes.",

@@ -33,5 +33,5 @@ "scripts": {

"camel-case": "^3.0.0",
"eosjs-json": "^1.0.7",
"eosjs-json": "^1.0.8",
"isomorphic-fetch": "^2.2.1"
}
}

@@ -10,2 +10,6 @@ [![Build Status](https://travis-ci.org/eosjs/api.svg?branch=master)](https://travis-ci.org/eosjs/api)

# Requirement
Build and run [eosd](https://github.com/eosio/eos) or direct requests to a public testnet or production node.
## Usage

@@ -15,3 +19,2 @@

Testnet = require('eosjs-api/testnet') // Or Testnet = require('./testnet')
assert = require('assert')

@@ -25,3 +28,7 @@ testnet = Testnet() // See ./testnet.js for configuration

// For promises instead of callbacks, use something like npmjs 'sb-promisify'
// A Promise is returned if a callback is not provided.
testnet.getInfo({}).then(result => console.log(result))
testnet.getBlock(1).then(result => console.log(result))
// For callbacks instead of Promises provide a callback
callback = (err, res) => {err ? console.error(err) : console.log(res)}

@@ -37,2 +44,3 @@

testnet.getBlock({block_num_or_id: 1}, callback)
testnet.getBlock({block_num_or_id: 1}).then(result => console.log(result))
```

@@ -39,0 +47,0 @@

@@ -36,7 +36,4 @@ require('isomorphic-fetch')

}
const callParams = args.slice(0, args.length - 1)
const callback = args[args.length - 1]
if (typeof callback !== 'function') {
throw new TypeError(`${methodName}: Callback function is required as the last argument`)
}
const {returnPromise, callParams, callback} = processArgs(args)
const apiParams = genParams(callParams, definition.params, methodName)

@@ -67,2 +64,4 @@ const body = JSON.stringify(apiParams)

})
return returnPromise
}

@@ -107,2 +106,23 @@ }

function processArgs(args) {
let returnPromise
let callParams = args.slice(0, args.length - 1)
let callback = args[args.length - 1]
if (typeof callback !== 'function') {
returnPromise = new Promise((resolve, reject) => {
callback = function(err, result) {
if(err) {
reject(err)
} else {
resolve(result)
}
}
})
callParams = args
} else {
callParams = args.slice(0, args.length - 1)
}
return {returnPromise, callParams, callback}
}
function genParams (callParams, defParams, methodName) {

@@ -109,0 +129,0 @@ let apiParams

@@ -7,3 +7,3 @@ /* eslint-env mocha */

const apiVersions = {
v1: require(`eosjson/api/v1`)
v1: require(`eosjs-json/api/v1`)
}

@@ -10,0 +10,0 @@

module.exports = {
// Under "api:" all functions must take api as their 1st parameter
api: {
// All functions must take api as their 1st parameter
createTransaction

@@ -9,4 +10,4 @@ }

/**
Consult the blockchain and gather information for use in a new signed transaction headers.
Per Transaction as Proof of Stake (TaPOS) 32 bits of a recent block Id is included.
Consult the blockchain and gather information for use in a new signed transaction.
For Transaction as Proof of Stake (TaPOS), 32 bits of a recent block Id is included.

@@ -36,4 +37,4 @@ @arg {number} expireInSeconds - How many seconds until expiration

messages: [],
authorization: [],
signatures: [],
authorizations: [],
})

@@ -40,0 +41,0 @@ callback(null, headers)

@@ -8,2 +8,3 @@ const apiGen = require('./src/apigen')

Testnet.api = require('eosjs-json/api/v1')
Testnet.schema = require('eosjs-json/schema')

@@ -10,0 +11,0 @@ // Change httpEndpoint to public testnet when available

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