Nothing Special   »   [go: up one dir, main page]

Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

Releases: ethereumjs/ethereumjs-util

v7.0.9 - Large ChainID Support

04 Mar 18:07
b100d13
Compare
Choose a tag to compare

This release adds support for very high chainId numbers exceeding MAX_SAFE_INTEGER (an example is the chain ID 34180983699157880 used for the ephemeral Yolov3 testnet preparing for the berlin hardfork, but high chain IDs might be used for things like private test networks and the like as well).

Function signatures for methods in address and signature are therefore expanded to allow for a BNLike input type (BN | PrefixedHexString | number | Buffer) for chain ID related parameters.

All function signatures are still taking in a number input for backwards-compatibility reasons. If you use one of the following functions to implement generic use cases in your library where the chain ID is not yet known it is recommended to updated to one of the other input types (with plain Buffer likely be the most future-proof). Note that on some functions this changes the return value as well.

  • account: toChecksumAddresss(hexAddress: string, eip1191ChainId?: number): string
    • -> toChecksumAddress = function(hexAddress: string, eip1191ChainId?: BNLike): string
  • account: isValidChecksumAddress(hexAddress: string, eip1191ChainId?: number)
    • -> isValidChecksumAddress(hexAddress: string, eip1191ChainId?: BNLike)
  • signature: ecsign(msgHash: Buffer, privateKey: Buffer, chainId?: number): ECDSASignature
    • -> ecsign(msgHash: Buffer, privateKey: Buffer, chainId?: number): ECDSASignature (return value stays the same on number input)
    • -> ecsign(msgHash: Buffer, privateKey: Buffer, chainId: BNLike): ECDSASignatureBuffer (changed return value for other type inputs)
  • signature: ecrecover(msgHash: Buffer, v: number, r: Buffer, s: Buffer, chainId?: number): Buffer
    • -> ecrecover(msgHash: Buffer, v: BNLike, r: Buffer, s: Buffer, chainId?: BNLike): Buffer
  • signature: toRpcSig(v: number, r: Buffer, s: Buffer, chainId?: number): string
    • -> toRpcSig(v: BNLike, r: Buffer, s: Buffer, chainId?: BNLike): string
  • signature: isValidSignature(v: number, r: Buffer, s: Buffer, homesteadOrLater: boolean = true, chainId?: number)
    • -> isValidSignature(v: BNLike, r: Buffer, s: Buffer, homesteadOrLater: boolean = true, chainId?: BNLike)

v7.0.8 - Bugfix Release

02 Feb 09:32
0725f7e
Compare
Choose a tag to compare
  • New Address.equals(address: Address) function for easier address equality comparions, PR #285
  • Fixed a bug in fromRpcSig() in the signature module not working correctly for chain IDs greater than 110, PR #287

v7.0.7 - Maintenance Release

19 Oct 08:12
dd2882d
Compare
Choose a tag to compare
  • Removed stateRoot check for Account.isEmpty() to make emptiness check EIP-161 compliant, PR #279
  • Added type AddressLike and helper bnToHex(), PR #279
  • Added account.raw() which returns a Buffer Array of the raw Buffers for the account in order, PR #279

v7.0.6 - New Account Class

08 Oct 11:31
c1787c1
Compare
Choose a tag to compare

New Account class

This release adds a new Account class intended as a modern replacement for ethereumjs-account. It has a shape of Account(nonce?: BN, balance?: BN, stateRoot?: Buffer, codeHash?: Buffer).

Instantiation

The static factory methods assist in creating an Account object from varying data types: Object: fromAccountData, RLP: fromRlpSerializedAccount, and Array: fromValuesArray.

Methods: isEmpty(): boolean, isContract(): boolean, serialize(): Buffer

Example usage:

import { Account, BN } from 'ethereumjs-util'

const account = new Account(
  new BN(0), // nonce, default: 0
  new BN(10).pow(new BN(18)), // balance, default: 0
  undefined, // stateRoot, default: KECCAK256_RLP (hash of RLP of null)
  undefined, // codeHash, default: KECCAK256_NULL (hash of null)
)

For more info see the documentation, examples of usage in test/account.spec.ts or PR #275.

New export: TypeScript types

A new file with helpful TypeScript types has been added to the exports of this project, see PR #275.

In this release it contains BNLike, BufferLike, and TransformableToBuffer.

Address.toBuffer()

The Address class has as a new method address.toBuffer() that will give you a copy of the underlying address.buf (PR #277).

toBuffer() now converts TransformableToBuffer

The toBuffer() exported function now additionally converts any object with a toBuffer() method (PR #277).

v7.0.5 - New Address Type

10 Sep 08:40
d8b8e44
Compare
Choose a tag to compare

This release adds a new module address - see README - with a new Address class and type which can be used for creating and representing Ethereum addresses.

Example usage:

import { Address } from 'ethereumjs-util'

const pubKey = Buffer.from(
  '3a443d8381a6798a70c6ff9304bdc8cb0163c23211d11628fae52ef9e0dca11a001cf066d56a8156fc201cd5df8a36ef694eecd258903fca7086c1fae7441e1d',
  'hex',
)
const address = Address.fromPublicKey(pubKey)

In TypeScript the associated Address type can be used to more strictly enforce type checks (e.g. on the length of an address) on function parameters expecting an address input. So you can declare a function like the following: myAddressRelatedFunction(address: Address) to get more assurance that the address input is correct.

See PR #186

v7.0.4 - Bugfix Release

04 Aug 16:14
ae6515d
Compare
Choose a tag to compare
  • Fixed BN.js and RLP re-export failures from TypeScript, PR #270
  • Fixed an issue along large-value input due to a string copy inconsistency within the assertIs* helper functions, issue affects most methods of the library, PR #269

v6.2.1 - Crypto Update (ethereum-cryptography)

16 Jul 08:48
d996942
Compare
Choose a tag to compare

This release replaces the native secp256k1 and keccak dependencies with ethereum-cryptopgraphy which doesn't need native compilation.

v5.2.1 - Crypto Update (ethereum-cryptography)

16 Jul 09:05
d909c08
Compare
Choose a tag to compare

This release replaces the native secp256k1 and keccak dependencies with ethereum-cryptopgraphy which doesn't need native compilation.

v4.5.1 - Crypto Update (ethereum-cryptography)

16 Jul 09:16
860beb7
Compare
Choose a tag to compare

This release replaces the native secp256k1 and keccak dependencies with ethereum-cryptopgraphy which doesn't need native compilation.

v7.0.3 - Crypto Update Release

08 Jul 08:25
c6e8f3e
Compare
Choose a tag to compare

This release replaces the keccak and secp256k1 dependencies (PR #257) and instead uses the ethereum-cryptography package that uses native JS implementations for cryptographic primitives and makes use of modern and forward-compatible N-API implementations in Node wherever possible.

This is part of a larger initiative led by Nomic Labs to improve the developer experience within the Ethereum developer ecosystem,
see ethereum/js-team-organization#18 for context.

Other Changes:

  • Added TypeScript definitions for ethjs-util methods, PR #248 and PR #260