web3-utils
Advanced tools
Comparing version 2.0.0-alpha.1 to 3.0.0-rc.0
{ | ||
"name": "web3-utils", | ||
"namespace": "ethereum", | ||
"version": "2.0.0-alpha.1", | ||
"version": "3.0.0-rc.0", | ||
"description": "Collection of utility functions used in web3.js.", | ||
"repository": "https://github.com/ethereum/web3.js/tree/1.0/packages/web3-utils", | ||
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-utils", | ||
"license": "LGPL-3.0", | ||
@@ -11,34 +10,23 @@ "engines": { | ||
}, | ||
"main": "dist/web3-utils.cjs.js", | ||
"module": "dist/web3-utils.esm.js", | ||
"browser": "dist/web3-utils.umd.js", | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"dev": "rollup -c -w", | ||
"test": "jest", | ||
"dtslint": "dtslint types --onlyTestTsNext" | ||
"compile": "tsc -b tsconfig.json", | ||
"dtslint": "dtslint --localTs ../../node_modules/typescript/lib types" | ||
}, | ||
"types": "types/index.d.ts", | ||
"main": "lib/index.js", | ||
"dependencies": { | ||
"@babel/runtime": "^7.3.1", | ||
"@types/bn.js": "^4.11.4", | ||
"@types/node": "^12.6.1", | ||
"bn.js": "4.11.8", | ||
"bn.js": "^4.11.9", | ||
"eth-lib": "0.2.8", | ||
"ethjs-unit": "^0.1.6", | ||
"lodash": "^4.17.11", | ||
"ethereum-bloom-filters": "^1.0.6", | ||
"ethjs-unit": "0.1.6", | ||
"number-to-bn": "1.7.0", | ||
"randombytes": "^2.1.0", | ||
"utf8": "2.1.1" | ||
"underscore": "1.9.1", | ||
"utf8": "3.0.0" | ||
}, | ||
"devDependencies": { | ||
"crypto-js": "3.1.9-1", | ||
"definitelytyped-header-parser": "^1.0.1", | ||
"dtslint": "0.4.2" | ||
"dtslint": "^3.4.1", | ||
"typescript": "^3.9.5" | ||
}, | ||
"files": [ | ||
"dist", | ||
"types/index.d.ts" | ||
], | ||
"gitHead": "cb266cc298150f4eb1c8cdac4f41551dd8819a81" | ||
"gitHead": "4c88fbc94d1348dfa412ebdefa1d34e50f509977" | ||
} |
# web3-utils | ||
This is a sub package of [web3.js][repo] | ||
[![NPM Package][npm-image]][npm-url] [![Dependency Status][deps-image]][deps-url] [![Dev Dependency Status][deps-dev-image]][deps-dev-url] | ||
This is a sub-package of [web3.js][repo]. | ||
This contains useful utility functions for Dapp developers. | ||
Please read the [documentation][docs] for more. | ||
@@ -10,2 +13,4 @@ | ||
### Node.js | ||
```bash | ||
@@ -17,12 +22,9 @@ npm install web3-utils | ||
Import all of the utils functions | ||
```js | ||
import * as Utils from 'web3-utils'; | ||
console.log(Utils); | ||
> { | ||
keccak256: Function, | ||
soliditySha3: Function, | ||
isAddress: Function, | ||
const Web3Utils = require('web3-utils'); | ||
console.log(Web3Utils); | ||
{ | ||
sha3: function(){}, | ||
soliditySha3: function(){}, | ||
isAddress: function(){}, | ||
... | ||
@@ -32,16 +34,13 @@ } | ||
Import what you need | ||
```js | ||
import { asciiToHex } from 'web3-utils'; | ||
console.log(asciiToHex('I have 100!')); | ||
> "0x49206861766520313030e282ac" | ||
``` | ||
## Types | ||
All the typescript typings are placed in the types folder. | ||
All the TypeScript typings are placed in the `types` folder. | ||
[docs]: http://web3js.readthedocs.io/en/1.0/ | ||
[repo]: https://github.com/ethereum/web3.js | ||
[npm-image]: https://img.shields.io/npm/v/web3-utils.svg | ||
[npm-url]: https://npmjs.org/package/web3-utils | ||
[deps-image]: https://david-dm.org/ethereum/web3.js/1.x/status.svg?path=packages/web3-utils | ||
[deps-url]: https://david-dm.org/ethereum/web3.js/1.x?path=packages/web3-utils | ||
[deps-dev-image]: https://david-dm.org/ethereum/web3.js/1.x/dev-status.svg?path=packages/web3-utils | ||
[deps-dev-url]: https://david-dm.org/ethereum/web3.js/1.x?type=dev&path=packages/web3-utils |
@@ -24,3 +24,2 @@ /* | ||
import BN = require('bn.js'); | ||
import {Buffer} from 'buffer'; | ||
@@ -100,3 +99,4 @@ export type Unit = | ||
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; | ||
@@ -112,5 +112,11 @@ export function utf8ToHex(string: string): string; | ||
export function isBloom(bloom: string): boolean; | ||
export function isInBloom(bloom: string, value: string | Uint8Array): boolean; | ||
export function isUserEthereumAddressInBloom(bloom: string, ethereumAddress: string): boolean; | ||
export function isContractAddressInBloom(bloom: string, contractAddress: string): boolean; | ||
export function isTopicInBloom(bloom: string, topic: string): boolean; | ||
export function isTopic(topic: string): boolean; | ||
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 encodePacked(...val: Mixed[]): string | null; | ||
export function getUnitValue(unit: Unit): string; | ||
@@ -152,3 +158,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; | ||
@@ -164,5 +170,11 @@ utf8ToHex(string: string): string; | ||
isBloom(bloom: string): boolean; | ||
isInBloom(bloom: string, value: string | Uint8Array): boolean; | ||
isUserEthereumAddressInBloom(bloom: string, ethereumAddress: string): boolean; | ||
isContractAddressInBloom(bloom: string, contractAddress: string): boolean; | ||
isTopicInBloom(bloom: string, topic: string): boolean; | ||
isTopic(topic: string): boolean; | ||
jsonInterfaceMethodToString(abiItem: AbiItem): string; | ||
soliditySha3(...val: Mixed[]): string; | ||
soliditySha3(...val: Mixed[]): string | null; | ||
soliditySha3Raw(...val: Mixed[]): string; | ||
encodePacked(...val: Mixed[]): string | null; | ||
getUnitValue(unit: Unit): string; | ||
@@ -218,2 +230,3 @@ unitMap(): Units; | ||
type: AbiType; | ||
gas?: number; | ||
} | ||
@@ -226,2 +239,3 @@ | ||
components?: AbiInput[]; | ||
internalType?: string; | ||
} | ||
@@ -233,2 +247,3 @@ | ||
components?: AbiOutput[]; | ||
internalType?: string; | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
161711
8
2
67
4743
44
1
+ Addedunderscore@1.9.1
+ Added@noble/hashes@1.5.0(transitive)
+ Addedethereum-bloom-filters@1.2.0(transitive)
+ Addedunderscore@1.9.1(transitive)
+ Addedutf8@3.0.0(transitive)
- Removed@babel/runtime@^7.3.1
- Removed@types/bn.js@^4.11.4
- Removed@types/node@^12.6.1
- Removedlodash@^4.17.11
- Removed@babel/runtime@7.26.0(transitive)
- Removed@types/bn.js@4.11.6(transitive)
- Removed@types/node@12.20.55(transitive)
- Removedbn.js@4.11.8(transitive)
- Removedlodash@4.17.21(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
- Removedutf8@2.1.1(transitive)
Updatedbn.js@^4.11.9
Updatedethjs-unit@0.1.6
Updatedutf8@3.0.0