@solana/kit 7.0.0-canary-20260630095418 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.development.js +1 -1
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.mjs.map +1 -1
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.production.min.js +1 -1
- package/dist/types/compute-unit-limit-estimation.d.ts.map +1 -1
- package/dist/types/resource-limit-estimation.d.ts.map +1 -1
- package/package.json +27 -27
- package/src/compute-unit-limit-estimation.ts +4 -3
- package/src/resource-limit-estimation.ts +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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":["MAX_COMPUTE_UNIT_LIMIT","isTransactionMessageWithDurableNonceLifetime","pipe","setTransactionMessageComputeUnitLimit","compileTransaction","getBase64EncodedWireTransaction","SolanaError","SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT","getSolanaErrorFromTransactionError","isSolanaError","getTransactionMessageComputeUnitLimit","createRecentSignatureConfirmationPromiseFactory","commitmentComparator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,gBAAuB,mDAAA,CAA0F;AAAA,EAC7G,WAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACJ,CAAA,EAEE;A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GACgE,CAAA;AACpE,EAAA,MAAM,wCAAwCG,+CAAAA,CAAgD;AAAA,IAC1F,GAAA;AAAA,IACA;AAAA,GACsE,CAAA;AAC1E,EAAA,eAAe,yBACX,MAAA,EAIF;AACE,IAAA,MAAM,oCAAA,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.mjs","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 type varies based on config (eg. `replacementBlockhash` is only\n // present when `replaceRecentBlockhash` is true), but `RpcSimulateTransactionResult`\n // is a flat superset. Cast through `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 provisory limit\n * during transaction construction, then later estimate and replace it before sending.\n *\n * @param estimateComputeUnitLimit - The estimator function, typically created by\n * {@link estimateComputeUnitLimitFactory}. You can also pass a custom wrapper that adds a buffer\n * (e.g. multiply the estimate by 1.1).\n * @return A function that accepts a transaction message and returns it with the compute unit limit\n * set to the estimated value.\n *\n * @example\n * ```ts\n * import { estimateAndSetComputeUnitLimitFactory, estimateComputeUnitLimitFactory } from '@solana/kit';\n *\n * const estimator = estimateComputeUnitLimitFactory({ rpc });\n * const estimateAndSet = estimateAndSetComputeUnitLimitFactory(estimator);\n * const updatedMessage = await estimateAndSet(transactionMessage);\n * ```\n *\n * @deprecated Use {@link estimateAndSetResourceLimitsFactory} instead, which additionally sets the\n * loaded accounts data size limit for version 1 transactions.\n */\nexport function estimateAndSetComputeUnitLimitFactory(\n estimateComputeUnitLimit: EstimateComputeUnitLimitFunction,\n): <TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer>(\n transactionMessage: TTransactionMessage,\n config?: EstimateComputeUnitLimitConfig,\n) => Promise<TTransactionMessage> {\n return async function estimateAndSetComputeUnitLimit(transactionMessage, config) {\n const existingLimit = getTransactionMessageComputeUnitLimit(transactionMessage);\n\n // If a non-provisory, non-max CU limit is already set, leave it as-is.\n if (existingLimit && existingLimit !== MAX_COMPUTE_UNIT_LIMIT) {\n return transactionMessage;\n }\n\n const estimatedUnits = await estimateComputeUnitLimit(transactionMessage, config);\n return setTransactionMessageComputeUnitLimit(estimatedUnits, transactionMessage);\n };\n}\n\n/**\n * Sets the compute unit limit to a provisory value of 0 if no compute unit limit is currently set\n * on the transaction message. If a limit is already set (any value, including 0), the message is\n * returned unchanged.\n *\n * This is useful during transaction construction to reserve space for a compute unit limit that\n * will later be replaced with an actual estimate via\n * {@link estimateAndSetComputeUnitLimitFactory}.\n *\n * @param transactionMessage - The transaction message to add a provisory limit to.\n * @return The transaction message with a provisory compute unit limit set, or unchanged if one was\n * already present.\n *\n * @example\n * ```ts\n * import { fillTransactionMessageProvisoryComputeUnitLimit } from '@solana/kit';\n *\n * const messageWithProvisoryLimit = fillTransactionMessageProvisoryComputeUnitLimit(transactionMessage);\n * ```\n *\n * @deprecated Use {@link fillTransactionMessageProvisoryResourceLimits} instead, which additionally\n * reserves space for the loaded accounts data size limit on version 1 transactions.\n */\nexport function fillTransactionMessageProvisoryComputeUnitLimit<TTransactionMessage extends TransactionMessage>(\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n if (getTransactionMessageComputeUnitLimit(transactionMessage) !== undefined) {\n return transactionMessage;\n }\n return setTransactionMessageComputeUnitLimit(PROVISORY_COMPUTE_UNIT_LIMIT, transactionMessage);\n}\n","import {\n assertAccountsDecoded,\n assertAccountsExist,\n type FetchAccountsConfig,\n fetchJsonParsedAccounts,\n} from '@solana/accounts';\nimport type { Address } from '@solana/addresses';\nimport type { GetMultipleAccountsApi, Rpc } from '@solana/rpc';\nimport { type AddressesByLookupTableAddress } from '@solana/transaction-messages';\n\ntype FetchedAddressLookup = {\n addresses: Address[];\n};\n\n/**\n * Given a list of addresses belonging to address lookup tables, returns a map of lookup table\n * addresses to an ordered array of the addresses they contain.\n *\n * @param rpc An object that supports the {@link GetMultipleAccountsApi} of the Solana RPC API\n * @param config\n */\nexport async function fetchAddressesForLookupTables(\n lookupTableAddresses: Address[],\n rpc: Rpc<GetMultipleAccountsApi>,\n config?: FetchAccountsConfig,\n): Promise<AddressesByLookupTableAddress> {\n if (lookupTableAddresses.length === 0) {\n return {};\n }\n\n const fetchedLookupTables = await fetchJsonParsedAccounts<FetchedAddressLookup[]>(\n rpc,\n lookupTableAddresses,\n config,\n );\n\n assertAccountsDecoded(fetchedLookupTables);\n assertAccountsExist(fetchedLookupTables);\n\n return fetchedLookupTables.reduce<AddressesByLookupTableAddress>((acc, lookup) => {\n return {\n ...acc,\n [lookup.address]: lookup.data.addresses,\n };\n }, {});\n}\n","import { type FetchAccountsConfig } from '@solana/accounts';\nimport type { GetMultipleAccountsApi, Rpc } from '@solana/rpc';\nimport {\n CompiledTransactionMessage,\n CompiledTransactionMessageWithLifetime,\n decompileTransactionMessage,\n TransactionMessage,\n TransactionMessageWithFeePayer,\n TransactionMessageWithLifetime,\n} from '@solana/transaction-messages';\n\nimport { fetchAddressesForLookupTables } from './fetch-lookup-tables';\n\ntype DecompileTransactionMessageFetchingLookupTablesConfig = FetchAccountsConfig & {\n lastValidBlockHeight?: bigint;\n};\n\n/**\n * Returns a {@link TransactionMessage} from a {@link CompiledTransactionMessage}. If any of the\n * accounts in the compiled message require an address lookup table to find their address, this\n * function will use the supplied RPC instance to fetch the contents of the address lookup table\n * from the network.\n *\n * @param rpc An object that supports the {@link GetMultipleAccountsApi} of the Solana RPC API\n * @param config\n */\nexport async function decompileTransactionMessageFetchingLookupTables(\n compiledTransactionMessage: CompiledTransactionMessage & CompiledTransactionMessageWithLifetime,\n rpc: Rpc<GetMultipleAccountsApi>,\n config?: DecompileTransactionMessageFetchingLookupTablesConfig,\n): Promise<TransactionMessage & TransactionMessageWithFeePayer & TransactionMessageWithLifetime> {\n const lookupTables =\n 'addressTableLookups' in compiledTransactionMessage &&\n compiledTransactionMessage.addressTableLookups !== undefined &&\n compiledTransactionMessage.addressTableLookups.length > 0\n ? compiledTransactionMessage.addressTableLookups\n : [];\n const lookupTableAddresses = lookupTables.map(l => l.lookupTableAddress);\n\n const { lastValidBlockHeight, ...fetchAccountsConfig } = config ?? {};\n const addressesByLookupTableAddress =\n lookupTableAddresses.length > 0\n ? await fetchAddressesForLookupTables(lookupTableAddresses, rpc, fetchAccountsConfig)\n : {};\n\n return decompileTransactionMessage(compiledTransactionMessage, {\n addressesByLookupTableAddress,\n lastValidBlockHeight,\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_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS,\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 getTransactionMessageLoadedAccountsDataSizeLimit,\n isTransactionMessageWithDurableNonceLifetime,\n setTransactionMessageComputeUnitLimit,\n setTransactionMessageLoadedAccountsDataSizeLimit,\n TransactionMessage,\n TransactionMessageWithFeePayer,\n} from '@solana/transaction-messages';\nimport { compileTransaction, getBase64EncodedWireTransaction } from '@solana/transactions';\n\nconst PROVISORY_LIMIT = 0;\n// From Agave: https://github.com/anza-xyz/agave/blob/2a165e7a90af75c76426d1e031ed0284211d5d1e/program-runtime/src/execution_budget.rs#L39\nconst MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n// From Agave: https://github.com/anza-xyz/agave/blob/2a165e7a90af75c76426d1e031ed0284211d5d1e/program-runtime/src/execution_budget.rs#L53\nconst MAX_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 64 * 1024 * 1024;\n\ntype EstimateResourceLimitsFactoryConfig = Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\ntype EstimateResourceLimitsConfig = Readonly<{\n abortSignal?: AbortSignal;\n commitment?: Commitment;\n minContextSlot?: Slot;\n}>;\n\n/**\n * The estimated resource limits for a transaction message.\n *\n * `computeUnitLimit` is always returned. For version 1 transaction messages,\n * `loadedAccountsDataSizeLimit` is also required. For legacy and version 0 messages, the\n * `loadedAccountsDataSizeLimit` is returned when the RPC includes it in the simulation result,\n * but is not required — callers that don't apply it can ignore the field.\n */\nexport type ResourceLimitsEstimate<TTransactionMessage extends TransactionMessage> = TTransactionMessage extends {\n version: 1;\n}\n ? { computeUnitLimit: number; loadedAccountsDataSizeLimit: number }\n : { computeUnitLimit: number; loadedAccountsDataSizeLimit?: number };\n\ntype EstimateResourceLimitsFunction = <TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer>(\n transactionMessage: TTransactionMessage,\n config?: EstimateResourceLimitsConfig,\n) => Promise<ResourceLimitsEstimate<TTransactionMessage>>;\n\n/**\n * Returns a function that estimates the resource limits required by a transaction message by\n * simulating it.\n *\n * The estimator sets the compute unit limit to the maximum (1,400,000) and the loaded accounts data\n * size limit to the maximum (64 MiB) before simulating, so the simulation does not fail due to\n * resource exhaustion. For blockhash-lifetime transactions, the RPC is asked to replace the\n * blockhash during simulation, so any blockhash value will work. For durable nonce transactions,\n * the actual nonce value is used.\n *\n * For version 1 transaction messages, both `computeUnitLimit` and `loadedAccountsDataSizeLimit` are\n * returned. The function throws if the RPC does not return a `loadedAccountsDataSize` value, since\n * this value is required for version 1 transactions. For legacy and version 0 messages, only\n * `computeUnitLimit` is returned.\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 resource limits.\n *\n * @example\n * ```ts\n * import { estimateResourceLimitsFactory } from '@solana/kit';\n *\n * const estimateResourceLimits = estimateResourceLimitsFactory({ rpc });\n * const { computeUnitLimit, loadedAccountsDataSizeLimit } = await estimateResourceLimits(transactionMessage);\n * ```\n */\nexport function estimateResourceLimitsFactory({\n rpc,\n}: EstimateResourceLimitsFactoryConfig): EstimateResourceLimitsFunction {\n return async function estimateResourceLimits<\n TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer,\n >(transactionMessage: TTransactionMessage, config?: EstimateResourceLimitsConfig) {\n const { abortSignal, ...simulateConfig } = config ?? {};\n const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n const isDataSizeRequired = transactionMessage.version === 1;\n\n const transaction = pipe(\n transactionMessage,\n m => setTransactionMessageComputeUnitLimit(MAX_COMPUTE_UNIT_LIMIT, m),\n m =>\n isDataSizeRequired\n ? setTransactionMessageLoadedAccountsDataSizeLimit(MAX_LOADED_ACCOUNTS_DATA_SIZE_LIMIT, m)\n : 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 type varies based on config (eg. `replacementBlockhash` is only\n // present when `replaceRecentBlockhash` is true), but `RpcSimulateTransactionResult`\n // is a flat superset. Cast through `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 (isDataSizeRequired && simulationResult.loadedAccountsDataSize == null) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT);\n }\n\n if (transactionError) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS, {\n ...simulationResult,\n cause: getSolanaErrorFromTransactionError(transactionError),\n });\n }\n\n // Downcast from bigint to number, capping at u32 max.\n const computeUnitLimit =\n simulationResult.unitsConsumed > 4_294_967_295n\n ? 4_294_967_295\n : Number(simulationResult.unitsConsumed);\n\n if (isDataSizeRequired) {\n return {\n computeUnitLimit,\n loadedAccountsDataSizeLimit: simulationResult.loadedAccountsDataSize!,\n } as ResourceLimitsEstimate<TTransactionMessage>;\n }\n return (\n simulationResult.loadedAccountsDataSize == null\n ? { computeUnitLimit }\n : { computeUnitLimit, loadedAccountsDataSizeLimit: simulationResult.loadedAccountsDataSize }\n ) as ResourceLimitsEstimate<TTransactionMessage>;\n } catch (e) {\n if (\n isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS) ||\n isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT)\n ) {\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 resource limits for a transaction message and sets them on\n * the message.\n *\n * For all versions, the compute unit limit is updated to the estimated value if it is not already\n * set to an explicit, non-provisory value. The compute unit limit also treats the maximum\n * (1,400,000) as non-explicit, so messages that pre-set the max for simulation get re-estimated.\n *\n * For version 1 messages, the loaded accounts data size limit is updated only if it is unset or set\n * to the provisory value of 0. An explicit value — including the runtime maximum — is left\n * untouched, since callers who set it explicitly are signaling a deliberate choice.\n *\n * This is designed to work with {@link fillTransactionMessageProvisoryResourceLimits}: first add\n * provisory limits during transaction construction, then later estimate and replace them before\n * sending.\n *\n * @param estimateResourceLimits - The estimator function, typically created by\n * {@link estimateResourceLimitsFactory}. You can also pass a custom wrapper that applies a buffer\n * to the returned values.\n * @return A function that accepts a transaction message and returns it with resource limits set to\n * the estimated values.\n *\n * @example\n * ```ts\n * import { estimateAndSetResourceLimitsFactory, estimateResourceLimitsFactory } from '@solana/kit';\n *\n * const estimator = estimateResourceLimitsFactory({ rpc });\n * const estimateAndSet = estimateAndSetResourceLimitsFactory(estimator);\n * const updatedMessage = await estimateAndSet(transactionMessage);\n * ```\n */\nexport function estimateAndSetResourceLimitsFactory(\n estimateResourceLimits: EstimateResourceLimitsFunction,\n): <TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer>(\n transactionMessage: TTransactionMessage,\n config?: EstimateResourceLimitsConfig,\n) => Promise<TTransactionMessage> {\n return async function estimateAndSetResourceLimits(transactionMessage, config) {\n const existingComputeUnitLimit = getTransactionMessageComputeUnitLimit(transactionMessage);\n const computeUnitLimitIsExplicit =\n existingComputeUnitLimit !== undefined &&\n existingComputeUnitLimit !== PROVISORY_LIMIT &&\n existingComputeUnitLimit !== MAX_COMPUTE_UNIT_LIMIT;\n\n const isV1 = transactionMessage.version === 1;\n let loadedAccountsDataSizeLimitIsExplicit = true;\n if (isV1) {\n const existingLoadedAccountsDataSizeLimit =\n getTransactionMessageLoadedAccountsDataSizeLimit(transactionMessage);\n loadedAccountsDataSizeLimitIsExplicit =\n existingLoadedAccountsDataSizeLimit !== undefined &&\n existingLoadedAccountsDataSizeLimit !== PROVISORY_LIMIT;\n }\n\n // Nothing to do — every applicable limit is already explicitly set.\n if (computeUnitLimitIsExplicit && loadedAccountsDataSizeLimitIsExplicit) {\n return transactionMessage;\n }\n\n const estimate = await estimateResourceLimits(transactionMessage, config);\n\n let result = transactionMessage;\n if (!computeUnitLimitIsExplicit) {\n result = setTransactionMessageComputeUnitLimit(estimate.computeUnitLimit, result);\n }\n if (isV1 && !loadedAccountsDataSizeLimitIsExplicit && 'loadedAccountsDataSizeLimit' in estimate) {\n result = setTransactionMessageLoadedAccountsDataSizeLimit(estimate.loadedAccountsDataSizeLimit, result);\n }\n return result;\n };\n}\n\n/**\n * Sets resource limits to a provisory value of 0 if no limit is currently set on the transaction\n * message.\n *\n * For all versions, this fills the compute unit limit. For version 1 messages, it also fills the\n * loaded accounts data size limit. If a limit is already set (any value, including 0), that limit\n * is left unchanged.\n *\n * This is useful during transaction construction to reserve space for resource limits that will\n * later be replaced with actual estimates via {@link estimateAndSetResourceLimitsFactory}.\n *\n * @param transactionMessage - The transaction message to add provisory limits to.\n * @return The transaction message with provisory resource limits set, or unchanged if all\n * applicable limits were already present.\n *\n * @example\n * ```ts\n * import { fillTransactionMessageProvisoryResourceLimits } from '@solana/kit';\n *\n * const messageWithProvisoryLimits = fillTransactionMessageProvisoryResourceLimits(transactionMessage);\n * ```\n */\nexport function fillTransactionMessageProvisoryResourceLimits<TTransactionMessage extends TransactionMessage>(\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n let result: TTransactionMessage = transactionMessage;\n if (getTransactionMessageComputeUnitLimit(result) === undefined) {\n result = setTransactionMessageComputeUnitLimit(PROVISORY_LIMIT, result);\n }\n if (result.version === 1 && getTransactionMessageLoadedAccountsDataSizeLimit(result) === undefined) {\n result = setTransactionMessageLoadedAccountsDataSizeLimit(PROVISORY_LIMIT, result);\n }\n return result;\n}\n","import type { Signature } from '@solana/keys';\nimport type { Rpc, SendTransactionApi } from '@solana/rpc';\nimport { Commitment, commitmentComparator } from '@solana/rpc-types';\nimport {\n TransactionWithLastValidBlockHeight,\n waitForDurableNonceTransactionConfirmation,\n waitForRecentTransactionConfirmation,\n} from '@solana/transaction-confirmation';\nimport {\n getBase64EncodedWireTransaction,\n SendableTransaction,\n Transaction,\n TransactionWithDurableNonceLifetime,\n} from '@solana/transactions';\n\ninterface SendAndConfirmDurableNonceTransactionConfig\n extends SendTransactionBaseConfig, SendTransactionConfigWithoutEncoding {\n confirmDurableNonceTransaction: (\n config: Omit<\n Parameters<typeof waitForDurableNonceTransactionConfirmation>[0],\n 'getNonceInvalidationPromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) => Promise<void>;\n transaction: SendableTransaction & Transaction & TransactionWithDurableNonceLifetime;\n}\n\ninterface SendAndConfirmTransactionWithBlockhashLifetimeConfig\n extends SendTransactionBaseConfig, SendTransactionConfigWithoutEncoding {\n confirmRecentTransaction: (\n config: Omit<\n Parameters<typeof waitForRecentTransactionConfirmation>[0],\n 'getBlockHeightExceedencePromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) => Promise<void>;\n transaction: SendableTransaction & Transaction & TransactionWithLastValidBlockHeight;\n}\n\ninterface SendTransactionBaseConfig extends SendTransactionConfigWithoutEncoding {\n abortSignal?: AbortSignal;\n commitment: Commitment;\n rpc: Rpc<SendTransactionApi>;\n transaction: SendableTransaction & Transaction;\n}\n\ntype SendTransactionConfigWithoutEncoding = Omit<\n NonNullable<Parameters<SendTransactionApi['sendTransaction']>[1]>,\n 'encoding'\n>;\n\nfunction getSendTransactionConfigWithAdjustedPreflightCommitment(\n commitment: Commitment,\n config?: SendTransactionConfigWithoutEncoding,\n): SendTransactionConfigWithoutEncoding | void {\n if (\n // The developer has supplied no value for `preflightCommitment`.\n !config?.preflightCommitment &&\n // The value of `commitment` is lower than the server default of `preflightCommitment`.\n commitmentComparator(commitment, 'finalized' /* default value of `preflightCommitment` */) < 0\n ) {\n return {\n ...config,\n // In the common case, it is unlikely that you want to simulate a transaction at\n // `finalized` commitment when your standard of commitment for confirming the\n // transaction is lower. Cap the simulation commitment level to the level of the\n // confirmation commitment.\n preflightCommitment: commitment,\n };\n }\n // The commitment at which the developer wishes to confirm the transaction is at least as\n // high as the commitment at which they want to simulate it. Honour the config as-is.\n return config;\n}\n\nexport async function sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n rpc,\n transaction,\n ...sendTransactionConfig\n}: SendTransactionBaseConfig): Promise<Signature> {\n const base64EncodedWireTransaction = getBase64EncodedWireTransaction(transaction);\n return await rpc\n .sendTransaction(base64EncodedWireTransaction, {\n ...getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, sendTransactionConfig),\n encoding: 'base64',\n })\n .send({ abortSignal });\n}\n\nexport async function sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n confirmDurableNonceTransaction,\n rpc,\n transaction,\n ...sendTransactionConfig\n}: SendAndConfirmDurableNonceTransactionConfig): Promise<Signature> {\n const transactionSignature = await sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...sendTransactionConfig,\n abortSignal,\n commitment,\n rpc,\n transaction,\n });\n await confirmDurableNonceTransaction({\n abortSignal,\n commitment,\n transaction,\n });\n return transactionSignature;\n}\n\nexport async function sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n confirmRecentTransaction,\n rpc,\n transaction,\n ...sendTransactionConfig\n}: SendAndConfirmTransactionWithBlockhashLifetimeConfig): Promise<Signature> {\n const transactionSignature = await sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...sendTransactionConfig,\n abortSignal,\n commitment,\n rpc,\n transaction,\n });\n await confirmRecentTransaction({\n abortSignal,\n commitment,\n transaction,\n });\n return transactionSignature;\n}\n","import { getSolanaErrorFromTransactionError, isSolanaError, SOLANA_ERROR__INVALID_NONCE } from '@solana/errors';\nimport { Signature } from '@solana/keys';\nimport type { GetAccountInfoApi, GetSignatureStatusesApi, Rpc, SendTransactionApi } from '@solana/rpc';\nimport type { AccountNotificationsApi, RpcSubscriptions, SignatureNotificationsApi } from '@solana/rpc-subscriptions';\nimport { commitmentComparator } from '@solana/rpc-types';\nimport {\n createNonceInvalidationPromiseFactory,\n createRecentSignatureConfirmationPromiseFactory,\n waitForDurableNonceTransactionConfirmation,\n} from '@solana/transaction-confirmation';\nimport {\n getSignatureFromTransaction,\n SendableTransaction,\n Transaction,\n TransactionWithDurableNonceLifetime,\n} from '@solana/transactions';\n\nimport { sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT } from './send-transaction-internal';\n\ntype SendAndConfirmDurableNonceTransactionFunction = (\n transaction: SendableTransaction & Transaction & TransactionWithDurableNonceLifetime,\n config: Omit<\n Parameters<typeof sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT>[0],\n 'confirmDurableNonceTransaction' | 'rpc' | 'transaction'\n >,\n) => Promise<void>;\n\ntype SendAndConfirmDurableNonceTransactionFactoryConfig<TCluster> = {\n /** An object that supports the {@link GetSignatureStatusesApi} and the {@link SendTransactionApi} of the Solana RPC API */\n rpc: Rpc<GetAccountInfoApi & GetSignatureStatusesApi & SendTransactionApi> & { '~cluster'?: TCluster };\n /** An object that supports the {@link AccountNotificationsApi} and the {@link SignatureNotificationsApi} of the Solana RPC Subscriptions API */\n rpcSubscriptions: RpcSubscriptions<AccountNotificationsApi & SignatureNotificationsApi> & { '~cluster'?: TCluster };\n};\n\n/**\n * Returns a function that you can call to send a nonce-based transaction to the network and to wait\n * until it has been confirmed.\n *\n * @param config\n *\n * @example\n * ```ts\n * import {\n * isSolanaError,\n * sendAndConfirmDurableNonceTransactionFactory,\n * SOLANA_ERROR__INVALID_NONCE,\n * SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,\n * } from '@solana/kit';\n *\n * const sendAndConfirmNonceTransaction = sendAndConfirmDurableNonceTransactionFactory({ rpc, rpcSubscriptions });\n *\n * try {\n * await sendAndConfirmNonceTransaction(transaction, { commitment: 'confirmed' });\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND)) {\n * console.error(\n * 'The lifetime specified by this transaction refers to a nonce account ' +\n * `\\`${e.context.nonceAccountAddress}\\` that does not exist`,\n * );\n * } else if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {\n * console.error('This transaction depends on a nonce that is no longer valid');\n * } else {\n * throw e;\n * }\n * }\n * ```\n */\nexport function sendAndConfirmDurableNonceTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<'devnet'>): SendAndConfirmDurableNonceTransactionFunction;\nexport function sendAndConfirmDurableNonceTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<'testnet'>): SendAndConfirmDurableNonceTransactionFunction;\nexport function sendAndConfirmDurableNonceTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<'mainnet'>): SendAndConfirmDurableNonceTransactionFunction;\nexport function sendAndConfirmDurableNonceTransactionFactory<\n TCluster extends 'devnet' | 'mainnet' | 'testnet' | void = void,\n>({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<TCluster>): SendAndConfirmDurableNonceTransactionFunction {\n const getNonceInvalidationPromise = createNonceInvalidationPromiseFactory({ rpc, rpcSubscriptions } as Parameters<\n typeof createNonceInvalidationPromiseFactory\n >[0]);\n const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createRecentSignatureConfirmationPromiseFactory>[0]);\n\n /**\n * Creates a wrapped version of getNonceInvalidationPromise that handles the race condition\n * where the nonce account update notification arrives before the signature confirmation.\n *\n * When the nonce changes, we check if our transaction actually landed on-chain.\n * If it did, we don't throw - letting the signature confirmation promise continue.\n */\n function createNonceInvalidationPromiseHandlingRaceCondition(\n signature: Signature,\n ): typeof getNonceInvalidationPromise {\n return async function wrappedGetNonceInvalidationPromise(config) {\n try {\n return await getNonceInvalidationPromise(config);\n } catch (e) {\n // If nonce became invalid, check if our transaction actually landed\n if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {\n let status;\n try {\n const { value: statuses } = await rpc\n .getSignatureStatuses([signature])\n .send({ abortSignal: config.abortSignal });\n status = statuses[0];\n } catch {\n // RPC failed - propagate the original nonce error\n throw e;\n }\n\n if (status === null || status === undefined) {\n // Transaction doesn't exist - nonce was truly invalid\n throw e;\n }\n\n // Check if status meets required commitment\n if (\n status.confirmationStatus !== null &&\n commitmentComparator(status.confirmationStatus, config.commitment) >= 0\n ) {\n // Transaction failed on-chain, throw the error from the transaction\n if (status.err !== null) {\n throw getSolanaErrorFromTransactionError(status.err);\n }\n // Transaction succeeded, resolve the promise successfully\n return;\n }\n\n // Commitment not met yet - return a never-resolving promise\n // This lets the signature confirmation promise continue\n return await new Promise(() => {});\n }\n throw e;\n }\n };\n }\n\n async function confirmDurableNonceTransaction(\n config: Omit<\n Parameters<typeof waitForDurableNonceTransactionConfirmation>[0],\n 'getNonceInvalidationPromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) {\n const wrappedGetNonceInvalidationPromise = createNonceInvalidationPromiseHandlingRaceCondition(\n getSignatureFromTransaction(config.transaction),\n );\n\n await waitForDurableNonceTransactionConfirmation({\n ...config,\n getNonceInvalidationPromise: wrappedGetNonceInvalidationPromise,\n getRecentSignatureConfirmationPromise,\n });\n }\n return async function sendAndConfirmDurableNonceTransaction(transaction, config) {\n await sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n confirmDurableNonceTransaction,\n rpc,\n transaction,\n });\n };\n}\n","import type { GetEpochInfoApi, GetSignatureStatusesApi, Rpc, SendTransactionApi } from '@solana/rpc';\nimport type { RpcSubscriptions, SignatureNotificationsApi, SlotNotificationsApi } from '@solana/rpc-subscriptions';\nimport {\n createBlockHeightExceedencePromiseFactory,\n createRecentSignatureConfirmationPromiseFactory,\n TransactionWithLastValidBlockHeight,\n waitForRecentTransactionConfirmation,\n} from '@solana/transaction-confirmation';\nimport { SendableTransaction, Transaction } from '@solana/transactions';\n\nimport { sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT } from './send-transaction-internal';\n\ntype SendAndConfirmTransactionWithBlockhashLifetimeFunction = (\n transaction: SendableTransaction & Transaction & TransactionWithLastValidBlockHeight,\n config: Omit<\n Parameters<typeof sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT>[0],\n 'confirmRecentTransaction' | 'rpc' | 'transaction'\n >,\n) => Promise<void>;\n\ntype SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<TCluster> = {\n /** An object that supports the {@link GetSignatureStatusesApi} and the {@link SendTransactionApi} of the Solana RPC API */\n rpc: Rpc<GetEpochInfoApi & GetSignatureStatusesApi & SendTransactionApi> & { '~cluster'?: TCluster };\n /** An object that supports the {@link SignatureNotificationsApi} and the {@link SlotNotificationsApi} of the Solana RPC Subscriptions API */\n rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi & SlotNotificationsApi> & { '~cluster'?: TCluster };\n};\n\n/**\n * Returns a function that you can call to send a blockhash-based transaction to the network and to\n * wait until it has been confirmed.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { isSolanaError, sendAndConfirmTransactionFactory, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED } from '@solana/kit';\n *\n * const sendAndConfirmTransaction = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });\n *\n * try {\n * await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED)) {\n * console.error('This transaction depends on a blockhash that has expired');\n * } else {\n * throw e;\n * }\n * }\n * ```\n */\nexport function sendAndConfirmTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<'devnet'>): SendAndConfirmTransactionWithBlockhashLifetimeFunction;\nexport function sendAndConfirmTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<'testnet'>): SendAndConfirmTransactionWithBlockhashLifetimeFunction;\nexport function sendAndConfirmTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<'mainnet'>): SendAndConfirmTransactionWithBlockhashLifetimeFunction;\nexport function sendAndConfirmTransactionFactory<TCluster extends 'devnet' | 'mainnet' | 'testnet' | void = void>({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<TCluster>): SendAndConfirmTransactionWithBlockhashLifetimeFunction {\n const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createBlockHeightExceedencePromiseFactory>[0]);\n const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createRecentSignatureConfirmationPromiseFactory>[0]);\n async function confirmRecentTransaction(\n config: Omit<\n Parameters<typeof waitForRecentTransactionConfirmation>[0],\n 'getBlockHeightExceedencePromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) {\n await waitForRecentTransactionConfirmation({\n ...config,\n getBlockHeightExceedencePromise,\n getRecentSignatureConfirmationPromise,\n });\n }\n return async function sendAndConfirmTransaction(transaction, config) {\n await sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n confirmRecentTransaction,\n rpc,\n transaction,\n });\n };\n}\n","import type { Rpc, SendTransactionApi } from '@solana/rpc';\nimport { SendableTransaction, Transaction } from '@solana/transactions';\n\nimport { sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT } from './send-transaction-internal';\n\ntype SendTransactionWithoutConfirmingFunction = (\n transaction: SendableTransaction & Transaction,\n config: Omit<Parameters<typeof sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT>[0], 'rpc' | 'transaction'>,\n) => Promise<void>;\n\ninterface SendTransactionWithoutConfirmingFactoryConfig {\n /** An object that supports the {@link SendTransactionApi} of the Solana RPC API */\n rpc: Rpc<SendTransactionApi>;\n}\n\n/**\n * Returns a function that you can call to send a transaction with any kind of lifetime to the\n * network without waiting for it to be confirmed.\n *\n * @param config\n *\n * @example\n * ```ts\n * import {\n * sendTransactionWithoutConfirmingFactory,\n * SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n * } from '@solana/kit';\n *\n * const sendTransaction = sendTransactionWithoutConfirmingFactory({ rpc });\n *\n * try {\n * await sendTransaction(transaction, { commitment: 'confirmed' });\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE)) {\n * console.error('The transaction failed in simulation', e.cause);\n * } else {\n * throw e;\n * }\n * }\n * ```\n */\nexport function sendTransactionWithoutConfirmingFactory({\n rpc,\n}: SendTransactionWithoutConfirmingFactoryConfig): SendTransactionWithoutConfirmingFunction {\n return async function sendTransactionWithoutConfirming(transaction, config) {\n await sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n rpc,\n transaction,\n });\n };\n}\n"]}
|
|
1
|
+
{"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":["MAX_COMPUTE_UNIT_LIMIT","isTransactionMessageWithDurableNonceLifetime","pipe","setTransactionMessageComputeUnitLimit","compileTransaction","getBase64EncodedWireTransaction","SolanaError","SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT","getSolanaErrorFromTransactionError","isSolanaError","getTransactionMessageComputeUnitLimit","createRecentSignatureConfirmationPromiseFactory","commitmentComparator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,gBAAuB,mDAAA,CAA0F;AAAA,EAC7G,WAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACJ,CAAA,EAEE;AACE,EAAA,IAAI,YAAY,OAAA,EAAS;AAEzB,EAAA,IAAI,iBAAiB,CAAC,EAAA;AAGtB,EAAA,MAAM,QAAoC,EAAC;AAC3C,EAAA,IAAI,cAAA,GAAqF,IAAA;AACzF,EAAA,IAAI,aAAA,GAAoD,IAAA;AACxD,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,IAAI,gBAAA,GAAmB,KAAA;AACvB,EAAA,IAAI,IAAA,GAAO,KAAA;AACX,EAAA,IA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AA,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.mjs","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 provisory limit\n * during transaction construction, then later estimate and replace it before sending.\n *\n * @param estimateComputeUnitLimit - The estimator function, typically created by\n * {@link estimateComputeUnitLimitFactory}. You can also pass a custom wrapper that adds a buffer\n * (e.g. multiply the estimate by 1.1).\n * @return A function that accepts a transaction message and returns it with the compute unit limit\n * set to the estimated value.\n *\n * @example\n * ```ts\n * import { estimateAndSetComputeUnitLimitFactory, estimateComputeUnitLimitFactory } from '@solana/kit';\n *\n * const estimator = estimateComputeUnitLimitFactory({ rpc });\n * const estimateAndSet = estimateAndSetComputeUnitLimitFactory(estimator);\n * const updatedMessage = await estimateAndSet(transactionMessage);\n * ```\n *\n * @deprecated Use {@link estimateAndSetResourceLimitsFactory} instead, which additionally sets the\n * loaded accounts data size limit for version 1 transactions.\n */\nexport function estimateAndSetComputeUnitLimitFactory(\n estimateComputeUnitLimit: EstimateComputeUnitLimitFunction,\n): <TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer>(\n transactionMessage: TTransactionMessage,\n config?: EstimateComputeUnitLimitConfig,\n) => Promise<TTransactionMessage> {\n return async function estimateAndSetComputeUnitLimit(transactionMessage, config) {\n const existingLimit = getTransactionMessageComputeUnitLimit(transactionMessage);\n\n // If a non-provisory, non-max CU limit is already set, leave it as-is.\n if (existingLimit && existingLimit !== MAX_COMPUTE_UNIT_LIMIT) {\n return transactionMessage;\n }\n\n const estimatedUnits = await estimateComputeUnitLimit(transactionMessage, config);\n return setTransactionMessageComputeUnitLimit(estimatedUnits, transactionMessage);\n };\n}\n\n/**\n * Sets the compute unit limit to a provisory value of 0 if no compute unit limit is currently set\n * on the transaction message. If a limit is already set (any value, including 0), the message is\n * returned unchanged.\n *\n * This is useful during transaction construction to reserve space for a compute unit limit that\n * will later be replaced with an actual estimate via\n * {@link estimateAndSetComputeUnitLimitFactory}.\n *\n * @param transactionMessage - The transaction message to add a provisory limit to.\n * @return The transaction message with a provisory compute unit limit set, or unchanged if one was\n * already present.\n *\n * @example\n * ```ts\n * import { fillTransactionMessageProvisoryComputeUnitLimit } from '@solana/kit';\n *\n * const messageWithProvisoryLimit = fillTransactionMessageProvisoryComputeUnitLimit(transactionMessage);\n * ```\n *\n * @deprecated Use {@link fillTransactionMessageProvisoryResourceLimits} instead, which additionally\n * reserves space for the loaded accounts data size limit on version 1 transactions.\n */\nexport function fillTransactionMessageProvisoryComputeUnitLimit<TTransactionMessage extends TransactionMessage>(\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n if (getTransactionMessageComputeUnitLimit(transactionMessage) !== undefined) {\n return transactionMessage;\n }\n return setTransactionMessageComputeUnitLimit(PROVISORY_COMPUTE_UNIT_LIMIT, transactionMessage);\n}\n","import {\n assertAccountsDecoded,\n assertAccountsExist,\n type FetchAccountsConfig,\n fetchJsonParsedAccounts,\n} from '@solana/accounts';\nimport type { Address } from '@solana/addresses';\nimport type { GetMultipleAccountsApi, Rpc } from '@solana/rpc';\nimport { type AddressesByLookupTableAddress } from '@solana/transaction-messages';\n\ntype FetchedAddressLookup = {\n addresses: Address[];\n};\n\n/**\n * Given a list of addresses belonging to address lookup tables, returns a map of lookup table\n * addresses to an ordered array of the addresses they contain.\n *\n * @param rpc An object that supports the {@link GetMultipleAccountsApi} of the Solana RPC API\n * @param config\n */\nexport async function fetchAddressesForLookupTables(\n lookupTableAddresses: Address[],\n rpc: Rpc<GetMultipleAccountsApi>,\n config?: FetchAccountsConfig,\n): Promise<AddressesByLookupTableAddress> {\n if (lookupTableAddresses.length === 0) {\n return {};\n }\n\n const fetchedLookupTables = await fetchJsonParsedAccounts<FetchedAddressLookup[]>(\n rpc,\n lookupTableAddresses,\n config,\n );\n\n assertAccountsDecoded(fetchedLookupTables);\n assertAccountsExist(fetchedLookupTables);\n\n return fetchedLookupTables.reduce<AddressesByLookupTableAddress>((acc, lookup) => {\n return {\n ...acc,\n [lookup.address]: lookup.data.addresses,\n };\n }, {});\n}\n","import { type FetchAccountsConfig } from '@solana/accounts';\nimport type { GetMultipleAccountsApi, Rpc } from '@solana/rpc';\nimport {\n CompiledTransactionMessage,\n CompiledTransactionMessageWithLifetime,\n decompileTransactionMessage,\n TransactionMessage,\n TransactionMessageWithFeePayer,\n TransactionMessageWithLifetime,\n} from '@solana/transaction-messages';\n\nimport { fetchAddressesForLookupTables } from './fetch-lookup-tables';\n\ntype DecompileTransactionMessageFetchingLookupTablesConfig = FetchAccountsConfig & {\n lastValidBlockHeight?: bigint;\n};\n\n/**\n * Returns a {@link TransactionMessage} from a {@link CompiledTransactionMessage}. If any of the\n * accounts in the compiled message require an address lookup table to find their address, this\n * function will use the supplied RPC instance to fetch the contents of the address lookup table\n * from the network.\n *\n * @param rpc An object that supports the {@link GetMultipleAccountsApi} of the Solana RPC API\n * @param config\n */\nexport async function decompileTransactionMessageFetchingLookupTables(\n compiledTransactionMessage: CompiledTransactionMessage & CompiledTransactionMessageWithLifetime,\n rpc: Rpc<GetMultipleAccountsApi>,\n config?: DecompileTransactionMessageFetchingLookupTablesConfig,\n): Promise<TransactionMessage & TransactionMessageWithFeePayer & TransactionMessageWithLifetime> {\n const lookupTables =\n 'addressTableLookups' in compiledTransactionMessage &&\n compiledTransactionMessage.addressTableLookups !== undefined &&\n compiledTransactionMessage.addressTableLookups.length > 0\n ? compiledTransactionMessage.addressTableLookups\n : [];\n const lookupTableAddresses = lookupTables.map(l => l.lookupTableAddress);\n\n const { lastValidBlockHeight, ...fetchAccountsConfig } = config ?? {};\n const addressesByLookupTableAddress =\n lookupTableAddresses.length > 0\n ? await fetchAddressesForLookupTables(lookupTableAddresses, rpc, fetchAccountsConfig)\n : {};\n\n return decompileTransactionMessage(compiledTransactionMessage, {\n addressesByLookupTableAddress,\n lastValidBlockHeight,\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_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT,\n SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS,\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 getTransactionMessageLoadedAccountsDataSizeLimit,\n isTransactionMessageWithDurableNonceLifetime,\n setTransactionMessageComputeUnitLimit,\n setTransactionMessageLoadedAccountsDataSizeLimit,\n TransactionMessage,\n TransactionMessageWithFeePayer,\n} from '@solana/transaction-messages';\nimport { compileTransaction, getBase64EncodedWireTransaction } from '@solana/transactions';\n\nconst PROVISORY_LIMIT = 0;\n// From Agave: https://github.com/anza-xyz/agave/blob/2a165e7a90af75c76426d1e031ed0284211d5d1e/program-runtime/src/execution_budget.rs#L39\nconst MAX_COMPUTE_UNIT_LIMIT = 1_400_000;\n// From Agave: https://github.com/anza-xyz/agave/blob/2a165e7a90af75c76426d1e031ed0284211d5d1e/program-runtime/src/execution_budget.rs#L53\nconst MAX_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 64 * 1024 * 1024;\n\ntype EstimateResourceLimitsFactoryConfig = Readonly<{\n rpc: Rpc<SimulateTransactionApi>;\n}>;\n\ntype EstimateResourceLimitsConfig = Readonly<{\n abortSignal?: AbortSignal;\n commitment?: Commitment;\n minContextSlot?: Slot;\n}>;\n\n/**\n * The estimated resource limits for a transaction message.\n *\n * `computeUnitLimit` is always returned. For version 1 transaction messages,\n * `loadedAccountsDataSizeLimit` is also required. For legacy and version 0 messages, the\n * `loadedAccountsDataSizeLimit` is returned when the RPC includes it in the simulation result,\n * but is not required — callers that don't apply it can ignore the field.\n */\nexport type ResourceLimitsEstimate<TTransactionMessage extends TransactionMessage> = TTransactionMessage extends {\n version: 1;\n}\n ? { computeUnitLimit: number; loadedAccountsDataSizeLimit: number }\n : { computeUnitLimit: number; loadedAccountsDataSizeLimit?: number };\n\ntype EstimateResourceLimitsFunction = <TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer>(\n transactionMessage: TTransactionMessage,\n config?: EstimateResourceLimitsConfig,\n) => Promise<ResourceLimitsEstimate<TTransactionMessage>>;\n\n/**\n * Returns a function that estimates the resource limits required by a transaction message by\n * simulating it.\n *\n * The estimator sets the compute unit limit to the maximum (1,400,000) and the loaded accounts data\n * size limit to the maximum (64 MiB) before simulating, so the simulation does not fail due to\n * resource exhaustion. For blockhash-lifetime transactions, the RPC is asked to replace the\n * blockhash during simulation, so any blockhash value will work. For durable nonce transactions,\n * the actual nonce value is used.\n *\n * For version 1 transaction messages, both `computeUnitLimit` and `loadedAccountsDataSizeLimit` are\n * returned. The function throws if the RPC does not return a `loadedAccountsDataSize` value, since\n * this value is required for version 1 transactions. For legacy and version 0 messages, only\n * `computeUnitLimit` is returned.\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 resource limits.\n *\n * @example\n * ```ts\n * import { estimateResourceLimitsFactory } from '@solana/kit';\n *\n * const estimateResourceLimits = estimateResourceLimitsFactory({ rpc });\n * const { computeUnitLimit, loadedAccountsDataSizeLimit } = await estimateResourceLimits(transactionMessage);\n * ```\n */\nexport function estimateResourceLimitsFactory({\n rpc,\n}: EstimateResourceLimitsFactoryConfig): EstimateResourceLimitsFunction {\n return async function estimateResourceLimits<\n TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer,\n >(transactionMessage: TTransactionMessage, config?: EstimateResourceLimitsConfig) {\n const { abortSignal, ...simulateConfig } = config ?? {};\n const replaceRecentBlockhash = !isTransactionMessageWithDurableNonceLifetime(transactionMessage);\n const isDataSizeRequired = transactionMessage.version === 1;\n\n const transaction = pipe(\n transactionMessage,\n m => setTransactionMessageComputeUnitLimit(MAX_COMPUTE_UNIT_LIMIT, m),\n m =>\n isDataSizeRequired\n ? setTransactionMessageLoadedAccountsDataSizeLimit(MAX_LOADED_ACCOUNTS_DATA_SIZE_LIMIT, m)\n : 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 (isDataSizeRequired && simulationResult.loadedAccountsDataSize == null) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT);\n }\n\n if (transactionError) {\n throw new SolanaError(SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS, {\n ...simulationResult,\n cause: getSolanaErrorFromTransactionError(transactionError),\n });\n }\n\n // Downcast from bigint to number, capping at u32 max.\n const computeUnitLimit =\n simulationResult.unitsConsumed > 4_294_967_295n\n ? 4_294_967_295\n : Number(simulationResult.unitsConsumed);\n\n if (isDataSizeRequired) {\n return {\n computeUnitLimit,\n loadedAccountsDataSizeLimit: simulationResult.loadedAccountsDataSize!,\n } as ResourceLimitsEstimate<TTransactionMessage>;\n }\n return (\n simulationResult.loadedAccountsDataSize == null\n ? { computeUnitLimit }\n : { computeUnitLimit, loadedAccountsDataSizeLimit: simulationResult.loadedAccountsDataSize }\n ) as ResourceLimitsEstimate<TTransactionMessage>;\n } catch (e) {\n if (\n isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_RESOURCE_LIMITS) ||\n isSolanaError(e, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_LOADED_ACCOUNTS_DATA_SIZE_LIMIT)\n ) {\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 resource limits for a transaction message and sets them on\n * the message.\n *\n * For all versions, the compute unit limit is updated to the estimated value if it is not already\n * set to an explicit, non-provisory value. The compute unit limit also treats the maximum\n * (1,400,000) as non-explicit, so messages that pre-set the max for simulation get re-estimated.\n *\n * For version 1 messages, the loaded accounts data size limit is updated only if it is unset or set\n * to the provisory value of 0. An explicit value — including the runtime maximum — is left\n * untouched, since callers who set it explicitly are signaling a deliberate choice.\n *\n * This is designed to work with {@link fillTransactionMessageProvisoryResourceLimits}: first add\n * provisory limits during transaction construction, then later estimate and replace them before\n * sending.\n *\n * @param estimateResourceLimits - The estimator function, typically created by\n * {@link estimateResourceLimitsFactory}. You can also pass a custom wrapper that applies a buffer\n * to the returned values.\n * @return A function that accepts a transaction message and returns it with resource limits set to\n * the estimated values.\n *\n * @example\n * ```ts\n * import { estimateAndSetResourceLimitsFactory, estimateResourceLimitsFactory } from '@solana/kit';\n *\n * const estimator = estimateResourceLimitsFactory({ rpc });\n * const estimateAndSet = estimateAndSetResourceLimitsFactory(estimator);\n * const updatedMessage = await estimateAndSet(transactionMessage);\n * ```\n */\nexport function estimateAndSetResourceLimitsFactory(\n estimateResourceLimits: EstimateResourceLimitsFunction,\n): <TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer>(\n transactionMessage: TTransactionMessage,\n config?: EstimateResourceLimitsConfig,\n) => Promise<TTransactionMessage> {\n return async function estimateAndSetResourceLimits(transactionMessage, config) {\n const existingComputeUnitLimit = getTransactionMessageComputeUnitLimit(transactionMessage);\n const computeUnitLimitIsExplicit =\n existingComputeUnitLimit !== undefined &&\n existingComputeUnitLimit !== PROVISORY_LIMIT &&\n existingComputeUnitLimit !== MAX_COMPUTE_UNIT_LIMIT;\n\n const isV1 = transactionMessage.version === 1;\n let loadedAccountsDataSizeLimitIsExplicit = true;\n if (isV1) {\n const existingLoadedAccountsDataSizeLimit =\n getTransactionMessageLoadedAccountsDataSizeLimit(transactionMessage);\n loadedAccountsDataSizeLimitIsExplicit =\n existingLoadedAccountsDataSizeLimit !== undefined &&\n existingLoadedAccountsDataSizeLimit !== PROVISORY_LIMIT;\n }\n\n // Nothing to do — every applicable limit is already explicitly set.\n if (computeUnitLimitIsExplicit && loadedAccountsDataSizeLimitIsExplicit) {\n return transactionMessage;\n }\n\n const estimate = await estimateResourceLimits(transactionMessage, config);\n\n let result = transactionMessage;\n if (!computeUnitLimitIsExplicit) {\n result = setTransactionMessageComputeUnitLimit(estimate.computeUnitLimit, result);\n }\n if (isV1 && !loadedAccountsDataSizeLimitIsExplicit && 'loadedAccountsDataSizeLimit' in estimate) {\n result = setTransactionMessageLoadedAccountsDataSizeLimit(estimate.loadedAccountsDataSizeLimit, result);\n }\n return result;\n };\n}\n\n/**\n * Sets resource limits to a provisory value of 0 if no limit is currently set on the transaction\n * message.\n *\n * For all versions, this fills the compute unit limit. For version 1 messages, it also fills the\n * loaded accounts data size limit. If a limit is already set (any value, including 0), that limit\n * is left unchanged.\n *\n * This is useful during transaction construction to reserve space for resource limits that will\n * later be replaced with actual estimates via {@link estimateAndSetResourceLimitsFactory}.\n *\n * @param transactionMessage - The transaction message to add provisory limits to.\n * @return The transaction message with provisory resource limits set, or unchanged if all\n * applicable limits were already present.\n *\n * @example\n * ```ts\n * import { fillTransactionMessageProvisoryResourceLimits } from '@solana/kit';\n *\n * const messageWithProvisoryLimits = fillTransactionMessageProvisoryResourceLimits(transactionMessage);\n * ```\n */\nexport function fillTransactionMessageProvisoryResourceLimits<TTransactionMessage extends TransactionMessage>(\n transactionMessage: TTransactionMessage,\n): TTransactionMessage {\n let result: TTransactionMessage = transactionMessage;\n if (getTransactionMessageComputeUnitLimit(result) === undefined) {\n result = setTransactionMessageComputeUnitLimit(PROVISORY_LIMIT, result);\n }\n if (result.version === 1 && getTransactionMessageLoadedAccountsDataSizeLimit(result) === undefined) {\n result = setTransactionMessageLoadedAccountsDataSizeLimit(PROVISORY_LIMIT, result);\n }\n return result;\n}\n","import type { Signature } from '@solana/keys';\nimport type { Rpc, SendTransactionApi } from '@solana/rpc';\nimport { Commitment, commitmentComparator } from '@solana/rpc-types';\nimport {\n TransactionWithLastValidBlockHeight,\n waitForDurableNonceTransactionConfirmation,\n waitForRecentTransactionConfirmation,\n} from '@solana/transaction-confirmation';\nimport {\n getBase64EncodedWireTransaction,\n SendableTransaction,\n Transaction,\n TransactionWithDurableNonceLifetime,\n} from '@solana/transactions';\n\ninterface SendAndConfirmDurableNonceTransactionConfig\n extends SendTransactionBaseConfig, SendTransactionConfigWithoutEncoding {\n confirmDurableNonceTransaction: (\n config: Omit<\n Parameters<typeof waitForDurableNonceTransactionConfirmation>[0],\n 'getNonceInvalidationPromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) => Promise<void>;\n transaction: SendableTransaction & Transaction & TransactionWithDurableNonceLifetime;\n}\n\ninterface SendAndConfirmTransactionWithBlockhashLifetimeConfig\n extends SendTransactionBaseConfig, SendTransactionConfigWithoutEncoding {\n confirmRecentTransaction: (\n config: Omit<\n Parameters<typeof waitForRecentTransactionConfirmation>[0],\n 'getBlockHeightExceedencePromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) => Promise<void>;\n transaction: SendableTransaction & Transaction & TransactionWithLastValidBlockHeight;\n}\n\ninterface SendTransactionBaseConfig extends SendTransactionConfigWithoutEncoding {\n abortSignal?: AbortSignal;\n commitment: Commitment;\n rpc: Rpc<SendTransactionApi>;\n transaction: SendableTransaction & Transaction;\n}\n\ntype SendTransactionConfigWithoutEncoding = Omit<\n NonNullable<Parameters<SendTransactionApi['sendTransaction']>[1]>,\n 'encoding'\n>;\n\nfunction getSendTransactionConfigWithAdjustedPreflightCommitment(\n commitment: Commitment,\n config?: SendTransactionConfigWithoutEncoding,\n): SendTransactionConfigWithoutEncoding | void {\n if (\n // The developer has supplied no value for `preflightCommitment`.\n !config?.preflightCommitment &&\n // The value of `commitment` is lower than the server default of `preflightCommitment`.\n commitmentComparator(commitment, 'finalized' /* default value of `preflightCommitment` */) < 0\n ) {\n return {\n ...config,\n // In the common case, it is unlikely that you want to simulate a transaction at\n // `finalized` commitment when your standard of commitment for confirming the\n // transaction is lower. Cap the simulation commitment level to the level of the\n // confirmation commitment.\n preflightCommitment: commitment,\n };\n }\n // The commitment at which the developer wishes to confirm the transaction is at least as\n // high as the commitment at which they want to simulate it. Honour the config as-is.\n return config;\n}\n\nexport async function sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n rpc,\n transaction,\n ...sendTransactionConfig\n}: SendTransactionBaseConfig): Promise<Signature> {\n const base64EncodedWireTransaction = getBase64EncodedWireTransaction(transaction);\n return await rpc\n .sendTransaction(base64EncodedWireTransaction, {\n ...getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, sendTransactionConfig),\n encoding: 'base64',\n })\n .send({ abortSignal });\n}\n\nexport async function sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n confirmDurableNonceTransaction,\n rpc,\n transaction,\n ...sendTransactionConfig\n}: SendAndConfirmDurableNonceTransactionConfig): Promise<Signature> {\n const transactionSignature = await sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...sendTransactionConfig,\n abortSignal,\n commitment,\n rpc,\n transaction,\n });\n await confirmDurableNonceTransaction({\n abortSignal,\n commitment,\n transaction,\n });\n return transactionSignature;\n}\n\nexport async function sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT({\n abortSignal,\n commitment,\n confirmRecentTransaction,\n rpc,\n transaction,\n ...sendTransactionConfig\n}: SendAndConfirmTransactionWithBlockhashLifetimeConfig): Promise<Signature> {\n const transactionSignature = await sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...sendTransactionConfig,\n abortSignal,\n commitment,\n rpc,\n transaction,\n });\n await confirmRecentTransaction({\n abortSignal,\n commitment,\n transaction,\n });\n return transactionSignature;\n}\n","import { getSolanaErrorFromTransactionError, isSolanaError, SOLANA_ERROR__INVALID_NONCE } from '@solana/errors';\nimport { Signature } from '@solana/keys';\nimport type { GetAccountInfoApi, GetSignatureStatusesApi, Rpc, SendTransactionApi } from '@solana/rpc';\nimport type { AccountNotificationsApi, RpcSubscriptions, SignatureNotificationsApi } from '@solana/rpc-subscriptions';\nimport { commitmentComparator } from '@solana/rpc-types';\nimport {\n createNonceInvalidationPromiseFactory,\n createRecentSignatureConfirmationPromiseFactory,\n waitForDurableNonceTransactionConfirmation,\n} from '@solana/transaction-confirmation';\nimport {\n getSignatureFromTransaction,\n SendableTransaction,\n Transaction,\n TransactionWithDurableNonceLifetime,\n} from '@solana/transactions';\n\nimport { sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT } from './send-transaction-internal';\n\ntype SendAndConfirmDurableNonceTransactionFunction = (\n transaction: SendableTransaction & Transaction & TransactionWithDurableNonceLifetime,\n config: Omit<\n Parameters<typeof sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT>[0],\n 'confirmDurableNonceTransaction' | 'rpc' | 'transaction'\n >,\n) => Promise<void>;\n\ntype SendAndConfirmDurableNonceTransactionFactoryConfig<TCluster> = {\n /** An object that supports the {@link GetSignatureStatusesApi} and the {@link SendTransactionApi} of the Solana RPC API */\n rpc: Rpc<GetAccountInfoApi & GetSignatureStatusesApi & SendTransactionApi> & { '~cluster'?: TCluster };\n /** An object that supports the {@link AccountNotificationsApi} and the {@link SignatureNotificationsApi} of the Solana RPC Subscriptions API */\n rpcSubscriptions: RpcSubscriptions<AccountNotificationsApi & SignatureNotificationsApi> & { '~cluster'?: TCluster };\n};\n\n/**\n * Returns a function that you can call to send a nonce-based transaction to the network and to wait\n * until it has been confirmed.\n *\n * @param config\n *\n * @example\n * ```ts\n * import {\n * isSolanaError,\n * sendAndConfirmDurableNonceTransactionFactory,\n * SOLANA_ERROR__INVALID_NONCE,\n * SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND,\n * } from '@solana/kit';\n *\n * const sendAndConfirmNonceTransaction = sendAndConfirmDurableNonceTransactionFactory({ rpc, rpcSubscriptions });\n *\n * try {\n * await sendAndConfirmNonceTransaction(transaction, { commitment: 'confirmed' });\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND)) {\n * console.error(\n * 'The lifetime specified by this transaction refers to a nonce account ' +\n * `\\`${e.context.nonceAccountAddress}\\` that does not exist`,\n * );\n * } else if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {\n * console.error('This transaction depends on a nonce that is no longer valid');\n * } else {\n * throw e;\n * }\n * }\n * ```\n */\nexport function sendAndConfirmDurableNonceTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<'devnet'>): SendAndConfirmDurableNonceTransactionFunction;\nexport function sendAndConfirmDurableNonceTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<'testnet'>): SendAndConfirmDurableNonceTransactionFunction;\nexport function sendAndConfirmDurableNonceTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<'mainnet'>): SendAndConfirmDurableNonceTransactionFunction;\nexport function sendAndConfirmDurableNonceTransactionFactory<\n TCluster extends 'devnet' | 'mainnet' | 'testnet' | void = void,\n>({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmDurableNonceTransactionFactoryConfig<TCluster>): SendAndConfirmDurableNonceTransactionFunction {\n const getNonceInvalidationPromise = createNonceInvalidationPromiseFactory({ rpc, rpcSubscriptions } as Parameters<\n typeof createNonceInvalidationPromiseFactory\n >[0]);\n const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createRecentSignatureConfirmationPromiseFactory>[0]);\n\n /**\n * Creates a wrapped version of getNonceInvalidationPromise that handles the race condition\n * where the nonce account update notification arrives before the signature confirmation.\n *\n * When the nonce changes, we check if our transaction actually landed on-chain.\n * If it did, we don't throw - letting the signature confirmation promise continue.\n */\n function createNonceInvalidationPromiseHandlingRaceCondition(\n signature: Signature,\n ): typeof getNonceInvalidationPromise {\n return async function wrappedGetNonceInvalidationPromise(config) {\n try {\n return await getNonceInvalidationPromise(config);\n } catch (e) {\n // If nonce became invalid, check if our transaction actually landed\n if (isSolanaError(e, SOLANA_ERROR__INVALID_NONCE)) {\n let status;\n try {\n const { value: statuses } = await rpc\n .getSignatureStatuses([signature])\n .send({ abortSignal: config.abortSignal });\n status = statuses[0];\n } catch {\n // RPC failed - propagate the original nonce error\n throw e;\n }\n\n if (status === null || status === undefined) {\n // Transaction doesn't exist - nonce was truly invalid\n throw e;\n }\n\n // Check if status meets required commitment\n if (\n status.confirmationStatus !== null &&\n commitmentComparator(status.confirmationStatus, config.commitment) >= 0\n ) {\n // Transaction failed on-chain, throw the error from the transaction\n if (status.err !== null) {\n throw getSolanaErrorFromTransactionError(status.err);\n }\n // Transaction succeeded, resolve the promise successfully\n return;\n }\n\n // Commitment not met yet - return a never-resolving promise\n // This lets the signature confirmation promise continue\n return await new Promise(() => {});\n }\n throw e;\n }\n };\n }\n\n async function confirmDurableNonceTransaction(\n config: Omit<\n Parameters<typeof waitForDurableNonceTransactionConfirmation>[0],\n 'getNonceInvalidationPromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) {\n const wrappedGetNonceInvalidationPromise = createNonceInvalidationPromiseHandlingRaceCondition(\n getSignatureFromTransaction(config.transaction),\n );\n\n await waitForDurableNonceTransactionConfirmation({\n ...config,\n getNonceInvalidationPromise: wrappedGetNonceInvalidationPromise,\n getRecentSignatureConfirmationPromise,\n });\n }\n return async function sendAndConfirmDurableNonceTransaction(transaction, config) {\n await sendAndConfirmDurableNonceTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n confirmDurableNonceTransaction,\n rpc,\n transaction,\n });\n };\n}\n","import type { GetEpochInfoApi, GetSignatureStatusesApi, Rpc, SendTransactionApi } from '@solana/rpc';\nimport type { RpcSubscriptions, SignatureNotificationsApi, SlotNotificationsApi } from '@solana/rpc-subscriptions';\nimport {\n createBlockHeightExceedencePromiseFactory,\n createRecentSignatureConfirmationPromiseFactory,\n TransactionWithLastValidBlockHeight,\n waitForRecentTransactionConfirmation,\n} from '@solana/transaction-confirmation';\nimport { SendableTransaction, Transaction } from '@solana/transactions';\n\nimport { sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT } from './send-transaction-internal';\n\ntype SendAndConfirmTransactionWithBlockhashLifetimeFunction = (\n transaction: SendableTransaction & Transaction & TransactionWithLastValidBlockHeight,\n config: Omit<\n Parameters<typeof sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT>[0],\n 'confirmRecentTransaction' | 'rpc' | 'transaction'\n >,\n) => Promise<void>;\n\ntype SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<TCluster> = {\n /** An object that supports the {@link GetSignatureStatusesApi} and the {@link SendTransactionApi} of the Solana RPC API */\n rpc: Rpc<GetEpochInfoApi & GetSignatureStatusesApi & SendTransactionApi> & { '~cluster'?: TCluster };\n /** An object that supports the {@link SignatureNotificationsApi} and the {@link SlotNotificationsApi} of the Solana RPC Subscriptions API */\n rpcSubscriptions: RpcSubscriptions<SignatureNotificationsApi & SlotNotificationsApi> & { '~cluster'?: TCluster };\n};\n\n/**\n * Returns a function that you can call to send a blockhash-based transaction to the network and to\n * wait until it has been confirmed.\n *\n * @param config\n *\n * @example\n * ```ts\n * import { isSolanaError, sendAndConfirmTransactionFactory, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED } from '@solana/kit';\n *\n * const sendAndConfirmTransaction = sendAndConfirmTransactionFactory({ rpc, rpcSubscriptions });\n *\n * try {\n * await sendAndConfirmTransaction(transaction, { commitment: 'confirmed' });\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED)) {\n * console.error('This transaction depends on a blockhash that has expired');\n * } else {\n * throw e;\n * }\n * }\n * ```\n */\nexport function sendAndConfirmTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<'devnet'>): SendAndConfirmTransactionWithBlockhashLifetimeFunction;\nexport function sendAndConfirmTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<'testnet'>): SendAndConfirmTransactionWithBlockhashLifetimeFunction;\nexport function sendAndConfirmTransactionFactory({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<'mainnet'>): SendAndConfirmTransactionWithBlockhashLifetimeFunction;\nexport function sendAndConfirmTransactionFactory<TCluster extends 'devnet' | 'mainnet' | 'testnet' | void = void>({\n rpc,\n rpcSubscriptions,\n}: SendAndConfirmTransactionWithBlockhashLifetimeFactoryConfig<TCluster>): SendAndConfirmTransactionWithBlockhashLifetimeFunction {\n const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createBlockHeightExceedencePromiseFactory>[0]);\n const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory({\n rpc,\n rpcSubscriptions,\n } as Parameters<typeof createRecentSignatureConfirmationPromiseFactory>[0]);\n async function confirmRecentTransaction(\n config: Omit<\n Parameters<typeof waitForRecentTransactionConfirmation>[0],\n 'getBlockHeightExceedencePromise' | 'getRecentSignatureConfirmationPromise'\n >,\n ) {\n await waitForRecentTransactionConfirmation({\n ...config,\n getBlockHeightExceedencePromise,\n getRecentSignatureConfirmationPromise,\n });\n }\n return async function sendAndConfirmTransaction(transaction, config) {\n await sendAndConfirmTransactionWithBlockhashLifetime_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n confirmRecentTransaction,\n rpc,\n transaction,\n });\n };\n}\n","import type { Rpc, SendTransactionApi } from '@solana/rpc';\nimport { SendableTransaction, Transaction } from '@solana/transactions';\n\nimport { sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT } from './send-transaction-internal';\n\ntype SendTransactionWithoutConfirmingFunction = (\n transaction: SendableTransaction & Transaction,\n config: Omit<Parameters<typeof sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT>[0], 'rpc' | 'transaction'>,\n) => Promise<void>;\n\ninterface SendTransactionWithoutConfirmingFactoryConfig {\n /** An object that supports the {@link SendTransactionApi} of the Solana RPC API */\n rpc: Rpc<SendTransactionApi>;\n}\n\n/**\n * Returns a function that you can call to send a transaction with any kind of lifetime to the\n * network without waiting for it to be confirmed.\n *\n * @param config\n *\n * @example\n * ```ts\n * import {\n * sendTransactionWithoutConfirmingFactory,\n * SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE,\n * } from '@solana/kit';\n *\n * const sendTransaction = sendTransactionWithoutConfirmingFactory({ rpc });\n *\n * try {\n * await sendTransaction(transaction, { commitment: 'confirmed' });\n * } catch (e) {\n * if (isSolanaError(e, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE)) {\n * console.error('The transaction failed in simulation', e.cause);\n * } else {\n * throw e;\n * }\n * }\n * ```\n */\nexport function sendTransactionWithoutConfirmingFactory({\n rpc,\n}: SendTransactionWithoutConfirmingFactoryConfig): SendTransactionWithoutConfirmingFunction {\n return async function sendTransactionWithoutConfirming(transaction, config) {\n await sendTransaction_INTERNAL_ONLY_DO_NOT_EXPORT({\n ...config,\n rpc,\n transaction,\n });\n };\n}\n"]}
|
|
@@ -10433,7 +10433,7 @@ ${lastLines.map((line) => ` > ${line}
|
|
|
10433
10433
|
...config.headers ? normalizeHeaders2(config.headers) : void 0,
|
|
10434
10434
|
...{
|
|
10435
10435
|
// Keep these headers lowercase so they will override any user-supplied headers above.
|
|
10436
|
-
"solana-client": `js/${"7.0.0
|
|
10436
|
+
"solana-client": `js/${"7.0.0"}`
|
|
10437
10437
|
}
|
|
10438
10438
|
}
|
|
10439
10439
|
}),
|