@solana/kit
Version:
Solana Javascript API
1 lines • 89.6 kB
Source Map (JSON)
{"version":3,"sources":["../src/create-async-generator-with-initial-value-and-slot-tracking.ts","../src/create-reactive-store-with-initial-value-and-slot-tracking.ts","../src/airdrop-internal.ts","../src/airdrop.ts","../src/compute-unit-limit-estimation.ts","../src/fetch-lookup-tables.ts","../src/decompile-transaction-message-fetching-lookup-tables.ts","../src/resource-limit-estimation.ts","../src/send-transaction-internal.ts","../src/send-and-confirm-durable-nonce-transaction.ts","../src/send-and-confirm-transaction.ts","../src/send-transaction-without-confirming.ts"],"names":["createRecentSignatureConfirmationPromiseFactory","waitForRecentTransactionConfirmationUntilTimeout","getTimeoutPromise","isTransactionMessageWithDurableNonceLifetime","pipe","setTransactionMessageComputeUnitLimit","compileTransaction","getBase64EncodedWireTransaction","SolanaError","SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT","SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT","getSolanaErrorFromTransactionError","isSolanaError","getTransactionMessageComputeUnitLimit","fetchJsonParsedAccounts","assertAccountsDecoded","assertAccountsExist","decompileTransactionMessage","MAX_COMPUTE_UNIT_LIMIT","setTransactionMessageLoadedAccountsDataSizeLimit","SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT","SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS","getTransactionMessageLoadedAccountsDataSizeLimit","commitmentComparator","createNonceInvalidationPromiseFactory","SOLANA_ERROR__INVALID_NONCE","getSignatureFromTransaction","waitForDurableNonceTransactionConfirmation","createBlockHeightExceedencePromiseFactory","waitForRecentTransactionConfirmation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,gBAAuB,mDAAA,CAA0F;AAAA,EAC7G,WAAA;AAAA,EACA,UAAA;AAAA,EACA,c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AC9G,GAAA;AAAA,EACA;AACJ,CAAA,EAAkI;AAC9H,EAAA,MAAM,kCAAkCC,iEAAA,CAA0C;AAAA,IAC9E,GAAA;AAAA,IACA;AAAA,GACgE,CAAA;AACpE,EAAA,MAAM,wCAAwC5B,uEAAAA,CAAgD;AAAA,IAC1F,GAAA;AAAA,IACA;AAAA,GACsE,CAAA;AAC1E,EAAA,eAAe,yBACX,MAAA,EAIF;AACE,IAAA,MAAM6B,4DAAA,CAAqC;AAAA,MACvC,GAAG,MAAA;AAAA,MACH,+BAAA;AAAA,MACA;AAAA,KACH,CAAA;AAAA,EACL;AACA,EAAA,OAAO,eAAe,yBAAA,CAA0B,WAAA,EAAa,MAAA,EAAQ;AACjE,IAAA,MAAM,0EAAA,CAA2E;AAAA,MAC7E,GAAG,MAAA;AAAA,MACH,wBAAA;AAAA,MACA,GAAA;AAAA,MACA;AAAA,KACH,CAAA;AAAA,EACL,CAAA;AACJ;;;ACrDO,SAAS,uCAAA,CAAwC;AAAA,EACpD;AACJ,CAAA,EAA4F;AACxF,EAAA,OAAO,eAAe,gCAAA,CAAiC,WAAA,EAAa,MAAA,EAAQ;AACxE,IAAA,MAAM,2CAAA,CAA4C;AAAA,MAC9C,GAAG,MAAA;AAAA,MACH,GAAA;AAAA,MACA;AAAA,KACH,CAAA;AAAA,EACL,CAAA;AACJ","file":"index.browser.cjs","sourcesContent":["import type { PendingRpcRequest } from '@solana/rpc';\nimport type { PendingRpcSubscriptionsRequest } from '@solana/rpc-subscriptions';\nimport type { SolanaRpcResponse } from '@solana/rpc-types';\n\ntype CreateAsyncGeneratorWithInitialValueAndSlotTrackingConfig<TRpcValue, TSubscriptionValue, TItem> = Readonly<{\n /**\n * Triggering this abort signal will cancel the pending RPC request and subscription, and\n * cause the async generator to return (complete without error).\n */\n abortSignal: AbortSignal;\n /**\n * A pending RPC request whose response will be yielded as the generator's first value\n * (unless a subscription notification with a newer slot arrives first).\n * The response must be a {@link SolanaRpcResponse} so that its slot can be compared with\n * subscription notifications.\n */\n rpcRequest: PendingRpcRequest<SolanaRpcResponse<TRpcValue>>;\n /**\n * A pending RPC subscription request whose notifications will be yielded as they arrive.\n * Each notification must be a {@link SolanaRpcResponse} so that its slot can be compared\n * with the initial RPC response and other notifications.\n */\n rpcSubscriptionRequest: PendingRpcSubscriptionsRequest<SolanaRpcResponse<TSubscriptionValue>>;\n /**\n * Maps the value from a subscription notification to the item type yielded by the generator.\n */\n rpcSubscriptionValueMapper: (value: TSubscriptionValue) => TItem;\n /**\n * Maps the value from the RPC response to the item type yielded by the generator.\n */\n rpcValueMapper: (value: TRpcValue) => TItem;\n}>;\n\n/**\n * Creates an async generator that combines an initial RPC fetch with an ongoing subscription,\n * yielding values as they arrive from either source.\n *\n * The generator uses slot-based comparison to ensure that only the most recent values are yielded.\n * Any value at a slot older than a previously yielded value is silently dropped.\n * This prevents stale data from appearing when the RPC response and subscription notifications\n * arrive out of order.\n *\n * Things to note:\n *\n * - The generator yields {@link SolanaRpcResponse} values from both the RPC response and\n * subscription notifications, each containing the slot context and the mapped value.\n * - Out-of-order values (by slot) are silently dropped — they are never yielded.\n * - On error from either source, the generator throws the error.\n * - Triggering the caller's abort signal causes the generator to return (complete without error).\n * - The generator completes when the subscription ends, an error occurs, or the abort signal fires.\n *\n * @param config\n *\n * @example\n * ```ts\n * import {\n * address,\n * createAsyncGeneratorWithInitialValueAndSlotTracking,\n * createSolanaRpc,\n * createSolanaRpcSubscriptions,\n * } from '@solana/kit';\n *\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const rpcSubscriptions = createSolanaRpcSubscriptions('ws://127.0.0.1:8900');\n * const myAddress = address('FnHyam9w4NZoWR6mKN1CuGBritdsEWZQa4Z4oawLZGxa');\n *\n * const abortController = new AbortController();\n * for await (const balance of createAsyncGeneratorWithInitialValueAndSlotTracking({\n * abortSignal: abortController.signal,\n * rpcRequest: rpc.getBalance(myAddress, { commitment: 'confirmed' }),\n * rpcValueMapper: lamports => lamports,\n * rpcSubscriptionRequest: rpcSubscriptions.accountNotifications(myAddress),\n * rpcSubscriptionValueMapper: ({ lamports }) => lamports,\n * })) {\n * console.log(`Balance at slot ${balance.context.slot}:`, balance.value);\n * }\n * ```\n */\nexport async function* createAsyncGeneratorWithInitialValueAndSlotTracking<TRpcValue, TSubscriptionValue, TItem>({\n abortSignal,\n rpcRequest,\n rpcValueMapper,\n rpcSubscriptionRequest,\n rpcSubscriptionValueMapper,\n}: CreateAsyncGeneratorWithInitialValueAndSlotTrackingConfig<TRpcValue, TSubscriptionValue, TItem>): AsyncGenerator<\n SolanaRpcResponse<TItem>\n> {\n if (abortSignal.aborted) return;\n\n let lastUpdateSlot = -1n;\n\n // Shared queue for merging values from the RPC response and subscription notifications.\n const queue: SolanaRpcResponse<TItem>[] = [];\n let waitingResolve: ((value: IteratorResult<SolanaRpcResponse<TItem>>) => void) | null = null;\n let waitingReject: ((reason: unknown) => void) | null = null;\n let rpcDone = false;\n let subscriptionDone = false;\n let done = false;\n let pendingError: unknown;\n\n function markSourcesDone() {\n done = true;\n if (waitingResolve) {\n const resolve = waitingResolve;\n waitingResolve = null;\n waitingReject = null;\n resolve({ done: true, value: undefined });\n }\n }\n\n const abortController = new AbortController();\n const signal = abortController.signal;\n\n function onAbort() {\n done = true;\n abortController.abort(abortSignal.reason);\n if (waitingResolve) {\n const resolve = waitingResolve;\n waitingResolve = null;\n waitingReject = null;\n resolve({ done: true, value: undefined });\n }\n }\n abortSignal.addEventListener('abort', onAbort);\n\n function enqueue(item: SolanaRpcResponse<TItem>) {\n if (done || signal.aborted) return;\n if (waitingResolve) {\n // generator is waiting for a value, so resolve immediately\n const resolve = waitingResolve;\n waitingResolve = null;\n waitingReject = null;\n resolve({ done: false, value: item });\n } else {\n // No pending generator pull, so enqueue the item for future delivery\n queue.push(item);\n }\n }\n\n function handleError(err: unknown) {\n if (signal.aborted) return;\n done = true;\n pendingError = err;\n abortController.abort(err);\n if (waitingReject) {\n // generator is waiting for a value, so reject immediately\n const reject = waitingReject;\n waitingResolve = null;\n waitingReject = null;\n reject(err);\n }\n }\n\n // Start both sources concurrently.\n rpcRequest\n .send({ abortSignal: signal })\n .then(({ context: { slot }, value }) => {\n if (signal.aborted) return;\n if (slot < lastUpdateSlot) return;\n lastUpdateSlot = slot;\n enqueue({ context: { slot }, value: rpcValueMapper(value) });\n })\n .then(() => {\n rpcDone = true;\n if (subscriptionDone) markSourcesDone();\n })\n .catch(handleError);\n\n rpcSubscriptionRequest\n .subscribe({ abortSignal: signal })\n .then(async notifications => {\n for await (const {\n context: { slot },\n value,\n } of notifications) {\n if (signal.aborted) return;\n if (slot < lastUpdateSlot) continue;\n lastUpdateSlot = slot;\n enqueue({ context: { slot }, value: rpcSubscriptionValueMapper(value) });\n }\n // Subscription completed normally.\n subscriptionDone = true;\n if (rpcDone) markSourcesDone();\n })\n .catch(handleError);\n\n try {\n while (true) {\n if (pendingError) throw pendingError;\n if (queue.length > 0) {\n yield queue.shift()!;\n } else if (done) {\n return;\n } else {\n // if no value queued or error, wait for the next value or error\n const result: IteratorResult<SolanaRpcResponse<TItem>> = await new Promise((resolve, reject) => {\n waitingResolve = resolve;\n waitingReject = reject;\n });\n if (result.done) return;\n yield result.value;\n }\n }\n } finally {\n abortSignal.removeEventListener('abort', onAbort);\n if (!signal.aborted) {\n abortController.abort();\n }\n }\n}\n","import type { SolanaRpcResponse } from '@solana/rpc-types';\nimport type {\n ReactiveActionSource,\n ReactiveState,\n ReactiveStreamSource,\n ReactiveStreamStore,\n} from '@solana/subscribable';\n\n/**\n * Configuration for {@link createReactiveStoreWithInitialValueAndSlotTracking}. Pairs a one-shot\n * initial-value source with an ongoing stream source so the resulting store can hydrate from the\n * initial response and keep up to date with notifications, slot-deduplicating the two sources.\n *\n * @typeParam TInitialValue - The value type produced by `initialValueSource` (inside the {@link SolanaRpcResponse} envelope).\n * @typeParam TStreamValue - The value type emitted by `streamSource` (inside the {@link SolanaRpcResponse} envelope).\n * @typeParam TItem - The unified item type the store holds, produced by the two value mappers.\n *\n * @see {@link createReactiveStoreWithInitialValueAndSlotTracking}\n */\nexport type CreateReactiveStoreWithInitialValueAndSlotTrackingConfig<TInitialValue, TStreamValue, TItem> = Readonly<{\n /**\n * Maps the value from the initial-value source's response to the item type stored in the\n * reactive store.\n */\n initialValueMapper: (value: TInitialValue) => TItem;\n /**\n * A reactive action source whose dispatched value will be used to set the store's initial\n * state. The value must be a {@link SolanaRpcResponse} so that its slot can be compared with\n * stream notifications. Satisfied by `PendingRpcRequest`.\n */\n initialValueSource: ReactiveActionSource<SolanaRpcResponse<TInitialValue>>;\n /**\n * A reactive stream source whose notifications will be used to keep the store up to date. Each\n * notification must be a {@link SolanaRpcResponse} so that its slot can be compared with the\n * initial value and with other notifications. Satisfied by `PendingRpcSubscriptionsRequest`.\n */\n streamSource: ReactiveStreamSource<SolanaRpcResponse<TStreamValue>>;\n /**\n * Maps the value from a stream notification to the item type stored in the reactive store.\n */\n streamValueMapper: (value: TStreamValue) => TItem;\n}>;\n\nconst IDLE_STATE: ReactiveState<never> = Object.freeze({\n data: undefined,\n error: undefined,\n status: 'idle',\n});\n\n/**\n * Creates a {@link ReactiveStreamStore} that combines an initial one-shot fetch with an ongoing\n * stream to keep its state up to date.\n *\n * The store uses slot-based comparison to ensure that only the most recent value is kept,\n * regardless of whether it came from the initial value source or a stream notification. This\n * prevents stale data from overwriting newer data when the two sources arrive out of order.\n *\n * The two sources are consumed via their {@link ReactiveActionSource.reactiveStore | `reactiveStore()`}\n * methods rather than by calling `send()` / `subscribe()` directly, so any object satisfying the\n * {@link ReactiveActionSource} / {@link ReactiveStreamSource} duck-types works — including\n * `PendingRpcRequest` / `PendingRpcSubscriptionsRequest` and plugin-authored wrappers.\n *\n * Things to note:\n *\n * - The returned store starts in `status: 'idle'`. Call\n * {@link ReactiveStreamStore.connect | `connect()`} to dispatch the initial-value source and open\n * the stream.\n * - The store transitions through `loading` until the first value or notification arrives,\n * then to `loaded` with a {@link SolanaRpcResponse} containing the value and the slot context\n * at which it was observed.\n * - On error from either source, the store transitions to `status: 'error'` preserving the last\n * known value. Only the first error per connection window is captured.\n * - A subsequent `connect()` aborts the current connection, transitions back to\n * `status: 'loading'` (preserving the last known `data` and `error` for stale-while-revalidate),\n * and re-builds both inner stores with a fresh inner abort signal.\n * - {@link ReactiveStreamStore.reset | `reset()`} aborts the current connection and returns the\n * store to `idle`, clearing `data` and `error`.\n * - Attach a caller-provided cancellation source via\n * {@link ReactiveStreamStore.withSignal | `withSignal()`} — `store.withSignal(signal).connect()`\n * composes the signal with the per-connection controller. Aborting the caller's signal\n * transitions the store to `error` with that abort reason.\n *\n * @param config\n *\n * @example\n * ```ts\n * import {\n * address,\n * createReactiveStoreWithInitialValueAndSlotTracking,\n * createSolanaRpc,\n * createSolanaRpcSubscriptions,\n * } from '@solana/kit';\n *\n * const rpc = createSolanaRpc('http://127.0.0.1:8899');\n * const rpcSubscriptions = createSolanaRpcSubscriptions('ws://127.0.0.1:8900');\n * const myAddress = address('FnHyam9w4NZoWR6mKN1CuGBritdsEWZQa4Z4oawLZGxa');\n *\n * const balanceStore = createReactiveStoreWithInitialValueAndSlotTracking({\n * initialValueSource: rpc.getBalance(myAddress, { commitment: 'confirmed' }),\n * initialValueMapper: lamports => lamports,\n * streamSource: rpcSubscriptions.accountNotifications(myAddress),\n * streamValueMapper: ({ lamports }) => lamports,\n * });\n *\n * const unsubscribe = balanceStore.subscribe(() => {\n * const state = balanceStore.getState();\n * if (state.status === 'error') {\n * console.error('Error:', state.error);\n * balanceStore.connect();\n * } else if (state.status === 'loaded') {\n * console.log(`Balance at slot ${state.data.context.slot}:`, state.data.value);\n * }\n * });\n * balanceStore.withSignal(AbortSignal.timeout(60_000)).connect();\n * ```\n *\n * @see {@link ReactiveStreamStore}\n */\nexport function createReactiveStoreWithInitialValueAndSlotTracking<TInitialValue, TStreamValue, TItem>({\n initialValueMapper,\n initialValueSource,\n streamSource,\n streamValueMapper,\n}: CreateReactiveStoreWithInitialValueAndSlotTrackingConfig<TInitialValue, TStreamValue, TItem>): ReactiveStreamStore<\n SolanaRpcResponse<TItem>\n> {\n let currentState: ReactiveState<SolanaRpcResponse<TItem>> = IDLE_STATE;\n let lastUpdateSlot = -1n;\n let currentInnerController: AbortController | undefined;\n const subscribers = new Set<() => void>();\n\n function notify() {\n subscribers.forEach(cb => cb());\n }\n\n function setState(next: ReactiveState<SolanaRpcResponse<TItem>>) {\n if (\n currentState.status === next.status &&\n currentState.data === next.data &&\n currentState.error === next.error\n ) {\n return;\n }\n currentState = next;\n notify();\n }\n\n function performConnect(callerSignal: AbortSignal | undefined) {\n // Abort any currently active connection before starting a fresh one.\n currentInnerController?.abort();\n // If the caller's signal is already aborted, surface as error and bail.\n if (callerSignal?.aborted) {\n setState({ data: currentState.data, error: callerSignal.reason, status: 'error' });\n return;\n }\n // Transition to `loading`, preserving the last known `data` and `error` for SWR. If\n // already `loading` with the same data/error, `setState` no-ops — no spurious notify.\n setState({ data: currentState.data, error: currentState.error, status: 'loading' });\n\n const innerController = new AbortController();\n currentInnerController = innerController;\n const innerSignal = innerController.signal;\n const signal = callerSignal ? AbortSignal.any([innerSignal, callerSignal]) : innerSignal;\n // Caller's signal aborting (not just supersede via the inner controller) transitions the\n // store to error with the caller's abort reason. Scoped to the inner signal so the\n // listener is removed on reconnect / reset.\n if (callerSignal) {\n callerSignal.addEventListener(\n 'abort',\n () => {\n if (innerSignal.aborted) return;\n setState({ data: currentState.data, error: callerSignal.reason, status: 'error' });\n innerController.abort(callerSignal.reason);\n },\n { signal: innerSignal },\n );\n }\n\n function handleError(err: unknown) {\n if (signal.aborted) return;\n if (currentState.status === 'error') return;\n setState({ data: currentState.data, error: err, status: 'error' });\n innerController.abort(err);\n }\n\n // `lastUpdateSlot` persists across reconnects so the surfaced value never regresses.\n function handleSlottedValue({ context: { slot }, value }: SolanaRpcResponse<TItem>) {\n if (signal.aborted) return;\n if (slot < lastUpdateSlot) {\n // Stale slot: keep the newer `data` we already hold, but still set `loaded`.\n if (currentState.data !== undefined) {\n setState({ data: currentState.data, error: undefined, status: 'loaded' });\n }\n return;\n }\n lastUpdateSlot = slot;\n setState({ data: { context: { slot }, value }, error: undefined, status: 'loaded' });\n }\n\n // Build fresh inner stores for this connection window and forward their state into the\n // unified store. Drive both with the composed signal so they tear down when this connection\n // window does.\n const actionStore = initialValueSource.reactiveStore();\n const streamStore = streamSource.reactiveStore();\n\n const unsubscribeAction = actionStore.subscribe(() => {\n const state = actionStore.getState();\n if (state.status === 'success') {\n const { context, value } = state.data;\n handleSlottedValue({ context, value: initialValueMapper(value) });\n } else if (state.status === 'error') {\n handleError(state.error);\n }\n });\n const unsubscribeStream = streamStore.subscribe(() => {\n const state = streamStore.getState();\n if (state.status === 'loaded') {\n const { context, value } = state.data;\n handleSlottedValue({ context, value: streamValueMapper(value) });\n } else if (state.status === 'error') {\n handleError(state.error);\n }\n });\n\n // Stop observing this connection's inner stores once it is superseded or the caller\n // aborts.\n // Note: don't call reset here, causes a race with the abort reason\n innerSignal.addEventListener(\n 'abort',\n () => {\n unsubscribeAction();\n unsubscribeStream();\n },\n { once: true },\n );\n\n streamStore.withSignal(signal).connect();\n actionStore.withSignal(signal).dispatch();\n }\n\n function performReset() {\n currentInnerController?.abort();\n currentInnerController = undefined;\n // `lastUpdateSlot` resets too — a fresh connect() starts a new slot window.\n lastUpdateSlot = -1n;\n setState(IDLE_STATE);\n }\n\n return {\n connect(): void {\n performConnect(undefined);\n },\n getState(): ReactiveState<SolanaRpcResponse<TItem>> {\n return currentState;\n },\n reset: performReset,\n subscribe(callback: () => void): () => void {\n subscribers.add(callback);\n return () => {\n subscribers.delete(callback);\n };\n },\n withSignal(signal: AbortSignal) {\n return {\n connect(): void {\n performConnect(signal);\n },\n };\n },\n };\n}\n","import type { Address } from '@solana/addresses';\nimport type { Signature } from '@solana/keys';\nimport type { RequestAirdropApi, Rpc } from '@solana/rpc';\nimport type { Commitment, Lamports } from '@solana/rpc-types';\nimport { waitForRecentTransactionConfirmationUntilTimeout } from '@solana/transaction-confirmation';\n\ntype RequestAndConfirmAirdropConfig = Readonly<{\n abortSignal?: AbortSignal;\n commitment: Commitment;\n confirmSignatureOnlyTransaction: (\n config: Omit<\n Parameters<typeof waitForRecentTransactionConfirmationUntilTimeout>[0],\n 'getRecentSignatureConfirmationPromise' | 'getTimeoutPromise'\n >,\n ) => Promise<void>;\n lamports: Lamports;\n recipientAddress: Address;\n rpc: Rpc<RequestAirdropApi>;\n}>;\n\nexport async function requestAndConfirmAirdrop_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n confirmSignatureOnlyTransaction,\n lamports,\n recipientAddress,\n rpc,\n}: RequestAndConfirmAirdropConfig): Promise<Signature> {\n const airdropTransactionSignature = await rpc\n .requestAirdrop(recipientAddress, lamports, { commitment })\n .send({ abortSignal });\n await confirmSignatureOnlyTransaction({\n abortSignal,\n commitment,\n signature: airdropTransactionSignature,\n });\n return airdropTransactionSignature;\n}\n","import type { Signature } from '@solana/keys';\nimport type { GetSignatureStatusesApi, RequestAirdropApi, Rpc } from '@solana/rpc';\nimport type { RpcSubscriptions, SignatureNotificationsApi } from '@solana/rpc-subscriptions';\nimport {\n createRecentSignatureConfirmationPromiseFactory,\n getTimeoutPromise,\n waitForRecentTransactionConfirmationUntilTimeout,\n} from '@solana/transaction-confirmation';\n\nimport { requestAndConfirmAirdrop_INTERNAL_ONLY_DO_NOT_EXPORT } from './airdrop-internal';\n\ntype AirdropFunction = (\n config: Omit<\n Parameters<typeof requestAndConfirmAirdrop_INTERNAL_ONLY_DO_NOT_EXPORT>[0],\n 'confirmSignatureOnlyTransaction' | 'rpc'\n >,\n) => Promise<Signature>;\n\ntype AirdropFactoryConfig<TCluster> = {\n /** An object that supports the {@link GetSignatureStatusesApi} and the {@link RequestAirdropApi} of the Solana RPC API */\n rpc: Rpc<GetSignatureStatusesApi & RequestAirdropApi> & { '~cluster'?: TCluster };\n /** An object that supports the {@link SignatureNotificationsApi} of the Solana RPC Subscriptions API */\n rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi> & { '~cluster'?: TCluster };\n};\n\n/**\n * Returns a function that you can call to airdrop a certain amount of {@link Lamports} to a Solana\n * address.\n *\n * > [!NOTE] This only works on test clusters.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { address, airdropFactory, createSolanaRpc, createSolanaRpcSubscriptions, devnet, lamports } from '@solana/kit';\n *\n * const rpc = createSolanaRpc(devnet('http://127.0.0.1:8899'));\n * const rpcSubscriptions = createSolanaRpcSubscriptions(devnet('ws://127.0.0.1:8900'));\n *\n * const airdrop = airdropFactory({ rpc, rpcSubscriptions });\n *\n * await airdrop({\n * commitment: 'confirmed',\n * recipientAddress: address('FnHyam9w4NZoWR6mKN1CuGBritdsEWZQa4Z4oawLZGxa'),\n * lamports: lamports(10_000_000n),\n * });\n * ```\n */\nexport function airdropFactory({ rpc, rpcSubscriptions }: AirdropFactoryConfig<'devnet'>): AirdropFunction;\nexport function airdropFactory({ rpc, rpcSubscriptions }: AirdropFactoryConfig<'mainnet'>): AirdropFunction;\nexport function airdropFactory({ rpc, rpcSubscriptions }: AirdropFactoryConfig<'testnet'>): AirdropFunction;\nexport function airdropFactory<TCluster extends 'devnet' | 'mainnet' | 'testnet' | void = void>({\n rpc,\n rpcSubscriptions,\n}: AirdropFactoryConfig<TCluster>): AirdropFunction {\n const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createRecentSignatureConfirmationPromiseFactory>[0]);\n async function confirmSignatureOnlyTransaction(\n config: Omit<\n Parameters<typeof waitForRecentTransactionConfirmationUntilTimeout>[0],\n 'getRecentSignatureConfirmationPromise' | 'getTimeoutPromise'\n >,\n ) {\n await waitForRecentTransactionConfirmationUntilTimeout({\n ...config,\n getRecentSignatureConfirmationPromise,\n getTimeoutPromise,\n });\n }\n return async function airdrop(config) {\n return await requestAndConfirmAirdrop_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n confirmSignatureOnlyTransaction,\n rpc,\n });\n };\n}\n","import {\n getSolanaErrorFromTransactionError,\n isSolanaError,\n type RpcSimulateTransactionResult,\n SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT,\n SolanaError,\n} from '@solana/errors';\nimport { pipe } from '@solana/functional';\nimport type { Rpc, SimulateTransactionApi } from '@solana/rpc';\nimport type { Commitment, Slot } from '@solana/rpc-types';\nimport {\n getTransactionMessageComputeUnitLimit,\n isTransactionMessageWithDurableNonceLifetime,\n setTransactionMessageComputeUnitLimit,\n TransactionMessage,\n TransactionMessageWithFeePayer,\n} from '@solana/transaction-messages';\nimport { compileTransaction, getBase64EncodedWireTransaction } from '@solana/transactions';\n\nconst PROVISORY_COMPUTE_UNIT_LIMIT = 0;\nconst MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n\ntype EstimateComputeUnitLimitFactoryConfig = Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\ntype EstimateComputeUnitLimitConfig = Readonly<{\n abortSignal?: AbortSignal;\n commitment?: Commitment;\n minContextSlot?: Slot;\n}>;\n\ntype EstimateComputeUnitLimitFunction = (\n transactionMessage: TransactionMessage & TransactionMessageWithFeePayer,\n config?: EstimateComputeUnitLimitConfig,\n) => Promise<number>;\n\n/**\n * Returns a function that estimates the compute units consumed by a transaction message by\n * simulating it.\n *\n * The estimator sets the compute unit limit to the maximum (1,400,000) before simulating, so the\n * simulation does not fail due to compute unit exhaustion. For blockhash-lifetime transactions, the\n * RPC is asked to replace the blockhash during simulation, so any blockhash value will work. For\n * durable nonce transactions, the actual nonce value is used.\n *\n * @param factoryConfig - An object containing the RPC instance to use for simulation.\n * @return A function that accepts a transaction message and returns the estimated compute units.\n *\n * @example\n * ```ts\n * import { estimateComputeUnitLimitFactory } from '@solana/kit';\n *\n * const estimateComputeUnitLimit = estimateComputeUnitLimitFactory({ rpc });\n * const estimatedUnits = await estimateComputeUnitLimit(transactionMessage);\n * ```\n *\n * @deprecated Use {@link estimateResourceLimitsFactory} instead. The resource-limits estimator\n * returns both the compute unit limit and (for version 1 transactions) the loaded accounts data\n * size limit from a single simulation call.\n */\nexport function estimateComputeUnitLimitFactory({\n rpc,\n}: EstimateComputeUnitLimitFactoryConfig): EstimateComputeUnitLimitFunction {\n return async function estimateComputeUnitLimit(transactionMessage, config) {\n const { abortSignal, ...simulateConfig } = config ?? {};\n const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n\n const transaction = pipe(\n transactionMessage,\n m => setTransactionMessageComputeUnitLimit(MAX_COMPUTE_UNIT_LIMIT, m),\n compileTransaction,\n );\n const wireTransactionBytes = getBase64EncodedWireTransaction(transaction);\n\n try {\n const response = await rpc\n .simulateTransaction(wireTransactionBytes, {\n ...simulateConfig,\n encoding: 'base64',\n replaceRecentBlockhash,\n sigVerify: false,\n })\n .send({ abortSignal });\n // The API response and `RpcSimulateTransactionResult` describe overlapping but\n // structurally different shapes (eg. `replacementBlockhash` is a parsed\n // `TransactionBlockhashLifetime` object here, but a raw string there). Cast through\n // `unknown` to bridge the structural gap.\n const { err: transactionError, ...simulationResult } =\n response.value as unknown as RpcSimulateTransactionResult;\n\n if (simulationResult.unitsConsumed == null) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT);\n }\n\n if (transactionError) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, {\n ...simulationResult,\n cause: getSolanaErrorFromTransactionError(transactionError),\n });\n }\n\n // Downcast from bigint to number, capping at u32 max.\n return simulationResult.unitsConsumed > 4_294_967_295n\n ? 4_294_967_295\n : Number(simulationResult.unitsConsumed);\n } catch (e) {\n if (isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT)) {\n throw e;\n }\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, {\n cause: e,\n });\n }\n };\n}\n\n/**\n * Returns a function that estimates the compute unit limit for a transaction message and sets it on\n * the message. If the message already has an explicit compute unit limit set (one that is not the\n * provisory value of 0, and not the maximum of 1,400,000), the message is returned unchanged.\n *\n * This is designed to work with {@link fillTransactionMessageProvisoryComputeUnitLimit}: first add a