diff --git a/src.ts/utils/index.ts b/src.ts/utils/index.ts index d7372faa6..8f7c8aa36 100644 --- a/src.ts/utils/index.ts +++ b/src.ts/utils/index.ts @@ -6,8 +6,8 @@ import { getAddress, getContractAddress, getIcapAddress } from './address'; import { AbiCoder, defaultAbiCoder, formatSignature, formatParamType, parseSignature, parseParamType } from './abi-coder'; import * as base64 from './base64'; -import { BigNumber, bigNumberify } from './bignumber'; -import { arrayify, concat, hexlify, joinSignature, padZeros, splitSignature, stripZeros } from './bytes'; +import { BigNumber, bigNumberify, ConstantNegativeOne, ConstantZero, ConstantOne, ConstantTwo, ConstantWeiPerEther } from './bignumber'; +import { AddressZero, arrayify, concat, HashZero, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexZeroPad, joinSignature, padZeros, splitSignature, stripZeros } from './bytes'; import { hashMessage, id, namehash } from './hash'; import { keccak256 } from './keccak256'; import { sha256 } from './sha2'; @@ -28,6 +28,16 @@ import * as errors from './errors'; // NFKC (composed) const etherSymbol = '\u039e'; +const constants = { + AddressZero: AddressZero, + HashZero: HashZero, + NegativeOne: ConstantNegativeOne, + Zero: ConstantZero, + One: ConstantOne, + Two: ConstantTwo, + WeiPerEther: ConstantWeiPerEther +}; + export { AbiCoder, defaultAbiCoder, @@ -36,6 +46,8 @@ export { parseSignature, parseParamType, + constants, + RLP, fetchJson, @@ -59,6 +71,10 @@ export { BigNumber, hexlify, + hexStripZeros, + hexZeroPad, + hexDataLength, + hexDataSlice, toUtf8Bytes, toUtf8String, @@ -101,6 +117,8 @@ export default { parseSignature, parseParamType, + constants, + RLP, fetchJson, @@ -124,6 +142,10 @@ export default { BigNumber, hexlify, + hexStripZeros, + hexZeroPad, + hexDataLength, + hexDataSlice, toUtf8Bytes, toUtf8String, diff --git a/utils/index.js b/utils/index.js index 9bcd113bc..e81be2c11 100644 --- a/utils/index.js +++ b/utils/index.js @@ -28,7 +28,11 @@ exports.bigNumberify = bignumber_1.bigNumberify; var bytes_1 = require("./bytes"); exports.arrayify = bytes_1.arrayify; exports.concat = bytes_1.concat; +exports.hexDataSlice = bytes_1.hexDataSlice; +exports.hexDataLength = bytes_1.hexDataLength; exports.hexlify = bytes_1.hexlify; +exports.hexStripZeros = bytes_1.hexStripZeros; +exports.hexZeroPad = bytes_1.hexZeroPad; exports.joinSignature = bytes_1.joinSignature; exports.padZeros = bytes_1.padZeros; exports.splitSignature = bytes_1.splitSignature; @@ -74,11 +78,22 @@ exports.errors = errors; // NFKC (composed) var etherSymbol = '\u039e'; exports.etherSymbol = etherSymbol; +var constants = { + AddressZero: bytes_1.AddressZero, + HashZero: bytes_1.HashZero, + NegativeOne: bignumber_1.ConstantNegativeOne, + Zero: bignumber_1.ConstantZero, + One: bignumber_1.ConstantOne, + Two: bignumber_1.ConstantTwo, + WeiPerEther: bignumber_1.ConstantWeiPerEther +}; +exports.constants = constants; exports.default = { AbiCoder: abi_coder_1.AbiCoder, defaultAbiCoder: abi_coder_1.defaultAbiCoder, parseSignature: abi_coder_1.parseSignature, parseParamType: abi_coder_1.parseParamType, + constants: constants, RLP: RLP, fetchJson: web_1.fetchJson, defineReadOnly: properties_1.defineReadOnly, @@ -94,6 +109,10 @@ exports.default = { bigNumberify: bignumber_1.bigNumberify, BigNumber: bignumber_1.BigNumber, hexlify: bytes_1.hexlify, + hexStripZeros: bytes_1.hexStripZeros, + hexZeroPad: bytes_1.hexZeroPad, + hexDataLength: bytes_1.hexDataLength, + hexDataSlice: bytes_1.hexDataSlice, toUtf8Bytes: utf8_1.toUtf8Bytes, toUtf8String: utf8_1.toUtf8String, hashMessage: hash_1.hashMessage,