Skip to content

Commit

Permalink
Remove the unnecessary chainId parameter (#5888) (#6057)
Browse files Browse the repository at this point in the history
* refactor: Remove the unnecessary chainId parameter (#5888)

Co-authored-by: Alex <[email protected]>
Co-authored-by: Wyatt Barnes <[email protected]>
Co-authored-by: Junaid <[email protected]>

* changelog update

---------

Co-authored-by: in74mz <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: Wyatt Barnes <[email protected]>
  • Loading branch information
4 people authored May 2, 2023
1 parent 7b3ce91 commit 13a2edc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions packages/web3-utils/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 0 additions & 16 deletions packages/web3-utils/types/tests/to-check-sum-address-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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);

0 comments on commit 13a2edc

Please sign in to comment.