web3-utils
Advanced tools
Comparing version 1.0.0-beta.52 to 1.0.0-beta.53
@@ -39,2 +39,3 @@ 'use strict'; | ||
var isAddress = function isAddress(address) { | ||
var chainId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { | ||
@@ -45,10 +46,16 @@ return false; | ||
} else { | ||
return checkAddressChecksum(address); | ||
return checkAddressChecksum(address, chainId); | ||
} | ||
}; | ||
var stripHexPrefix = function stripHexPrefix(string) { | ||
return string.slice(0, 2) === '0x' ? string.slice(2) : string; | ||
}; | ||
var checkAddressChecksum = function checkAddressChecksum(address) { | ||
address = address.replace(/^0x/i, ''); | ||
var addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); | ||
for (var i = 0; i < 40; i++) { | ||
if (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i] || parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) { | ||
var chainId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
var stripAddress = stripHexPrefix(address).toLowerCase(); | ||
var prefix = chainId != null ? chainId.toString() + '0x' : ''; | ||
var keccakHash = Hash.keccak256(prefix + stripAddress).toString('hex').replace(/^0x/i, ''); | ||
for (var i = 0; i < stripAddress.length; i++) { | ||
var output = parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]; | ||
if (stripHexPrefix(address)[i] !== output) { | ||
return false; | ||
@@ -186,4 +193,4 @@ } | ||
}; | ||
var SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; | ||
var sha3 = function sha3(value) { | ||
var KECCAK256_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; | ||
var keccak256 = function keccak256(value) { | ||
if (isHexStrict(value) && /^0x/i.test(value.toString())) { | ||
@@ -193,3 +200,3 @@ value = hexToBytes(value); | ||
var returnValue = Hash.keccak256(value); | ||
if (returnValue === SHA3_NULL_S) { | ||
if (returnValue === KECCAK256_NULL_S) { | ||
return null; | ||
@@ -200,3 +207,3 @@ } else { | ||
}; | ||
sha3._Hash = Hash; | ||
keccak256._Hash = Hash; | ||
var getSignatureParameters = function getSignatureParameters(signature) { | ||
@@ -218,2 +225,28 @@ if (!isHexStrict(signature)) { | ||
var utils = /*#__PURE__*/Object.freeze({ | ||
isBN: isBN, | ||
isBigNumber: isBigNumber, | ||
toBN: toBN, | ||
toTwosComplement: toTwosComplement, | ||
isAddress: isAddress, | ||
stripHexPrefix: stripHexPrefix, | ||
checkAddressChecksum: checkAddressChecksum, | ||
leftPad: leftPad, | ||
rightPad: rightPad, | ||
utf8ToHex: utf8ToHex, | ||
hexToUtf8: hexToUtf8, | ||
hexToNumber: hexToNumber, | ||
hexToNumberString: hexToNumberString, | ||
numberToHex: numberToHex, | ||
bytesToHex: bytesToHex, | ||
hexToBytes: hexToBytes, | ||
toHex: toHex, | ||
isHexStrict: isHexStrict, | ||
isHex: isHex, | ||
isBloom: isBloom, | ||
isTopic: isTopic, | ||
keccak256: keccak256, | ||
getSignatureParameters: getSignatureParameters | ||
}); | ||
var _elementaryName = function _elementaryName(name) { | ||
@@ -377,3 +410,3 @@ if (name.startsWith('int[')) { | ||
var hexArguments = map(arguments_, _processSoliditySha3Arguments); | ||
return sha3("0x".concat(hexArguments.join(''))); | ||
return keccak256("0x".concat(hexArguments.join(''))); | ||
}; | ||
@@ -447,3 +480,3 @@ | ||
if (!isBN(number) && !isString(number)) { | ||
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); | ||
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); | ||
} | ||
@@ -455,3 +488,3 @@ return isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10); | ||
if (!isBN(number) && !isString(number)) { | ||
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); | ||
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); | ||
} | ||
@@ -461,18 +494,18 @@ return isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10); | ||
var toChecksumAddress = function toChecksumAddress(address) { | ||
if (typeof address === 'undefined') return ''; | ||
var chainId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
if (typeof address !== 'string') { | ||
return ''; | ||
} | ||
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error("Given address \"".concat(address, "\" is not a valid Ethereum address.")); | ||
address = address.toLowerCase().replace(/^0x/i, ''); | ||
var addressHash = sha3(address).replace(/^0x/i, ''); | ||
var stripAddress = stripHexPrefix$1(address).toLowerCase(); | ||
var prefix = chainId != null ? chainId.toString() + '0x' : ''; | ||
var keccakHash = Hash.keccak256(prefix + stripAddress).toString('hex').replace(/^0x/i, ''); | ||
var checksumAddress = '0x'; | ||
for (var i = 0; i < address.length; i++) { | ||
if (parseInt(addressHash[i], 16) > 7) { | ||
checksumAddress += address[i].toUpperCase(); | ||
} else { | ||
checksumAddress += address[i]; | ||
} | ||
for (var i = 0; i < stripAddress.length; i++) { | ||
checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]; | ||
} | ||
return checksumAddress; | ||
}; | ||
var keccak256 = sha3; | ||
var sha3$1 = sha3; | ||
var keccak256$1 = keccak256; | ||
var sha3 = keccak256; | ||
var toDecimal = hexToNumber; | ||
@@ -506,3 +539,5 @@ var hexToNumber$1 = hexToNumber; | ||
var hexToBytes$1 = hexToBytes; | ||
var stripHexPrefix$1 = stripHexPrefix; | ||
exports.BN = BN; | ||
exports.randomHex = randomhex; | ||
@@ -531,9 +566,10 @@ exports.asciiToHex = asciiToHex; | ||
exports.jsonInterfaceMethodToString = jsonInterfaceMethodToString; | ||
exports.keccak256 = keccak256; | ||
exports.keccak256 = keccak256$1; | ||
exports.numberToHex = numberToHex$1; | ||
exports.padLeft = padLeft; | ||
exports.padRight = padRight; | ||
exports.sha3 = sha3$1; | ||
exports.sha3 = sha3; | ||
exports.soliditySha3 = soliditySha3; | ||
exports.stringToHex = stringToHex; | ||
exports.stripHexPrefix = stripHexPrefix$1; | ||
exports.toAscii = toAscii; | ||
@@ -540,0 +576,0 @@ exports.toBN = toBN$1; |
@@ -11,2 +11,3 @@ import isObject from 'lodash/isObject'; | ||
import BN from 'bn.js'; | ||
export { default as BN } from 'bn.js'; | ||
import { unitMap, fromWei as fromWei$1, toWei as toWei$1 } from 'ethjs-unit'; | ||
@@ -32,3 +33,3 @@ import map from 'lodash/map'; | ||
}; | ||
const isAddress = address => { | ||
const isAddress = (address, chainId = null) => { | ||
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { | ||
@@ -39,10 +40,15 @@ return false; | ||
} else { | ||
return checkAddressChecksum(address); | ||
return checkAddressChecksum(address, chainId); | ||
} | ||
}; | ||
const checkAddressChecksum = address => { | ||
address = address.replace(/^0x/i, ''); | ||
const addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); | ||
for (let i = 0; i < 40; i++) { | ||
if (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i] || parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) { | ||
const stripHexPrefix = string => { | ||
return string.slice(0, 2) === '0x' ? string.slice(2) : string; | ||
}; | ||
const checkAddressChecksum = (address, chainId = null) => { | ||
const stripAddress = stripHexPrefix(address).toLowerCase(); | ||
const prefix = chainId != null ? chainId.toString() + '0x' : ''; | ||
const keccakHash = Hash.keccak256(prefix + stripAddress).toString('hex').replace(/^0x/i, ''); | ||
for (let i = 0; i < stripAddress.length; i++) { | ||
let output = parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]; | ||
if (stripHexPrefix(address)[i] !== output) { | ||
return false; | ||
@@ -180,4 +186,4 @@ } | ||
}; | ||
const SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; | ||
const sha3 = value => { | ||
const KECCAK256_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; | ||
const keccak256 = value => { | ||
if (isHexStrict(value) && /^0x/i.test(value.toString())) { | ||
@@ -187,3 +193,3 @@ value = hexToBytes(value); | ||
const returnValue = Hash.keccak256(value); | ||
if (returnValue === SHA3_NULL_S) { | ||
if (returnValue === KECCAK256_NULL_S) { | ||
return null; | ||
@@ -194,3 +200,3 @@ } else { | ||
}; | ||
sha3._Hash = Hash; | ||
keccak256._Hash = Hash; | ||
const getSignatureParameters = signature => { | ||
@@ -212,2 +218,28 @@ if (!isHexStrict(signature)) { | ||
var utils = /*#__PURE__*/Object.freeze({ | ||
isBN: isBN, | ||
isBigNumber: isBigNumber, | ||
toBN: toBN, | ||
toTwosComplement: toTwosComplement, | ||
isAddress: isAddress, | ||
stripHexPrefix: stripHexPrefix, | ||
checkAddressChecksum: checkAddressChecksum, | ||
leftPad: leftPad, | ||
rightPad: rightPad, | ||
utf8ToHex: utf8ToHex, | ||
hexToUtf8: hexToUtf8, | ||
hexToNumber: hexToNumber, | ||
hexToNumberString: hexToNumberString, | ||
numberToHex: numberToHex, | ||
bytesToHex: bytesToHex, | ||
hexToBytes: hexToBytes, | ||
toHex: toHex, | ||
isHexStrict: isHexStrict, | ||
isHex: isHex, | ||
isBloom: isBloom, | ||
isTopic: isTopic, | ||
keccak256: keccak256, | ||
getSignatureParameters: getSignatureParameters | ||
}); | ||
const _elementaryName = name => { | ||
@@ -371,3 +403,3 @@ if (name.startsWith('int[')) { | ||
const hexArguments = map(arguments_, _processSoliditySha3Arguments); | ||
return sha3(`0x${hexArguments.join('')}`); | ||
return keccak256(`0x${hexArguments.join('')}`); | ||
}; | ||
@@ -440,3 +472,3 @@ | ||
if (!isBN(number) && !isString(number)) { | ||
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); | ||
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); | ||
} | ||
@@ -448,23 +480,20 @@ return isBN(number) ? fromWei$1(number, unit) : fromWei$1(number, unit).toString(10); | ||
if (!isBN(number) && !isString(number)) { | ||
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); | ||
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); | ||
} | ||
return isBN(number) ? toWei$1(number, unit) : toWei$1(number, unit).toString(10); | ||
}; | ||
const toChecksumAddress = address => { | ||
if (typeof address === 'undefined') return ''; | ||
const toChecksumAddress = (address, chainId = null) => { | ||
if (typeof address !== 'string') { | ||
return ''; | ||
} | ||
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error(`Given address "${address}" is not a valid Ethereum address.`); | ||
address = address.toLowerCase().replace(/^0x/i, ''); | ||
const addressHash = sha3(address).replace(/^0x/i, ''); | ||
const stripAddress = stripHexPrefix$1(address).toLowerCase(); | ||
const prefix = chainId != null ? chainId.toString() + '0x' : ''; | ||
const keccakHash = Hash.keccak256(prefix + stripAddress).toString('hex').replace(/^0x/i, ''); | ||
let checksumAddress = '0x'; | ||
for (let i = 0; i < address.length; i++) { | ||
if (parseInt(addressHash[i], 16) > 7) { | ||
checksumAddress += address[i].toUpperCase(); | ||
} else { | ||
checksumAddress += address[i]; | ||
} | ||
} | ||
for (let i = 0; i < stripAddress.length; i++) checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]; | ||
return checksumAddress; | ||
}; | ||
const keccak256 = sha3; | ||
const sha3$1 = sha3; | ||
const keccak256$1 = keccak256; | ||
const sha3 = keccak256; | ||
const toDecimal = hexToNumber; | ||
@@ -498,3 +527,4 @@ const hexToNumber$1 = hexToNumber; | ||
const hexToBytes$1 = hexToBytes; | ||
const stripHexPrefix$1 = stripHexPrefix; | ||
export { asciiToHex, bytesToHex$1 as bytesToHex, checkAddressChecksum$1 as checkAddressChecksum, fromAscii, fromDecimal, fromUtf8, fromWei, getSignatureParameters$1 as getSignatureParameters, getUnitValue, hexToAscii, hexToBytes$1 as hexToBytes, hexToNumber$1 as hexToNumber, hexToNumberString$1 as hexToNumberString, hexToString, hexToUtf8$1 as hexToUtf8, isAddress$1 as isAddress, isBN$1 as isBN, isBloom$1 as isBloom, isHex$1 as isHex, isHexStrict$1 as isHexStrict, isTopic$1 as isTopic, jsonInterfaceMethodToString, keccak256, numberToHex$1 as numberToHex, padLeft, padRight, sha3$1 as sha3, soliditySha3, stringToHex, toAscii, toBN$1 as toBN, toChecksumAddress, toDecimal, toHex$1 as toHex, toTwosComplement$1 as toTwosComplement, toUtf8, toWei, utf8ToHex$1 as utf8ToHex }; | ||
export { asciiToHex, bytesToHex$1 as bytesToHex, checkAddressChecksum$1 as checkAddressChecksum, fromAscii, fromDecimal, fromUtf8, fromWei, getSignatureParameters$1 as getSignatureParameters, getUnitValue, hexToAscii, hexToBytes$1 as hexToBytes, hexToNumber$1 as hexToNumber, hexToNumberString$1 as hexToNumberString, hexToString, hexToUtf8$1 as hexToUtf8, isAddress$1 as isAddress, isBN$1 as isBN, isBloom$1 as isBloom, isHex$1 as isHex, isHexStrict$1 as isHexStrict, isTopic$1 as isTopic, jsonInterfaceMethodToString, keccak256$1 as keccak256, numberToHex$1 as numberToHex, padLeft, padRight, sha3, soliditySha3, stringToHex, stripHexPrefix$1 as stripHexPrefix, toAscii, toBN$1 as toBN, toChecksumAddress, toDecimal, toHex$1 as toHex, toTwosComplement$1 as toTwosComplement, toUtf8, toWei, utf8ToHex$1 as utf8ToHex }; |
@@ -38,2 +38,3 @@ (function (global, factory) { | ||
var isAddress = function isAddress(address) { | ||
var chainId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { | ||
@@ -44,10 +45,16 @@ return false; | ||
} else { | ||
return checkAddressChecksum(address); | ||
return checkAddressChecksum(address, chainId); | ||
} | ||
}; | ||
var stripHexPrefix = function stripHexPrefix(string) { | ||
return string.slice(0, 2) === '0x' ? string.slice(2) : string; | ||
}; | ||
var checkAddressChecksum = function checkAddressChecksum(address) { | ||
address = address.replace(/^0x/i, ''); | ||
var addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); | ||
for (var i = 0; i < 40; i++) { | ||
if (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i] || parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) { | ||
var chainId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
var stripAddress = stripHexPrefix(address).toLowerCase(); | ||
var prefix = chainId != null ? chainId.toString() + '0x' : ''; | ||
var keccakHash = Hash.keccak256(prefix + stripAddress).toString('hex').replace(/^0x/i, ''); | ||
for (var i = 0; i < stripAddress.length; i++) { | ||
var output = parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]; | ||
if (stripHexPrefix(address)[i] !== output) { | ||
return false; | ||
@@ -185,4 +192,4 @@ } | ||
}; | ||
var SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; | ||
var sha3 = function sha3(value) { | ||
var KECCAK256_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; | ||
var keccak256 = function keccak256(value) { | ||
if (isHexStrict(value) && /^0x/i.test(value.toString())) { | ||
@@ -192,3 +199,3 @@ value = hexToBytes(value); | ||
var returnValue = Hash.keccak256(value); | ||
if (returnValue === SHA3_NULL_S) { | ||
if (returnValue === KECCAK256_NULL_S) { | ||
return null; | ||
@@ -199,3 +206,3 @@ } else { | ||
}; | ||
sha3._Hash = Hash; | ||
keccak256._Hash = Hash; | ||
var getSignatureParameters = function getSignatureParameters(signature) { | ||
@@ -217,2 +224,28 @@ if (!isHexStrict(signature)) { | ||
var utils = /*#__PURE__*/Object.freeze({ | ||
isBN: isBN, | ||
isBigNumber: isBigNumber, | ||
toBN: toBN, | ||
toTwosComplement: toTwosComplement, | ||
isAddress: isAddress, | ||
stripHexPrefix: stripHexPrefix, | ||
checkAddressChecksum: checkAddressChecksum, | ||
leftPad: leftPad, | ||
rightPad: rightPad, | ||
utf8ToHex: utf8ToHex, | ||
hexToUtf8: hexToUtf8, | ||
hexToNumber: hexToNumber, | ||
hexToNumberString: hexToNumberString, | ||
numberToHex: numberToHex, | ||
bytesToHex: bytesToHex, | ||
hexToBytes: hexToBytes, | ||
toHex: toHex, | ||
isHexStrict: isHexStrict, | ||
isHex: isHex, | ||
isBloom: isBloom, | ||
isTopic: isTopic, | ||
keccak256: keccak256, | ||
getSignatureParameters: getSignatureParameters | ||
}); | ||
var _elementaryName = function _elementaryName(name) { | ||
@@ -376,3 +409,3 @@ if (name.startsWith('int[')) { | ||
var hexArguments = map(arguments_, _processSoliditySha3Arguments); | ||
return sha3("0x".concat(hexArguments.join(''))); | ||
return keccak256("0x".concat(hexArguments.join(''))); | ||
}; | ||
@@ -446,3 +479,3 @@ | ||
if (!isBN(number) && !isString(number)) { | ||
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); | ||
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); | ||
} | ||
@@ -454,3 +487,3 @@ return isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10); | ||
if (!isBN(number) && !isString(number)) { | ||
throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); | ||
throw new Error('Please pass numbers as strings or BN objects to avoid precision errors.'); | ||
} | ||
@@ -460,18 +493,18 @@ return isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10); | ||
var toChecksumAddress = function toChecksumAddress(address) { | ||
if (typeof address === 'undefined') return ''; | ||
var chainId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; | ||
if (typeof address !== 'string') { | ||
return ''; | ||
} | ||
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error("Given address \"".concat(address, "\" is not a valid Ethereum address.")); | ||
address = address.toLowerCase().replace(/^0x/i, ''); | ||
var addressHash = sha3(address).replace(/^0x/i, ''); | ||
var stripAddress = stripHexPrefix$1(address).toLowerCase(); | ||
var prefix = chainId != null ? chainId.toString() + '0x' : ''; | ||
var keccakHash = Hash.keccak256(prefix + stripAddress).toString('hex').replace(/^0x/i, ''); | ||
var checksumAddress = '0x'; | ||
for (var i = 0; i < address.length; i++) { | ||
if (parseInt(addressHash[i], 16) > 7) { | ||
checksumAddress += address[i].toUpperCase(); | ||
} else { | ||
checksumAddress += address[i]; | ||
} | ||
for (var i = 0; i < stripAddress.length; i++) { | ||
checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]; | ||
} | ||
return checksumAddress; | ||
}; | ||
var keccak256 = sha3; | ||
var sha3$1 = sha3; | ||
var keccak256$1 = keccak256; | ||
var sha3 = keccak256; | ||
var toDecimal = hexToNumber; | ||
@@ -505,3 +538,5 @@ var hexToNumber$1 = hexToNumber; | ||
var hexToBytes$1 = hexToBytes; | ||
var stripHexPrefix$1 = stripHexPrefix; | ||
exports.BN = BN; | ||
exports.randomHex = randomhex; | ||
@@ -530,9 +565,10 @@ exports.asciiToHex = asciiToHex; | ||
exports.jsonInterfaceMethodToString = jsonInterfaceMethodToString; | ||
exports.keccak256 = keccak256; | ||
exports.keccak256 = keccak256$1; | ||
exports.numberToHex = numberToHex$1; | ||
exports.padLeft = padLeft; | ||
exports.padRight = padRight; | ||
exports.sha3 = sha3$1; | ||
exports.sha3 = sha3; | ||
exports.soliditySha3 = soliditySha3; | ||
exports.stringToHex = stringToHex; | ||
exports.stripHexPrefix = stripHexPrefix$1; | ||
exports.toAscii = toAscii; | ||
@@ -539,0 +575,0 @@ exports.toBN = toBN$1; |
{ | ||
"name": "web3-utils", | ||
"namespace": "ethereum", | ||
"version": "1.0.0-beta.52", | ||
"version": "1.0.0-beta.53", | ||
"description": "Collection of utility functions used in web3.js.", | ||
@@ -39,3 +39,3 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.0/packages/web3-utils", | ||
], | ||
"gitHead": "1c89f503c90180598910d29892f6ebf92455cfe1" | ||
"gitHead": "d955a98a5fc8819ff866254ff7141a10b503b5cd" | ||
} |
@@ -5,3 +5,3 @@ # web3-utils | ||
This contains useful utility functions for Dapp developers. | ||
This contains useful utility functions for Dapp developers. | ||
Please read the [documentation][docs] for more. | ||
@@ -24,3 +24,3 @@ | ||
> { | ||
sha3: Function, | ||
keccak256: Function, | ||
soliditySha3: Function, | ||
@@ -41,3 +41,3 @@ isAddress: Function, | ||
## Types | ||
## Types | ||
@@ -44,0 +44,0 @@ All the typescript typings are placed in the types folder. |
@@ -76,3 +76,3 @@ /* | ||
export function toTwosComplement(value: number | string | BN): string; | ||
export function isAddress(address: string): boolean; | ||
export function isAddress(address: string, chainId?: number): boolean; | ||
export function isHex(hex: Hex): boolean; | ||
@@ -85,3 +85,3 @@ export function isHexStrict(hex: Hex): boolean; | ||
export function numberToHex(value: number | string | BN): string; | ||
export function checkAddressChecksum(address: string): boolean; | ||
export function checkAddressChecksum(address: string, chainId?: number): boolean; | ||
export function fromAscii(string: string): string; | ||
@@ -105,3 +105,3 @@ export function fromDecimal(value: string | number): string; | ||
export function stringToHex(string: string): string; | ||
export function toChecksumAddress(address: string): string; | ||
export function toChecksumAddress(address: string, chainId?: number): string; | ||
export function toDecimal(hex: Hex): number; | ||
@@ -121,2 +121,3 @@ export function toHex(value: number | string | BN): string; | ||
export function getSignatureParameters(signature: string): {r: string; s: string; v: number}; | ||
export function stripHexPrefix(str: string): string; | ||
@@ -129,3 +130,3 @@ // interfaces | ||
toTwosComplement(value: number | string | BN): string; | ||
isAddress(address: string): boolean; | ||
isAddress(address: string, chainId?: number): boolean; | ||
isHex(hex: Hex): boolean; | ||
@@ -138,3 +139,3 @@ isHexStrict(hex: Hex): boolean; | ||
numberToHex(value: number | string | BN): string; | ||
checkAddressChecksum(address: string): boolean; | ||
checkAddressChecksum(address: string, chainId?: number): boolean; | ||
fromAscii(string: string): string; | ||
@@ -158,3 +159,3 @@ fromDecimal(value: string | number): string; | ||
stringToHex(string: string): string; | ||
toChecksumAddress(address: string): string; | ||
toChecksumAddress(address: string, chainId?: number): string; | ||
toDecimal(hex: Hex): number; | ||
@@ -174,2 +175,3 @@ toHex(value: number | string | BN): string; | ||
getSignatureParameters(signature: string): {r: string; s: string; v: number}; | ||
stripHexPrefix(str: string): string; | ||
} | ||
@@ -176,0 +178,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72346
1860