From 13a2edc852aa2ae35cf827f8b08958c26356db4c Mon Sep 17 00:00:00 2001 From: Junaid <86780488+jdevcs@users.noreply.github.com> Date: Tue, 2 May 2023 14:18:07 +0200 Subject: [PATCH] Remove the unnecessary chainId parameter (#5888) (#6057) * refactor: Remove the unnecessary chainId parameter (#5888) Co-authored-by: Alex Co-authored-by: Wyatt Barnes Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com> * changelog update --------- Co-authored-by: in74mz <35923031+in74mz@users.noreply.github.com> Co-authored-by: Alex Co-authored-by: Wyatt Barnes --- CHANGELOG.md | 2 +- packages/web3-utils/types/index.d.ts | 6 +++--- .../types/tests/to-check-sum-address-test.ts | 16 ---------------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a9e4d597c..34e9d833cdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -672,7 +672,7 @@ Released with 1.0.0-beta.37 code base. - `transaction.type` is now formatted to a hex string before being send to provider (#5979) - When sending a transaction, if `transaction.type === '0x1' && transaction.accessList === undefined`, then `transaction.accessList` is set to `[]` (#5979) - + - Removed an unnecessary `chainId` parameter from `toChecksumAddress()` function types (#5888) ### Added - Added support for `getPastEvents` method to filter `allEvents` and specific event (#6015) diff --git a/packages/web3-utils/types/index.d.ts b/packages/web3-utils/types/index.d.ts index a49c3daccf6..825e8031b8f 100644 --- a/packages/web3-utils/types/index.d.ts +++ b/packages/web3-utils/types/index.d.ts @@ -80,7 +80,7 @@ export function hexToAscii(string: string): string; export function toAscii(string: string): string; export function bytesToHex(bytes: number[]): string; export function numberToHex(value: number | string | BN): string; -export function checkAddressChecksum(address: string, chainId?: number): boolean; +export function checkAddressChecksum(address: string): boolean; export function fromAscii(string: string): string; export function fromDecimal(value: string | number): string; export function fromUtf8(string: string): string; @@ -100,7 +100,7 @@ export function sha3Raw(value: string | BN | Buffer): string; export function randomHex(bytesSize: number): string; export function utf8ToHex(string: string): string; export function stringToHex(string: string): string; -export function toChecksumAddress(address: string, chainId?: number): string; +export function toChecksumAddress(address: string): string; export function toDecimal(hex: Hex): number; export function toHex(value: number | string | BN): string; export function toUtf8(string: string): string; @@ -157,7 +157,7 @@ export interface Utils { randomHex(bytesSize: number): string; utf8ToHex(string: string): string; stringToHex(string: string): string; - toChecksumAddress(address: string, chainId?: number): string; + toChecksumAddress(address: string): string; toDecimal(hex: Hex): number; toHex(value: number | string | BN): string; toUtf8(string: string): string; diff --git a/packages/web3-utils/types/tests/to-check-sum-address-test.ts b/packages/web3-utils/types/tests/to-check-sum-address-test.ts index a43aa7a8f80..6fe37fb577f 100644 --- a/packages/web3-utils/types/tests/to-check-sum-address-test.ts +++ b/packages/web3-utils/types/tests/to-check-sum-address-test.ts @@ -25,10 +25,6 @@ import {toChecksumAddress} from 'web3-utils'; // $ExpectType string toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51'); -// $ExpectType string -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', 31); -// $ExpectType string -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', undefined); // $ExpectError toChecksumAddress([4]); @@ -46,15 +42,3 @@ toChecksumAddress(true); toChecksumAddress(null); // $ExpectError toChecksumAddress(undefined); -// $ExpectError -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', [4]); -// $ExpectError -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', ['string']); -// $ExpectError -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', new BN(3)); -// $ExpectError -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', {}); -// $ExpectError -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', true); -// $ExpectError -toChecksumAddress('0x8ee7f17bb3f88b01247c21ab6603880b64ae53e811f5e01138822e558cf1ab51', null);