diff --git a/packages/rpc-core/src/__tests__/commitment-test.ts b/packages/rpc-core/src/__tests__/commitment-test.ts new file mode 100644 index 000000000000..0a8bc2f7ae19 --- /dev/null +++ b/packages/rpc-core/src/__tests__/commitment-test.ts @@ -0,0 +1,11 @@ +import { Commitment, commitmentComparator } from '../commitment'; + +describe('commitmentComparator', () => { + it('sorts commitments according to their level of finality ascending', () => { + expect((['finalized', 'processed', 'confirmed'] as Commitment[]).sort(commitmentComparator)).toEqual([ + 'processed', + 'confirmed', + 'finalized', + ]); + }); +}); diff --git a/packages/rpc-core/src/commitment.ts b/packages/rpc-core/src/commitment.ts new file mode 100644 index 000000000000..59dbd15e5ec8 --- /dev/null +++ b/packages/rpc-core/src/commitment.ts @@ -0,0 +1,23 @@ +export type Commitment = 'confirmed' | 'finalized' | 'processed'; + +function getCommitmentScore(commitment: Commitment): number { + switch (commitment) { + case 'finalized': + return 2; + case 'confirmed': + return 1; + case 'processed': + return 0; + default: + return ((_: never) => { + throw new Error(`Unrecognized commitment \`${commitment}\`.`); + })(commitment); + } +} + +export function commitmentComparator(a: Commitment, b: Commitment): -1 | 0 | 1 { + if (a === b) { + return 0; + } + return getCommitmentScore(a) < getCommitmentScore(b) ? -1 : 1; +} diff --git a/packages/rpc-core/src/index.ts b/packages/rpc-core/src/index.ts index f4edb91f564e..f6d1d132b4b1 100644 --- a/packages/rpc-core/src/index.ts +++ b/packages/rpc-core/src/index.ts @@ -1,3 +1,4 @@ +export * from './commitment'; export * from './lamports'; export * from './rpc-methods'; export * from './rpc-subscriptions'; diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-account-info-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-account-info-test.ts index cf42da6ac989..d0cd0dd67120 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-account-info-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-account-info-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-balance-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-balance-test.ts index 47f81edfcf1c..d9c9faaaa09c 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-balance-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-balance-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getBalance', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-block-height.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-block-height.ts index a8ff29ebb84d..f8647ad8102b 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-block-height.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-block-height.ts @@ -3,7 +3,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getBlockHeight', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-block-production-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-block-production-test.ts index c17131b02045..a22672dbcd6b 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-block-production-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-block-production-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-epoch-info-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-epoch-info-test.ts index e5e70f62f85e..4c17b1039f92 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-epoch-info-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-epoch-info-test.ts @@ -3,7 +3,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getEpochInfo', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-fee-for-message-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-fee-for-message-test.ts index 53f75cca8097..2bf40eea763d 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-fee-for-message-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-fee-for-message-test.ts @@ -5,7 +5,7 @@ import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import { Blockhash, SerializedMessageBytesBase64 } from '@solana/transactions'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-governor-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-governor-test.ts index 704961a7aae4..de079cc901f5 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-governor-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-governor-test.ts @@ -2,7 +2,7 @@ import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport'; import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getInflationGovernor', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-reward-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-reward-test.ts index 9462b3f30d84..0c9df3ef144e 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-reward-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-inflation-reward-test.ts @@ -3,7 +3,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getInflationReward', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-largest-accounts-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-largest-accounts-test.ts index 4925c9052ff9..b2cb7f044f93 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-largest-accounts-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-largest-accounts-test.ts @@ -7,7 +7,7 @@ import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; import path from 'path'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-latest-blockhash-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-latest-blockhash-test.ts index 3ea30d96eaae..909135c28729 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-latest-blockhash-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-latest-blockhash-test.ts @@ -3,7 +3,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-leader-schedule-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-leader-schedule-test.ts index f9ab9a4c372d..9796502baf5a 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-leader-schedule-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-leader-schedule-test.ts @@ -7,7 +7,7 @@ import { open } from 'fs/promises'; import fetchMock from 'jest-fetch-mock-fork'; import path from 'path'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const validatorKeypairPath = path.resolve(__dirname, '../../../../../test-ledger/validator-keypair.json'); diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-minimum-balance-for-rent-exemption-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-minimum-balance-for-rent-exemption-test.ts index d328e25a0010..aa8d836a4a18 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-minimum-balance-for-rent-exemption-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-minimum-balance-for-rent-exemption-test.ts @@ -2,7 +2,7 @@ import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport'; import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getMinimumBalanceForRentExemption', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-multiple-accounts-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-multiple-accounts-test.ts index 819e3466d1ca..c758b9ced273 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-multiple-accounts-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-multiple-accounts-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-program-accounts-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-program-accounts-test.ts index f34d56706075..23178b6ca89b 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-program-accounts-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-program-accounts-test.ts @@ -8,7 +8,7 @@ import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; import path from 'path'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-slot-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-slot-test.ts index 4eaabe6dc2bc..a3edd0ad96e7 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-slot-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-slot-test.ts @@ -3,7 +3,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getSlot', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-stake-activation-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-stake-activation-test.ts index f813411ba110..54a6c7930275 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-stake-activation-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-stake-activation-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; // See scripts/fixtures/stake-account.json diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-stake-minimum-delegation-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-stake-minimum-delegation-test.ts index 35951e637917..4dbcbfb3c3a5 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-stake-minimum-delegation-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-stake-minimum-delegation-test.ts @@ -2,7 +2,7 @@ import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport'; import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getStakeMinimumDelegation', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-supply-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-supply-test.ts index 3fd8a274dab8..22713f1c0810 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-supply-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-supply-test.ts @@ -2,7 +2,7 @@ import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport'; import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-token-account-balance-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-token-account-balance-test.ts index 2f65d04c935b..5726099aae19 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-token-account-balance-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-token-account-balance-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-delegate-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-delegate-test.ts index af96597e2b77..403ff494d782 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-delegate-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-delegate-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-owner-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-owner-test.ts index aee93fda1b9a..5d241df19845 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-owner-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-token-accounts-by-owner-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-token-largest-accounts-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-token-largest-accounts-test.ts index d26a9f0c1126..83ab21be57a5 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-token-largest-accounts-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-token-largest-accounts-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-token-supply-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-token-supply-test.ts index 327578d2caf3..e2dabf2ebcff 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-token-supply-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-token-supply-test.ts @@ -4,7 +4,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/get-transaction-count-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/get-transaction-count-test.ts index bb406cfb8905..ab48c0af736c 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/get-transaction-count-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/get-transaction-count-test.ts @@ -3,7 +3,7 @@ import type { SolanaJsonRpcErrorCode } from '@solana/rpc-transport/dist/types/js import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('getTransactionCount', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/is-blockhash-valid-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/is-blockhash-valid-test.ts index b4bd0973287c..fc8e1ad7dc3b 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/is-blockhash-valid-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/is-blockhash-valid-test.ts @@ -3,7 +3,7 @@ import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import { Blockhash } from '@solana/transactions'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('isBlockhashValid', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/request-airdrop-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/request-airdrop-test.ts index b7e6972f5539..5c0a5a880c02 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/request-airdrop-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/request-airdrop-test.ts @@ -4,8 +4,8 @@ import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport'; import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import fetchMock from 'jest-fetch-mock-fork'; +import { Commitment } from '../../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../../lamports'; -import { Commitment } from '../common'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; describe('requestAirdrop', () => { diff --git a/packages/rpc-core/src/rpc-methods/__tests__/send-transaction-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/send-transaction-test.ts index 61b93fb9bad5..42a03031e627 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/send-transaction-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/send-transaction-test.ts @@ -5,7 +5,7 @@ import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import { Base64EncodedWireTransaction } from '@solana/transactions'; import fetchMock from 'jest-fetch-mock-fork'; -import { Commitment } from '../common'; +import { Commitment } from '../../commitment'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; function getMockTransactionMessage({ diff --git a/packages/rpc-core/src/rpc-methods/__tests__/simulate-transaction-test.ts b/packages/rpc-core/src/rpc-methods/__tests__/simulate-transaction-test.ts index 842aa102facf..187f765616b8 100644 --- a/packages/rpc-core/src/rpc-methods/__tests__/simulate-transaction-test.ts +++ b/packages/rpc-core/src/rpc-methods/__tests__/simulate-transaction-test.ts @@ -6,7 +6,8 @@ import type { Rpc } from '@solana/rpc-transport/dist/types/json-rpc-types'; import { Base64EncodedWireTransaction } from '@solana/transactions'; import fetchMock from 'jest-fetch-mock-fork'; -import { Base58EncodedBytes, Commitment } from '../common'; +import { Commitment } from '../../commitment'; +import { Base58EncodedBytes } from '../common'; import { createSolanaRpcApi, SolanaRpcMethods } from '../index'; const CONTEXT_MATCHER = expect.objectContaining({ diff --git a/packages/rpc-core/src/rpc-methods/common.ts b/packages/rpc-core/src/rpc-methods/common.ts index bced865f8c46..89ef2f8c6f6f 100644 --- a/packages/rpc-core/src/rpc-methods/common.ts +++ b/packages/rpc-core/src/rpc-methods/common.ts @@ -4,8 +4,6 @@ import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; import { StringifiedBigInt } from '../stringified-bigint'; import { StringifiedNumber } from '../stringified-number'; -export type Commitment = 'confirmed' | 'finalized' | 'processed'; - export type DataSlice = Readonly<{ offset: number; length: number; diff --git a/packages/rpc-core/src/rpc-methods/getAccountInfo.ts b/packages/rpc-core/src/rpc-methods/getAccountInfo.ts index 450ef9915640..3df21d59456a 100644 --- a/packages/rpc-core/src/rpc-methods/getAccountInfo.ts +++ b/packages/rpc-core/src/rpc-methods/getAccountInfo.ts @@ -1,5 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58Bytes, @@ -7,7 +8,6 @@ import { AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, - Commitment, DataSlice, RpcResponse, Slot, diff --git a/packages/rpc-core/src/rpc-methods/getBalance.ts b/packages/rpc-core/src/rpc-methods/getBalance.ts index fd9f156d6dee..94a8432a5aa2 100644 --- a/packages/rpc-core/src/rpc-methods/getBalance.ts +++ b/packages/rpc-core/src/rpc-methods/getBalance.ts @@ -1,7 +1,8 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Commitment, RpcResponse, Slot } from './common'; +import { RpcResponse, Slot } from './common'; type GetBalanceApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/getBlock.ts b/packages/rpc-core/src/rpc-methods/getBlock.ts index 86b1fdf35dc3..523af56baa5a 100644 --- a/packages/rpc-core/src/rpc-methods/getBlock.ts +++ b/packages/rpc-core/src/rpc-methods/getBlock.ts @@ -1,7 +1,8 @@ import { Blockhash, TransactionVersion } from '@solana/transactions'; +import { Commitment } from '../commitment'; import { UnixTimestamp } from '../unix-timestamp'; -import { Base58EncodedBytes, Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Base58EncodedBytes, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; import { Reward, TransactionForAccounts, diff --git a/packages/rpc-core/src/rpc-methods/getBlockHeight.ts b/packages/rpc-core/src/rpc-methods/getBlockHeight.ts index b9299704e3d7..890e049f82f1 100644 --- a/packages/rpc-core/src/rpc-methods/getBlockHeight.ts +++ b/packages/rpc-core/src/rpc-methods/getBlockHeight.ts @@ -1,4 +1,5 @@ -import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetBlockHeightApiResponse = U64UnsafeBeyond2Pow53Minus1; diff --git a/packages/rpc-core/src/rpc-methods/getBlockProduction.ts b/packages/rpc-core/src/rpc-methods/getBlockProduction.ts index 99b445334df0..7a61d9a6a5ff 100644 --- a/packages/rpc-core/src/rpc-methods/getBlockProduction.ts +++ b/packages/rpc-core/src/rpc-methods/getBlockProduction.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, RpcResponse, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, U64UnsafeBeyond2Pow53Minus1 } from './common'; type NumberOfLeaderSlots = U64UnsafeBeyond2Pow53Minus1; type NumberOfBlocksProduced = U64UnsafeBeyond2Pow53Minus1; diff --git a/packages/rpc-core/src/rpc-methods/getBlocks.ts b/packages/rpc-core/src/rpc-methods/getBlocks.ts index 433d195c6069..fbabd035e685 100644 --- a/packages/rpc-core/src/rpc-methods/getBlocks.ts +++ b/packages/rpc-core/src/rpc-methods/getBlocks.ts @@ -1,4 +1,5 @@ -import { Commitment, Slot } from './common'; +import { Commitment } from '../commitment'; +import { Slot } from './common'; type GetBlocksApiResponse = Slot[]; diff --git a/packages/rpc-core/src/rpc-methods/getBlocksWithLimit.ts b/packages/rpc-core/src/rpc-methods/getBlocksWithLimit.ts index 9ada083dbaf6..c8e4a1936563 100644 --- a/packages/rpc-core/src/rpc-methods/getBlocksWithLimit.ts +++ b/packages/rpc-core/src/rpc-methods/getBlocksWithLimit.ts @@ -1,4 +1,5 @@ -import { Commitment, Slot } from './common'; +import { Commitment } from '../commitment'; +import { Slot } from './common'; type GetBlocksWithLimitApiResponse = Slot[]; diff --git a/packages/rpc-core/src/rpc-methods/getEpochInfo.ts b/packages/rpc-core/src/rpc-methods/getEpochInfo.ts index 0535d716be02..a6058bb619e5 100644 --- a/packages/rpc-core/src/rpc-methods/getEpochInfo.ts +++ b/packages/rpc-core/src/rpc-methods/getEpochInfo.ts @@ -1,4 +1,5 @@ -import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetEpochInfoApiResponse = Readonly<{ /** the current slot */ diff --git a/packages/rpc-core/src/rpc-methods/getFeeForMessage.ts b/packages/rpc-core/src/rpc-methods/getFeeForMessage.ts index 82dc6410dbe8..6c223f4288cf 100644 --- a/packages/rpc-core/src/rpc-methods/getFeeForMessage.ts +++ b/packages/rpc-core/src/rpc-methods/getFeeForMessage.ts @@ -1,6 +1,7 @@ import { SerializedMessageBytesBase64 } from '@solana/transactions'; -import { Commitment, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; /** Fee corresponding to the message at the specified blockhash */ type GetFeeForMessageApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/getInflationGovernor.ts b/packages/rpc-core/src/rpc-methods/getInflationGovernor.ts index 552c5d3b0bb6..498ee4021e00 100644 --- a/packages/rpc-core/src/rpc-methods/getInflationGovernor.ts +++ b/packages/rpc-core/src/rpc-methods/getInflationGovernor.ts @@ -1,4 +1,5 @@ -import { Commitment, F64UnsafeSeeDocumentation } from './common'; +import { Commitment } from '../commitment'; +import { F64UnsafeSeeDocumentation } from './common'; type GetInflationGovernorApiResponse = Readonly<{ /** The initial inflation percentage from time 0 */ diff --git a/packages/rpc-core/src/rpc-methods/getInflationReward.ts b/packages/rpc-core/src/rpc-methods/getInflationReward.ts index 01ef6ce1be04..b6a7c4896647 100644 --- a/packages/rpc-core/src/rpc-methods/getInflationReward.ts +++ b/packages/rpc-core/src/rpc-methods/getInflationReward.ts @@ -1,7 +1,8 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetInflationRewardApiResponse = Readonly<{ // Reward amount in lamports diff --git a/packages/rpc-core/src/rpc-methods/getLargestAccounts.ts b/packages/rpc-core/src/rpc-methods/getLargestAccounts.ts index 4b00032c9f5f..0dfc24e39c73 100644 --- a/packages/rpc-core/src/rpc-methods/getLargestAccounts.ts +++ b/packages/rpc-core/src/rpc-methods/getLargestAccounts.ts @@ -1,7 +1,8 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Commitment, RpcResponse } from './common'; +import { RpcResponse } from './common'; type GetLargestAccountsResponseItem = Readonly<{ /** Base-58 encoded address of the account */ diff --git a/packages/rpc-core/src/rpc-methods/getLatestBlockhash.ts b/packages/rpc-core/src/rpc-methods/getLatestBlockhash.ts index 355dec20468e..80f7453cfd57 100644 --- a/packages/rpc-core/src/rpc-methods/getLatestBlockhash.ts +++ b/packages/rpc-core/src/rpc-methods/getLatestBlockhash.ts @@ -1,6 +1,7 @@ import { Blockhash } from '@solana/transactions'; -import { Commitment, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetLatestBlockhashApiResponse = RpcResponse<{ /** a Hash as base-58 encoded string */ diff --git a/packages/rpc-core/src/rpc-methods/getLeaderSchedule.ts b/packages/rpc-core/src/rpc-methods/getLeaderSchedule.ts index 3b33345b5079..0b165b1ae6e3 100644 --- a/packages/rpc-core/src/rpc-methods/getLeaderSchedule.ts +++ b/packages/rpc-core/src/rpc-methods/getLeaderSchedule.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, Slot } from './common'; +import { Commitment } from '../commitment'; +import { Slot } from './common'; /** * This return type is a dictionary of validator identities, as base-58 encoded diff --git a/packages/rpc-core/src/rpc-methods/getMinimumBalanceForRentExemption.ts b/packages/rpc-core/src/rpc-methods/getMinimumBalanceForRentExemption.ts index 7eccd9f65d47..06f12bcdb259 100644 --- a/packages/rpc-core/src/rpc-methods/getMinimumBalanceForRentExemption.ts +++ b/packages/rpc-core/src/rpc-methods/getMinimumBalanceForRentExemption.ts @@ -1,5 +1,6 @@ +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Commitment, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetMinimumBalanceForRentExemptionApiResponse = LamportsUnsafeBeyond2Pow53Minus1; diff --git a/packages/rpc-core/src/rpc-methods/getMultipleAccounts.ts b/packages/rpc-core/src/rpc-methods/getMultipleAccounts.ts index b91f7b601550..51d7affd229e 100644 --- a/packages/rpc-core/src/rpc-methods/getMultipleAccounts.ts +++ b/packages/rpc-core/src/rpc-methods/getMultipleAccounts.ts @@ -1,12 +1,12 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, - Commitment, DataSlice, RpcResponse, Slot, diff --git a/packages/rpc-core/src/rpc-methods/getProgramAccounts.ts b/packages/rpc-core/src/rpc-methods/getProgramAccounts.ts index cfd5f9eceb3d..1f72e14cc9b3 100644 --- a/packages/rpc-core/src/rpc-methods/getProgramAccounts.ts +++ b/packages/rpc-core/src/rpc-methods/getProgramAccounts.ts @@ -1,5 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58Bytes, @@ -8,7 +9,6 @@ import { AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, AccountInfoWithPubkey, - Commitment, DataSlice, RpcResponse, Slot, diff --git a/packages/rpc-core/src/rpc-methods/getSignatureStatuses.ts b/packages/rpc-core/src/rpc-methods/getSignatureStatuses.ts index 536dfd4dda55..25a9826c6ede 100644 --- a/packages/rpc-core/src/rpc-methods/getSignatureStatuses.ts +++ b/packages/rpc-core/src/rpc-methods/getSignatureStatuses.ts @@ -1,7 +1,8 @@ import { TransactionSignature } from '@solana/transactions'; +import { Commitment } from '../commitment'; import { TransactionError } from '../transaction-error'; -import { Commitment, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; /** @deprecated */ type TransactionStatusOk = Readonly<{ diff --git a/packages/rpc-core/src/rpc-methods/getSignaturesForAddress.ts b/packages/rpc-core/src/rpc-methods/getSignaturesForAddress.ts index 7cd112cf154a..7e5a4fd83848 100644 --- a/packages/rpc-core/src/rpc-methods/getSignaturesForAddress.ts +++ b/packages/rpc-core/src/rpc-methods/getSignaturesForAddress.ts @@ -1,9 +1,10 @@ import { Base58EncodedAddress } from '@solana/addresses'; import { TransactionSignature } from '@solana/transactions'; +import { Commitment } from '../commitment'; import { TransactionError } from '../transaction-error'; import { UnixTimestamp } from '../unix-timestamp'; -import { Commitment, RpcResponse, Slot } from './common'; +import { RpcResponse, Slot } from './common'; type GetSignaturesForAddressTransaction = RpcResponse<{ /** transaction signature as base-58 encoded string */ diff --git a/packages/rpc-core/src/rpc-methods/getSlot.ts b/packages/rpc-core/src/rpc-methods/getSlot.ts index 40ab2f920183..47799468ee0b 100644 --- a/packages/rpc-core/src/rpc-methods/getSlot.ts +++ b/packages/rpc-core/src/rpc-methods/getSlot.ts @@ -1,4 +1,5 @@ -import { Commitment, Slot } from './common'; +import { Commitment } from '../commitment'; +import { Slot } from './common'; type GetSlotApiResponse = Slot; diff --git a/packages/rpc-core/src/rpc-methods/getSlotLeader.ts b/packages/rpc-core/src/rpc-methods/getSlotLeader.ts index bc34873c2e13..339f7aab1658 100644 --- a/packages/rpc-core/src/rpc-methods/getSlotLeader.ts +++ b/packages/rpc-core/src/rpc-methods/getSlotLeader.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, Slot } from './common'; +import { Commitment } from '../commitment'; +import { Slot } from './common'; export interface GetSlotLeaderApi { /** diff --git a/packages/rpc-core/src/rpc-methods/getStakeActivation.ts b/packages/rpc-core/src/rpc-methods/getStakeActivation.ts index d975835ac4ee..bfb8fc576f12 100644 --- a/packages/rpc-core/src/rpc-methods/getStakeActivation.ts +++ b/packages/rpc-core/src/rpc-methods/getStakeActivation.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetStakeActivationApiResponse = Readonly<{ /** Stake active during the epoch */ diff --git a/packages/rpc-core/src/rpc-methods/getStakeMinimumDelegation.ts b/packages/rpc-core/src/rpc-methods/getStakeMinimumDelegation.ts index 040a41e29a24..536b367d1732 100644 --- a/packages/rpc-core/src/rpc-methods/getStakeMinimumDelegation.ts +++ b/packages/rpc-core/src/rpc-methods/getStakeMinimumDelegation.ts @@ -1,5 +1,6 @@ +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Commitment, RpcResponse } from './common'; +import { RpcResponse } from './common'; type GetStakeMinimumDelegationApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/getSupply.ts b/packages/rpc-core/src/rpc-methods/getSupply.ts index 95ce2b09855f..f64888e6b06b 100644 --- a/packages/rpc-core/src/rpc-methods/getSupply.ts +++ b/packages/rpc-core/src/rpc-methods/getSupply.ts @@ -1,7 +1,8 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Commitment, RpcResponse } from './common'; +import { RpcResponse } from './common'; type GetSupplyConfig = Readonly<{ commitment?: Commitment; diff --git a/packages/rpc-core/src/rpc-methods/getTokenAccountBalance.ts b/packages/rpc-core/src/rpc-methods/getTokenAccountBalance.ts index d1f7382e4ea7..6ca4e7d94eb6 100644 --- a/packages/rpc-core/src/rpc-methods/getTokenAccountBalance.ts +++ b/packages/rpc-core/src/rpc-methods/getTokenAccountBalance.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, RpcResponse, TokenAmount } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, TokenAmount } from './common'; type GetTokenAccountBalanceApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/getTokenAccountsByDelegate.ts b/packages/rpc-core/src/rpc-methods/getTokenAccountsByDelegate.ts index eea1601237b7..bf02b1b6ad61 100644 --- a/packages/rpc-core/src/rpc-methods/getTokenAccountsByDelegate.ts +++ b/packages/rpc-core/src/rpc-methods/getTokenAccountsByDelegate.ts @@ -1,5 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58Bytes, @@ -7,7 +8,6 @@ import { AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithPubkey, - Commitment, DataSlice, RpcResponse, Slot, diff --git a/packages/rpc-core/src/rpc-methods/getTokenAccountsByOwner.ts b/packages/rpc-core/src/rpc-methods/getTokenAccountsByOwner.ts index c244d37a16b8..b028596caa59 100644 --- a/packages/rpc-core/src/rpc-methods/getTokenAccountsByOwner.ts +++ b/packages/rpc-core/src/rpc-methods/getTokenAccountsByOwner.ts @@ -1,5 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58Bytes, @@ -7,7 +8,6 @@ import { AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithPubkey, - Commitment, DataSlice, RpcResponse, Slot, diff --git a/packages/rpc-core/src/rpc-methods/getTokenLargestAccounts.ts b/packages/rpc-core/src/rpc-methods/getTokenLargestAccounts.ts index 27503e2fb2be..6dfaee31119d 100644 --- a/packages/rpc-core/src/rpc-methods/getTokenLargestAccounts.ts +++ b/packages/rpc-core/src/rpc-methods/getTokenLargestAccounts.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, RpcResponse, TokenAmount } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, TokenAmount } from './common'; type GetTokenLargestAccountsApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/getTokenSupply.ts b/packages/rpc-core/src/rpc-methods/getTokenSupply.ts index d4f1bf50471a..e6e4c2bc9b5c 100644 --- a/packages/rpc-core/src/rpc-methods/getTokenSupply.ts +++ b/packages/rpc-core/src/rpc-methods/getTokenSupply.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, RpcResponse, TokenAmount } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, TokenAmount } from './common'; type GetTokenSupplyApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/getTransaction.ts b/packages/rpc-core/src/rpc-methods/getTransaction.ts index 027e36f713e3..d34e99634ee5 100644 --- a/packages/rpc-core/src/rpc-methods/getTransaction.ts +++ b/packages/rpc-core/src/rpc-methods/getTransaction.ts @@ -2,6 +2,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; import { Blockhash, TransactionVersion } from '@solana/transactions'; import { TransactionSignature } from '@solana/transactions'; +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; import { TransactionError } from '../transaction-error'; import { UnixTimestamp } from '../unix-timestamp'; @@ -9,7 +10,6 @@ import { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, - Commitment, Slot, TokenBalance, U64UnsafeBeyond2Pow53Minus1, diff --git a/packages/rpc-core/src/rpc-methods/getTransactionCount.ts b/packages/rpc-core/src/rpc-methods/getTransactionCount.ts index d9ecf4971684..7c1d89d0aec4 100644 --- a/packages/rpc-core/src/rpc-methods/getTransactionCount.ts +++ b/packages/rpc-core/src/rpc-methods/getTransactionCount.ts @@ -1,4 +1,5 @@ -import { Commitment, Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { Slot, U64UnsafeBeyond2Pow53Minus1 } from './common'; type GetTransactionCountApiResponse = U64UnsafeBeyond2Pow53Minus1; diff --git a/packages/rpc-core/src/rpc-methods/getVoteAccounts.ts b/packages/rpc-core/src/rpc-methods/getVoteAccounts.ts index e937db9a8237..67693fa2ad85 100644 --- a/packages/rpc-core/src/rpc-methods/getVoteAccounts.ts +++ b/packages/rpc-core/src/rpc-methods/getVoteAccounts.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment, U64UnsafeBeyond2Pow53Minus1 } from './common'; +import { Commitment } from '../commitment'; +import { U64UnsafeBeyond2Pow53Minus1 } from './common'; type Epoch = U64UnsafeBeyond2Pow53Minus1; type Credits = U64UnsafeBeyond2Pow53Minus1; diff --git a/packages/rpc-core/src/rpc-methods/index.ts b/packages/rpc-core/src/rpc-methods/index.ts index 44970f378cad..3ab77d225b15 100644 --- a/packages/rpc-core/src/rpc-methods/index.ts +++ b/packages/rpc-core/src/rpc-methods/index.ts @@ -114,8 +114,6 @@ export type SolanaRpcMethods = GetAccountInfoApi & SendTransactionApi & SimulateTransactionApi; -export type { Commitment } from './common'; - export function createSolanaRpcApi(config?: Config): IRpcApi { return new Proxy({} as IRpcApi, { defineProperty() { diff --git a/packages/rpc-core/src/rpc-methods/isBlockhashValid.ts b/packages/rpc-core/src/rpc-methods/isBlockhashValid.ts index 338528e5cee3..992938669b2b 100644 --- a/packages/rpc-core/src/rpc-methods/isBlockhashValid.ts +++ b/packages/rpc-core/src/rpc-methods/isBlockhashValid.ts @@ -1,6 +1,7 @@ import { Blockhash } from '@solana/transactions'; -import { Commitment, RpcResponse, Slot } from './common'; +import { Commitment } from '../commitment'; +import { RpcResponse, Slot } from './common'; type IsBlockhashValidApiResponse = RpcResponse; diff --git a/packages/rpc-core/src/rpc-methods/requestAirdrop.ts b/packages/rpc-core/src/rpc-methods/requestAirdrop.ts index 1cc2e9622f47..e51bb3f497bd 100644 --- a/packages/rpc-core/src/rpc-methods/requestAirdrop.ts +++ b/packages/rpc-core/src/rpc-methods/requestAirdrop.ts @@ -1,7 +1,8 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { LamportsUnsafeBeyond2Pow53Minus1 } from '../lamports'; -import { Base58EncodedTransactionSignature, Commitment } from './common'; +import { Base58EncodedTransactionSignature } from './common'; type RequestAirdropConfig = Readonly<{ commitment?: Commitment; diff --git a/packages/rpc-core/src/rpc-methods/sendTransaction.ts b/packages/rpc-core/src/rpc-methods/sendTransaction.ts index 61825659d9da..a3c5efefafb2 100644 --- a/packages/rpc-core/src/rpc-methods/sendTransaction.ts +++ b/packages/rpc-core/src/rpc-methods/sendTransaction.ts @@ -1,6 +1,7 @@ import { Base64EncodedWireTransaction } from '@solana/transactions'; -import { Base58EncodedTransactionSignature, Commitment, Slot } from './common'; +import { Commitment } from '../commitment'; +import { Base58EncodedTransactionSignature, Slot } from './common'; type SendTransactionConfig = Readonly<{ skipPreflight?: boolean; diff --git a/packages/rpc-core/src/rpc-methods/simulateTransaction.ts b/packages/rpc-core/src/rpc-methods/simulateTransaction.ts index 5cb08de79076..0c7332fc1d43 100644 --- a/packages/rpc-core/src/rpc-methods/simulateTransaction.ts +++ b/packages/rpc-core/src/rpc-methods/simulateTransaction.ts @@ -1,6 +1,7 @@ import { Base58EncodedAddress } from '@solana/addresses'; import { Base64EncodedWireTransaction } from '@solana/transactions'; +import { Commitment } from '../commitment'; import { TransactionError } from '../transaction-error'; import { AccountInfoBase, @@ -9,7 +10,6 @@ import { AccountInfoWithJsonData, Base58EncodedBytes, Base64EncodedDataResponse, - Commitment, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1, diff --git a/packages/rpc-core/src/rpc-subscriptions/__tests__/logs-notifications-test.ts b/packages/rpc-core/src/rpc-subscriptions/__tests__/logs-notifications-test.ts index 2b3c17440302..b9dea49b1149 100644 --- a/packages/rpc-core/src/rpc-subscriptions/__tests__/logs-notifications-test.ts +++ b/packages/rpc-core/src/rpc-subscriptions/__tests__/logs-notifications-test.ts @@ -1,6 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; -import { Commitment } from '../../rpc-methods/common'; +import { Commitment } from '../../commitment'; describe('logsNotifications', () => { ( diff --git a/packages/rpc-core/src/rpc-subscriptions/account-notifications.ts b/packages/rpc-core/src/rpc-subscriptions/account-notifications.ts index e15217b6bd93..491d02f55e08 100644 --- a/packages/rpc-core/src/rpc-subscriptions/account-notifications.ts +++ b/packages/rpc-core/src/rpc-subscriptions/account-notifications.ts @@ -1,5 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58Bytes, @@ -7,7 +8,6 @@ import { AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, - Commitment, RpcResponse, } from '../rpc-methods/common'; diff --git a/packages/rpc-core/src/rpc-subscriptions/block-notifications.ts b/packages/rpc-core/src/rpc-subscriptions/block-notifications.ts index 3cace9704a1a..4411a4561d8b 100644 --- a/packages/rpc-core/src/rpc-subscriptions/block-notifications.ts +++ b/packages/rpc-core/src/rpc-subscriptions/block-notifications.ts @@ -1,6 +1,7 @@ import { Blockhash, TransactionVersion } from '@solana/transactions'; -import { Base58EncodedBytes, Commitment, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '../rpc-methods/common'; +import { Commitment } from '../commitment'; +import { Base58EncodedBytes, RpcResponse, Slot, U64UnsafeBeyond2Pow53Minus1 } from '../rpc-methods/common'; import { Reward, TransactionForAccounts, diff --git a/packages/rpc-core/src/rpc-subscriptions/logs-notifications.ts b/packages/rpc-core/src/rpc-subscriptions/logs-notifications.ts index be62102a852c..f870286530bd 100644 --- a/packages/rpc-core/src/rpc-subscriptions/logs-notifications.ts +++ b/packages/rpc-core/src/rpc-subscriptions/logs-notifications.ts @@ -1,7 +1,8 @@ import { Base58EncodedAddress } from '@solana/addresses'; import { TransactionSignature } from '@solana/transactions'; -import { Commitment, RpcResponse } from '../rpc-methods/common'; +import { Commitment } from '../commitment'; +import { RpcResponse } from '../rpc-methods/common'; import { TransactionError } from '../transaction-error'; type LogsNotificationsApiNotification = RpcResponse< diff --git a/packages/rpc-core/src/rpc-subscriptions/program-notifications.ts b/packages/rpc-core/src/rpc-subscriptions/program-notifications.ts index 8ab3ae6abae8..a01cc3a88a37 100644 --- a/packages/rpc-core/src/rpc-subscriptions/program-notifications.ts +++ b/packages/rpc-core/src/rpc-subscriptions/program-notifications.ts @@ -1,5 +1,6 @@ import { Base58EncodedAddress } from '@solana/addresses'; +import { Commitment } from '../commitment'; import { AccountInfoBase, AccountInfoWithBase58Bytes, @@ -9,7 +10,6 @@ import { AccountInfoWithJsonData, Base58EncodedBytes, Base64EncodedBytes, - Commitment, RpcResponse, U64UnsafeBeyond2Pow53Minus1, } from '../rpc-methods/common'; diff --git a/packages/rpc-core/src/rpc-subscriptions/signature-notifications.ts b/packages/rpc-core/src/rpc-subscriptions/signature-notifications.ts index ea64549a2a22..08e7890041af 100644 --- a/packages/rpc-core/src/rpc-subscriptions/signature-notifications.ts +++ b/packages/rpc-core/src/rpc-subscriptions/signature-notifications.ts @@ -1,6 +1,7 @@ import { TransactionSignature } from '@solana/transactions'; -import { Commitment, RpcResponse } from '../rpc-methods/common'; +import { Commitment } from '../commitment'; +import { RpcResponse } from '../rpc-methods/common'; import { TransactionError } from '../transaction-error'; type SignatureNotificationsApiNotificationReceived = RpcResponse>;