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

@0xproject/utils

Package Overview
Dependencies
Maintainers
6
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xproject/utils - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

lib/src/fetch_async.d.ts

14

CHANGELOG.json
[
{
"timestamp": 1535133899,
"version": "1.0.6",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.5",

@@ -8,2 +17,7 @@ "changes": [

"pr": 807
},
{
"note":
"Store different ABIs for events with same function signature and different amount of indexed arguments",
"pr": 933
}

@@ -10,0 +24,0 @@ ],

13

CHANGELOG.md

@@ -8,5 +8,10 @@ <!--

## v1.0.5 - _August 13, 2018_
## v1.0.6 - _August 24, 2018_
* Dependencies updated
## v1.0.5 - _August 14, 2018_
* Increased BigNumber decimal precision from 20 to 78 (#807)
* Store different ABIs for events with same function signature and different amount of indexed arguments (#933)

@@ -29,3 +34,3 @@ ## v1.0.4 - _July 26, 2018_

## v1.0.0 - _July 19, 2018_
## v1.0.0 - _July 20, 2018_

@@ -48,3 +53,3 @@ * Add `fetchAsync` which adds a default timeout to all requests (#874)

## v0.7.0 - _May 31, 2018_
## v0.7.0 - _June 1, 2018_

@@ -57,3 +62,3 @@ * Incorrect publish that was unpublished

## v0.6.1 - _May 4, 2018_
## v0.6.1 - _May 5, 2018_

@@ -60,0 +65,0 @@ * Dependencies updated

import { AbiDefinition, DecodedLogArgs, LogEntry, LogWithDecodedArgs, RawLog } from 'ethereum-types';
/**
* AbiDecoder allows you to decode event logs given a set of supplied contract ABI's. It takes the contract's event
* signature from the ABI and attempts to decode the logs using it.
*/
export declare class AbiDecoder {
private readonly _methodIds;
/**
* Instantiate an AbiDecoder
* @param abiArrays An array of contract ABI's
* @return AbiDecoder instance
*/
constructor(abiArrays: AbiDefinition[][]);
/**
* Attempt to decode a log given the ABI's the AbiDecoder knows about.
* @param log The log to attempt to decode
* @return The decoded log if the requisite ABI was available. Otherwise the log unaltered.
*/
tryToDecodeLogOrNoop<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog;
/**
* Add additional ABI definitions to the AbiDecoder
* @param abiArray An array of ABI definitions to add to the AbiDecoder
*/
addABI(abiArray: AbiDefinition[]): void;
}
"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};

@@ -16,3 +19,12 @@ Object.defineProperty(exports, "__esModule", { value: true });

var configured_bignumber_1 = require("./configured_bignumber");
/**
* AbiDecoder allows you to decode event logs given a set of supplied contract ABI's. It takes the contract's event
* signature from the ABI and attempts to decode the logs using it.
*/
var AbiDecoder = /** @class */ (function () {
/**
* Instantiate an AbiDecoder
* @param abiArrays An array of contract ABI's
* @return AbiDecoder instance
*/
function AbiDecoder(abiArrays) {

@@ -22,9 +34,14 @@ this._methodIds = {};

}
// This method can only decode logs from the 0x & ERC20 smart contracts
/**
* Attempt to decode a log given the ABI's the AbiDecoder knows about.
* @param log The log to attempt to decode
* @return The decoded log if the requisite ABI was available. Otherwise the log unaltered.
*/
AbiDecoder.prototype.tryToDecodeLogOrNoop = function (log) {
var methodId = log.topics[0];
var event = this._methodIds[methodId];
if (_.isUndefined(event)) {
var numIndexedArgs = log.topics.length - 1;
if (_.isUndefined(this._methodIds[methodId]) || _.isUndefined(this._methodIds[methodId][numIndexedArgs])) {
return log;
}
var event = this._methodIds[methodId][numIndexedArgs];
var ethersInterface = new ethers.Interface([event]);

@@ -75,2 +92,6 @@ var decodedParams = {};

};
/**
* Add additional ABI definitions to the AbiDecoder
* @param abiArray An array of ABI definitions to add to the AbiDecoder
*/
AbiDecoder.prototype.addABI = function (abiArray) {

@@ -83,5 +104,7 @@ var _this = this;

_.map(abiArray, function (abi) {
var _a;
if (abi.type === ethereum_types_1.AbiType.Event) {
var topic = ethersInterface.events[abi.name].topics[0];
_this._methodIds[topic] = abi;
var numIndexedArgs = _.reduce(abi.inputs, function (sum, input) { return (input.indexed ? sum + 1 : sum); }, 0);
_this._methodIds[topic] = __assign({}, _this._methodIds[topic], (_a = {}, _a[numIndexedArgs] = abi, _a));
}

@@ -88,0 +111,0 @@ });

@@ -11,2 +11,2 @@ export { promisify } from './promisify';

export { errorUtils } from './error_utils';
export { fetchAsync } from './fetchAsync';
export { fetchAsync } from './fetch_async';

@@ -23,4 +23,4 @@ "use strict";

exports.errorUtils = error_utils_1.errorUtils;
var fetchAsync_1 = require("./fetchAsync");
exports.fetchAsync = fetchAsync_1.fetchAsync;
var fetch_async_1 = require("./fetch_async");
exports.fetchAsync = fetch_async_1.fetchAsync;
//# sourceMappingURL=index.js.map
{
"name": "@0xproject/utils",
"version": "1.0.5",
"version": "1.0.6",
"engines": {

@@ -12,4 +12,5 @@ "node": ">=6.12"

"watch_without_deps": "tsc -w",
"build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts",
"clean": "shx rm -rf lib scripts",
"build": "tsc",
"clean": "shx rm -rf lib",
"lint": "tslint --project .",
"test": "yarn run_mocha",

@@ -19,5 +20,3 @@ "test:circleci": "yarn test:coverage",

"test:coverage": "nyc npm run test --all && yarn coverage:report:lcov",
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info",
"lint": "tslint --project .",
"manual:postpublish": "yarn build; node ./scripts/postpublish.js"
"coverage:report:lcov": "nyc report --reporter=text-lcov > coverage/lcov.info"
},

@@ -34,8 +33,7 @@ "license": "Apache-2.0",

"devDependencies": {
"@0xproject/monorepo-scripts": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
"@0xproject/tslint-config": "^1.0.6",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"chai": "^4.0.1",
"copyfiles": "^1.2.0",
"copyfiles": "^2.0.0",
"make-promises-safe": "^1.1.0",

@@ -46,7 +44,7 @@ "mocha": "^4.1.0",

"tslint": "5.11.0",
"typescript": "2.9.2"
"typescript": "3.0.1"
},
"dependencies": {
"@0xproject/types": "^1.0.1-rc.4",
"@0xproject/typescript-typings": "^1.0.4",
"@0xproject/types": "^1.0.1-rc.5",
"@0xproject/typescript-typings": "^1.0.5",
"@types/node": "^8.0.53",

@@ -56,3 +54,3 @@ "abortcontroller-polyfill": "^1.1.9",

"detect-node": "2.0.3",
"ethereum-types": "^1.0.4",
"ethereum-types": "^1.0.5",
"ethereumjs-util": "^5.1.1",

@@ -67,3 +65,3 @@ "ethers": "3.0.22",

},
"gitHead": "fadd292ecf367e42154856509d0ea0c20b23f2f1"
"gitHead": "7f585a15f526e0a61fd822cdefb7087fc6bb8934"
}

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