From 3834d82eb1dd150f261612d742c3105194689c13 Mon Sep 17 00:00:00 2001 From: Loris Leiva Date: Mon, 28 Oct 2024 10:45:35 +0000 Subject: [PATCH] Dissolve `U64` and `I64` RPC types (#3467) --- .changeset/fair-moles-collect.md | 5 +++++ packages/accounts/src/rpc-api/common.ts | 4 +--- .../src/__typetests__/get-block-type-test.ts | 9 ++++----- packages/rpc-api/src/getBlock.ts | 3 +-- packages/rpc-api/src/getBlockHeight.ts | 4 ++-- packages/rpc-api/src/getBlockProduction.ts | 6 +++--- packages/rpc-api/src/getEpochInfo.ts | 12 ++++++------ packages/rpc-api/src/getEpochSchedule.ts | 10 ++++------ packages/rpc-api/src/getInflationRate.ts | 4 ++-- packages/rpc-api/src/getInflationReward.ts | 6 +++--- packages/rpc-api/src/getLatestBlockhash.ts | 4 ++-- .../src/getMinimumBalanceForRentExemption.ts | 4 ++-- .../rpc-api/src/getRecentPerformanceSamples.ts | 8 ++++---- packages/rpc-api/src/getSignatureStatuses.ts | 4 ++-- .../rpc-api/src/getTokenAccountsByDelegate.ts | 3 +-- packages/rpc-api/src/getTokenAccountsByOwner.ts | 3 +-- packages/rpc-api/src/getTransaction.ts | 3 +-- packages/rpc-api/src/getTransactionCount.ts | 4 ++-- packages/rpc-api/src/getVoteAccounts.ts | 13 ++++++------- packages/rpc-api/src/simulateTransaction.ts | 3 +-- .../account-notifications-type-test.ts | 7 +++---- .../block-notifications-type-test.ts | 9 ++++----- .../program-notifications-type-test.ts | 15 +++++++-------- .../slots-updates-notifications-type-test.ts | 4 ++-- .../src/block-notifications.ts | 3 +-- .../src/program-notifications.ts | 7 +++---- .../src/slots-updates-notifications.ts | 12 ++++++------ packages/rpc-types/src/account-filters.ts | 6 ++---- packages/rpc-types/src/account-info.ts | 5 ++--- packages/rpc-types/src/transaction.ts | 4 ++-- packages/rpc-types/src/typed-numbers.ts | 11 ++++------- 31 files changed, 89 insertions(+), 106 deletions(-) create mode 100644 .changeset/fair-moles-collect.md diff --git a/.changeset/fair-moles-collect.md b/.changeset/fair-moles-collect.md new file mode 100644 index 000000000000..d77ff6e54685 --- /dev/null +++ b/.changeset/fair-moles-collect.md @@ -0,0 +1,5 @@ +--- +'@solana/rpc-types': patch +--- + +Remove `U64` and `I64` types in favour of `bigint` diff --git a/packages/accounts/src/rpc-api/common.ts b/packages/accounts/src/rpc-api/common.ts index 7d1d780ce69a..ca5d98b3f679 100644 --- a/packages/accounts/src/rpc-api/common.ts +++ b/packages/accounts/src/rpc-api/common.ts @@ -1,5 +1,3 @@ -import type { U64 } from '@solana/rpc-types'; - export type JsonParsedDataResponse = Readonly<{ parsed: { info?: TData; @@ -7,5 +5,5 @@ export type JsonParsedDataResponse = Readonly<{ }; // Name of the program that owns this account. program: string; - space: U64; + space: bigint; }>; diff --git a/packages/rpc-api/src/__typetests__/get-block-type-test.ts b/packages/rpc-api/src/__typetests__/get-block-type-test.ts index 67019b8a747e..91911106d9d6 100644 --- a/packages/rpc-api/src/__typetests__/get-block-type-test.ts +++ b/packages/rpc-api/src/__typetests__/get-block-type-test.ts @@ -10,7 +10,6 @@ import type { TokenBalance, TransactionError, TransactionStatus, - U64, } from '@solana/rpc-types'; import { TransactionVersion } from '@solana/transaction-messages'; @@ -503,7 +502,7 @@ void (async () => { } type ExpectedMetaForFullBase58 = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ @@ -728,7 +727,7 @@ void (async () => { } type ExpectedMetaForFullBase64 = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ @@ -927,7 +926,7 @@ void (async () => { | ExpectedPartiallyDecodedTransactionInstruction; type ExpectedMetaForFullJsonParsedBase = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ @@ -1092,7 +1091,7 @@ void (async () => { }; type ExpectedMetaForFullJsonBase = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ diff --git a/packages/rpc-api/src/getBlock.ts b/packages/rpc-api/src/getBlock.ts index 0cfea8efca9e..e9488d4c8b4f 100644 --- a/packages/rpc-api/src/getBlock.ts +++ b/packages/rpc-api/src/getBlock.ts @@ -9,7 +9,6 @@ import type { TransactionForFullBase64, TransactionForFullJson, TransactionForFullJsonParsed, - U64, UnixTimestamp, } from '@solana/rpc-types'; import type { TransactionVersion } from '@solana/transaction-messages'; @@ -18,7 +17,7 @@ import type { TransactionVersion } from '@solana/transaction-messages'; type GetBlockApiResponseBase = Readonly<{ /** The number of blocks beneath this block */ - blockHeight: U64; + blockHeight: bigint; /** Estimated production time, as Unix timestamp */ blockTime: UnixTimestamp; /** the blockhash of this block */ diff --git a/packages/rpc-api/src/getBlockHeight.ts b/packages/rpc-api/src/getBlockHeight.ts index ef725a9c24ff..ed831d26da8c 100644 --- a/packages/rpc-api/src/getBlockHeight.ts +++ b/packages/rpc-api/src/getBlockHeight.ts @@ -1,6 +1,6 @@ -import type { Commitment, Slot, U64 } from '@solana/rpc-types'; +import type { Commitment, Slot } from '@solana/rpc-types'; -type GetBlockHeightApiResponse = U64; +type GetBlockHeightApiResponse = bigint; export type GetBlockHeightApi = { /** diff --git a/packages/rpc-api/src/getBlockProduction.ts b/packages/rpc-api/src/getBlockProduction.ts index 00e054834f70..4bd73f205ef6 100644 --- a/packages/rpc-api/src/getBlockProduction.ts +++ b/packages/rpc-api/src/getBlockProduction.ts @@ -1,8 +1,8 @@ import type { Address } from '@solana/addresses'; -import type { Commitment, Slot, SolanaRpcResponse, U64 } from '@solana/rpc-types'; +import type { Commitment, Slot, SolanaRpcResponse } from '@solana/rpc-types'; -type NumberOfLeaderSlots = U64; -type NumberOfBlocksProduced = U64; +type NumberOfLeaderSlots = bigint; +type NumberOfBlocksProduced = bigint; type SlotRange = Readonly<{ firstSlot: Slot; diff --git a/packages/rpc-api/src/getEpochInfo.ts b/packages/rpc-api/src/getEpochInfo.ts index a409ecbc095d..68cdef5bb7e4 100644 --- a/packages/rpc-api/src/getEpochInfo.ts +++ b/packages/rpc-api/src/getEpochInfo.ts @@ -1,18 +1,18 @@ -import type { Commitment, Slot, U64 } from '@solana/rpc-types'; +import type { Commitment, Slot } from '@solana/rpc-types'; type GetEpochInfoApiResponse = Readonly<{ /** the current slot */ absoluteSlot: Slot; /** the current block height */ - blockHeight: U64; + blockHeight: bigint; /** the current epoch */ - epoch: U64; + epoch: bigint; /** the current slot relative to the start of the current epoch */ - slotIndex: U64; + slotIndex: bigint; /** the number of slots in this epoch */ - slotsInEpoch: U64; + slotsInEpoch: bigint; /** total number of transactions processed without error since genesis */ - transactionCount: U64 | null; + transactionCount: bigint | null; }>; export type GetEpochInfoApi = { diff --git a/packages/rpc-api/src/getEpochSchedule.ts b/packages/rpc-api/src/getEpochSchedule.ts index be200e5f2d58..4cbb4351e7e9 100644 --- a/packages/rpc-api/src/getEpochSchedule.ts +++ b/packages/rpc-api/src/getEpochSchedule.ts @@ -1,14 +1,12 @@ -import type { U64 } from '@solana/rpc-types'; - type GetEpochScheduleApiResponse = Readonly<{ /** first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH) */ - firstNormalEpoch: U64; + firstNormalEpoch: bigint; /** MINIMUM_SLOTS_PER_EPOCH * (2^(firstNormalEpoch) - 1) */ - firstNormalSlot: U64; + firstNormalSlot: bigint; /** the number of slots before beginning of an epoch to calculate a leader schedule for that epoch */ - leaderScheduleSlotOffset: U64; + leaderScheduleSlotOffset: bigint; /** the maximum number of slots in each epoch */ - slotsPerEpoch: U64; + slotsPerEpoch: bigint; /** whether epochs start short and grow */ warmup: boolean; }>; diff --git a/packages/rpc-api/src/getInflationRate.ts b/packages/rpc-api/src/getInflationRate.ts index 008b6a63df75..656136249dbd 100644 --- a/packages/rpc-api/src/getInflationRate.ts +++ b/packages/rpc-api/src/getInflationRate.ts @@ -1,8 +1,8 @@ -import type { F64UnsafeSeeDocumentation, U64 } from '@solana/rpc-types'; +import type { F64UnsafeSeeDocumentation } from '@solana/rpc-types'; type GetInflationRateApiResponse = Readonly<{ /** Epoch for which these values are valid */ - epoch: U64; + epoch: bigint; /** Inflation allocated to the foundation */ foundation: F64UnsafeSeeDocumentation; /** Total inflation */ diff --git a/packages/rpc-api/src/getInflationReward.ts b/packages/rpc-api/src/getInflationReward.ts index a6d092105420..38f45982390e 100644 --- a/packages/rpc-api/src/getInflationReward.ts +++ b/packages/rpc-api/src/getInflationReward.ts @@ -1,12 +1,12 @@ import type { Address } from '@solana/addresses'; -import type { Commitment, Lamports, Slot, U64 } from '@solana/rpc-types'; +import type { Commitment, Lamports, Slot } from '@solana/rpc-types'; type GetInflationRewardApiConfig = Readonly<{ // Defaults to `finalized` commitment?: Commitment; // An epoch for which the reward occurs. // If omitted, the previous epoch will be used - epoch?: U64; + epoch?: bigint; // The minimum slot that the request can be evaluated at minContextSlot?: Slot; }>; @@ -19,7 +19,7 @@ type InflationReward = Readonly<{ // The slot in which the rewards are effective effectiveSlot: Slot; // Epoch for which reward occurred - epoch: U64; + epoch: bigint; // Post balance of the account in lamports postBalance: Lamports; }>; diff --git a/packages/rpc-api/src/getLatestBlockhash.ts b/packages/rpc-api/src/getLatestBlockhash.ts index e6708f8815a5..f6c396228fd6 100644 --- a/packages/rpc-api/src/getLatestBlockhash.ts +++ b/packages/rpc-api/src/getLatestBlockhash.ts @@ -1,10 +1,10 @@ -import type { Blockhash, Commitment, Slot, SolanaRpcResponse, U64 } from '@solana/rpc-types'; +import type { Blockhash, Commitment, Slot, SolanaRpcResponse } from '@solana/rpc-types'; type GetLatestBlockhashApiResponse = Readonly<{ /** a Hash as base-58 encoded string */ blockhash: Blockhash; /** last block height at which the blockhash will be valid */ - lastValidBlockHeight: U64; + lastValidBlockHeight: bigint; }>; export type GetLatestBlockhashApi = { diff --git a/packages/rpc-api/src/getMinimumBalanceForRentExemption.ts b/packages/rpc-api/src/getMinimumBalanceForRentExemption.ts index 8a727c5b7f84..d425a68d62f3 100644 --- a/packages/rpc-api/src/getMinimumBalanceForRentExemption.ts +++ b/packages/rpc-api/src/getMinimumBalanceForRentExemption.ts @@ -1,4 +1,4 @@ -import type { Commitment, Lamports, U64 } from '@solana/rpc-types'; +import type { Commitment, Lamports } from '@solana/rpc-types'; type GetMinimumBalanceForRentExemptionApiResponse = Lamports; @@ -7,7 +7,7 @@ export type GetMinimumBalanceForRentExemptionApi = { * Returns the minimum balance to exempt an account of a certain size from rent */ getMinimumBalanceForRentExemption( - size: U64, + size: bigint, config?: Readonly<{ commitment?: Commitment; }>, diff --git a/packages/rpc-api/src/getRecentPerformanceSamples.ts b/packages/rpc-api/src/getRecentPerformanceSamples.ts index aa0b8aa1c9f8..56414dba536f 100644 --- a/packages/rpc-api/src/getRecentPerformanceSamples.ts +++ b/packages/rpc-api/src/getRecentPerformanceSamples.ts @@ -1,12 +1,12 @@ -import type { Slot, U64 } from '@solana/rpc-types'; +import type { Slot } from '@solana/rpc-types'; type PerformanceSample = Readonly<{ /** Number of non-vote transactions in sample. */ - numNonVoteTransactions: U64; + numNonVoteTransactions: bigint; /** Number of slots in sample */ - numSlots: U64; + numSlots: bigint; /** Number of transactions in sample */ - numTransactions: U64; + numTransactions: bigint; /** Number of seconds in a sample window */ samplePeriodSecs: number; /** Slot in which sample was taken at */ diff --git a/packages/rpc-api/src/getSignatureStatuses.ts b/packages/rpc-api/src/getSignatureStatuses.ts index 3e24e6a801f1..6b166990549a 100644 --- a/packages/rpc-api/src/getSignatureStatuses.ts +++ b/packages/rpc-api/src/getSignatureStatuses.ts @@ -1,5 +1,5 @@ import type { Signature } from '@solana/keys'; -import type { Commitment, Slot, SolanaRpcResponse, TransactionError, U64 } from '@solana/rpc-types'; +import type { Commitment, Slot, SolanaRpcResponse, TransactionError } from '@solana/rpc-types'; /** @deprecated */ type TransactionStatusOk = Readonly<{ @@ -21,7 +21,7 @@ type SignatureStatusResult = Readonly<{ * Number of blocks since signature confirmation, null if rooted, * as well as finalized by a supermajority of the cluster */ - confirmations: U64 | null; + confirmations: bigint | null; /** Error if transaction failed, null if transaction succeeded */ err: TransactionError | null; /** The slot the transaction was processed */ diff --git a/packages/rpc-api/src/getTokenAccountsByDelegate.ts b/packages/rpc-api/src/getTokenAccountsByDelegate.ts index 8024b74a4fff..ec65a33dd17e 100644 --- a/packages/rpc-api/src/getTokenAccountsByDelegate.ts +++ b/packages/rpc-api/src/getTokenAccountsByDelegate.ts @@ -11,7 +11,6 @@ import type { DataSlice, Slot, SolanaRpcResponse, - U64, } from '@solana/rpc-types'; type TokenAccountInfoWithJsonData = Readonly<{ @@ -22,7 +21,7 @@ type TokenAccountInfoWithJsonData = Readonly<{ }; /** Name of the program that owns this account. */ program: Address; - space: U64; + space: bigint; }>; }>; diff --git a/packages/rpc-api/src/getTokenAccountsByOwner.ts b/packages/rpc-api/src/getTokenAccountsByOwner.ts index b0382ee37923..a7b6798cd804 100644 --- a/packages/rpc-api/src/getTokenAccountsByOwner.ts +++ b/packages/rpc-api/src/getTokenAccountsByOwner.ts @@ -11,7 +11,6 @@ import type { DataSlice, Slot, SolanaRpcResponse, - U64, } from '@solana/rpc-types'; type TokenAccountInfoWithJsonData = Readonly<{ @@ -22,7 +21,7 @@ type TokenAccountInfoWithJsonData = Readonly<{ }; /** Name of the program that owns this account. */ program: Address; - space: U64; + space: bigint; }>; }>; diff --git a/packages/rpc-api/src/getTransaction.ts b/packages/rpc-api/src/getTransaction.ts index 6b1bd3c216ee..d63539fb068a 100644 --- a/packages/rpc-api/src/getTransaction.ts +++ b/packages/rpc-api/src/getTransaction.ts @@ -12,7 +12,6 @@ import type { TokenBalance, TransactionError, TransactionStatus, - U64, UnixTimestamp, } from '@solana/rpc-types'; import type { TransactionVersion } from '@solana/transaction-messages'; @@ -26,7 +25,7 @@ type ReturnData = { type TransactionMetaBase = Readonly<{ /** number of compute units consumed by the transaction */ - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; /** Error if transaction failed, null if transaction succeeded. */ err: TransactionError | null; /** fee this transaction was charged */ diff --git a/packages/rpc-api/src/getTransactionCount.ts b/packages/rpc-api/src/getTransactionCount.ts index cd811f82962e..372304252f11 100644 --- a/packages/rpc-api/src/getTransactionCount.ts +++ b/packages/rpc-api/src/getTransactionCount.ts @@ -1,6 +1,6 @@ -import type { Commitment, Slot, U64 } from '@solana/rpc-types'; +import type { Commitment, Slot } from '@solana/rpc-types'; -type GetTransactionCountApiResponse = U64; +type GetTransactionCountApiResponse = bigint; export type GetTransactionCountApi = { /** diff --git a/packages/rpc-api/src/getVoteAccounts.ts b/packages/rpc-api/src/getVoteAccounts.ts index eb97267200b0..27e6971c2b54 100644 --- a/packages/rpc-api/src/getVoteAccounts.ts +++ b/packages/rpc-api/src/getVoteAccounts.ts @@ -1,15 +1,14 @@ import type { Address } from '@solana/addresses'; -import type { Commitment, Slot, U64 } from '@solana/rpc-types'; +import type { Commitment, Epoch, Slot } from '@solana/rpc-types'; -type Epoch = U64; -type Credits = U64; -type PreviousCredits = U64; +type Credits = bigint; +type PreviousCredits = bigint; type EpochCredit = [Epoch, Credits, PreviousCredits]; type VoteAccount = Readonly<{ /** the stake, in lamports, delegated to this vote account and active in this epoch */ - activatedStake: U64; + activatedStake: bigint; /** percentage (0-100) of rewards payout owed to the vote account */ commission: number; /** Latest history of earned credits for up to five epochs */ @@ -17,7 +16,7 @@ type VoteAccount = Readonly<{ /** whether the vote account is staked for this epoch */ epochVoteAccount: boolean; /** Most recent slot voted on by this vote account */ - lastVote: U64; + lastVote: bigint; /** Validator identity */ nodePubkey: Address; /** Current root slot for this vote account */ @@ -34,7 +33,7 @@ type GetVoteAccountsApiResponse = Readonly<{ type GetVoteAccountsConfig = Readonly<{ commitment?: Commitment; /** Specify the number of slots behind the tip that a validator must fall to be considered delinquent. **NOTE:** For the sake of consistency between ecosystem products, _it is **not** recommended that this argument be specified._ */ - delinquentSlotDistance?: U64; + delinquentSlotDistance?: bigint; /** Do not filter out delinquent validators with no stake */ keepUnstakedDelinquents?: boolean; /** Only return results for this validator vote address */ diff --git a/packages/rpc-api/src/simulateTransaction.ts b/packages/rpc-api/src/simulateTransaction.ts index 466eebeffede..1b899d891a33 100644 --- a/packages/rpc-api/src/simulateTransaction.ts +++ b/packages/rpc-api/src/simulateTransaction.ts @@ -13,7 +13,6 @@ import type { TransactionError, TransactionForFullMetaInnerInstructionsParsed, TransactionForFullMetaInnerInstructionsUnparsed, - U64, } from '@solana/rpc-types'; import type { Base64EncodedWireTransaction } from '@solana/transactions'; @@ -104,7 +103,7 @@ type SimulateTransactionApiResponseBase = Readonly<{ programId: Address; }> | null; /** The number of compute budget units consumed during the processing of this transaction */ - unitsConsumed?: U64; + unitsConsumed?: bigint; }>; type SimulateTransactionApiResponseWithAccounts = Readonly<{ diff --git a/packages/rpc-subscriptions-api/src/__typetests__/account-notifications-type-test.ts b/packages/rpc-subscriptions-api/src/__typetests__/account-notifications-type-test.ts index 6add657cc148..34e10f0a6a7a 100644 --- a/packages/rpc-subscriptions-api/src/__typetests__/account-notifications-type-test.ts +++ b/packages/rpc-subscriptions-api/src/__typetests__/account-notifications-type-test.ts @@ -8,7 +8,6 @@ import type { Base64EncodedZStdCompressedDataResponse, Lamports, SolanaRpcResponse, - U64, } from '@solana/rpc-types'; import type { AccountNotificationsApi } from '../account-notifications'; @@ -24,7 +23,7 @@ type TNotificationBase = Readonly<{ executable: boolean; lamports: Lamports; owner: Address; - rentEpoch: U64; + rentEpoch: bigint; }>; // No optional configs @@ -131,7 +130,7 @@ rpcSubscriptions.accountNotifications(pubkey, { encoding: 'jsonParsed' }) satisf | Readonly<{ parsed: unknown; program: string; - space: U64; + space: bigint; }>; } > @@ -147,7 +146,7 @@ rpcSubscriptions | Readonly<{ parsed: unknown; program: string; - space: U64; + space: bigint; }>; } > diff --git a/packages/rpc-subscriptions-api/src/__typetests__/block-notifications-type-test.ts b/packages/rpc-subscriptions-api/src/__typetests__/block-notifications-type-test.ts index 3cdb80454fba..0b3158e51e6b 100644 --- a/packages/rpc-subscriptions-api/src/__typetests__/block-notifications-type-test.ts +++ b/packages/rpc-subscriptions-api/src/__typetests__/block-notifications-type-test.ts @@ -13,7 +13,6 @@ import type { TokenBalance, TransactionError, TransactionStatus, - U64, } from '@solana/rpc-types'; import type { TransactionVersion } from '@solana/transaction-messages'; @@ -716,7 +715,7 @@ rpcSubscriptions >; type ExpectedMetaForFullBase58 = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ @@ -983,7 +982,7 @@ rpcSubscriptions >; type ExpectedMetaForFullBase64 = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ @@ -1213,7 +1212,7 @@ type ExpectedTransactionInstructionForFullJsonParsed = | ExpectedPartiallyDecodedTransactionInstruction; type ExpectedMetaForFullJsonParsedBase = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ @@ -1397,7 +1396,7 @@ type ExpectedTransactionInstructionForFullJson = { }; type ExpectedMetaForFullJsonBase = { - computeUnitsConsumed?: U64; + computeUnitsConsumed?: bigint; err: TransactionError | null; fee: Lamports; innerInstructions: readonly Readonly<{ diff --git a/packages/rpc-subscriptions-api/src/__typetests__/program-notifications-type-test.ts b/packages/rpc-subscriptions-api/src/__typetests__/program-notifications-type-test.ts index ea875999e944..223cad5bd270 100644 --- a/packages/rpc-subscriptions-api/src/__typetests__/program-notifications-type-test.ts +++ b/packages/rpc-subscriptions-api/src/__typetests__/program-notifications-type-test.ts @@ -9,7 +9,6 @@ import type { Base64EncodedZStdCompressedDataResponse, Lamports, SolanaRpcResponse, - U64, } from '@solana/rpc-types'; import type { ProgramNotificationsApi } from '../program-notifications'; @@ -25,7 +24,7 @@ type TNotificationBase = Readonly<{ executable: boolean; lamports: Lamports; owner: Address; - rentEpoch: U64; + rentEpoch: bigint; }>; pubkey: Address; }>; @@ -161,7 +160,7 @@ rpcSubscriptions.programNotifications(programId, { | Readonly<{ parsed: unknown; program: string; - space: U64; + space: bigint; }>; }; } @@ -179,7 +178,7 @@ rpcSubscriptions | Readonly<{ parsed: unknown; program: string; - space: U64; + space: bigint; }>; }; } @@ -194,7 +193,7 @@ rpcSubscriptions memcmp: { bytes: 'bytes' as Base58EncodedBytes, encoding: 'base58', - offset: 0n as U64, + offset: 0n, }, }, ], @@ -207,7 +206,7 @@ rpcSubscriptions memcmp: { bytes: 'bytes' as Base58EncodedBytes, encoding: 'base64', - offset: 0n as U64, + offset: 0n, }, }, ], @@ -218,7 +217,7 @@ rpcSubscriptions memcmp: { bytes: 'bytes' as Base64EncodedBytes, encoding: 'base64', - offset: 0n as U64, + offset: 0n, }, }, ], @@ -231,7 +230,7 @@ rpcSubscriptions memcmp: { bytes: 'bytes' as Base64EncodedBytes, encoding: 'base58', - offset: 0n as U64, + offset: 0n, }, }, ], diff --git a/packages/rpc-subscriptions-api/src/__typetests__/slots-updates-notifications-type-test.ts b/packages/rpc-subscriptions-api/src/__typetests__/slots-updates-notifications-type-test.ts index 6b0a3730ae37..8b9579484760 100644 --- a/packages/rpc-subscriptions-api/src/__typetests__/slots-updates-notifications-type-test.ts +++ b/packages/rpc-subscriptions-api/src/__typetests__/slots-updates-notifications-type-test.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-floating-promises */ import type { PendingRpcSubscriptionsRequest, RpcSubscriptions } from '@solana/rpc-subscriptions-spec'; -import type { Slot, U64 } from '@solana/rpc-types'; +import type { Slot } from '@solana/rpc-types'; import type { SlotsUpdatesNotificationsApi } from '../slots-updates-notifications'; @@ -9,7 +9,7 @@ const rpcSubscriptions = null as unknown as RpcSubscriptions; rpcSubscriptions.slotsUpdatesNotifications() satisfies PendingRpcSubscriptionsRequest; diff --git a/packages/rpc-subscriptions-api/src/block-notifications.ts b/packages/rpc-subscriptions-api/src/block-notifications.ts index 2019b1eb298f..39d598b4a892 100644 --- a/packages/rpc-subscriptions-api/src/block-notifications.ts +++ b/packages/rpc-subscriptions-api/src/block-notifications.ts @@ -10,7 +10,6 @@ import type { TransactionForFullBase64, TransactionForFullJson, TransactionForFullJsonParsed, - U64, UnixTimestamp, } from '@solana/rpc-types'; import type { TransactionVersion } from '@solana/transaction-messages'; @@ -30,7 +29,7 @@ type BlockNotificationsNotificationBase = Readonly<{ type BlockNotificationsNotificationBlock = Readonly<{ /** The number of blocks beneath this block */ - blockHeight: U64; + blockHeight: bigint; /** Estimated production time, as Unix timestamp */ blockTime: UnixTimestamp; /** the blockhash of this block */ diff --git a/packages/rpc-subscriptions-api/src/program-notifications.ts b/packages/rpc-subscriptions-api/src/program-notifications.ts index 7de75e46cf1c..4757db5df632 100644 --- a/packages/rpc-subscriptions-api/src/program-notifications.ts +++ b/packages/rpc-subscriptions-api/src/program-notifications.ts @@ -10,22 +10,21 @@ import type { Base64EncodedBytes, Commitment, SolanaRpcResponse, - U64, } from '@solana/rpc-types'; type ProgramNotificationsMemcmpFilterBase58 = Readonly<{ bytes: Base58EncodedBytes; encoding: 'base58'; - offset: U64; + offset: bigint; }>; type ProgramNotificationsMemcmpFilterBase64 = Readonly<{ bytes: Base64EncodedBytes; encoding: 'base64'; - offset: U64; + offset: bigint; }>; -type ProgramNotificationsDatasizeFilter = U64; +type ProgramNotificationsDatasizeFilter = bigint; type ProgramNotificationsApiNotificationBase = SolanaRpcResponse< Readonly<{ diff --git a/packages/rpc-subscriptions-api/src/slots-updates-notifications.ts b/packages/rpc-subscriptions-api/src/slots-updates-notifications.ts index c83d8cdd41e0..e4e3f7e78740 100644 --- a/packages/rpc-subscriptions-api/src/slots-updates-notifications.ts +++ b/packages/rpc-subscriptions-api/src/slots-updates-notifications.ts @@ -1,8 +1,8 @@ -import type { Slot, U64 } from '@solana/rpc-types'; +import type { Slot } from '@solana/rpc-types'; type SlotsUpdatesNotificationsApiNotificationBase = Readonly<{ slot: Slot; - timestamp: U64; + timestamp: bigint; type: 'completed' | 'firstShredReceived' | 'optimisticConfirmation' | 'root'; }>; @@ -20,10 +20,10 @@ type SlotsUpdatesNotificationsApiNotificationDead = Readonly<{ type SlotsUpdatesNotificationsApiNotificationFrozen = Readonly<{ stats: Readonly<{ - maxTransactionsPerEntry: U64; - numFailedTransactions: U64; - numSuccessfulTransactions: U64; - numTransactionEntries: U64; + maxTransactionsPerEntry: bigint; + numFailedTransactions: bigint; + numSuccessfulTransactions: bigint; + numTransactionEntries: bigint; }>; type: 'frozen'; }> & diff --git a/packages/rpc-types/src/account-filters.ts b/packages/rpc-types/src/account-filters.ts index cc8eac775728..3beb8bbefe83 100644 --- a/packages/rpc-types/src/account-filters.ts +++ b/packages/rpc-types/src/account-filters.ts @@ -1,5 +1,3 @@ -import type { U64 } from './typed-numbers'; - export type DataSlice = Readonly<{ length: number; offset: number; @@ -9,10 +7,10 @@ export type GetProgramAccountsMemcmpFilter = Readonly<{ memcmp: Readonly<{ bytes: string; encoding: 'base58' | 'base64'; - offset: U64; + offset: bigint; }>; }>; export type GetProgramAccountsDatasizeFilter = Readonly<{ - dataSize: U64; + dataSize: bigint; }>; diff --git a/packages/rpc-types/src/account-info.ts b/packages/rpc-types/src/account-info.ts index 81bc7d2076f5..d93160b41018 100644 --- a/packages/rpc-types/src/account-info.ts +++ b/packages/rpc-types/src/account-info.ts @@ -7,7 +7,6 @@ import type { Base64EncodedZStdCompressedDataResponse, } from './encoded-bytes'; import type { Lamports } from './lamports'; -import type { U64 } from './typed-numbers'; export type AccountInfoBase = Readonly<{ /** indicates if the account contains a program (and is strictly read-only) */ @@ -17,7 +16,7 @@ export type AccountInfoBase = Readonly<{ /** pubkey of the program this account has been assigned to */ owner: Address; /** the epoch at which this account will next owe rent */ - rentEpoch: U64; + rentEpoch: bigint; }>; /** @deprecated */ @@ -48,7 +47,7 @@ export type AccountInfoWithJsonData = Readonly<{ }; // Name of the program that owns this account. program: string; - space: U64; + space: bigint; }>; }>; diff --git a/packages/rpc-types/src/transaction.ts b/packages/rpc-types/src/transaction.ts index 56f56b9e8fd1..64c9c72fcf50 100644 --- a/packages/rpc-types/src/transaction.ts +++ b/packages/rpc-types/src/transaction.ts @@ -5,7 +5,7 @@ import type { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataRe import type { Lamports } from './lamports'; import type { TokenBalance } from './token-balance'; import type { TransactionError } from './transaction-error'; -import type { SignedLamports, U64 } from './typed-numbers'; +import type { SignedLamports } from './typed-numbers'; type TransactionVersion = 'legacy' | 0; @@ -118,7 +118,7 @@ export type TransactionForAccounts