From d466799871bb5f80189a403eef0b508c68ee108d Mon Sep 17 00:00:00 2001 From: Steven Luscher Date: Mon, 19 Sep 2022 18:31:16 -0700 Subject: [PATCH] fix: replace bigint literals with `BigInt` constructors (#27930) This makes web3.js compatible with runtimes that don't understand bigint literals but _do_ understand `BigInt` constructors. For whatever that's worth. --- web3.js/src/programs/address-lookup-table/state.ts | 2 +- web3.js/test/message-tests/compiled-keys.test.ts | 2 +- web3.js/test/message-tests/v0.test.ts | 2 +- web3.js/test/transaction-tests/message.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web3.js/src/programs/address-lookup-table/state.ts b/web3.js/src/programs/address-lookup-table/state.ts index e455867474..4764ea2e16 100644 --- a/web3.js/src/programs/address-lookup-table/state.ts +++ b/web3.js/src/programs/address-lookup-table/state.ts @@ -32,7 +32,7 @@ export class AddressLookupTableAccount { } isActive(): boolean { - const U64_MAX = 18446744073709551615n; + const U64_MAX = BigInt('0xffffffffffffffff'); return this.state.deactivationSlot === U64_MAX; } diff --git a/web3.js/test/message-tests/compiled-keys.test.ts b/web3.js/test/message-tests/compiled-keys.test.ts index 28e1366a78..adca1cefe2 100644 --- a/web3.js/test/message-tests/compiled-keys.test.ts +++ b/web3.js/test/message-tests/compiled-keys.test.ts @@ -12,7 +12,7 @@ function createTestKeys(count: number): Array { function createTestLookupTable( addresses: Array, ): AddressLookupTableAccount { - const U64_MAX = 18446744073709551615n; + const U64_MAX = BigInt('0xffffffffffffffff'); return new AddressLookupTableAccount({ key: PublicKey.unique(), state: { diff --git a/web3.js/test/message-tests/v0.test.ts b/web3.js/test/message-tests/v0.test.ts index d5a6ba02c5..8705f7b0fd 100644 --- a/web3.js/test/message-tests/v0.test.ts +++ b/web3.js/test/message-tests/v0.test.ts @@ -18,7 +18,7 @@ function createTestKeys(count: number): Array { function createTestLookupTable( addresses: Array, ): AddressLookupTableAccount { - const U64_MAX = 18446744073709551615n; + const U64_MAX = BigInt('0xffffffffffffffff'); return new AddressLookupTableAccount({ key: PublicKey.unique(), state: { diff --git a/web3.js/test/transaction-tests/message.test.ts b/web3.js/test/transaction-tests/message.test.ts index 909e26d420..261d424d72 100644 --- a/web3.js/test/transaction-tests/message.test.ts +++ b/web3.js/test/transaction-tests/message.test.ts @@ -17,7 +17,7 @@ function createTestKeys(count: number): Array { function createTestLookupTable( addresses: Array, ): AddressLookupTableAccount { - const U64_MAX = 18446744073709551615n; + const U64_MAX = BigInt('0xffffffffffffffff'); return new AddressLookupTableAccount({ key: PublicKey.unique(), state: {