New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

augur-abi

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

augur-abi - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

67

index.js

@@ -24,2 +24,34 @@ /**

keccak_256: keccak_256,
// Convert hex to byte array for sha3
// (https://github.com/ethereum/dapp-bin/blob/master/ether_ad/scripts/sha3.min.js)
hex_to_bytes: function (s) {
var o = [];
var alpha = "0123456789abcdef";
for (var i = (s.substr(0, 2) === "0x" ? 2 : 0); i < s.length; i += 2) {
var index1 = alpha.indexOf(s[i]);
var index2 = alpha.indexOf(s[i + 1]);
if (index1 < 0 || index2 < 0) {
throw("Bad input to hex decoding: " + s + " " + i + " " + index1 + " " + index2);
}
o.push(16*index1 + index2);
}
return o;
},
bytes_to_hex: function (b) {
var hexbyte, h = "";
for (var i = 0, n = b.length; i < n; ++i) {
hexbyte = this.strip_0x(b[i].toString(16));
if (hexbyte.length === 1) hexbyte = "0" + hexbyte;
h += hexbyte;
}
return h;
},
sha3: function (hexstr) {
return keccak_256(this.hex_to_bytes(hexstr));
},
copy: function (obj) {

@@ -89,3 +121,4 @@ if (null === obj || "object" !== typeof obj) return obj;

if (s.length > 32) s = s.slice(0, 32);
return this.prefix_hex(ethabi.rawEncode(["string"], [s]).slice(64).toString("hex"));
return this.prefix_hex(this.pad_right(new Buffer(s, "utf8").toString("hex")));
// return this.prefix_hex(ethabi.rawEncode(["string"], [s]).slice(64).toString("hex"));
},

@@ -114,11 +147,22 @@

// convert bytes to hex
encode_hex: function (str) {
var hexbyte, hex = '';
encode_hex: function (str, toArray) {
var hexbyte, hex, i, len;
if (str && str.constructor === Object || str.constructor === Array) {
str = JSON.stringify(str);
}
for (var i = 0, len = str.length; i < len; ++i) {
hexbyte = str.charCodeAt(i).toString(16);
if (hexbyte.length === 1) hexbyte = "0" + hexbyte;
hex += hexbyte;
len = str.length;
if (toArray) {
hex = [];
for (i = 0; i < len; ++i) {
hexbyte = str.charCodeAt(i).toString(16);
if (hexbyte.length === 1) hexbyte = "0" + hexbyte;
hex.push(this.prefix_hex(hexbyte));
}
} else {
hex = '';
for (i = 0; i < len; ++i) {
hexbyte = str.charCodeAt(i).toString(16);
if (hexbyte.length === 1) hexbyte = "0" + hexbyte;
hex += hexbyte;
}
}

@@ -128,2 +172,11 @@ return hex;

raw_encode_hex: function (str) {
return ethabi.rawEncode(["string"], [str]).toString("hex");
},
raw_decode_hex: function (hex) {
if (!Buffer.isBuffer(hex)) hex = new Buffer(this.strip_0x(hex), "hex");
return ethabi.rawDecode(["string"], hex)[0];
},
unfork: function (forked, prefix) {

@@ -130,0 +183,0 @@ if (forked !== null && forked !== undefined) {

2

package.json
{
"name": "augur-abi",
"version": "0.3.2",
"version": "0.3.3",
"description": "Contract ABI serialization",

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

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

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