@usearete/sdk 0.25.0 → 0.26.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.d.ts CHANGED
@@ -751,15 +751,15 @@ declare function createInstructionHandler<TParams = Record<string, unknown>, TEr
751
751
  */
752
752
  interface BuildOptions {
753
753
  /** Wallet, used only for accounts explicitly marked with signerKind: 'wallet'. */
754
- wallet?: WalletAdapter;
754
+ wallet?: WalletAdapter | undefined;
755
755
  /** Explicit account-address overrides, including signer slots when needed. */
756
- accounts?: Record<string, string>;
756
+ accounts?: Record<string, string> | undefined;
757
757
  /**
758
758
  * Extra account metas appended after the instruction's declared accounts
759
759
  * (Anchor's `remainingAccounts`) — for routers, transfer hooks, and other
760
760
  * composition patterns the IDL cannot express.
761
761
  */
762
- remainingAccounts?: BuiltAccountMeta[];
762
+ remainingAccounts?: BuiltAccountMeta[] | undefined;
763
763
  }
764
764
  /**
765
765
  * Options for executing (building + sending) an instruction.
@@ -1163,6 +1163,14 @@ interface WatchOptions<TSchema = unknown> {
1163
1163
  /** Maximum number of entities to include in snapshot */
1164
1164
  snapshotLimit?: number;
1165
1165
  }
1166
+ /** Options for the one-shot reads `get` and `getOne`. */
1167
+ interface GetOptions extends WatchOptions {
1168
+ /**
1169
+ * How long to wait for the initial snapshot before rejecting with
1170
+ * `InitialDataTimeoutError` (defaults to 5000). `null` waits forever.
1171
+ */
1172
+ timeoutMs?: number | null;
1173
+ }
1166
1174
  interface AreteOptions<TStack extends StackDefinition> {
1167
1175
  stack: TStack;
1168
1176
  /** Connect immediately when the client is created (defaults to true). */
@@ -1328,14 +1336,32 @@ interface TypedStateView<T, TKey = string> {
1328
1336
  use<TSchema = T>(key: TKey, options?: WatchOptions<TSchema>): AsyncIterable<TSchema>;
1329
1337
  watch(key: TKey, options?: WatchOptions): AsyncIterable<Update<T>>;
1330
1338
  watchRich(key: TKey, options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
1331
- get(key: TKey, options?: WatchOptions): Promise<T | null>;
1339
+ /**
1340
+ * Open (or reuse) the equivalent subscription, wait for its initial
1341
+ * snapshot, and release it. Resolves `null` when the entity is absent.
1342
+ */
1343
+ get(key: TKey, options?: GetOptions): Promise<T | null>;
1344
+ /**
1345
+ * Read an already active equivalent subscription without waiting;
1346
+ * `undefined` when none is active (absent is not the same as empty).
1347
+ */
1332
1348
  getSync(key: TKey, options?: WatchOptions): T | null | undefined;
1333
1349
  }
1334
1350
  interface TypedListView<T> {
1335
1351
  use<TSchema = T>(options?: WatchOptions<TSchema>): AsyncIterable<TSchema>;
1336
1352
  watch(options?: WatchOptions): AsyncIterable<Update<T>>;
1337
1353
  watchRich(options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
1338
- get(options?: WatchOptions): Promise<T[]>;
1354
+ /**
1355
+ * Open (or reuse) the equivalent subscription, wait for its initial
1356
+ * snapshot, and release it.
1357
+ */
1358
+ get(options?: GetOptions): Promise<T[]>;
1359
+ /** Like `get` with `take: 1`: the first item, or `null` when the list is empty. */
1360
+ getOne(options?: Omit<GetOptions, 'take'>): Promise<T | null>;
1361
+ /**
1362
+ * Read an already active equivalent subscription without waiting;
1363
+ * `undefined` when none is active (absent is not the same as empty).
1364
+ */
1339
1365
  getSync(options?: WatchOptions): T[] | undefined;
1340
1366
  }
1341
1367
  type SubscribeCallback<T> = (update: Update<T>) => void;
@@ -1812,6 +1838,8 @@ declare class SubscriptionRegistry {
1812
1838
  private readonly queryStore;
1813
1839
  private readonly subscriptions;
1814
1840
  private readonly subscriptionsById;
1841
+ private readonly failureListeners;
1842
+ private connectionError;
1815
1843
  constructor(connection: ConnectionManager, queryStore: QueryStore);
1816
1844
  subscribe(query: SubscriptionQuery, snapshotEnabled?: boolean): QueryLease;
1817
1845
  refresh(query: SubscriptionQuery, snapshotEnabled?: boolean): Promise<void>;
@@ -1824,8 +1852,16 @@ declare class SubscriptionRegistry {
1824
1852
  getRefCount(query: SubscriptionQuery, snapshotEnabled?: boolean): number;
1825
1853
  getActiveSubscriptions(): Subscription[];
1826
1854
  getSnapshot<T>(query: SubscriptionQuery, snapshotEnabled?: boolean): QuerySnapshot<T> | undefined;
1827
- handleConnectionState(state: ConnectionState): void;
1855
+ handleConnectionState(state: ConnectionState, message?: string): void;
1856
+ /** The terminal connection failure while the connection is in the `error` state. */
1857
+ getConnectionError(): AreteError | undefined;
1858
+ /**
1859
+ * Called when pending queries can no longer resolve: the connection failed
1860
+ * terminally, or a disconnect cleared every subscription.
1861
+ */
1862
+ onFailure(callback: (error: AreteError) => void): UnsubscribeFn;
1828
1863
  clear(): void;
1864
+ private notifyFailure;
1829
1865
  private createLease;
1830
1866
  private getTracker;
1831
1867
  private refreshTracker;
@@ -1984,18 +2020,18 @@ interface CreatePreparedInstructionInput<TArtifacts> {
1984
2020
  name: string;
1985
2021
  instruction: BuiltInstruction;
1986
2022
  artifacts: TArtifacts;
1987
- requiredSignerAddresses?: readonly string[];
1988
- signers?: readonly unknown[];
1989
- errors?: readonly ErrorMetadata[];
2023
+ requiredSignerAddresses?: readonly string[] | undefined;
2024
+ signers?: readonly unknown[] | undefined;
2025
+ errors?: readonly ErrorMetadata[] | undefined;
1990
2026
  }
1991
2027
  type PreparedTransactionInstruction = BuiltInstruction | PreparedInstruction<unknown>;
1992
2028
  type PreparedTransactionOperation = PreparedInstruction<unknown> | PreparedTransaction<unknown>;
1993
2029
  interface CreatePreparedTransactionBaseInput<TArtifacts> {
1994
2030
  name: string;
1995
2031
  artifacts: TArtifacts;
1996
- requiredSignerAddresses?: readonly string[];
1997
- signers?: readonly unknown[];
1998
- errors?: readonly ErrorMetadata[];
2032
+ requiredSignerAddresses?: readonly string[] | undefined;
2033
+ signers?: readonly unknown[] | undefined;
2034
+ errors?: readonly ErrorMetadata[] | undefined;
1999
2035
  }
2000
2036
  type CreatePreparedTransactionInput<TArtifacts> = CreatePreparedTransactionBaseInput<TArtifacts> & ({
2001
2037
  instructions: readonly PreparedTransactionInstruction[];
@@ -2012,9 +2048,9 @@ interface CreatePreparedFlowInput<TArtifacts> {
2012
2048
  declare function createPreparedTransactionBody(input: {
2013
2049
  name: string;
2014
2050
  instructions: readonly BuiltInstruction[];
2015
- requiredSignerAddresses?: readonly string[];
2016
- signers?: readonly unknown[];
2017
- errors?: readonly ErrorMetadata[];
2051
+ requiredSignerAddresses?: readonly string[] | undefined;
2052
+ signers?: readonly unknown[] | undefined;
2053
+ errors?: readonly ErrorMetadata[] | undefined;
2018
2054
  }): PreparedTransactionBody;
2019
2055
  declare function createPreparedInstruction<TArtifacts>(input: CreatePreparedInstructionInput<TArtifacts>): PreparedInstruction<TArtifacts>;
2020
2056
  declare function createPreparedTransaction<TArtifacts>(input: CreatePreparedTransactionInput<TArtifacts>): PreparedTransaction<TArtifacts>;
@@ -2200,6 +2236,13 @@ type MaybeField<TKey extends string, TValue> = [TValue] extends [never] ? {} : {
2200
2236
  readonly [K in TKey]: TValue;
2201
2237
  };
2202
2238
  type Field<TValue, TKey extends PropertyKey> = TKey extends keyof TValue ? TValue[TKey] : never;
2239
+ /**
2240
+ * A field an extension provides. The helpers skip an extension value that is
2241
+ * `undefined`, so an optional field is never `undefined` on the result either
2242
+ * (which `exactOptionalPropertyTypes` would reject where the result is used as
2243
+ * a `ProgramSdkDefinition`).
2244
+ */
2245
+ type ExtensionField<TValue, TKey extends PropertyKey> = Exclude<Field<TValue, TKey>, undefined>;
2203
2246
  type DeepMerge<TBase, TExtension> = TBase extends Record<string, unknown> ? TExtension extends Record<string, unknown> ? Omit<TBase, keyof TExtension> & {
2204
2247
  readonly [K in keyof TExtension]: K extends keyof TBase ? DeepMerge<TBase[K], TExtension[K]> : TExtension[K];
2205
2248
  } : TExtension : TExtension;
@@ -2251,7 +2294,7 @@ type DefinedProgramExtensions<TBase extends ProgramSdkDefinition, TAddresses, TC
2251
2294
  readonly createRead?: (context: ProgramOperationContext<ExtendedProgramDefinition<TBase, TAddresses, TConstants, TDefaults, ProgramOperations, TMath, never>>) => TRead;
2252
2295
  };
2253
2296
  declare function defineProgramExtensions<TBase extends ProgramSdkDefinition>(): <TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never, TRead = never>(extensions: DefinedProgramExtensions<TBase, TAddresses, TConstants, TDefaults, TOperations, TMath, TRead>) => DefinedProgramExtensions<TBase, TAddresses, TConstants, TDefaults, TOperations, TMath, TRead>;
2254
- declare function extendProgram<TBase extends ProgramSdkDefinition, TExtension extends ProgramExtensionInput<any, any, any, any, any, any, any>>(program: TBase, extensions: TExtension): ExtendedProgramDefinition<TBase, MergeField<Field<TBase, 'addresses'>, Field<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, Field<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, Field<TExtension, 'defaults'>>, Extract<FactoryReturn<TExtension, 'createOperations'>, AnyProgramOperations>, MergeField<Field<TBase, 'math'>, Field<TExtension, 'math'>>, FactoryReturn<TExtension, 'createRead'>>;
2297
+ declare function extendProgram<TBase extends ProgramSdkDefinition, TExtension extends ProgramExtensionInput<any, any, any, any, any, any, any>>(program: TBase, extensions: TExtension): ExtendedProgramDefinition<TBase, MergeField<Field<TBase, 'addresses'>, ExtensionField<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, ExtensionField<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, ExtensionField<TExtension, 'defaults'>>, Extract<FactoryReturn<TExtension, 'createOperations'>, AnyProgramOperations>, MergeField<Field<TBase, 'math'>, ExtensionField<TExtension, 'math'>>, FactoryReturn<TExtension, 'createRead'>>;
2255
2298
  declare function extendPrograms<TPrograms extends Record<string, ProgramSdkDefinition>, TExtensions extends Partial<{
2256
2299
  [K in keyof TPrograms]: ProgramExtensionInput<any, any, any, any, any, any, any>;
2257
2300
  }>>(programs: TPrograms, extensions: TExtensions): {
@@ -2290,7 +2333,7 @@ declare function defineStackExtensions<TBase extends StackDefinition>(): <const
2290
2333
  readonly createRead?: (client: StackExtensionClient<TBase, any, any, any, any>) => unknown;
2291
2334
  readonly createFlows?: (client: StackExtensionClient<TBase, any, any, any, any>) => FlowOperationNamespace | EmptyRecord;
2292
2335
  }) => TExtension;
2293
- declare function extendStack<TBase extends StackDefinition, TExtension extends StackExtensionInput<any, any, any, any, any, any, any>>(stack: TBase, extensions: TExtension & ReadArgumentCountRequirement<TExtension>): ExtendedStackDefinition<TBase, MergeField<Field<TBase, 'addresses'>, Field<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, Field<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, Field<TExtension, 'defaults'>>, MergeField<Field<TBase, 'math'>, Field<TExtension, 'math'>>, MergeField<StackReadOf<TBase>, FactoryReturn<TExtension, 'createRead'>>, Extract<MergeField<StackFlowsOf<TBase>, FactoryReturn<TExtension, 'createFlows'>>, FlowOperationNamespace | EmptyRecord>>;
2336
+ declare function extendStack<TBase extends StackDefinition, TExtension extends StackExtensionInput<any, any, any, any, any, any, any>>(stack: TBase, extensions: TExtension & ReadArgumentCountRequirement<TExtension>): ExtendedStackDefinition<TBase, MergeField<Field<TBase, 'addresses'>, ExtensionField<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, ExtensionField<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, ExtensionField<TExtension, 'defaults'>>, MergeField<Field<TBase, 'math'>, ExtensionField<TExtension, 'math'>>, MergeField<StackReadOf<TBase>, FactoryReturn<TExtension, 'createRead'>>, Extract<MergeField<StackFlowsOf<TBase>, FactoryReturn<TExtension, 'createFlows'>>, FlowOperationNamespace | EmptyRecord>>;
2294
2337
  declare function getStackRuntimeExtensions<TStack extends StackDefinition>(stack: TStack): StackRuntimeExtensions<StackReadOf<TStack>> | undefined;
2295
2338
  declare function applyConnectedStackExtensions<TClient extends object, TStack extends StackDefinition>(client: TClient, stack: TStack): ConnectedStackClient<TClient, TStack>;
2296
2339
 
@@ -2773,7 +2816,8 @@ type AmountInput = bigint | {
2773
2816
  interface AmountResolutionInput {
2774
2817
  mint: string;
2775
2818
  amount: AmountInput;
2776
- decimals?: number;
2819
+ /** The mint's decimals; read from the mint when absent. */
2820
+ decimals?: number | undefined;
2777
2821
  }
2778
2822
  /** Convert a UI amount ("1.5") to raw base units using string math (no float precision loss). */
2779
2823
  declare function parseUiAmountToRaw(value: string | number, decimals: number): bigint;
@@ -2903,6 +2947,18 @@ declare function createUpdateStream<T>(_storage: StorageAdapter, subscriptionReg
2903
2947
  declare function createEntityStream<T>(_storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, query: SubscriptionQuery, options?: WatchOptions<any>, keyFilter?: string): AsyncIterable<T>;
2904
2948
  declare function createRichUpdateStream<T>(_storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, query: SubscriptionQuery, keyFilter?: string, snapshotEnabled?: boolean): AsyncIterable<RichUpdate<T>>;
2905
2949
 
2950
+ /** How long `get` and `getOne` wait for an initial snapshot, as in the Rust and Python SDKs. */
2951
+ declare const DEFAULT_INITIAL_DATA_TIMEOUT_MS = 5000;
2952
+ /**
2953
+ * `get` or `getOne` gave up waiting for the initial snapshot: the socket never
2954
+ * delivered it (no connection, a reconnect storm, a server that never
2955
+ * answers). The read's subscription is released before this is thrown.
2956
+ */
2957
+ declare class InitialDataTimeoutError extends AreteError {
2958
+ readonly view: string;
2959
+ readonly timeoutMs: number;
2960
+ constructor(view: string, timeoutMs: number);
2961
+ }
2906
2962
  declare function serializeViewKey<TKey>(viewDef: ViewDef<unknown, 'state', TKey>, key: TKey): string;
2907
2963
  declare function createTypedStateView<T, TKey = unknown>(viewDef: ViewDef<T, 'state', TKey>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedStateView<T, DefaultViewKey<TKey>>;
2908
2964
  declare function createTypedListView<T>(viewDef: ViewDef<T, 'list'>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedListView<T>;
@@ -2912,5 +2968,5 @@ declare const Arete: typeof Arete$1 & {
2912
2968
  session: typeof createSession;
2913
2969
  };
2914
2970
 
2915
- export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, EXTENSION_API_VERSION, FrameProcessor, InstructionError, MemoryAdapter, OPERATION_KIND, OperationCallbackError, OperationExecutionError, PROGRAM_KEY_CONFLICT, PROGRAM_OPERATION_EXTENSIONS, ProcessedSlotTimeoutError, QueryStore, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, StreamGapError, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, TRANSACTION_RESOURCE_OPTION_KEYS, TransactionExecutionError, TransactionOptionsError, TransactionTransportError, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, canonicalQueryKey, chainAccountLoader, compareProgramIdentity, createChainClient, createEntityStream, createHostedSolanaGatewayTransports, createInstructionExecutor, createInstructionHandler, createPreparedFlow, createPreparedInstruction, createPreparedTransaction, createPreparedTransactionBody, createProgramPdas, createPublicKeySeed, createRichUpdateStream, createSeed, createSession, createSignerRegistry, createSubscriptionId, createTransactionTransport, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, decodeBase58, defineProgramExtensions, defineStackExtensions, deriveAssociatedTokenAccount, deriveHttpEndpoint, findProgramAddress as derivePda, describePreparedOperation, encodeBase58, executeInstruction, executePreparedOperation, extendProgram, extendPrograms, extendStack, findProgramAddress, findProgramAddressSync, flowOperation, formatPreparedOperation, formatProgramError, formatRawToUi, getMintDecimals, getOperationKind, getProgramRuntimeExtensions, getStackRuntimeExtensions, getTransactionFailureOutcome, hostedWebsocketSuffixes, inspectPreparedOperation, instructionOperation, isEntityFrame, isErrorFrame, isHostedAreteEndpoint, isReplayErrorCode, isSameProgramSdk, isSnapshotFrame, isStackVersionRefusalCode, isSubscribedFrame, isUnsubscribedFrame, isValidFrame, literal, normalizeSubscription, normalizeSubscriptionQuery, normalizeSubscriptionRequest, normalizeTransactionError, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, resolveTransactionBuildOptions, safeToRawAmount, serializeInstructionData, serializeViewKey, setHostedWebsocketSuffixes, stackQuery, stringifyBigints, toJsonValue, toRawAmount, toWireResourceOptions, transactionOperation, unwrapOperationExecutionError, validateAccountResolution, validateProgramReadDescriptor, validateSubscriptionId, withProgramIdentity, withProgramRead, withPrograms };
2916
- export type { AccountCategory, AccountLoader, AccountMeta, AccountResolutionOptions, AccountResolutionResult, AmountInput, AnyOperation, AreteConfig, AreteOptions, AreteOptionsWithStorage, ArgSchema, ArgType, AuthConfig, AuthTokenRequest, AuthTokenResult, AuthTokenTarget, BuildOptions, BuiltAccountMeta, BuiltInstruction, ChainClient, ChainClock, ChainFailedTransactionOutcome, CompositionSessionOptions, ConfirmationLevel, ConfirmedTransactionOutcome, ConnectOptions, ConnectedArete, ConnectedStackClient, ConnectionState, ConnectionStateCallback, ContextSlotOptions, CreatePreparedFlowInput, CreatePreparedInstructionInput, CreatePreparedTransactionInput, DefaultViewKey, EntityFrame, ErrorFrame, ErrorMetadata, ExecuteOptions, ExecutionResult, ExtendedProgramDefinition, ExtendedStackDefinition, FlowOperation, FlowOperationNamespace, FlowOperationReceipt, Frame, FrameMode, FrameOp, FrameProcessorConfig, FrameValidationDiagnostic, HostedSolanaGatewayBindings, HostedSolanaGatewayCapabilityBinding, HostedSolanaGatewayTransportOptions, HostedSolanaGatewayTransports, HttpAuthMetadata, InstructionExecutor, InstructionHandler, InstructionHandlerConfig, InstructionOperation, InstructionOperationNamespace, JsonObject, JsonPrimitive, JsonValue, LatestBlockhashResult, MergeProgramMaps, MintAccountInfo, NativeBalanceInfo, NonEmptyReadonlyArray, NotSubmittedTransactionOutcome, OperationCallbackPhase, OperationExecutionEvent, OperationExecutionHost, OperationExecutionOptions, OperationExecutionSuccessEvent, OperationInspection, OperationInspectionOptions, OperationKind, OperationKindBrand, OperationNamespace, OperationPlan, OperationReceiptFor, OperationTransactionReceipt, PdaConfig, PdaDeriveContext, PdaFactory, PdaProgram, PdaProgramSelector, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountBatchItem, ProgramAccountBatchResult, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramIdentityMatch, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramReadBinding, ProgramReadBindingAuthTarget, ProgramReadDescriptor, ProgramReadDescriptors, ProgramReadOf, ProgramReadOverride, ProgramReadOverrides, ProgramReadRequest, ProgramReadTransport, ProgramReleaseReference, ProgramRuntimeExtensionCarrier, ProgramRuntimeExtensions, ProgramSdkDefinition, ProgramSdkIdentity, ProgramsInterface, QueriesInterface, QueryLease, QuerySnapshot, RawAccountInfo, RawInstructionsInterface, RawProgramsInterface, ReadArgumentCount, ReadArgumentCounts, ReadTransportMethod, ReplayErrorCode, ReplayWindow, ResolvedAccount, ResolvedAccounts, ResolvedTransactionBuildOptions, ResolvedTransactionResourceOptions, ResourceLamports, ResourceUnits, RichUpdate, RichUpdateCallback, Schema, SchemaResult, SeedDef, SendOptions, SendResult, Session, SessionDefinition, SessionMemberOptions, SessionOptions, SignerRegistry, SingleTransactionOperationReceipt, SnapshotEntity, SnapshotFrame, SocketIssue, SocketIssueCallback, SolanaGatewayAuthMetadata, SolanaGatewayAuthScope, SolanaGatewayBindingAuthTarget, SortConfig, SortOrder, StackConnectedExtensions, StackDefinition, StackEndpoints, StackExtensionClient, StackExtensionInput, StackQueryDefinition, StackRelease, StackRuntimeExtensionCarrier, StackRuntimeExtensions, StackVersionRefusal, StackWithAttachedPrograms, StorageAdapter, StorageAdapterConfig, StringifiedBigints, SubmittedUnknownTransactionOutcome, SubscribeCallback, SubscribedFrame, Subscription, SubscriptionIdentity, SubscriptionOptions, SubscriptionQuery, SubscriptionRequest, SubscriptionSnapshotOptions, TokenAccountInfo, TokenBalanceInfo, TokenBalanceInput, TransactionBuildCapability, TransactionBuildOptions, TransactionCommitment, TransactionFailureOutcome, TransactionFailurePhase, TransactionFailureStatus, TransactionFeeResult, TransactionInspectionOptions, TransactionInspectionResult, TransactionOperation, TransactionOperationNamespace, TransactionOptions, TransactionOptionsErrorCode, TransactionOutcome, TransactionRequestContext, TransactionResourceOptionKey, TransactionResourceOptions, TransactionSendOptions, TransactionSendResult, TransactionSignatureStatus, TransactionSimulationOptions, TransactionSimulationResult, TransactionTransport, TransactionTransportErrorBody, TransactionVersion, TypedAccountReader, TypedInstruction, TypedListView, TypedQueryExecutor, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, UnsubscribedFrame, Update, UpdateCallback, ViewDef, ViewGroup, ViewKeyFields, ViewKeyValue, ViewSortConfig, WaitForProcessedSlotOptions, WalletAdapter, WalletConnectOptions, WalletExecutionContext, WalletState, WatchOptions, WebSocketFactoryInit };
2971
+ export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_INITIAL_DATA_TIMEOUT_MS, DEFAULT_MAX_ENTRIES_PER_VIEW, EXTENSION_API_VERSION, FrameProcessor, InitialDataTimeoutError, InstructionError, MemoryAdapter, OPERATION_KIND, OperationCallbackError, OperationExecutionError, PROGRAM_KEY_CONFLICT, PROGRAM_OPERATION_EXTENSIONS, ProcessedSlotTimeoutError, QueryStore, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, StreamGapError, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, TRANSACTION_RESOURCE_OPTION_KEYS, TransactionExecutionError, TransactionOptionsError, TransactionTransportError, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, canonicalQueryKey, chainAccountLoader, compareProgramIdentity, createChainClient, createEntityStream, createHostedSolanaGatewayTransports, createInstructionExecutor, createInstructionHandler, createPreparedFlow, createPreparedInstruction, createPreparedTransaction, createPreparedTransactionBody, createProgramPdas, createPublicKeySeed, createRichUpdateStream, createSeed, createSession, createSignerRegistry, createSubscriptionId, createTransactionTransport, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, decodeBase58, defineProgramExtensions, defineStackExtensions, deriveAssociatedTokenAccount, deriveHttpEndpoint, findProgramAddress as derivePda, describePreparedOperation, encodeBase58, executeInstruction, executePreparedOperation, extendProgram, extendPrograms, extendStack, findProgramAddress, findProgramAddressSync, flowOperation, formatPreparedOperation, formatProgramError, formatRawToUi, getMintDecimals, getOperationKind, getProgramRuntimeExtensions, getStackRuntimeExtensions, getTransactionFailureOutcome, hostedWebsocketSuffixes, inspectPreparedOperation, instructionOperation, isEntityFrame, isErrorFrame, isHostedAreteEndpoint, isReplayErrorCode, isSameProgramSdk, isSnapshotFrame, isStackVersionRefusalCode, isSubscribedFrame, isUnsubscribedFrame, isValidFrame, literal, normalizeSubscription, normalizeSubscriptionQuery, normalizeSubscriptionRequest, normalizeTransactionError, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, resolveTransactionBuildOptions, safeToRawAmount, serializeInstructionData, serializeViewKey, setHostedWebsocketSuffixes, stackQuery, stringifyBigints, toJsonValue, toRawAmount, toWireResourceOptions, transactionOperation, unwrapOperationExecutionError, validateAccountResolution, validateProgramReadDescriptor, validateSubscriptionId, withProgramIdentity, withProgramRead, withPrograms };
2972
+ export type { AccountCategory, AccountLoader, AccountMeta, AccountResolutionOptions, AccountResolutionResult, AmountInput, AnyOperation, AreteConfig, AreteOptions, AreteOptionsWithStorage, ArgSchema, ArgType, AuthConfig, AuthTokenRequest, AuthTokenResult, AuthTokenTarget, BuildOptions, BuiltAccountMeta, BuiltInstruction, ChainClient, ChainClock, ChainFailedTransactionOutcome, CompositionSessionOptions, ConfirmationLevel, ConfirmedTransactionOutcome, ConnectOptions, ConnectedArete, ConnectedStackClient, ConnectionState, ConnectionStateCallback, ContextSlotOptions, CreatePreparedFlowInput, CreatePreparedInstructionInput, CreatePreparedTransactionInput, DefaultViewKey, EntityFrame, ErrorFrame, ErrorMetadata, ExecuteOptions, ExecutionResult, ExtendedProgramDefinition, ExtendedStackDefinition, FlowOperation, FlowOperationNamespace, FlowOperationReceipt, Frame, FrameMode, FrameOp, FrameProcessorConfig, FrameValidationDiagnostic, GetOptions, HostedSolanaGatewayBindings, HostedSolanaGatewayCapabilityBinding, HostedSolanaGatewayTransportOptions, HostedSolanaGatewayTransports, HttpAuthMetadata, InstructionExecutor, InstructionHandler, InstructionHandlerConfig, InstructionOperation, InstructionOperationNamespace, JsonObject, JsonPrimitive, JsonValue, LatestBlockhashResult, MergeProgramMaps, MintAccountInfo, NativeBalanceInfo, NonEmptyReadonlyArray, NotSubmittedTransactionOutcome, OperationCallbackPhase, OperationExecutionEvent, OperationExecutionHost, OperationExecutionOptions, OperationExecutionSuccessEvent, OperationInspection, OperationInspectionOptions, OperationKind, OperationKindBrand, OperationNamespace, OperationPlan, OperationReceiptFor, OperationTransactionReceipt, PdaConfig, PdaDeriveContext, PdaFactory, PdaProgram, PdaProgramSelector, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountBatchItem, ProgramAccountBatchResult, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramIdentityMatch, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramReadBinding, ProgramReadBindingAuthTarget, ProgramReadDescriptor, ProgramReadDescriptors, ProgramReadOf, ProgramReadOverride, ProgramReadOverrides, ProgramReadRequest, ProgramReadTransport, ProgramReleaseReference, ProgramRuntimeExtensionCarrier, ProgramRuntimeExtensions, ProgramSdkDefinition, ProgramSdkIdentity, ProgramsInterface, QueriesInterface, QueryLease, QuerySnapshot, RawAccountInfo, RawInstructionsInterface, RawProgramsInterface, ReadArgumentCount, ReadArgumentCounts, ReadTransportMethod, ReplayErrorCode, ReplayWindow, ResolvedAccount, ResolvedAccounts, ResolvedTransactionBuildOptions, ResolvedTransactionResourceOptions, ResourceLamports, ResourceUnits, RichUpdate, RichUpdateCallback, Schema, SchemaResult, SeedDef, SendOptions, SendResult, Session, SessionDefinition, SessionMemberOptions, SessionOptions, SignerRegistry, SingleTransactionOperationReceipt, SnapshotEntity, SnapshotFrame, SocketIssue, SocketIssueCallback, SolanaGatewayAuthMetadata, SolanaGatewayAuthScope, SolanaGatewayBindingAuthTarget, SortConfig, SortOrder, StackConnectedExtensions, StackDefinition, StackEndpoints, StackExtensionClient, StackExtensionInput, StackQueryDefinition, StackRelease, StackRuntimeExtensionCarrier, StackRuntimeExtensions, StackVersionRefusal, StackWithAttachedPrograms, StorageAdapter, StorageAdapterConfig, StringifiedBigints, SubmittedUnknownTransactionOutcome, SubscribeCallback, SubscribedFrame, Subscription, SubscriptionIdentity, SubscriptionOptions, SubscriptionQuery, SubscriptionRequest, SubscriptionSnapshotOptions, TokenAccountInfo, TokenBalanceInfo, TokenBalanceInput, TransactionBuildCapability, TransactionBuildOptions, TransactionCommitment, TransactionFailureOutcome, TransactionFailurePhase, TransactionFailureStatus, TransactionFeeResult, TransactionInspectionOptions, TransactionInspectionResult, TransactionOperation, TransactionOperationNamespace, TransactionOptions, TransactionOptionsErrorCode, TransactionOutcome, TransactionRequestContext, TransactionResourceOptionKey, TransactionResourceOptions, TransactionSendOptions, TransactionSendResult, TransactionSignatureStatus, TransactionSimulationOptions, TransactionSimulationResult, TransactionTransport, TransactionTransportErrorBody, TransactionVersion, TypedAccountReader, TypedInstruction, TypedListView, TypedQueryExecutor, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, UnsubscribedFrame, Update, UpdateCallback, ViewDef, ViewGroup, ViewKeyFields, ViewKeyValue, ViewSortConfig, WaitForProcessedSlotOptions, WalletAdapter, WalletConnectOptions, WalletExecutionContext, WalletState, WatchOptions, WebSocketFactoryInit };
package/dist/index.esm.js CHANGED
@@ -442,6 +442,7 @@ class SubscriptionRegistry {
442
442
  this.queryStore = queryStore;
443
443
  this.subscriptions = new Map();
444
444
  this.subscriptionsById = new Map();
445
+ this.failureListeners = new Set();
445
446
  }
446
447
  subscribe(query, snapshotEnabled = true) {
447
448
  const request = normalizeSubscriptionRequest({
@@ -504,12 +505,30 @@ class SubscriptionRegistry {
504
505
  ? this.queryStore.getSnapshot(tracker.subscription.subscriptionId)
505
506
  : undefined;
506
507
  }
507
- handleConnectionState(state) {
508
+ handleConnectionState(state, message) {
508
509
  if (state === 'reconnecting')
509
510
  this.queryStore.beginReconnect();
510
- if (state === 'error') {
511
- this.queryStore.failRefreshing(new AreteError('Connection failed while refreshing subscriptions', 'CONNECTION_ERROR'));
511
+ if (state !== 'error') {
512
+ this.connectionError = undefined;
513
+ return;
512
514
  }
515
+ this.queryStore.failRefreshing(new AreteError('Connection failed while refreshing subscriptions', 'CONNECTION_ERROR'));
516
+ // Queries still waiting for their first snapshot are not failed above;
517
+ // one-shot reads learn about the failure here instead of timing out.
518
+ this.connectionError = new AreteError(message ?? 'Connection failed', 'CONNECTION_ERROR');
519
+ this.notifyFailure(this.connectionError);
520
+ }
521
+ /** The terminal connection failure while the connection is in the `error` state. */
522
+ getConnectionError() {
523
+ return this.connectionError;
524
+ }
525
+ /**
526
+ * Called when pending queries can no longer resolve: the connection failed
527
+ * terminally, or a disconnect cleared every subscription.
528
+ */
529
+ onFailure(callback) {
530
+ this.failureListeners.add(callback);
531
+ return () => this.failureListeners.delete(callback);
513
532
  }
514
533
  clear() {
515
534
  for (const { subscription } of this.subscriptions.values()) {
@@ -525,6 +544,11 @@ class SubscriptionRegistry {
525
544
  }
526
545
  this.subscriptions.clear();
527
546
  this.subscriptionsById.clear();
547
+ this.notifyFailure(new AreteError('Subscriptions were cleared by a disconnect', 'CONNECTION_CANCELLED'));
548
+ }
549
+ notifyFailure(error) {
550
+ for (const listener of [...this.failureListeners])
551
+ listener(error);
528
552
  }
529
553
  createLease(tracker) {
530
554
  let released = false;
@@ -3563,10 +3587,90 @@ function createRichUpdateStream(_storage, subscriptionRegistry, query, keyFilter
3563
3587
  };
3564
3588
  }
3565
3589
 
3590
+ /** How long `get` and `getOne` wait for an initial snapshot, as in the Rust and Python SDKs. */
3591
+ const DEFAULT_INITIAL_DATA_TIMEOUT_MS = 5000;
3592
+ /**
3593
+ * `get` or `getOne` gave up waiting for the initial snapshot: the socket never
3594
+ * delivered it (no connection, a reconnect storm, a server that never
3595
+ * answers). The read's subscription is released before this is thrown.
3596
+ */
3597
+ class InitialDataTimeoutError extends AreteError {
3598
+ constructor(view, timeoutMs) {
3599
+ super(`Timed out after ${timeoutMs}ms waiting for the initial snapshot of view '${view}'`, 'INITIAL_DATA_TIMEOUT', { view, timeoutMs });
3600
+ this.view = view;
3601
+ this.timeoutMs = timeoutMs;
3602
+ this.name = 'InitialDataTimeoutError';
3603
+ }
3604
+ }
3566
3605
  function queryOptions(options) {
3567
- const { schema: _schema, withSnapshot, ...query } = options ?? {};
3606
+ const { schema: _schema, withSnapshot, timeoutMs: _timeoutMs, ...query } = options ?? {};
3568
3607
  return { query, snapshotEnabled: withSnapshot ?? true };
3569
3608
  }
3609
+ function resolveTimeout(options) {
3610
+ const timeoutMs = options?.timeoutMs === undefined
3611
+ ? DEFAULT_INITIAL_DATA_TIMEOUT_MS
3612
+ : options.timeoutMs;
3613
+ if (timeoutMs !== null && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
3614
+ throw new RangeError('timeoutMs must be a positive finite number or null');
3615
+ }
3616
+ return timeoutMs;
3617
+ }
3618
+ /**
3619
+ * Open (or reuse) the equivalent subscription, wait until its snapshot has
3620
+ * resolved or its query has failed, and release it. A terminal connection
3621
+ * failure or a disconnect rejects with that reason. Bounded by `timeoutMs`
3622
+ * (`null` waits forever) so a socket that never delivers cannot hang the caller.
3623
+ */
3624
+ async function readResolved(registry, query, snapshotEnabled, timeoutMs) {
3625
+ const lease = registry.subscribe(query, snapshotEnabled);
3626
+ try {
3627
+ await new Promise((resolve, reject) => {
3628
+ let settled = false;
3629
+ let stop = () => { };
3630
+ let timer;
3631
+ const finish = (error) => {
3632
+ if (settled)
3633
+ return;
3634
+ settled = true;
3635
+ stop();
3636
+ if (timer !== undefined)
3637
+ clearTimeout(timer);
3638
+ if (error)
3639
+ reject(error);
3640
+ else
3641
+ resolve();
3642
+ };
3643
+ const check = () => {
3644
+ const error = lease.getError();
3645
+ if (error)
3646
+ finish(error);
3647
+ else if (!lease.getSnapshot().isLoading)
3648
+ finish();
3649
+ else {
3650
+ const connectionError = registry.getConnectionError();
3651
+ if (connectionError)
3652
+ finish(connectionError);
3653
+ }
3654
+ };
3655
+ check();
3656
+ if (settled)
3657
+ return;
3658
+ const stopChanges = lease.onChange(check);
3659
+ const stopFailures = registry.onFailure(finish);
3660
+ stop = () => {
3661
+ stopChanges();
3662
+ stopFailures();
3663
+ };
3664
+ if (timeoutMs !== null) {
3665
+ timer = setTimeout(() => finish(new InitialDataTimeoutError(query.view, timeoutMs)), timeoutMs);
3666
+ }
3667
+ });
3668
+ return lease.getSnapshot();
3669
+ }
3670
+ finally {
3671
+ lease.release();
3672
+ }
3673
+ }
3570
3674
  function serializeViewKeyValue(value, view, field) {
3571
3675
  const location = field === undefined ? `view '${view}'` : `key field '${field}' for view '${view}'`;
3572
3676
  if (typeof value === 'string')
@@ -3617,7 +3721,10 @@ function createTypedStateView(viewDef, storage, subscriptionRegistry) {
3617
3721
  return createRichUpdateStream(storage, subscriptionRegistry, { view: viewDef.view, key: serializedKey, ...query }, serializedKey, snapshotEnabled);
3618
3722
  },
3619
3723
  async get(key, options) {
3620
- return this.getSync(key, options) ?? null;
3724
+ const timeoutMs = resolveTimeout(options);
3725
+ const { query, snapshotEnabled } = queryOptions(options);
3726
+ const snapshot = await readResolved(subscriptionRegistry, { view: viewDef.view, key: wireKey(key), ...query }, snapshotEnabled, timeoutMs);
3727
+ return snapshot.data[0] ?? null;
3621
3728
  },
3622
3729
  getSync(key, options) {
3623
3730
  const { query, snapshotEnabled } = queryOptions(options);
@@ -3645,7 +3752,14 @@ function createTypedListView(viewDef, storage, subscriptionRegistry) {
3645
3752
  return createRichUpdateStream(storage, subscriptionRegistry, { view: viewDef.view, ...query }, undefined, snapshotEnabled);
3646
3753
  },
3647
3754
  async get(options) {
3648
- return this.getSync(options) ?? [];
3755
+ const timeoutMs = resolveTimeout(options);
3756
+ const { query, snapshotEnabled } = queryOptions(options);
3757
+ const snapshot = await readResolved(subscriptionRegistry, { view: viewDef.view, ...query }, snapshotEnabled, timeoutMs);
3758
+ return [...snapshot.data];
3759
+ },
3760
+ async getOne(options) {
3761
+ const items = await this.get({ ...options, take: 1 });
3762
+ return items[0] ?? null;
3649
3763
  },
3650
3764
  getSync(options) {
3651
3765
  const { query, snapshotEnabled } = queryOptions(options);
@@ -7563,8 +7677,8 @@ let Arete$1 = class Arete {
7563
7677
  this.connection.onFrame((frame) => {
7564
7678
  this.processor.handleFrame(frame);
7565
7679
  });
7566
- this.connection.onStateChange((state) => {
7567
- this.subscriptionRegistry.handleConnectionState(state);
7680
+ this.connection.onStateChange((state, error) => {
7681
+ this.subscriptionRegistry.handleConnectionState(state, error);
7568
7682
  });
7569
7683
  this._views = createTypedViews(this.stack, this.storage, this.subscriptionRegistry);
7570
7684
  this._queries = this.buildQueries();
@@ -8547,5 +8661,5 @@ function stringifyBigints(value) {
8547
8661
 
8548
8662
  const Arete = Object.assign(Arete$1, { session: createSession });
8549
8663
 
8550
- export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, EXTENSION_API_VERSION, FrameProcessor, InstructionError, MemoryAdapter, OPERATION_KIND, OperationCallbackError, OperationExecutionError, PROGRAM_KEY_CONFLICT, PROGRAM_OPERATION_EXTENSIONS, ProcessedSlotTimeoutError, QueryStore, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, StreamGapError, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, TRANSACTION_RESOURCE_OPTION_KEYS, TransactionExecutionError, TransactionOptionsError, TransactionTransportError, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, canonicalQueryKey, chainAccountLoader, compareProgramIdentity, createChainClient, createEntityStream, createHostedSolanaGatewayTransports, createInstructionExecutor, createInstructionHandler, createPreparedFlow, createPreparedInstruction, createPreparedTransaction, createPreparedTransactionBody, createProgramPdas, createPublicKeySeed, createRichUpdateStream, createSeed, createSession, createSignerRegistry, createSubscriptionId, createTransactionTransport, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, decodeBase58, defineProgramExtensions, defineStackExtensions, deriveAssociatedTokenAccount, deriveHttpEndpoint, findProgramAddress as derivePda, describePreparedOperation, encodeBase58, executeInstruction, executePreparedOperation, extendProgram, extendPrograms, extendStack, findProgramAddress, findProgramAddressSync, flowOperation, formatPreparedOperation, formatProgramError, formatRawToUi, getMintDecimals, getOperationKind, getProgramRuntimeExtensions, getStackRuntimeExtensions, getTransactionFailureOutcome, hostedWebsocketSuffixes, inspectPreparedOperation, instructionOperation, isEntityFrame, isErrorFrame, isHostedAreteEndpoint, isReplayErrorCode, isSameProgramSdk, isSnapshotFrame, isStackVersionRefusalCode, isSubscribedFrame, isUnsubscribedFrame, isValidFrame, literal, normalizeSubscription, normalizeSubscriptionQuery, normalizeSubscriptionRequest, normalizeTransactionError, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, resolveTransactionBuildOptions, safeToRawAmount, serializeInstructionData, serializeViewKey, setHostedWebsocketSuffixes, stackQuery, stringifyBigints, toJsonValue, toRawAmount, toWireResourceOptions, transactionOperation, unwrapOperationExecutionError, validateAccountResolution, validateProgramReadDescriptor, validateSubscriptionId, withProgramIdentity, withProgramRead, withPrograms };
8664
+ export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_INITIAL_DATA_TIMEOUT_MS, DEFAULT_MAX_ENTRIES_PER_VIEW, EXTENSION_API_VERSION, FrameProcessor, InitialDataTimeoutError, InstructionError, MemoryAdapter, OPERATION_KIND, OperationCallbackError, OperationExecutionError, PROGRAM_KEY_CONFLICT, PROGRAM_OPERATION_EXTENSIONS, ProcessedSlotTimeoutError, QueryStore, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, StreamGapError, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, TRANSACTION_RESOURCE_OPTION_KEYS, TransactionExecutionError, TransactionOptionsError, TransactionTransportError, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, canonicalQueryKey, chainAccountLoader, compareProgramIdentity, createChainClient, createEntityStream, createHostedSolanaGatewayTransports, createInstructionExecutor, createInstructionHandler, createPreparedFlow, createPreparedInstruction, createPreparedTransaction, createPreparedTransactionBody, createProgramPdas, createPublicKeySeed, createRichUpdateStream, createSeed, createSession, createSignerRegistry, createSubscriptionId, createTransactionTransport, createTypedListView, createTypedStateView, createTypedViews, createUpdateStream, decodeBase58, defineProgramExtensions, defineStackExtensions, deriveAssociatedTokenAccount, deriveHttpEndpoint, findProgramAddress as derivePda, describePreparedOperation, encodeBase58, executeInstruction, executePreparedOperation, extendProgram, extendPrograms, extendStack, findProgramAddress, findProgramAddressSync, flowOperation, formatPreparedOperation, formatProgramError, formatRawToUi, getMintDecimals, getOperationKind, getProgramRuntimeExtensions, getStackRuntimeExtensions, getTransactionFailureOutcome, hostedWebsocketSuffixes, inspectPreparedOperation, instructionOperation, isEntityFrame, isErrorFrame, isHostedAreteEndpoint, isReplayErrorCode, isSameProgramSdk, isSnapshotFrame, isStackVersionRefusalCode, isSubscribedFrame, isUnsubscribedFrame, isValidFrame, literal, normalizeSubscription, normalizeSubscriptionQuery, normalizeSubscriptionRequest, normalizeTransactionError, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, resolveTransactionBuildOptions, safeToRawAmount, serializeInstructionData, serializeViewKey, setHostedWebsocketSuffixes, stackQuery, stringifyBigints, toJsonValue, toRawAmount, toWireResourceOptions, transactionOperation, unwrapOperationExecutionError, validateAccountResolution, validateProgramReadDescriptor, validateSubscriptionId, withProgramIdentity, withProgramRead, withPrograms };
8551
8665
  //# sourceMappingURL=index.esm.js.map