Catalog npm
PACKAGE EXPLORERView in registry

@0xcert/ethereum-utils

npm

General Ethereum utility module with helper functions for the Ethereum blockchain.

0xcertassetblockchaincurrencyerc-20erc-721ethereumframeworkfungiblejavascriptlibrariesnodejsnon-fungiblenpmnuxtjsprotocol
All keywords (32)
smart-contracttokentypescriptvaluevaluesvuejszxccontractcontractsethsmartsmart-contractstokensutilitiesutilityutils
Versions collected72
Direct dependencies12From release 2.1.1
Last observed20 Oct, 22:48 UTC

README

Current package documentation

General Ethereum utility module with helper functions for the Ethereum blockchain.

The 0xcert Framework is a free and open-source JavaScript library that provides tools for building powerful decentralized applications. Please refer to the official documentation for more details.

This module is one of the bricks of the 0xcert Framework. It's written with TypeScript and it's actively maintained. The source code is available on GitHub where you can also find our issue tracker.

Ethereum Utilities

This module wraps several useful Ethereum functions which will be useful through the 0xcert Framework. Currently supported are these functions and classes from ethers.js:

ABI coder

This converts the value to and from the packed Ethereum ABI encoding.

  • encodeParameters(types: any, values: Array<any>): string
  • decodeParameters(types: any, data: any): any

Encoding example:

import { decodeParameters, encodeParameters } from '0xcert/ethereum-utils/abi';

const types = ['tuple(uint256, uint256[])'];
const values = [[ 42, [ 45 ] ]];
const encodedValues = encodeParameters(types, values);

Decoding example:

import { decodeParameters, encodeParameters } from '0xcert/ethereum-utils/abi';

const types = ['tuple(uint256, uint256[])'];
const encoded = '0x' +
  '0000000000000000000000000000000000000000000000000000000000000020' +
  '000000000000000000000000000000000000000000000000000000000000002a' +
  '0000000000000000000000000000000000000000000000000000000000000040' +
  '0000000000000000000000000000000000000000000000000000000000000001' +
  '000000000000000000000000000000000000000000000000000000000000002d';
const values = decodeParameters(types, values);

Big umbers

Here is a basic example adapted from the ethers.js documentation.

import { bigNumberify } from '0xcert/ethereum-utils/big-number';

let gasPriceWei = bigNumberify("20902747399");
let gasLimit = bigNumberify(3000000);

let maxCostWei = gasPriceWei.mul(gasLimit)
console.log("Max Cost: " + maxCostWei.toString());
// "Max Cost: 62708242197000000"

console.log("Number: " + maxCostWei.toNumber());
// throws an Error, the value is too large for JavaScript to handle safely

Address normalization

The ethers.js address normalization function implements EIP-55 Mixed-case checksum address encoding.

import { getAddress } from '0xcert/ethereum-utils/normalize-address';

let zxcTokenAddress = '0x83e2be8d114f9661221384b3a50d24b96a5653f5';
let zxcTokenAddressNormalized = normalizeAddress(zxcToenAddress);
// 0x83e2BE8d114F9661221384B3a50d24B96a5653F5

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 72

Collected releases
VersionPublishedDirect dependenciesOpen version
1.5.16 May 20196
1.5.03 May 20196
1.4.13 May 20196
1.4.023 Apr 20196
1.3.023 Apr 20196
1.2.0-alpha111 Apr 20196
1.2.022 Mar 20196
1.0.0-rc1315 Mar 20196
1.0.0-rc1228 Feb 20196
1.0.0-rc1127 Feb 20196
1.0.0-rc1027 Feb 20196
1.0.0-rc924 Feb 20196
1.0.0-rc819 Feb 20196
1.0.0-rc715 Feb 20196
1.0.0-rc615 Feb 20196
1.0.0-rc512 Feb 20196
1.0.0-rc412 Feb 20196
1.0.0-rc31 Feb 20196
1.0.0-rc227 Jan 201911
1.0.0-rc124 Jan 201911

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
0xcert/ethereum-utils

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
0xcert/framework

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:48 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:aed53ff14645fa151b90bb397c011d4059d6a826ce740740a194a6a2540ffaf7