Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dissolve U64 and I64 RPC types #3467

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-moles-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@solana/rpc-types': patch
---

Remove `U64` and `I64` types in favour of `bigint`
4 changes: 1 addition & 3 deletions packages/accounts/src/rpc-api/common.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import type { U64 } from '@solana/rpc-types';

export type JsonParsedDataResponse<TData = object> = Readonly<{
parsed: {
info?: TData;
type: string;
};
// Name of the program that owns this account.
program: string;
space: U64;
space: bigint;
}>;
9 changes: 4 additions & 5 deletions packages/rpc-api/src/__typetests__/get-block-type-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import type {
TokenBalance,
TransactionError,
TransactionStatus,
U64,
} from '@solana/rpc-types';
import { TransactionVersion } from '@solana/transaction-messages';

Expand Down Expand Up @@ -503,7 +502,7 @@ void (async () => {
}

type ExpectedMetaForFullBase58 = {
computeUnitsConsumed?: U64;
computeUnitsConsumed?: bigint;
err: TransactionError | null;
fee: Lamports;
innerInstructions: readonly Readonly<{
Expand Down Expand Up @@ -728,7 +727,7 @@ void (async () => {
}

type ExpectedMetaForFullBase64 = {
computeUnitsConsumed?: U64;
computeUnitsConsumed?: bigint;
err: TransactionError | null;
fee: Lamports;
innerInstructions: readonly Readonly<{
Expand Down Expand Up @@ -927,7 +926,7 @@ void (async () => {
| ExpectedPartiallyDecodedTransactionInstruction;

type ExpectedMetaForFullJsonParsedBase = {
computeUnitsConsumed?: U64;
computeUnitsConsumed?: bigint;
err: TransactionError | null;
fee: Lamports;
innerInstructions: readonly Readonly<{
Expand Down Expand Up @@ -1092,7 +1091,7 @@ void (async () => {
};

type ExpectedMetaForFullJsonBase = {
computeUnitsConsumed?: U64;
computeUnitsConsumed?: bigint;
err: TransactionError | null;
fee: Lamports;
innerInstructions: readonly Readonly<{
Expand Down
3 changes: 1 addition & 2 deletions packages/rpc-api/src/getBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TransactionForFullBase64,
TransactionForFullJson,
TransactionForFullJsonParsed,
U64,
UnixTimestamp,
} from '@solana/rpc-types';
import type { TransactionVersion } from '@solana/transaction-messages';
Expand All @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-api/src/getBlockHeight.ts
Original file line number Diff line number Diff line change
@@ -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 = {
/**
Expand Down
6 changes: 3 additions & 3 deletions packages/rpc-api/src/getBlockProduction.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
12 changes: 6 additions & 6 deletions packages/rpc-api/src/getEpochInfo.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
10 changes: 4 additions & 6 deletions packages/rpc-api/src/getEpochSchedule.ts
Original file line number Diff line number Diff line change
@@ -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;
}>;
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-api/src/getInflationRate.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions packages/rpc-api/src/getInflationReward.ts
Original file line number Diff line number Diff line change
@@ -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;
}>;
Expand All @@ -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;
}>;
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-api/src/getLatestBlockhash.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-api/src/getMinimumBalanceForRentExemption.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Commitment, Lamports, U64 } from '@solana/rpc-types';
import type { Commitment, Lamports } from '@solana/rpc-types';

type GetMinimumBalanceForRentExemptionApiResponse = Lamports;

Expand All @@ -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;
}>,
Expand Down
8 changes: 4 additions & 4 deletions packages/rpc-api/src/getRecentPerformanceSamples.ts
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-api/src/getSignatureStatuses.ts
Original file line number Diff line number Diff line change
@@ -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<{
Expand All @@ -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 */
Expand Down
3 changes: 1 addition & 2 deletions packages/rpc-api/src/getTokenAccountsByDelegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {
DataSlice,
Slot,
SolanaRpcResponse,
U64,
} from '@solana/rpc-types';

type TokenAccountInfoWithJsonData = Readonly<{
Expand All @@ -22,7 +21,7 @@ type TokenAccountInfoWithJsonData = Readonly<{
};
/** Name of the program that owns this account. */
program: Address;
space: U64;
space: bigint;
}>;
}>;

Expand Down
3 changes: 1 addition & 2 deletions packages/rpc-api/src/getTokenAccountsByOwner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import type {
DataSlice,
Slot,
SolanaRpcResponse,
U64,
} from '@solana/rpc-types';

type TokenAccountInfoWithJsonData = Readonly<{
Expand All @@ -22,7 +21,7 @@ type TokenAccountInfoWithJsonData = Readonly<{
};
/** Name of the program that owns this account. */
program: Address;
space: U64;
space: bigint;
}>;
}>;

Expand Down
3 changes: 1 addition & 2 deletions packages/rpc-api/src/getTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import type {
TokenBalance,
TransactionError,
TransactionStatus,
U64,
UnixTimestamp,
} from '@solana/rpc-types';
import type { TransactionVersion } from '@solana/transaction-messages';
Expand All @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions packages/rpc-api/src/getTransactionCount.ts
Original file line number Diff line number Diff line change
@@ -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 = {
/**
Expand Down
13 changes: 6 additions & 7 deletions packages/rpc-api/src/getVoteAccounts.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
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<TVotePubkey extends Address> = 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 */
epochCredits: readonly EpochCredit[];
/** 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 */
Expand All @@ -34,7 +33,7 @@ type GetVoteAccountsApiResponse<TVotePubkey extends Address> = Readonly<{
type GetVoteAccountsConfig<TVotePubkey extends Address> = 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 */
Expand Down
3 changes: 1 addition & 2 deletions packages/rpc-api/src/simulateTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import type {
TransactionError,
TransactionForFullMetaInnerInstructionsParsed,
TransactionForFullMetaInnerInstructionsUnparsed,
U64,
} from '@solana/rpc-types';
import type { Base64EncodedWireTransaction } from '@solana/transactions';

Expand Down Expand Up @@ -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<T extends AccountInfoBase> = Readonly<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
Base64EncodedZStdCompressedDataResponse,
Lamports,
SolanaRpcResponse,
U64,
} from '@solana/rpc-types';

import type { AccountNotificationsApi } from '../account-notifications';
Expand All @@ -24,7 +23,7 @@ type TNotificationBase = Readonly<{
executable: boolean;
lamports: Lamports;
owner: Address;
rentEpoch: U64;
rentEpoch: bigint;
}>;

// No optional configs
Expand Down Expand Up @@ -131,7 +130,7 @@ rpcSubscriptions.accountNotifications(pubkey, { encoding: 'jsonParsed' }) satisf
| Readonly<{
parsed: unknown;
program: string;
space: U64;
space: bigint;
}>;
}
>
Expand All @@ -147,7 +146,7 @@ rpcSubscriptions
| Readonly<{
parsed: unknown;
program: string;
space: U64;
space: bigint;
}>;
}
>
Expand Down
Loading