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

ethjs-contract

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethjs-contract - npm Package Compare versions

Comparing version 0.1.7 to 0.1.9

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 0.1.8 -- handles decode of empty addrs nicely
1. Handles decode of empty addrs nicely
# 0.1.6 -- BN formatting update

@@ -2,0 +6,0 @@

41

lib/index.js

@@ -34,2 +34,12 @@ 'use strict';

return function ContractFactory(contractABI, contractBytecode, contractDefaultTxObject) {
if (!Array.isArray(contractABI)) {
throw new Error('[ethjs-contract] Contract ABI must be type Array, got type ' + typeof contractABI);
}
if (typeof contractBytecode !== 'undefined' && typeof contractBytecode !== 'string') {
throw new Error('[ethjs-contract] Contract bytecode must be type String, got type ' + typeof contractBytecode);
}
if (typeof contractDefaultTxObject !== 'undefined' && typeof contractDefaultTxObject !== 'object') {
throw new Error('[ethjs-contract] Contract default tx object must be type Object, got type ' + typeof contractABI);
}
var output = {};

@@ -94,15 +104,22 @@ output.at = function atContract(address) {

} else if (methodObject.type === 'event') {
var filterInputTypes = getKeys(methodObject.inputs, 'type', false);
var filterTopic = '0x' + keccak256(methodObject.name + '(' + filterInputTypes.join(',') + ')');
var argsObject = Object.assign({}, methodArgs[0]) || {};
var _ret = function () {
var filterInputTypes = getKeys(methodObject.inputs, 'type', false);
var filterTopic = '0x' + keccak256(methodObject.name + '(' + filterInputTypes.join(',') + ')');
var filterTopcis = [filterTopic];
var argsObject = Object.assign({}, methodArgs[0]) || {};
return new self.filters.Filter(Object.assign({}, argsObject, {
decoder: function decoder(logData) {
return abi.decodeEvent(methodObject, logData);
},
defaultFilterObject: Object.assign({}, methodArgs[0] || {}, {
to: self.address,
topics: [filterTopic]
})
}));
return {
v: new self.filters.Filter(Object.assign({}, argsObject, {
decoder: function decoder(logData) {
return abi.decodeEvent(methodObject, logData, filterTopcis);
},
defaultFilterObject: Object.assign({}, methodArgs[0] || {}, {
to: self.address,
topics: filterTopcis
})
}))
};
}();
if (typeof _ret === "object") return _ret.v;
}

@@ -109,0 +126,0 @@ };

{
"name": "ethjs-contract",
"version": "0.1.7",
"version": "0.1.9",
"description": "A simple contract object for the Ethereum RPC.",

@@ -69,3 +69,3 @@ "main": "lib/index.js",

"dependencies": {
"ethjs-abi": "0.1.7",
"ethjs-abi": "0.2.0",
"ethjs-filter": "0.1.5",

@@ -72,0 +72,0 @@ "js-sha3": "0.5.5",

@@ -75,4 +75,4 @@ ## ethjs-contract

const filter = simpleStore.SetComplete()
.new({ toBlock: 'latest' }, (error, result) => {
const filter = simpleStore.SetComplete();
filter.new({ toBlock: 'latest' }, (error, result) => {
// result null <BigNumber ...> filterId

@@ -79,0 +79,0 @@ });

@@ -30,2 +30,6 @@ const abi = require('ethjs-abi'); // eslint-disable-line

return function ContractFactory(contractABI, contractBytecode, contractDefaultTxObject) {
if (!Array.isArray(contractABI)) { throw new Error(`[ethjs-contract] Contract ABI must be type Array, got type ${typeof contractABI}`); }
if (typeof contractBytecode !== 'undefined' && typeof contractBytecode !== 'string') { throw new Error(`[ethjs-contract] Contract bytecode must be type String, got type ${typeof contractBytecode}`); }
if (typeof contractDefaultTxObject !== 'undefined' && typeof contractDefaultTxObject !== 'object') { throw new Error(`[ethjs-contract] Contract default tx object must be type Object, got type ${typeof contractABI}`); }
const output = {};

@@ -93,9 +97,10 @@ output.at = function atContract(address) {

const filterTopic = `0x${keccak256(`${methodObject.name}(${filterInputTypes.join(',')})`)}`;
const filterTopcis = [filterTopic];
const argsObject = Object.assign({}, methodArgs[0]) || {};
return new self.filters.Filter(Object.assign({}, argsObject, {
decoder: (logData) => abi.decodeEvent(methodObject, logData),
decoder: (logData) => abi.decodeEvent(methodObject, logData, filterTopcis),
defaultFilterObject: Object.assign({}, (methodArgs[0] || {}), {
to: self.address,
topics: [filterTopic],
topics: filterTopcis,
}),

@@ -102,0 +107,0 @@ }));

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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