From 74117f8749e443f8f11ead757e574c40768cd004 Mon Sep 17 00:00:00 2001 From: steveluscher Date: Mon, 19 Sep 2022 16:58:05 -0700 Subject: [PATCH] fix: replace bigint literals with `BigInt` constructors 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 e4558674748a6b..4764ea2e162b3a 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 28e1366a78e2e4..adca1cefe2407a 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 d5a6ba02c5e5fd..8705f7b0fd098b 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 909e26d420d89f..261d424d727b01 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: {