Comparing version 0.1.1 to 0.1.3
19
index.js
@@ -167,3 +167,5 @@ /** | ||
var bn, len; | ||
if (n !== null && n !== undefined && n !== "0x") { | ||
if (n !== null && n !== undefined && n !== "0x" && | ||
!n.error && !n.message) | ||
{ | ||
switch (n.constructor) { | ||
@@ -189,7 +191,3 @@ case Number: | ||
} catch (exc) { | ||
if (n.slice(0, 1) === '-') { | ||
bn = new BigNumber("-0x" + n.slice(1)); | ||
} else { | ||
bn = new BigNumber("0x" + n); | ||
} | ||
bn = new BigNumber(this.prefix_hex(n)); | ||
} | ||
@@ -208,3 +206,4 @@ break; | ||
default: | ||
return n; | ||
console.log("[augur-abi] Couldn't convert", n, "to BigNumber"); | ||
return; | ||
} | ||
@@ -233,3 +232,3 @@ if (bn !== undefined && bn !== null && bn.constructor === BigNumber) { | ||
var fixed; | ||
if (n && n !== "0x") { | ||
if (n && n !== "0x" && !n.error && !n.message) { | ||
if (encode && n.constructor === String) { | ||
@@ -272,3 +271,3 @@ encode = encode.toLowerCase(); | ||
var unfixed; | ||
if (n && n !== "0x") { | ||
if (n && n !== "0x" && !n.error && !n.message) { | ||
if (encode) encode = encode.toLowerCase(); | ||
@@ -287,3 +286,3 @@ if (n.constructor === Array) { | ||
} | ||
if (encode) { | ||
if (unfixed && encode) { | ||
if (encode === "hex") { | ||
@@ -290,0 +289,0 @@ unfixed = this.prefix_hex(unfixed); |
{ | ||
"name": "augur-abi", | ||
"version": "0.1.1", | ||
"version": "0.1.3", | ||
"description": "Contract ABI serialization", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,5 +6,4 @@ augur-abi | ||
[![Coverage Status](https://coveralls.io/repos/AugurProject/augur-abi/badge.svg?branch=master&service=github)](https://coveralls.io/github/AugurProject/augur-abi?branch=master) | ||
[![npm version](https://badge.fury.io/js/augur-abi.svg)](http://badge.fury.io/js/augur-abi) | ||
[![NPM](https://nodei.co/npm/augur-abi.png)](https://nodei.co/npm/augur-abi/) | ||
augur-abi is a standalone JavaScript module that provides Ethereum contract ABI data serialization methods. [ABI encoding](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) is needed to invoke functions on Ethereum smart contracts. | ||
@@ -11,0 +10,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1015234
20476
48