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

web3-eth-abi

Package Overview
Dependencies
Maintainers
1
Versions
481
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-eth-abi - npm Package Compare versions

Comparing version 1.0.0-beta.26 to 1.0.0-beta.27

6

package.json
{
"name": "web3-eth-abi",
"namespace": "ethereum",
"version": "1.0.0-beta.26",
"version": "1.0.0-beta.27",
"description": "Web3 module encode and decode EVM in/output.",

@@ -12,5 +12,5 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-eth-abi",

"underscore": "1.8.3",
"web3-core-helpers": "^1.0.0-beta.26",
"web3-utils": "^1.0.0-beta.26"
"web3-core-helpers": "1.0.0-beta.27",
"web3-utils": "1.0.0-beta.27"
}
}

@@ -145,4 +145,8 @@ /*

var formatOutputInt = function (param) {
var value = param.staticPart() || "0";
var value = param.staticPart();
if(!value && !param.rawValue) {
throw new Error('Couldn\'t decode '+ name +' from ABI: 0x'+ param.rawValue);
}
// check if it's negative number

@@ -166,3 +170,3 @@ // it it is, return two's complement

if(!value && param.rawValue) {
if(!value && !param.rawValue) {
throw new Error('Couldn\'t decode '+ name +' from ABI: 0x'+ param.rawValue);

@@ -181,2 +185,3 @@ }

* @param {SolidityParam} param
* @param {String} name type name
* @returns {Boolean} right-aligned input bytes formatted to bool

@@ -187,3 +192,3 @@ */

if(!value) {
if(!value && !param.rawValue) {
throw new Error('Couldn\'t decode '+ name +' from ABI: 0x'+ param.rawValue);

@@ -219,6 +224,13 @@ }

* @param {SolidityParam} param left-aligned hex representation of string
* @param {String} name type name
* @returns {String} hex string
*/
var formatOutputDynamicBytes = function (param) {
var length = (new BN(param.dynamicPart().slice(0, 64), 16)).toNumber() * 2;
var formatOutputDynamicBytes = function (param, name) {
var hex = param.dynamicPart().slice(0, 64);
if (!hex) {
throw new Error('Couldn\'t decode '+ name +' from ABI: 0x'+ param.rawValue);
}
var length = (new BN(hex, 16)).toNumber() * 2;
return '0x' + param.dynamicPart().substr(64, length);

@@ -236,8 +248,9 @@ };

var hex = param.dynamicPart().slice(0, 64);
if(hex) {
var length = (new BN(hex, 16)).toNumber() * 2;
return length ? utils.hexToUtf8('0x'+ param.dynamicPart().substr(64, length).replace(/^0x/i, '')) : '';
} else {
if(!hex) {
throw new Error('ERROR: The returned value is not a convertible string:'+ hex);
}
var length = (new BN(hex, 16)).toNumber() * 2;
return length ? utils.hexToUtf8('0x'+ param.dynamicPart().substr(64, length).replace(/^0x/i, '')) : '';
};

@@ -249,7 +262,13 @@

* @method formatOutputAddress
* @param {Object} param right-aligned input bytes
* @param {SolidityParam} param right-aligned input bytes
* @param {String} name type name
* @returns {String} address
*/
var formatOutputAddress = function (param) {
var formatOutputAddress = function (param, name) {
var value = param.staticPart();
if (!value) {
throw new Error('Couldn\'t decode '+ name +' from ABI: 0x'+ param.rawValue);
}
return utils.toChecksumAddress("0x" + value.slice(value.length - 40, value.length));

@@ -256,0 +275,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