Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

web3-utils

Package Overview
Dependencies
Maintainers
3
Versions
494
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-utils - npm Package Compare versions

Comparing version 2.0.0-alpha.1 to 3.0.0-rc.0

lib/index.js

40

package.json
{
"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;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc