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 14.1.0 to 14.1.1

30

lib/format.js

@@ -5,2 +5,4 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var assert = require('assert');

@@ -27,2 +29,3 @@

UDecimalUnimply: UDecimalUnimply,
joinAssetString: joinAssetString,
parseExtendedAsset: parseExtendedAsset

@@ -302,2 +305,21 @@ };

/** @private for now, support for asset strings is limited
*/
function joinAssetString(_ref) {
var amount = _ref.amount,
precision = _ref.precision,
symbol = _ref.symbol,
contract = _ref.contract;
assert.equal(typeof symbol === 'undefined' ? 'undefined' : _typeof(symbol), 'string', 'symbol is a required string');
var join = function join(e1, e2) {
return e1 == null ? '' : e2 == null ? '' : e1 + e2;
};
var asset = join(precision, ',') + symbol;
// const extendedAsset = join(symbol, '') + join('@', contract)
return join(amount, ' ') + asset + join('@', contract);
}
/**

@@ -331,7 +353,4 @@ Attempts to parse all forms of the asset strings (symbol, asset, or extended

var join = function join(e1, e2) {
return e1 == null ? '' : e2 == null ? '' : e1 + e2;
};
var asset = join(precision, ',') + symbol;
var check = join(amount, ' ') + asset + join('@', contract);
var check = joinAssetString({ amount: amount, precision: precision, symbol: symbol, contract: contract });
assert.equal(str, check, 'Invalid extended asset string: ' + str + ' !== ' + check);

@@ -349,4 +368,3 @@

var extendedAsset = join(symbol, '') + join('@', contract);
return { amount: amount, precision: precision, symbol: symbol, contract: contract };
}

71

lib/structs.js

@@ -24,2 +24,3 @@ 'use strict';

UDecimalUnimply = _require2.UDecimalUnimply,
joinAssetString = _require2.joinAssetString,
parseExtendedAsset = _require2.parseExtendedAsset;

@@ -509,14 +510,16 @@

var contract = contractName.fromByteBuffer(b);
return asset + '@' + contract;
return parseExtendedAsset(asset + '@' + contract);
},
appendByteBuffer: function appendByteBuffer(b, value) {
assert.equal(typeof value === 'undefined' ? 'undefined' : _typeof(value), 'string', 'Invalid extended asset: ' + value);
assert.equal(typeof value === 'undefined' ? 'undefined' : _typeof(value), 'object', 'expecting extended_asset object, got ' + (typeof value === 'undefined' ? 'undefined' : _typeof(value)));
var _value$split3 = value.split('@'),
_value$split4 = _slicedToArray(_value$split3, 2),
asset = _value$split4[0],
contract = _value$split4[1];
var asset = joinAssetString(value);
var _asset$split = asset.split('@'),
_asset$split2 = _slicedToArray(_asset$split, 2),
contract = _asset$split2[1];
assert.equal(typeof contract === 'undefined' ? 'undefined' : _typeof(contract), 'string', 'Invalid extended asset: ' + value);
// asset includes contract (assetType needs this)
assetType.appendByteBuffer(b, asset);

@@ -527,10 +530,48 @@ contractName.appendByteBuffer(b, contract);

// like: 1.0000 SYS@contract or 1 SYS@contract
assert(/^\d+(\.\d+)* [A-Z]+@[a-z0-5]+(\.[a-z0-5]+)*$/.test(value), 'Invalid extended asset: ' + value);
return toAssetString(value, assetCache, 'full_extended_asset');
var asset = {};
if (typeof value === 'string') {
Object.assign(asset, parseExtendedAsset(value));
} else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
Object.assign(asset, value);
} else {
assert(false, 'expecting extended_asset<object|string>, got: ' + (typeof value === 'undefined' ? 'undefined' : _typeof(value)));
}
var amount = asset.amount,
precision = asset.precision,
symbol = asset.symbol,
contract = asset.contract;
assert(amount != null, 'missing amount');
assert(precision == null || typeof precision === 'number', 'precision is an optional number'); // pending async lookup or still offchain
assert(symbol != null, 'missing symbol');
assert(contract != null, 'missing contract');
return { amount: amount, precision: precision, symbol: symbol, contract: contract };
},
toObject: function toObject(value) {
if (validation.defaults && value == null) {
return '1.0000 SYS@eosio.token';
return {
amount: '1.0000',
precision: 4,
symbol: 'SYS',
contract: 'eosio.token'
};
}
return toAssetString(value, assetCache, 'extended_asset');
assert.equal(typeof value === 'undefined' ? 'undefined' : _typeof(value), 'object', 'expecting extended_asset object');
var _precisionCache6 = precisionCache(assetCache, joinAssetString(value)),
precision = _precisionCache6.precision,
symbol = _precisionCache6.symbol,
amount = _precisionCache6.amount,
contract = _precisionCache6.contract;
return {
amount: UDecimalPad(amount, precision),
precision: precision,
symbol: symbol,
contract: contract
};
}

@@ -577,7 +618,7 @@ };

if (typeof value === 'string') {
var _value$split5 = value.split('@'),
_value$split6 = _slicedToArray(_value$split5, 2),
account = _value$split6[0],
_value$split6$ = _value$split6[1],
permission = _value$split6$ === undefined ? 'active' : _value$split6$;
var _value$split3 = value.split('@'),
_value$split4 = _slicedToArray(_value$split3, 2),
account = _value$split4[0],
_value$split4$ = _value$split4[1],
permission = _value$split4$ === undefined ? 'active' : _value$split4$;

@@ -584,0 +625,0 @@ return {

@@ -79,4 +79,4 @@ 'use strict';

var eaType = eos.fc.types.extended_asset();
var eaString = eaType.toObject();
assertSerializer(eaType, eaString);
var eaObject = eaType.fromObject('1.0000 4,SYS@eosio.token');
assertSerializer(eaType, eaObject);
});

@@ -83,0 +83,0 @@

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

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

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

// Next, your going to need nodeosd running on localhost:8888 (see ./docker)
// Next, you're going to need nodeosd running on localhost:8888 (see ./docker)

@@ -73,2 +73,6 @@ // If a callback is not provided, a Promise is returned

* **chainId** - Unique ID for the blockchain you're connecting too. This is
required for valid transaction signing. The chainId is provided via the
[get_info](http://ayeaye.cypherglass.com:8888/v1/chain/get_info) API call.
* `mockTransactions` (optional)

@@ -98,6 +102,2 @@ * `pass` - do not broadcast, always pretend that the transaction worked

* **chainId** - Unique ID for the blockchain your connecting too. This is
required for valid transaction signing. The chainId is provided via the
[get_info](http://ayeaye.cypherglass.com:8888/v1/chain/get_info) API call.
* **authorization** `{array<auth>|auth}` - identifies the

@@ -216,3 +216,3 @@ signing account and permission typically in a multi-sig

// If your loading a wasm file, you do not need binaryen. If your loading
// If you're loading a wasm file, you do not need binaryen. If you're loading
// a "wast" file you can include and configure the binaryen compiler:

@@ -326,3 +326,3 @@ //

Note, `package.json` has a "main" pointing to `./lib`. The `./lib` folder is for
es2015 code built in a separate step. If your changing and testing code,
es2015 code built in a separate step. If you're changing and testing code,
import from `./src` instead.

@@ -329,0 +329,0 @@

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