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

eosjs

Package Overview
Dependencies
Maintainers
2
Versions
292
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eosjs - npm Package Compare versions

Comparing version 15.0.1 to 15.0.2

20

lib/index.test.js

@@ -43,8 +43,4 @@ 'use strict';

var transactionHeaders = function transactionHeaders(expireInSeconds, callback) {
callback(null /*error*/, headers);
};
it('multi-signature', function _callee() {
var eos, trx;
var transactionHeaders, eos, trx;
return _regenerator2.default.async(function _callee$(_context) {

@@ -54,2 +50,6 @@ while (1) {

case 0:
transactionHeaders = function transactionHeaders(expireInSeconds, callback) {
callback(null /*error*/, headers);
};
eos = Eos({

@@ -60,6 +60,6 @@ keyProvider: [ecc.seedPrivate('key1'), ecc.seedPrivate('key2')],

});
_context.next = 3;
_context.next = 4;
return _regenerator2.default.awrap(eos.nonce(1, { authorization: 'inita' }));
case 3:
case 4:
trx = _context.sent;

@@ -70,3 +70,3 @@

case 5:
case 6:
case 'end':

@@ -119,3 +119,3 @@ return _context.stop();

it('transactionHeaders callback', function _callee3() {
it('transactionHeaders object', function _callee3() {
var eos, memo, trx;

@@ -129,3 +129,3 @@ return _regenerator2.default.async(function _callee3$(_context3) {

httpEndpoint: null,
transactionHeaders: transactionHeaders
transactionHeaders: headers
});

@@ -132,0 +132,0 @@ memo = '';

@@ -628,11 +628,16 @@ 'use strict';

} else if (config.transactionHeaders) {
assert.equal((0, _typeof3.default)(config.transactionHeaders), 'function', 'config.transactionHeaders');
headers = config.transactionHeaders;
if ((0, _typeof3.default)(config.transactionHeaders) === 'object') {
headers = function headers(exp, callback) {
return callback(null, config.transactionHeaders);
};
} else {
assert.equal((0, _typeof3.default)(config.transactionHeaders), 'function', 'config.transactionHeaders');
headers = config.transactionHeaders;
}
} else {
assert(network, 'Network is required, provide config.httpEndpoint');
assert(network, 'Network is required, provide httpEndpoint or own transaction headers');
headers = network.createTransaction;
}
headers(options.expireInSeconds, checkError(callback, config.logger, function _callee2(rawTx) {
var txObject, buf, tr, transactionId, sigs, chainIdBuf, signBuf;
var defaultHeaders, txObject, buf, tr, transactionId, sigs, chainIdBuf, signBuf;
return _regenerator2.default.async(function _callee2$(_context2) {

@@ -648,4 +653,11 @@ while (1) {

rawTx = Object.assign({}, rawTx);
defaultHeaders = {
net_usage_words: 0,
max_cpu_usage_ms: 0,
delay_sec: 0
};
rawTx = Object.assign({}, defaultHeaders, rawTx);
rawTx.actions = arg.actions;

@@ -718,15 +730,13 @@

} else {
network.pushTransaction(packedTr, function (error) {
network.pushTransaction(packedTr, function (error, processedTransaction) {
if (!error) {
callback(null, {
transaction_id: transactionId,
callback(null, Object.assign({
broadcast: true,
transaction: packedTr
});
transaction: packedTr,
transaction_id: transactionId
}, processedTransaction));
} else {
if (config.logger.error) {
config.logger.error('[push_transaction error] \'' + error.message + '\', transaction \'' + buf.toString('hex') + '\'');
}
callback(error.message);

@@ -743,3 +753,3 @@ }

case 13:
case 14:
case 'end':

@@ -746,0 +756,0 @@ return _context2.stop();

{
"name": "eosjs",
"version": "15.0.1",
"version": "15.0.2",
"description": "General purpose library for the EOS blockchain.",

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

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

| --- | --- | --- | --- |
| tag: 15.0.1 | `npm install eosjs` (version 15) | tag: v1.0.5 | eosio/eos:v1.0.5 |
| tag: 15.0.2 | `npm install eosjs` (version 15) | tag: v1.0.5 | eosio/eos:v1.0.5 |
Upgrade notes:
* Converted some types in **format** module from unsigned to signed: UDecimalPad -> DecimalPad for example (15.0.1)
* All `asset` and `extended_asset` amounts require exact decimal places (Change `1 SYS` to `1.0000 SYS`) (15.0.0)

@@ -283,2 +284,12 @@ * Use `config.verbose` instead of `config.debug` (14.1.0)

Assets amounts require zero padding. For a better user-experience, if you know
the correct precision you may use DecimalPad to add the padding.
```js
DecimalPad = Eos.modules.format.DecimalPad
userInput = '10.2'
precision = 4
assert.equal('10.2000', DecimalPad(userInput, precision))
```
For more advanced signing, see `keyProvider` and `signProvider` in

@@ -392,3 +403,40 @@ [index.test.js](https://github.com/EOSIO/eosjs/blob/master/src/index.test.js).

```
#### Offline or cold-storage transaction
```js
// ONLINE
// Prepare headers
expireInSeconds = 60 * 60 // 1 hour
eos = Eos(/* {httpEndpoint: 'https://..'} */)
info = await eos.getInfo({})
chainDate = new Date(info.head_block_time + 'Z')
expiration = new Date(chainDate.getTime() + expireInSeconds * 1000)
expiration = expiration.toISOString().split('.')[0]
block = await eos.getBlock(info.last_irreversible_block_num)
transactionHeaders = {
expiration,
ref_block_num: info.last_irreversible_block_num & 0xFFFF,
ref_block_prefix: block.ref_block_prefix
}
// OFFLINE (bring `transactionHeaders`)
// All keys in keyProvider will sign.
eos = Eos({httpEndpoint: null, chainId, keyProvider, transactionHeaders})
transfer = await eos.transfer('inita', 'initb', '1.0000 SYS', '')
transferTransaction = transfer.transaction
// ONLINE (bring `transferTransaction`)
eos = Eos(/* {httpEndpoint: 'https://..'} */)
processedTransaction = await eos.pushTransaction(transferTransaction)
```
#### Custom Token

@@ -395,0 +443,0 @@

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