Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0x/web3-wrapper

Package Overview
Dependencies
Maintainers
5
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0x/web3-wrapper - npm Package Compare versions

Comparing version 6.0.4 to 6.0.5

9

CHANGELOG.json
[
{
"version": "6.0.5",
"changes": [
{
"note": "Dependencies updated"
}
],
"timestamp": 1554997931
},
{
"timestamp": 1553183790,

@@ -4,0 +13,0 @@ "version": "6.0.4",

4

CHANGELOG.md

@@ -8,2 +8,6 @@ <!--

## v6.0.5 - _April 11, 2019_
* Dependencies updated
## v6.0.4 - _March 21, 2019_

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

30

lib/src/marshaller.js

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

unmarshalIntoBlockWithoutTransactionData: function (blockWithHexValues) {
var block = __assign({}, blockWithHexValues, { gasLimit: utils_2.utils.convertHexToNumber(blockWithHexValues.gasLimit), gasUsed: utils_2.utils.convertHexToNumber(blockWithHexValues.gasUsed), size: utils_2.utils.convertHexToNumber(blockWithHexValues.size), timestamp: utils_2.utils.convertHexToNumber(blockWithHexValues.timestamp), number: _.isNull(blockWithHexValues.number) ? null : utils_2.utils.convertHexToNumber(blockWithHexValues.number), difficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.difficulty), totalDifficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.totalDifficulty) });
var block = __assign({}, blockWithHexValues, { gasLimit: utils_2.utils.convertHexToNumber(blockWithHexValues.gasLimit), gasUsed: utils_2.utils.convertHexToNumber(blockWithHexValues.gasUsed), size: utils_2.utils.convertHexToNumber(blockWithHexValues.size), timestamp: utils_2.utils.convertHexToNumber(blockWithHexValues.timestamp), number: blockWithHexValues.number === null ? null : utils_2.utils.convertHexToNumber(blockWithHexValues.number), difficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.difficulty), totalDifficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.totalDifficulty) });
return block;

@@ -39,3 +39,3 @@ },

unmarshalIntoBlockWithTransactionData: function (blockWithHexValues) {
var block = __assign({}, blockWithHexValues, { gasLimit: utils_2.utils.convertHexToNumber(blockWithHexValues.gasLimit), gasUsed: utils_2.utils.convertHexToNumber(blockWithHexValues.gasUsed), size: utils_2.utils.convertHexToNumber(blockWithHexValues.size), timestamp: utils_2.utils.convertHexToNumber(blockWithHexValues.timestamp), number: _.isNull(blockWithHexValues.number) ? null : utils_2.utils.convertHexToNumber(blockWithHexValues.number), difficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.difficulty), totalDifficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.totalDifficulty), transactions: [] });
var block = __assign({}, blockWithHexValues, { gasLimit: utils_2.utils.convertHexToNumber(blockWithHexValues.gasLimit), gasUsed: utils_2.utils.convertHexToNumber(blockWithHexValues.gasUsed), size: utils_2.utils.convertHexToNumber(blockWithHexValues.size), timestamp: utils_2.utils.convertHexToNumber(blockWithHexValues.timestamp), number: blockWithHexValues.number === null ? null : utils_2.utils.convertHexToNumber(blockWithHexValues.number), difficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.difficulty), totalDifficulty: utils_2.utils.convertAmountToBigNumber(blockWithHexValues.totalDifficulty), transactions: [] });
block.transactions = _.map(blockWithHexValues.transactions, function (tx) {

@@ -53,5 +53,3 @@ var transaction = exports.marshaller.unmarshalTransaction(tx);

unmarshalTransaction: function (txRpc) {
var tx = __assign({}, txRpc, { blockNumber: !_.isNull(txRpc.blockNumber) ? utils_2.utils.convertHexToNumber(txRpc.blockNumber) : null, transactionIndex: !_.isNull(txRpc.transactionIndex)
? utils_2.utils.convertHexToNumber(txRpc.transactionIndex)
: null, nonce: utils_2.utils.convertHexToNumber(txRpc.nonce), gas: utils_2.utils.convertHexToNumber(txRpc.gas), gasPrice: utils_2.utils.convertAmountToBigNumber(txRpc.gasPrice), value: utils_2.utils.convertAmountToBigNumber(txRpc.value) });
var tx = __assign({}, txRpc, { blockNumber: txRpc.blockNumber !== null ? utils_2.utils.convertHexToNumber(txRpc.blockNumber) : null, transactionIndex: txRpc.transactionIndex !== null ? utils_2.utils.convertHexToNumber(txRpc.transactionIndex) : null, nonce: utils_2.utils.convertHexToNumber(txRpc.nonce), gas: utils_2.utils.convertHexToNumber(txRpc.gas), gasPrice: utils_2.utils.convertAmountToBigNumber(txRpc.gasPrice), value: utils_2.utils.convertAmountToBigNumber(txRpc.value) });
return tx;

@@ -74,8 +72,6 @@ },

unmarshalTxData: function (txDataRpc) {
if (_.isUndefined(txDataRpc.from)) {
if (txDataRpc.from === undefined) {
throw new Error("txData must include valid 'from' value.");
}
var txData = __assign({}, txDataRpc, { value: !_.isUndefined(txDataRpc.value) ? utils_2.utils.convertAmountToBigNumber(txDataRpc.value) : undefined, gas: !_.isUndefined(txDataRpc.gas) ? utils_2.utils.convertHexToNumber(txDataRpc.gas) : undefined, gasPrice: !_.isUndefined(txDataRpc.gasPrice)
? utils_2.utils.convertAmountToBigNumber(txDataRpc.gasPrice)
: undefined, nonce: !_.isUndefined(txDataRpc.nonce) ? utils_2.utils.convertHexToNumber(txDataRpc.nonce) : undefined });
var txData = __assign({}, txDataRpc, { value: txDataRpc.value !== undefined ? utils_2.utils.convertAmountToBigNumber(txDataRpc.value) : undefined, gas: txDataRpc.gas !== undefined ? utils_2.utils.convertHexToNumber(txDataRpc.gas) : undefined, gasPrice: txDataRpc.gasPrice !== undefined ? utils_2.utils.convertAmountToBigNumber(txDataRpc.gasPrice) : undefined, nonce: txDataRpc.nonce !== undefined ? utils_2.utils.convertHexToNumber(txDataRpc.nonce) : undefined });
return txData;

@@ -89,3 +85,3 @@ },

marshalTxData: function (txData) {
if (_.isUndefined(txData.from)) {
if (txData.from === undefined) {
throw new Error("txData must include valid 'from' value.");

@@ -99,3 +95,3 @@ }

_.each(txDataRPC, function (value, key) {
if (_.isUndefined(value) && _.includes(prunableIfUndefined, key)) {
if (value === undefined && _.includes(prunableIfUndefined, key)) {
delete txDataRPC[key];

@@ -115,3 +111,3 @@ }

var callTxDataBaseRPC = exports.marshaller._marshalCallTxDataBase(callTxDataBase);
var callDataRPC = __assign({}, callTxDataBaseRPC, { from: _.isUndefined(callData.from) ? undefined : exports.marshaller.marshalAddress(callData.from) });
var callDataRPC = __assign({}, callTxDataBaseRPC, { from: callData.from === undefined ? undefined : exports.marshaller.marshalAddress(callData.from) });
return callDataRPC;

@@ -136,3 +132,3 @@ },

marshalBlockParam: function (blockParam) {
if (_.isUndefined(blockParam)) {
if (blockParam === undefined) {
return ethereum_types_1.BlockParamLiteral.Latest;

@@ -153,9 +149,5 @@ }

_marshalCallTxDataBase: function (callTxDataBase) {
var callTxDataBaseRPC = __assign({}, callTxDataBase, { to: _.isUndefined(callTxDataBase.to) ? undefined : exports.marshaller.marshalAddress(callTxDataBase.to), gasPrice: _.isUndefined(callTxDataBase.gasPrice)
var callTxDataBaseRPC = __assign({}, callTxDataBase, { to: callTxDataBase.to === undefined ? undefined : exports.marshaller.marshalAddress(callTxDataBase.to), gasPrice: callTxDataBase.gasPrice === undefined
? undefined
: utils_2.utils.encodeAmountAsHexString(callTxDataBase.gasPrice), gas: _.isUndefined(callTxDataBase.gas) ? undefined : utils_2.utils.encodeAmountAsHexString(callTxDataBase.gas), value: _.isUndefined(callTxDataBase.value)
? undefined
: utils_2.utils.encodeAmountAsHexString(callTxDataBase.value), nonce: _.isUndefined(callTxDataBase.nonce)
? undefined
: utils_2.utils.encodeAmountAsHexString(callTxDataBase.nonce) });
: utils_2.utils.encodeAmountAsHexString(callTxDataBase.gasPrice), gas: callTxDataBase.gas === undefined ? undefined : utils_2.utils.encodeAmountAsHexString(callTxDataBase.gas), value: callTxDataBase.value === undefined ? undefined : utils_2.utils.encodeAmountAsHexString(callTxDataBase.value), nonce: callTxDataBase.nonce === undefined ? undefined : utils_2.utils.encodeAmountAsHexString(callTxDataBase.nonce) });
return callTxDataBaseRPC;

@@ -162,0 +154,0 @@ },

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

convertHexToNumberOrNull: function (hex) {
if (_.isNull(hex)) {
if (hex === null) {
return null;

@@ -15,0 +15,0 @@ }

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

}
else if (_.isUndefined(status)) {
else if (status === undefined) {
return null;

@@ -279,3 +279,3 @@ }

// ref: https://github.com/paritytech/parity-ethereum/issues/1180
if (!_.isNull(transactionReceiptRpc) && !_.isNull(transactionReceiptRpc.blockNumber)) {
if (transactionReceiptRpc !== null && transactionReceiptRpc.blockNumber !== null) {
transactionReceiptRpc.status = Web3Wrapper._normalizeTxReceiptStatus(transactionReceiptRpc.status);

@@ -330,3 +330,3 @@ transactionReceipt = marshaller_1.marshaller.unmarshalTransactionReceipt(transactionReceiptRpc);

assert_1.assert.isETHAddressHex('owner', owner);
if (!_.isUndefined(defaultBlock)) {
if (defaultBlock !== undefined) {
Web3Wrapper._assertBlockParam(defaultBlock);

@@ -382,3 +382,3 @@ }

assert_1.assert.isETHAddressHex('address', address);
if (!_.isUndefined(defaultBlock)) {
if (defaultBlock !== undefined) {
Web3Wrapper._assertBlockParam(defaultBlock);

@@ -516,3 +516,3 @@ }

blockWithoutTransactionDataWithHexValuesOrNull = _a.sent();
if (!_.isNull(blockWithoutTransactionDataWithHexValuesOrNull)) {
if (blockWithoutTransactionDataWithHexValuesOrNull !== null) {
blockWithoutTransactionDataIfExists = marshaller_1.marshaller.unmarshalIntoBlockWithoutTransactionData(blockWithoutTransactionDataWithHexValuesOrNull);

@@ -570,3 +570,3 @@ }

blockIfExists = _a.sent();
if (_.isUndefined(blockIfExists)) {
if (blockIfExists === undefined) {
throw new Error("Failed to fetch block with blockParam: " + JSON.stringify(blockParam));

@@ -694,3 +694,3 @@ }

case 0:
if (!_.isUndefined(filter.blockHash) && (!_.isUndefined(filter.fromBlock) || !_.isUndefined(filter.toBlock))) {
if (filter.blockHash !== undefined && (filter.fromBlock !== undefined || filter.toBlock !== undefined)) {
throw new Error("Cannot specify 'blockHash' as well as 'fromBlock'/'toBlock' in the filter supplied to 'getLogsAsync'");

@@ -764,3 +764,3 @@ }

]);
if (!_.isUndefined(defaultBlock)) {
if (defaultBlock !== undefined) {
Web3Wrapper._assertBlockParam(defaultBlock);

@@ -827,3 +827,3 @@ }

assert_1.assert.isNumber('pollingIntervalMs', pollingIntervalMs);
if (!_.isUndefined(timeoutMs)) {
if (timeoutMs !== undefined) {
assert_1.assert.isNumber('timeoutMs', timeoutMs);

@@ -834,3 +834,3 @@ }

transactionReceipt = _a.sent();
if (!_.isUndefined(transactionReceipt)) {
if (transactionReceipt !== undefined) {
logsWithDecodedArgs = _.map(transactionReceipt.logs, this.abiDecoder.tryToDecodeLogOrNoop.bind(this.abiDecoder));

@@ -857,3 +857,3 @@ transactionReceiptWithDecodedLogArgs = __assign({}, transactionReceipt, { logs: logsWithDecodedArgs });

transactionReceipt = _a.sent();
if (!_.isUndefined(transactionReceipt)) {
if (transactionReceipt !== undefined) {
utils_1.intervalUtils.clearAsyncExcludingInterval(intervalId);

@@ -860,0 +860,0 @@ logsWithDecodedArgs = _.map(transactionReceipt.logs, this.abiDecoder.tryToDecodeLogOrNoop.bind(this.abiDecoder));

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

blockIfExists = _a.sent();
if (_.isUndefined(blockIfExists)) {
if (blockIfExists === undefined) {
throw new Error('Expected block to exist');

@@ -265,3 +265,3 @@ }

blockIfExists = _a.sent();
if (_.isUndefined(blockIfExists)) {
if (blockIfExists === undefined) {
throw new Error('Expected block to exist');

@@ -283,3 +283,3 @@ }

blockIfExists = _a.sent();
if (_.isUndefined(blockIfExists)) {
if (blockIfExists === undefined) {
throw new Error('Expected block to exist');

@@ -290,3 +290,3 @@ }

sameBlockIfExists = _a.sent();
if (_.isUndefined(sameBlockIfExists)) {
if (sameBlockIfExists === undefined) {
throw new Error('Expected block to exist');

@@ -293,0 +293,0 @@ }

{
"name": "@0x/web3-wrapper",
"version": "6.0.4",
"version": "6.0.5",
"engines": {

@@ -16,2 +16,3 @@ "node": ">=6.12"

"lint": "tslint --format stylish --project .",
"fix": "tslint --fix --format stylish --project .",
"test": "yarn run_mocha",

@@ -40,3 +41,3 @@ "rebuild_and_test": "run-s clean build test",

"devDependencies": {
"@0x/tslint-config": "^3.0.0",
"@0x/tslint-config": "^3.0.1",
"@types/lodash": "4.14.104",

@@ -58,7 +59,7 @@ "chai": "^4.0.1",

"dependencies": {
"@0x/assert": "^2.0.8",
"@0x/json-schemas": "^3.0.8",
"@0x/typescript-typings": "^4.2.1",
"@0x/utils": "^4.3.0",
"ethereum-types": "^2.1.1",
"@0x/assert": "^2.0.9",
"@0x/json-schemas": "^3.0.9",
"@0x/typescript-typings": "^4.2.2",
"@0x/utils": "^4.3.1",
"ethereum-types": "^2.1.2",
"ethereumjs-util": "^5.1.1",

@@ -71,3 +72,3 @@ "ethers": "~4.0.4",

},
"gitHead": "0f45409b4d481b72280db4eb872c0c72beeea504"
"gitHead": "c78a60299053f0ec825bf34dd3ea0cea7bb9365b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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