web3-utils
Advanced tools
Comparing version 1.2.4 to 1.2.5-rc.0
{ | ||
"name": "web3-utils", | ||
"version": "1.2.4", | ||
"version": "1.2.5-rc.0", | ||
"description": "Collection of utility functions used in web3.js.", | ||
@@ -29,3 +29,3 @@ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-utils", | ||
}, | ||
"gitHead": "341015ab24efc3ea1e5d8afd07e8c92a7c738536" | ||
"gitHead": "e919f81ccf7fee23a2d9075fa141bec0ff4a087a" | ||
} |
@@ -66,5 +66,7 @@ /* | ||
// OR suppress uncatched error if an callback listener is present | ||
if (emitter && | ||
if ( | ||
emitter && | ||
(_.isFunction(emitter.listeners) && | ||
emitter.listeners('error').length) || _.isFunction(callback)) { | ||
emitter.listeners('error').length) || _.isFunction(callback) | ||
) { | ||
emitter.catch(function(){}); | ||
@@ -318,4 +320,2 @@ } | ||
module.exports = { | ||
@@ -335,4 +335,6 @@ _fireError: _fireError, | ||
sha3: utils.sha3, | ||
sha3Raw: utils.sha3Raw, | ||
keccak256: utils.sha3, | ||
soliditySha3: soliditySha3, | ||
soliditySha3: soliditySha3.soliditySha3, | ||
soliditySha3Raw: soliditySha3.soliditySha3Raw, | ||
isAddress: utils.isAddress, | ||
@@ -376,4 +378,10 @@ checkAddressChecksum: utils.checkAddressChecksum, | ||
rightPad: utils.rightPad, | ||
toTwosComplement: utils.toTwosComplement | ||
toTwosComplement: utils.toTwosComplement, | ||
isBloom: utils.isBloom, | ||
isUserEthereumAddressInBloom: utils.isUserEthereumAddressInBloom, | ||
isContractAddressInBloom: utils.isContractAddressInBloom, | ||
isTopic: utils.isTopic, | ||
isTopicInBloom: utils.isTopicInBloom, | ||
isInBloom: utils.isInBloom | ||
}; | ||
@@ -244,3 +244,16 @@ /* | ||
/** | ||
* Hashes solidity values to a sha3 hash using keccak 256 but does return the hash of value `null` instead of `null` | ||
* | ||
* @method soliditySha3Raw | ||
* @return {Object} the sha3 | ||
*/ | ||
var soliditySha3Raw = function () { | ||
return utils.sha3Raw('0x'+ _.map(Array.prototype.slice.call(arguments), _processSoliditySha3Args).join('')); | ||
}; | ||
module.exports = soliditySha3; | ||
module.exports = { | ||
soliditySha3: soliditySha3, | ||
soliditySha3Raw: soliditySha3Raw | ||
}; |
@@ -496,3 +496,20 @@ /* | ||
/** | ||
* @method sha3Raw | ||
* | ||
* @param value | ||
* | ||
* @returns {string} | ||
*/ | ||
var sha3Raw = function(value) { | ||
value = sha3(value); | ||
if (value === null) { | ||
return SHA3_NULL_S; | ||
} | ||
return value; | ||
}; | ||
module.exports = { | ||
@@ -524,3 +541,4 @@ BN: BN, | ||
toTwosComplement: toTwosComplement, | ||
sha3: sha3 | ||
sha3: sha3, | ||
sha3Raw: sha3Raw | ||
}; |
@@ -98,3 +98,4 @@ /* | ||
export function padRight(string: string | number, characterAmount: number, sign?: string): string; | ||
export function sha3(value: string | BN): string; | ||
export function sha3(value: string | BN): string | null; | ||
export function sha3Raw(value: string | BN): string; | ||
export function randomHex(bytesSize: number): string; | ||
@@ -116,3 +117,4 @@ export function utf8ToHex(string: string): string; | ||
export function jsonInterfaceMethodToString(abiItem: AbiItem): string; | ||
export function soliditySha3(...val: Mixed[]): string; | ||
export function soliditySha3(...val: Mixed[]): string | null; | ||
export function soliditySha3Raw(...val: Mixed[]): string; | ||
export function getUnitValue(unit: Unit): string; | ||
@@ -154,3 +156,3 @@ export function unitMap(): Units; | ||
padRight(string: string | number, characterAmount: number, sign?: string): string; | ||
sha3(value: string | BN): string; | ||
sha3(value: string | BN): string | null; | ||
randomHex(bytesSize: number): string; | ||
@@ -172,3 +174,4 @@ utf8ToHex(string: string): string; | ||
jsonInterfaceMethodToString(abiItem: AbiItem): string; | ||
soliditySha3(...val: Mixed[]): string; | ||
soliditySha3(...val: Mixed[]): string | null; | ||
soliditySha3Raw(...val: Mixed[]): string; | ||
getUnitValue(unit: Unit): string; | ||
@@ -231,2 +234,3 @@ unitMap(): Units; | ||
components?: AbiInput[]; | ||
internalType?: string; | ||
} | ||
@@ -233,0 +237,0 @@ |
@@ -26,5 +26,5 @@ /* | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
sha3('234'); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
sha3(new BN(3)); | ||
@@ -31,0 +31,0 @@ |
@@ -26,19 +26,19 @@ /* | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3('234564535', '0xfff23243', true, -10); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3('Hello!%'); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3('234'); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3(0xea); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3(new BN(3)); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3({type: 'uint256', value: '234'}); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3({t: 'uint', v: new BN('234')}); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3({t: 'string', v: 'Hello!%'}, {t: 'int8', v: -23}, {t: 'address', v: '0x85F43D8a49eeB85d32Cf465507DD71d507100C1d'}); | ||
// $ExpectType string | ||
// $ExpectType string | null | ||
soliditySha3('0x407D73d8a49eeb85D32Cf465507dd71d507100c1'); | ||
@@ -45,0 +45,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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
121360
62
3474
2