@usearete/sdk 0.2.0 → 0.3.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
@@ -1,3 +1,78 @@
1
+ import { Buffer } from 'buffer';
2
+
3
+ type TransactionCommitment = 'processed' | 'confirmed' | 'finalized';
4
+ type TransactionAuthScope = 'transaction:inspect' | 'transaction:send';
5
+ interface TransactionRequestContext {
6
+ commitment?: TransactionCommitment;
7
+ minContextSlot?: bigint;
8
+ }
9
+ interface LatestBlockhashResult {
10
+ blockhash: string;
11
+ contextSlot: bigint;
12
+ lastValidBlockHeight: bigint;
13
+ }
14
+ interface TransactionFeeResult {
15
+ feeLamports: bigint | null;
16
+ contextSlot: bigint;
17
+ }
18
+ interface TransactionSimulationOptions extends TransactionRequestContext {
19
+ accounts?: readonly string[];
20
+ innerInstructions?: boolean;
21
+ replaceRecentBlockhash?: boolean;
22
+ }
23
+ interface TransactionSimulationResult {
24
+ contextSlot: bigint;
25
+ err: unknown | null;
26
+ logs: readonly string[] | null;
27
+ unitsConsumed?: bigint;
28
+ accounts?: readonly unknown[] | null;
29
+ }
30
+ interface TransactionSendOptions {
31
+ skipPreflight?: boolean;
32
+ preflightCommitment?: TransactionCommitment;
33
+ minContextSlot?: bigint;
34
+ }
35
+ interface TransactionSendResult {
36
+ signature: string;
37
+ }
38
+ interface TransactionSignatureStatus {
39
+ signature: string;
40
+ slot: bigint | null;
41
+ confirmationStatus: TransactionCommitment | null;
42
+ err: unknown | null;
43
+ }
44
+ interface TransactionTransportErrorBody {
45
+ code: string;
46
+ message: string;
47
+ retryable: boolean;
48
+ request_id?: string;
49
+ submission_state?: 'not_submitted' | 'unknown';
50
+ signature?: string;
51
+ details?: unknown;
52
+ }
53
+ declare class TransactionTransportError extends Error {
54
+ readonly code: string;
55
+ readonly retryable: boolean;
56
+ readonly requestId?: string;
57
+ readonly submissionState?: 'not_submitted' | 'unknown';
58
+ readonly signature?: string;
59
+ readonly details?: unknown;
60
+ readonly status: number;
61
+ constructor(status: number, body: TransactionTransportErrorBody);
62
+ }
63
+ interface TransactionTransport {
64
+ getLatestBlockhash(options?: TransactionRequestContext): Promise<LatestBlockhashResult>;
65
+ getFeeForMessage(message: string, options?: TransactionRequestContext): Promise<TransactionFeeResult>;
66
+ simulateTransaction(transaction: string, options?: TransactionSimulationOptions): Promise<TransactionSimulationResult>;
67
+ sendTransaction(transaction: string, options?: TransactionSendOptions): Promise<TransactionSendResult>;
68
+ getSignatureStatus(signature: string, options?: TransactionRequestContext & {
69
+ searchTransactionHistory?: boolean;
70
+ }): Promise<TransactionSignatureStatus | null>;
71
+ getBlockHeight(options?: TransactionRequestContext): Promise<bigint>;
72
+ }
73
+ type AuthenticatedTransactionFetch = (input: string, init: RequestInit, scope: TransactionAuthScope, allowAuthReplay: boolean) => Promise<Response>;
74
+ declare function createTransactionTransport(baseUrl: string, authenticatedFetch: AuthenticatedTransactionFetch): TransactionTransport;
75
+
1
76
  /**
2
77
  * Wallet adapter boundary for the Arete SDK.
3
78
  *
@@ -7,6 +82,7 @@
7
82
  * boundary, implemented by adapters that wrap the Solana library of your choice
8
83
  * (@solana/web3.js, @solana/kit, a raw Keypair signer for scripts, etc.).
9
84
  */
85
+
10
86
  /**
11
87
  * A single account reference within a built instruction.
12
88
  */
@@ -70,6 +146,35 @@ interface SendResult {
70
146
  /** Slot in which the transaction landed, if the adapter reports it */
71
147
  slot?: number;
72
148
  }
149
+ /**
150
+ * Adapter-specific options for unsigned transaction inspection.
151
+ *
152
+ * Inspection must not sign or submit the transaction. Concrete adapters may
153
+ * accept additional simulation options through this passthrough object.
154
+ */
155
+ interface TransactionInspectionOptions {
156
+ [key: string]: unknown;
157
+ }
158
+ /**
159
+ * Unsigned transaction inspection returned by a capable wallet adapter.
160
+ */
161
+ interface TransactionInspectionResult {
162
+ /** Estimated transaction fee in lamports, when available. */
163
+ feeLamports?: number;
164
+ /** Program logs produced by simulation, when available. */
165
+ logs?: readonly string[];
166
+ /** Compute units consumed by simulation, when available. */
167
+ computeUnitsConsumed?: number;
168
+ /** RPC context slot for the inspection, when available. */
169
+ contextSlot?: number;
170
+ /** Raw simulation failure, if the inspected transaction would fail. */
171
+ error?: unknown;
172
+ /** Adapter-specific inspection fields. */
173
+ [key: string]: unknown;
174
+ }
175
+ interface WalletExecutionContext {
176
+ transactionTransport?: TransactionTransport;
177
+ }
73
178
  /**
74
179
  * Wallet adapter interface for signing and sending transactions.
75
180
  *
@@ -93,7 +198,14 @@ interface WalletAdapter {
93
198
  * @param options - Adapter-specific send/confirmation options
94
199
  * @returns The transaction signature (and slot, if known)
95
200
  */
96
- signAndSend(instructions: readonly BuiltInstruction[], options?: SendOptions): Promise<SendResult>;
201
+ signAndSend(instructions: readonly BuiltInstruction[], options?: SendOptions, context?: WalletExecutionContext): Promise<SendResult>;
202
+ /**
203
+ * Inspect a transaction without signing, submitting, or prompting a wallet.
204
+ *
205
+ * This capability is optional because not every adapter has an RPC-backed
206
+ * unsigned simulation implementation.
207
+ */
208
+ inspectTransaction?(instructions: readonly BuiltInstruction[], options?: TransactionInspectionOptions, context?: WalletExecutionContext): Promise<TransactionInspectionResult>;
97
209
  }
98
210
  /**
99
211
  * Wallet connection state
@@ -272,6 +384,7 @@ declare function createPublicKeySeed(address: string): Uint8Array;
272
384
  * This module handles serializing instruction arguments into the binary format
273
385
  * expected by Solana programs using Borsh serialization.
274
386
  */
387
+
275
388
  /**
276
389
  * Instruction argument schema for serialization.
277
390
  */
@@ -352,6 +465,46 @@ interface ErrorMetadata {
352
465
  name: string;
353
466
  msg: string;
354
467
  }
468
+ type TransactionFailureStatus = 'not-submitted' | 'submitted-unknown' | 'chain-failed';
469
+ type TransactionFailurePhase = 'build' | 'wallet' | 'send' | 'confirmation' | 'chain';
470
+ interface ConfirmedTransactionOutcome {
471
+ readonly status: 'confirmed';
472
+ readonly phase: 'confirmation';
473
+ readonly signature: string;
474
+ readonly slot?: number;
475
+ }
476
+ interface NotSubmittedTransactionOutcome {
477
+ readonly status: 'not-submitted';
478
+ readonly phase: 'build' | 'wallet' | 'send';
479
+ readonly cause: unknown;
480
+ }
481
+ interface SubmittedUnknownTransactionOutcome {
482
+ readonly status: 'submitted-unknown';
483
+ readonly phase: 'send' | 'confirmation';
484
+ readonly signature: string;
485
+ readonly slot?: number;
486
+ readonly cause: unknown;
487
+ }
488
+ interface ChainFailedTransactionOutcome {
489
+ readonly status: 'chain-failed';
490
+ readonly phase: 'confirmation' | 'chain';
491
+ readonly signature?: string;
492
+ readonly slot?: number;
493
+ readonly programError?: ProgramError;
494
+ readonly cause: unknown;
495
+ }
496
+ type TransactionFailureOutcome = NotSubmittedTransactionOutcome | SubmittedUnknownTransactionOutcome | ChainFailedTransactionOutcome;
497
+ type TransactionOutcome = ConfirmedTransactionOutcome | TransactionFailureOutcome;
498
+ /**
499
+ * Structured transaction failure thrown by adapters and the core executor.
500
+ */
501
+ declare class TransactionExecutionError extends Error {
502
+ readonly outcome: TransactionFailureOutcome;
503
+ readonly cause: unknown;
504
+ readonly signature?: string;
505
+ readonly slot?: number;
506
+ constructor(outcome: TransactionFailureOutcome, message?: string);
507
+ }
355
508
  /**
356
509
  * Parses an error returned from a Solana transaction.
357
510
  *
@@ -359,7 +512,7 @@ interface ErrorMetadata {
359
512
  * @param errorMetadata - Error definitions from the IDL
360
513
  * @returns Parsed program error or null if not a program error
361
514
  */
362
- declare function parseInstructionError(error: unknown, errorMetadata: ErrorMetadata[]): ProgramError | null;
515
+ declare function parseInstructionError(error: unknown, errorMetadata: readonly ErrorMetadata[]): ProgramError | null;
363
516
  /**
364
517
  * Formats an error for display.
365
518
  *
@@ -376,8 +529,18 @@ declare class InstructionError extends Error {
376
529
  readonly programError: ProgramError | null;
377
530
  /** The original underlying error from the wallet adapter / RPC. */
378
531
  readonly cause: unknown;
379
- constructor(message: string, programError: ProgramError | null, cause: unknown);
532
+ /** Structured chain-failure outcome, including signature and slot when known. */
533
+ readonly outcome: ChainFailedTransactionOutcome;
534
+ readonly signature?: string;
535
+ readonly slot?: number;
536
+ constructor(message: string, programError: ProgramError | null, cause: unknown, outcome?: ChainFailedTransactionOutcome);
380
537
  }
538
+ /** Find a structured transaction failure through nested error causes. */
539
+ declare function getTransactionFailureOutcome(error: unknown): TransactionFailureOutcome | null;
540
+ /**
541
+ * Normalize an adapter/host exception without retrying or resubmitting.
542
+ */
543
+ declare function normalizeTransactionError(cause: unknown, errorMetadata?: readonly ErrorMetadata[], fallbackPhase?: 'wallet' | 'send'): InstructionError | TransactionExecutionError;
381
544
 
382
545
  /**
383
546
  * Resolved accounts map passed to a handler's build function.
@@ -546,6 +709,9 @@ type Update<T> = {
546
709
  type: 'patch';
547
710
  key: string;
548
711
  data: Partial<T>;
712
+ } | {
713
+ type: 'remove';
714
+ key: string;
549
715
  } | {
550
716
  type: 'delete';
551
717
  key: string;
@@ -560,15 +726,23 @@ type RichUpdate<T> = {
560
726
  before: T;
561
727
  after: T;
562
728
  patch?: unknown;
729
+ } | {
730
+ type: 'removed';
731
+ key: string;
732
+ lastKnown?: T;
563
733
  } | {
564
734
  type: 'deleted';
565
735
  key: string;
566
736
  lastKnown?: T;
567
737
  };
568
- interface ViewDef<T, TMode extends 'state' | 'list'> {
738
+ type ViewKeyValue = string | number | bigint;
739
+ type ViewKeyFields<TKey> = unknown extends TKey ? readonly string[] : TKey extends object ? readonly Extract<keyof TKey, string>[] : readonly string[];
740
+ interface ViewDef<T, TMode extends 'state' | 'list', TKey = unknown> {
569
741
  readonly mode: TMode;
570
742
  readonly view: string;
743
+ readonly keyFields?: ViewKeyFields<TKey>;
571
744
  readonly _entity?: T;
745
+ readonly _key?: TKey;
572
746
  }
573
747
  interface StackEndpoints {
574
748
  readonly ws: string;
@@ -600,6 +774,8 @@ interface StackQueryDefinition<TParams = unknown, TResult = unknown> {
600
774
  interface ProgramSdkDefinition {
601
775
  readonly name: string;
602
776
  readonly programId?: string;
777
+ /** Stable fingerprint of the generated program behavior used for client caching. */
778
+ readonly definitionHash?: string;
603
779
  readonly schemas?: Record<string, Schema<unknown>>;
604
780
  readonly pdas?: Record<string, unknown>;
605
781
  readonly accounts?: Record<string, ProgramAccountReadDefinition<unknown>>;
@@ -620,23 +796,56 @@ interface StackDefinition {
620
796
  readonly programs?: Record<string, ProgramSdkDefinition>;
621
797
  }
622
798
  interface ViewGroup {
623
- state?: ViewDef<unknown, 'state'>;
624
- list?: ViewDef<unknown, 'list'>;
799
+ state?: ViewDef<any, 'state', any>;
800
+ list?: ViewDef<any, 'list'>;
625
801
  }
626
- interface Subscription {
802
+ interface SubscriptionQuery {
627
803
  view: string;
628
804
  key?: string;
629
805
  partition?: string;
630
- filters?: Record<string, string>;
806
+ filters?: Record<string, unknown>;
631
807
  take?: number;
632
808
  skip?: number;
633
- /** Whether to include initial snapshot (defaults to true for backward compatibility) */
634
- withSnapshot?: boolean;
635
- /** Cursor for resuming from a specific point (_seq value) */
636
809
  after?: string;
637
- /** Maximum number of entities to include in snapshot (pagination hint) */
638
810
  snapshotLimit?: number;
639
811
  }
812
+ interface SubscriptionSnapshotOptions {
813
+ enabled: boolean;
814
+ }
815
+ /** Protocol v2 wire subscription. The client-selected ID remains stable across reconnects. */
816
+ interface Subscription {
817
+ type: 'subscribe';
818
+ protocolVersion: 2;
819
+ subscriptionId: string;
820
+ query: SubscriptionQuery;
821
+ snapshot: SubscriptionSnapshotOptions;
822
+ }
823
+ interface SubscriptionRequest {
824
+ query: SubscriptionQuery;
825
+ snapshot?: Partial<SubscriptionSnapshotOptions>;
826
+ }
827
+ /** Canonical query identity includes every server query field and snapshot behavior. */
828
+ type SubscriptionIdentity = SubscriptionRequest;
829
+ type SubscriptionOptions = SubscriptionSnapshotOptions;
830
+ interface QuerySnapshot<T = unknown> {
831
+ readonly subscriptionId: string;
832
+ readonly query: SubscriptionQuery;
833
+ readonly keys: readonly string[];
834
+ readonly data: readonly T[];
835
+ readonly isLoading: boolean;
836
+ readonly isRefreshing: boolean;
837
+ readonly error?: AreteError;
838
+ }
839
+ interface QueryLease {
840
+ readonly subscription: Subscription;
841
+ readonly queryKey: string;
842
+ getSnapshot<T = unknown>(): QuerySnapshot<T>;
843
+ onChange(callback: () => void): UnsubscribeFn;
844
+ onUpdate<T = unknown>(callback: (update: Update<T>) => void): UnsubscribeFn;
845
+ onRichUpdate<T = unknown>(callback: (update: RichUpdate<T>) => void): UnsubscribeFn;
846
+ refresh(): Promise<void>;
847
+ release(): void;
848
+ }
640
849
  type SchemaResult<T> = {
641
850
  success: true;
642
851
  data: T;
@@ -648,9 +857,10 @@ interface Schema<T> {
648
857
  safeParse: (input: unknown) => SchemaResult<T>;
649
858
  }
650
859
  interface WatchOptions<TSchema = unknown> {
860
+ partition?: string;
651
861
  take?: number;
652
862
  skip?: number;
653
- filters?: Record<string, string>;
863
+ filters?: Record<string, unknown>;
654
864
  schema?: Schema<TSchema>;
655
865
  /** Whether to include initial snapshot (defaults to true) */
656
866
  withSnapshot?: boolean;
@@ -661,6 +871,9 @@ interface WatchOptions<TSchema = unknown> {
661
871
  }
662
872
  interface AreteOptions<TStack extends StackDefinition> {
663
873
  stack: TStack;
874
+ /** Connect immediately when the client is created (defaults to true). */
875
+ autoConnect?: boolean;
876
+ /** Reconnect automatically after an established connection is lost (defaults to true). */
664
877
  autoReconnect?: boolean;
665
878
  reconnectIntervals?: number[];
666
879
  maxReconnectAttempts?: number;
@@ -671,6 +884,10 @@ interface AuthTokenResult {
671
884
  token: string;
672
885
  expiresAt?: number;
673
886
  expires_at?: number;
887
+ scopes?: readonly string[];
888
+ }
889
+ interface AuthTokenRequest {
890
+ scopes: readonly string[];
674
891
  }
675
892
  interface WebSocketFactoryInit {
676
893
  headers?: Record<string, string>;
@@ -680,7 +897,7 @@ interface WebSocketFactoryInit {
680
897
  */
681
898
  interface AuthConfig {
682
899
  /** Custom token provider function - called before each connection and during refresh */
683
- getToken?: () => Promise<string | AuthTokenResult>;
900
+ getToken?: (request?: AuthTokenRequest) => Promise<string | AuthTokenResult>;
684
901
  /** Arete Cloud token endpoint URL */
685
902
  tokenEndpoint?: string;
686
903
  /** Publishable key for Arete Cloud */
@@ -699,6 +916,8 @@ interface AuthConfig {
699
916
  interface AreteConfig {
700
917
  /** WebSocket endpoint. `null`/omitted disables the WebSocket transport (HTTP-only mode). */
701
918
  websocketUrl?: string | null;
919
+ /** Reconnect automatically after an established connection is lost (defaults to true). */
920
+ autoReconnect?: boolean;
702
921
  reconnectIntervals?: number[];
703
922
  maxReconnectAttempts?: number;
704
923
  initialSubscriptions?: Subscription[];
@@ -709,14 +928,15 @@ interface AreteConfig {
709
928
  interface SocketIssue {
710
929
  error: string;
711
930
  message: string;
712
- code: AuthErrorCode;
931
+ code: string | AuthErrorCode;
713
932
  retryable: boolean;
714
933
  retryAfter?: number;
715
934
  suggestedAction?: string;
716
935
  docsUrl?: string;
717
936
  fatal: boolean;
937
+ subscriptionId?: string | null;
718
938
  }
719
- declare const DEFAULT_CONFIG: Required<Pick<AreteConfig, 'reconnectIntervals' | 'maxReconnectAttempts' | 'maxEntriesPerView'>>;
939
+ declare const DEFAULT_CONFIG: Required<Pick<AreteConfig, 'autoReconnect' | 'reconnectIntervals' | 'maxReconnectAttempts' | 'maxEntriesPerView'>>;
720
940
  /**
721
941
  * Machine-readable error codes for authentication and rate limiting failures
722
942
  *
@@ -732,21 +952,22 @@ type TypedViews<TViews extends StackDefinition['views']> = {
732
952
  [K in keyof TViews]: TypedViewGroup<TViews[K]>;
733
953
  };
734
954
  type TypedViewGroup<TGroup> = {
735
- [K in keyof TGroup]: TGroup[K] extends ViewDef<infer T, 'state'> ? TypedStateView<T> : TGroup[K] extends ViewDef<infer T, 'list'> ? TypedListView<T> : never;
955
+ [K in keyof TGroup]: TGroup[K] extends ViewDef<infer T, 'state', infer TKey> ? TypedStateView<T, DefaultViewKey<TKey>> : TGroup[K] extends ViewDef<infer T, 'list'> ? TypedListView<T> : never;
736
956
  };
737
- interface TypedStateView<T> {
738
- use<TSchema = T>(key: string, options?: WatchOptions<TSchema>): AsyncIterable<TSchema>;
739
- watch(key: string, options?: WatchOptions): AsyncIterable<Update<T>>;
740
- watchRich(key: string, options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
741
- get(key: string): Promise<T | null>;
742
- getSync(key: string): T | null | undefined;
957
+ type DefaultViewKey<TKey> = unknown extends TKey ? string : TKey;
958
+ interface TypedStateView<T, TKey = string> {
959
+ use<TSchema = T>(key: TKey, options?: WatchOptions<TSchema>): AsyncIterable<TSchema>;
960
+ watch(key: TKey, options?: WatchOptions): AsyncIterable<Update<T>>;
961
+ watchRich(key: TKey, options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
962
+ get(key: TKey, options?: WatchOptions): Promise<T | null>;
963
+ getSync(key: TKey, options?: WatchOptions): T | null | undefined;
743
964
  }
744
965
  interface TypedListView<T> {
745
966
  use<TSchema = T>(options?: WatchOptions<TSchema>): AsyncIterable<TSchema>;
746
967
  watch(options?: WatchOptions): AsyncIterable<Update<T>>;
747
968
  watchRich(options?: WatchOptions): AsyncIterable<RichUpdate<T>>;
748
- get(): Promise<T[]>;
749
- getSync(): T[] | undefined;
969
+ get(options?: WatchOptions): Promise<T[]>;
970
+ getSync(options?: WatchOptions): T[] | undefined;
750
971
  }
751
972
  type SubscribeCallback<T> = (update: Update<T>) => void;
752
973
  type UnsubscribeFn = () => void;
@@ -754,52 +975,77 @@ type ConnectionStateCallback = (state: ConnectionState, error?: string) => void;
754
975
  type SocketIssueCallback = (issue: SocketIssue) => void;
755
976
 
756
977
  type FrameMode = 'state' | 'append' | 'list';
757
- type FrameOp = 'create' | 'upsert' | 'patch' | 'delete' | 'snapshot' | 'subscribed';
978
+ type FrameOp = 'subscribed' | 'unsubscribed' | 'snapshot' | 'upsert' | 'patch' | 'remove' | 'delete';
758
979
  type SortOrder = 'asc' | 'desc';
759
980
  interface SortConfig {
760
981
  field: string[];
761
982
  order: SortOrder;
762
983
  }
763
- interface SubscribedFrame {
984
+ interface IdentifiedFrame {
985
+ protocolVersion: 2;
986
+ subscriptionId: string;
987
+ }
988
+ interface SubscribedFrame extends IdentifiedFrame {
764
989
  op: 'subscribed';
765
- view: string;
990
+ query: SubscriptionQuery;
766
991
  mode: FrameMode;
767
992
  sort?: SortConfig;
768
993
  }
769
- interface EntityFrame<T = unknown> {
994
+ interface UnsubscribedFrame extends IdentifiedFrame {
995
+ op: 'unsubscribed';
996
+ }
997
+ interface EntityFrame<T = unknown> extends IdentifiedFrame {
770
998
  mode: FrameMode;
771
999
  entity: string;
772
- op: FrameOp;
1000
+ op: 'upsert' | 'patch' | 'remove' | 'delete';
773
1001
  key: string;
774
- data: T;
1002
+ data: T | null;
775
1003
  append?: string[];
776
- /** Sequence cursor for ordering and resume capability */
777
1004
  seq?: string;
778
1005
  }
779
1006
  interface SnapshotEntity<T = unknown> {
780
1007
  key: string;
781
1008
  data: T;
782
1009
  }
783
- interface SnapshotFrame<T = unknown> {
1010
+ interface SnapshotFrame<T = unknown> extends IdentifiedFrame {
1011
+ snapshotId: string;
1012
+ authoritative: boolean;
784
1013
  mode: FrameMode;
785
1014
  entity: string;
786
1015
  op: 'snapshot';
1016
+ key?: string;
787
1017
  data: SnapshotEntity<T>[];
788
- /** Indicates if this is the final snapshot batch. When false, more batches will follow. */
789
- complete?: boolean;
1018
+ complete: boolean;
1019
+ }
1020
+ interface ErrorFrame {
1021
+ type: 'error';
1022
+ protocolVersion: 2;
1023
+ subscriptionId: string | null;
1024
+ error?: string;
1025
+ message?: string;
1026
+ code: string;
1027
+ retryable?: boolean;
1028
+ fatal: boolean;
1029
+ retry_after?: number;
1030
+ suggested_action?: string;
1031
+ docs_url?: string;
790
1032
  }
791
- type Frame<T = unknown> = EntityFrame<T> | SnapshotFrame<T> | SubscribedFrame;
1033
+ type Frame<T = unknown> = EntityFrame<T> | SnapshotFrame<T> | SubscribedFrame | UnsubscribedFrame | ErrorFrame;
792
1034
  declare function isSnapshotFrame<T>(frame: Frame<T>): frame is SnapshotFrame<T>;
793
1035
  declare function isSubscribedFrame(frame: Frame): frame is SubscribedFrame;
1036
+ declare function isUnsubscribedFrame(frame: Frame): frame is UnsubscribedFrame;
1037
+ declare function isErrorFrame(frame: Frame): frame is ErrorFrame;
794
1038
  declare function isEntityFrame<T>(frame: Frame<T>): frame is EntityFrame<T>;
795
1039
  declare function parseFrame(data: ArrayBuffer | string): Frame;
796
1040
  declare function parseFrameFromBlob(blob: Blob): Promise<Frame>;
797
1041
  declare function isValidFrame(frame: unknown): frame is Frame;
798
1042
 
799
1043
  type FrameHandler = <T>(frame: Frame<T>) => void;
1044
+ declare function isHostedAreteEndpoint(url: string): boolean;
800
1045
  declare class ConnectionManager {
801
1046
  private ws;
802
1047
  private websocketUrl;
1048
+ private readonly autoReconnect;
803
1049
  private reconnectIntervals;
804
1050
  private maxReconnectAttempts;
805
1051
  private reconnectAttempts;
@@ -807,15 +1053,20 @@ declare class ConnectionManager {
807
1053
  private pingInterval;
808
1054
  private tokenRefreshTimeout;
809
1055
  private tokenRefreshInFlight;
1056
+ private tokenRequestInFlight;
810
1057
  private currentState;
811
1058
  private subscriptionQueue;
812
1059
  private activeSubscriptions;
1060
+ private socketGeneration;
1061
+ private pendingConnect;
813
1062
  private frameHandlers;
814
1063
  private stateHandlers;
815
1064
  private socketIssueHandlers;
816
1065
  private authConfig?;
817
1066
  private currentToken?;
818
1067
  private tokenExpiry?;
1068
+ private tokenScopes;
1069
+ private requestedScopes;
819
1070
  private readonly hostedAreteUrl;
820
1071
  private reconnectForTokenRefresh;
821
1072
  constructor(config: AreteConfig);
@@ -824,7 +1075,9 @@ declare class ConnectionManager {
824
1075
  private hasRefreshableAuth;
825
1076
  private updateTokenState;
826
1077
  private clearTokenState;
1078
+ private tokenCovers;
827
1079
  private getOrRefreshToken;
1080
+ private fetchAuthToken;
828
1081
  private createTokenEndpointRequestBody;
829
1082
  private fetchTokenFromEndpoint;
830
1083
  private isTokenExpired;
@@ -840,19 +1093,21 @@ declare class ConnectionManager {
840
1093
  private createWebSocket;
841
1094
  getState(): ConnectionState;
842
1095
  getHttpAuthToken(forceRefresh?: boolean): Promise<string | undefined>;
1096
+ getHttpAuthToken(requiredScopes?: readonly string[], forceRefresh?: boolean): Promise<string | undefined>;
843
1097
  clearHttpAuthToken(): void;
844
1098
  onFrame(handler: FrameHandler): () => void;
845
1099
  onStateChange(handler: ConnectionStateCallback): () => void;
846
1100
  onSocketIssue(handler: SocketIssueCallback): () => void;
847
1101
  private notifySocketIssue;
848
- connect(): Promise<void>;
1102
+ connect(recovering?: boolean): Promise<void>;
849
1103
  disconnect(): void;
850
1104
  subscribe(subscription: Subscription): void;
851
- unsubscribe(view: string, key?: string): void;
1105
+ unsubscribe(subscriptionId: string): void;
1106
+ refresh(subscription: Subscription): void;
852
1107
  isConnected(): boolean;
853
- private makeSubKey;
854
1108
  private flushSubscriptionQueue;
855
1109
  private resubscribeActive;
1110
+ private addQueuedSubscription;
856
1111
  private updateState;
857
1112
  private notifyFrameHandlers;
858
1113
  private handleReconnect;
@@ -893,16 +1148,169 @@ interface StorageAdapter {
893
1148
  notifyRichUpdate<T>(viewPath: string, key: string, update: RichUpdate<T>): void;
894
1149
  }
895
1150
 
1151
+ declare class QueryStore {
1152
+ private readonly storage;
1153
+ private readonly records;
1154
+ constructor(storage: StorageAdapter);
1155
+ register(subscription: Subscription, queryKey: string): void;
1156
+ unregister(subscriptionId: string): void;
1157
+ getSubscription(subscriptionId: string): Subscription | undefined;
1158
+ getQueryKey(subscriptionId: string): string | undefined;
1159
+ getSnapshot<T>(subscriptionId: string): QuerySnapshot<T> | undefined;
1160
+ onChange(subscriptionId: string, callback: () => void): UnsubscribeFn;
1161
+ onUpdate<T>(subscriptionId: string, callback: (update: Update<T>) => void): UnsubscribeFn;
1162
+ onRichUpdate<T>(subscriptionId: string, callback: (update: RichUpdate<T>) => void): UnsubscribeFn;
1163
+ acknowledge(subscriptionId: string, effectiveQuery: SubscriptionQuery, mode: FrameMode, sort?: SortConfig): void;
1164
+ stageSnapshot(frame: SnapshotFrame, keys: readonly string[]): void;
1165
+ applyLive(subscriptionId: string, key: string, update: Update<unknown>, richUpdate?: RichUpdate<unknown>, sequence?: string): void;
1166
+ deleteGlobal(view: string, key: string, lastKnown?: unknown): void;
1167
+ evict(view: string, key: string): void;
1168
+ failFrame(frame: ErrorFrame): void;
1169
+ beginRefresh(subscriptionId: string, waitForSnapshot?: boolean): Promise<void>;
1170
+ failRefresh(subscriptionId: string, error: AreteError): void;
1171
+ beginReconnect(): void;
1172
+ failRefreshing(error: AreteError): void;
1173
+ clear(): void;
1174
+ private mergeIncremental;
1175
+ private sortKeys;
1176
+ private entitySequence;
1177
+ private fail;
1178
+ private resolveRefresh;
1179
+ private rejectRefresh;
1180
+ private requireRecord;
1181
+ private touch;
1182
+ private emitUpdate;
1183
+ private emitRichUpdate;
1184
+ }
1185
+
1186
+ interface WaitForProcessedSlotOptions {
1187
+ /** Reject if the requested slot has not been processed within this duration. */
1188
+ timeoutMs?: number;
1189
+ /** Abort this wait without affecting frame processing or the connection. */
1190
+ signal?: AbortSignal;
1191
+ }
1192
+ declare class ProcessedSlotTimeoutError extends Error {
1193
+ readonly targetSlot: bigint;
1194
+ readonly processedSlot: bigint | null;
1195
+ constructor(targetSlot: bigint, processedSlot: bigint | null);
1196
+ }
1197
+ interface FrameProcessorConfig {
1198
+ maxEntriesPerView?: number | null;
1199
+ /**
1200
+ * Interval in milliseconds to buffer frames before flushing to storage.
1201
+ * Set to 0 for immediate processing (no buffering).
1202
+ * Default: 0 (immediate)
1203
+ *
1204
+ * For React applications, 16ms (one frame at 60fps) is recommended to
1205
+ * reduce unnecessary re-renders during high-frequency updates.
1206
+ */
1207
+ flushIntervalMs?: number;
1208
+ schemas?: Record<string, Schema<unknown>>;
1209
+ patchSchemas?: Record<string, Schema<unknown>>;
1210
+ queryStore?: QueryStore;
1211
+ /** Whether rejected frames should also be written to `console.warn`. */
1212
+ warnOnValidationError?: boolean;
1213
+ /** Receives structured details whenever a generated schema rejects a frame. */
1214
+ onValidationError?: (diagnostic: FrameValidationDiagnostic) => void;
1215
+ }
1216
+ interface FrameValidationDiagnostic {
1217
+ readonly view: string;
1218
+ readonly key?: string;
1219
+ readonly seq?: string;
1220
+ readonly operation: 'snapshot' | 'upsert' | 'patch';
1221
+ readonly error: unknown;
1222
+ }
1223
+ declare class FrameProcessor {
1224
+ private storage;
1225
+ private maxEntriesPerView;
1226
+ private flushIntervalMs;
1227
+ private schemas?;
1228
+ private patchSchemas?;
1229
+ private queryStore?;
1230
+ private warnOnValidationError;
1231
+ private onValidationError?;
1232
+ private pendingUpdates;
1233
+ private flushTimer;
1234
+ private isProcessing;
1235
+ private latestProcessedSlot;
1236
+ private processedSlotWaiters;
1237
+ constructor(storage: StorageAdapter, config?: FrameProcessorConfig);
1238
+ private getSchema;
1239
+ private normalizeEntity;
1240
+ private hasSchema;
1241
+ private normalizePathSegment;
1242
+ private normalizePath;
1243
+ private normalizeSortConfig;
1244
+ private normalizeAppendPaths;
1245
+ private extractSeq;
1246
+ private getInternalSeq;
1247
+ private compareSeq;
1248
+ private attachInternalSeq;
1249
+ handleFrame<T>(frame: Frame<T>): void;
1250
+ /**
1251
+ * Immediately flush all pending updates.
1252
+ * Useful for ensuring all updates are processed before reading state.
1253
+ */
1254
+ flush(): void;
1255
+ getProcessedSlot(): bigint | null;
1256
+ waitForProcessedSlot(slot: number | bigint, options?: WaitForProcessedSlotOptions): Promise<bigint>;
1257
+ /**
1258
+ * Clean up any pending timers. Call when disposing the processor.
1259
+ */
1260
+ dispose(): void;
1261
+ private scheduleFlush;
1262
+ private flushPendingUpdates;
1263
+ private processFrame;
1264
+ private normalizeSlot;
1265
+ private slotFromSeq;
1266
+ private frameSlot;
1267
+ private markFrameProcessed;
1268
+ private removeProcessedSlotWaiter;
1269
+ private createAbortError;
1270
+ private processFrameWithoutEnforce;
1271
+ private handleSubscribedFrame;
1272
+ private handleSnapshotFrame;
1273
+ private handleSnapshotFrameWithoutEnforce;
1274
+ private handleEntityFrame;
1275
+ private handleEntityFrameWithoutEnforce;
1276
+ private emitRichUpdate;
1277
+ private createRichUpdate;
1278
+ private enforceMaxEntries;
1279
+ }
1280
+
1281
+ interface NormalizedSubscriptionRequest {
1282
+ query: SubscriptionQuery;
1283
+ snapshot: SubscriptionSnapshotOptions;
1284
+ }
1285
+ declare function validateSubscriptionId(subscriptionId: string): void;
1286
+ declare function createSubscriptionId(): string;
1287
+ declare function normalizeSubscriptionQuery(query: SubscriptionQuery): SubscriptionQuery;
1288
+ declare function normalizeSubscriptionRequest(request: SubscriptionRequest): NormalizedSubscriptionRequest;
1289
+ declare function canonicalQueryKey(request: SubscriptionRequest): string;
1290
+ declare function normalizeSubscription(subscription: Subscription): Subscription;
896
1291
  declare class SubscriptionRegistry {
897
- private subscriptions;
898
- private connection;
899
- constructor(connection: ConnectionManager);
900
- subscribe(subscription: Subscription): UnsubscribeFn;
901
- unsubscribe(subscription: Subscription): void;
902
- getRefCount(subscription: Subscription): number;
1292
+ private readonly connection;
1293
+ private readonly queryStore;
1294
+ private readonly subscriptions;
1295
+ private readonly subscriptionsById;
1296
+ constructor(connection: ConnectionManager, queryStore: QueryStore);
1297
+ subscribe(query: SubscriptionQuery, snapshotEnabled?: boolean): QueryLease;
1298
+ refresh(query: SubscriptionQuery, snapshotEnabled?: boolean): Promise<void>;
1299
+ /**
1300
+ * Refresh every active subscription for a view, optionally narrowed to one
1301
+ * serialized key. Resolves immediately when nothing matches — refreshing a
1302
+ * view with no active subscriptions is a no-op, not an error.
1303
+ */
1304
+ refreshView(view: string, key?: string): Promise<void>;
1305
+ getRefCount(query: SubscriptionQuery, snapshotEnabled?: boolean): number;
903
1306
  getActiveSubscriptions(): Subscription[];
1307
+ getSnapshot<T>(query: SubscriptionQuery, snapshotEnabled?: boolean): QuerySnapshot<T> | undefined;
1308
+ handleConnectionState(state: ConnectionState): void;
904
1309
  clear(): void;
905
- private makeSubKey;
1310
+ private createLease;
1311
+ private getTracker;
1312
+ private refreshTracker;
1313
+ private releaseTracker;
906
1314
  }
907
1315
 
908
1316
  interface ChainClock {
@@ -936,6 +1344,19 @@ interface TokenBalanceInfo {
936
1344
  amount: string;
937
1345
  decimals?: number | null;
938
1346
  uiAmountString?: string | null;
1347
+ contextSlot: bigint;
1348
+ }
1349
+ interface NativeBalanceInfo {
1350
+ lamports: bigint;
1351
+ contextSlot: bigint;
1352
+ }
1353
+ interface ContextSlotOptions {
1354
+ minContextSlot?: number | bigint;
1355
+ }
1356
+ interface TokenBalanceInput {
1357
+ owner: string;
1358
+ mint: string;
1359
+ tokenProgram?: string;
939
1360
  }
940
1361
  interface RawAccountInfo {
941
1362
  address: string;
@@ -947,16 +1368,13 @@ interface RawAccountInfo {
947
1368
  interface ChainClient {
948
1369
  exists(address: string): Promise<boolean>;
949
1370
  lamports(address: string): Promise<number>;
1371
+ nativeBalance(address: string, options?: ContextSlotOptions): Promise<NativeBalanceInfo>;
950
1372
  minimumBalanceForRentExemption(space: number): Promise<number>;
951
1373
  clock(): Promise<ChainClock>;
952
1374
  account(address: string): Promise<RawAccountInfo | null>;
953
1375
  mint(address: string): Promise<MintAccountInfo | null>;
954
1376
  tokenAccount(address: string): Promise<TokenAccountInfo | null>;
955
- balance(input: {
956
- owner: string;
957
- mint: string;
958
- tokenProgram?: string;
959
- }): Promise<TokenBalanceInfo>;
1377
+ balance(input: TokenBalanceInput, options?: ContextSlotOptions): Promise<TokenBalanceInfo>;
960
1378
  }
961
1379
  type FetchLike = typeof fetch;
962
1380
  declare function deriveHttpEndpoint(wsUrl: string): string;
@@ -1000,6 +1418,19 @@ interface PreparedOperationDescription {
1000
1418
  }[];
1001
1419
  }[];
1002
1420
  }
1421
+ interface OperationInspection {
1422
+ /** JSON-safe description produced by {@link describePreparedOperation}. */
1423
+ readonly description: PreparedOperationDescription;
1424
+ /** Raw unsigned inspection returned by the adapter. */
1425
+ readonly transaction: TransactionInspectionResult;
1426
+ /** IDL-aware program error parsed from the inspection failure, if any. */
1427
+ readonly programError: ProgramError | null;
1428
+ }
1429
+ interface OperationInspectionOptions {
1430
+ wallet?: WalletAdapter;
1431
+ inspect?: TransactionInspectionOptions;
1432
+ transactionTransport?: TransactionTransport;
1433
+ }
1003
1434
  interface PreparedTransactionBody {
1004
1435
  readonly name: string;
1005
1436
  readonly instructions: NonEmptyReadonlyArray<BuiltInstruction>;
@@ -1079,6 +1510,7 @@ interface SingleTransactionOperationReceipt<TArtifacts> {
1079
1510
  readonly artifacts: TArtifacts;
1080
1511
  readonly signatures: NonEmptyReadonlyArray<string>;
1081
1512
  readonly transaction: OperationTransactionReceipt;
1513
+ readonly callbackErrors?: readonly OperationCallbackError[];
1082
1514
  }
1083
1515
  interface FlowOperationReceipt<TArtifacts> {
1084
1516
  readonly kind: 'flow';
@@ -1086,6 +1518,7 @@ interface FlowOperationReceipt<TArtifacts> {
1086
1518
  readonly artifacts: TArtifacts;
1087
1519
  readonly signatures: NonEmptyReadonlyArray<string>;
1088
1520
  readonly transactions: NonEmptyReadonlyArray<OperationTransactionReceipt>;
1521
+ readonly callbackErrors?: readonly OperationCallbackError[];
1089
1522
  }
1090
1523
  type OperationReceiptFor<TPrepared extends PreparedOperation> = TPrepared extends PreparedFlow<infer TArtifacts> ? FlowOperationReceipt<TArtifacts> : TPrepared extends PreparedInstruction<infer TArtifacts> ? SingleTransactionOperationReceipt<TArtifacts> : TPrepared extends PreparedTransaction<infer TArtifacts> ? SingleTransactionOperationReceipt<TArtifacts> : never;
1091
1524
  interface OperationExecutionEvent<TPrepared extends PreparedOperation = PreparedOperation> {
@@ -1096,14 +1529,18 @@ interface OperationExecutionEvent<TPrepared extends PreparedOperation = Prepared
1096
1529
  interface OperationExecutionSuccessEvent<TPrepared extends PreparedOperation = PreparedOperation> extends OperationExecutionEvent<TPrepared> {
1097
1530
  readonly receipt: OperationTransactionReceipt;
1098
1531
  }
1532
+ type OperationCallbackPhase = 'transaction-start' | 'transaction-success';
1099
1533
  interface OperationExecutionOptions<TSigner = unknown, TPrepared extends PreparedOperation = PreparedOperation> {
1100
1534
  wallet?: WalletAdapter;
1535
+ transactionTransport?: TransactionTransport;
1101
1536
  send?: SendOptions;
1102
1537
  signers?: readonly TSigner[];
1103
1538
  signerRegistry?: SignerRegistry<TSigner>;
1104
1539
  availableSignerAddresses?: readonly string[];
1105
1540
  onTransactionStart?: (event: OperationExecutionEvent<TPrepared>) => void | Promise<void>;
1106
1541
  onTransactionSuccess?: (event: OperationExecutionSuccessEvent<TPrepared>) => void | Promise<void>;
1542
+ /** Receives observer failures without changing the transaction outcome. */
1543
+ onCallbackError?: (error: OperationCallbackError<TPrepared>) => void | Promise<void>;
1107
1544
  }
1108
1545
  interface OperationExecutionHost<TSigner = unknown> {
1109
1546
  readonly wallet?: WalletAdapter;
@@ -1113,28 +1550,60 @@ interface OperationExecutionHost<TSigner = unknown> {
1113
1550
  send?: SendOptions;
1114
1551
  errors?: ErrorMetadata[];
1115
1552
  signers?: readonly TSigner[];
1553
+ transactionTransport?: TransactionTransport;
1116
1554
  }): Promise<{
1117
1555
  signature: string;
1118
1556
  slot?: number;
1119
1557
  }>;
1120
1558
  }
1559
+ declare class OperationCallbackError<TPrepared extends PreparedOperation = PreparedOperation> extends Error {
1560
+ readonly phase: OperationCallbackPhase;
1561
+ readonly operation: TPrepared;
1562
+ readonly transaction: PreparedTransactionBody;
1563
+ readonly transactionIndex: number;
1564
+ readonly receipt?: OperationTransactionReceipt;
1565
+ readonly cause: unknown;
1566
+ constructor(input: {
1567
+ phase: OperationCallbackPhase;
1568
+ operation: TPrepared;
1569
+ transaction: PreparedTransactionBody;
1570
+ transactionIndex: number;
1571
+ receipt?: OperationTransactionReceipt;
1572
+ cause: unknown;
1573
+ });
1574
+ }
1121
1575
  declare class OperationExecutionError<TPrepared extends PreparedOperation = PreparedOperation> extends Error {
1122
1576
  readonly operation: TPrepared;
1123
1577
  readonly failedTransaction: PreparedTransactionBody;
1124
1578
  readonly failedTransactionIndex: number;
1125
1579
  readonly completedReceipts: readonly OperationTransactionReceipt[];
1580
+ readonly callbackErrors: readonly OperationCallbackError<TPrepared>[];
1581
+ readonly outcome: TransactionFailureOutcome;
1582
+ readonly signature?: string;
1583
+ readonly slot?: number;
1126
1584
  readonly cause: unknown;
1127
1585
  constructor(input: {
1128
1586
  operation: TPrepared;
1129
1587
  failedTransaction: PreparedTransactionBody;
1130
1588
  failedTransactionIndex: number;
1131
1589
  completedReceipts: readonly OperationTransactionReceipt[];
1590
+ callbackErrors?: readonly OperationCallbackError<TPrepared>[];
1591
+ outcome?: TransactionFailureOutcome;
1132
1592
  cause: unknown;
1133
1593
  });
1134
1594
  }
1135
1595
  declare function executePreparedOperation<TPrepared extends PreparedOperation, TSigner = unknown>(host: OperationExecutionHost<TSigner>, operation: TPrepared, options?: OperationExecutionOptions<TSigner, TPrepared>): Promise<OperationReceiptFor<TPrepared>>;
1596
+ /**
1597
+ * Recursively unwrap operation context while retaining structured transaction outcomes.
1598
+ */
1599
+ declare function unwrapOperationExecutionError(error: unknown): InstructionError | TransactionFailureOutcome | unknown;
1136
1600
  declare function toJsonValue(value: unknown): JsonValue;
1137
1601
  declare function describePreparedOperation(operation: PreparedOperation): PreparedOperationDescription;
1602
+ /**
1603
+ * Inspect one prepared instruction/transaction without signing or submission.
1604
+ * Multi-transaction flows are intentionally unsupported.
1605
+ */
1606
+ declare function inspectPreparedOperation(wallet: WalletAdapter | undefined, operation: PreparedOperation, options?: TransactionInspectionOptions, context?: WalletExecutionContext): Promise<OperationInspection>;
1138
1607
  declare function formatPreparedOperation(operation: PreparedOperation): string;
1139
1608
 
1140
1609
  interface InstructionOperation<TInput = unknown, TArtifacts = void> {
@@ -1164,6 +1633,16 @@ declare function flowOperation<TInput, TArtifacts>(prepare: (input: TInput) => M
1164
1633
  declare const STACK_RUNTIME_EXTENSIONS: "__areteStackRuntimeExtensions";
1165
1634
  declare const PROGRAM_OPERATION_EXTENSIONS: "__areteProgramOperationExtensions";
1166
1635
  type EmptyRecord = Record<string, never>;
1636
+ /** Fixed arity, or `[required, total]` when a read has optional arguments. */
1637
+ type ReadArgumentCount = number | readonly [required: number, total: number];
1638
+ type RequiredArgumentCount<TArgs extends readonly unknown[], TCount extends readonly unknown[] = []> = TArgs extends readonly [infer THead, ...infer TTail] ? undefined extends THead ? TCount['length'] : RequiredArgumentCount<TTail, readonly [...TCount, unknown]> : TCount['length'];
1639
+ type ReadArgumentCountFor<TRead> = TRead extends (...args: infer TArgs) => unknown ? number extends Required<TArgs>['length'] ? ReadArgumentCount : RequiredArgumentCount<TArgs> extends Required<TArgs>['length'] ? Required<TArgs>['length'] : readonly [
1640
+ required: RequiredArgumentCount<TArgs>,
1641
+ total: Required<TArgs>['length']
1642
+ ] : never;
1643
+ type ReadArgumentCounts<TRead = Record<string, unknown>> = {
1644
+ readonly [K in keyof TRead]: ReadArgumentCountFor<TRead[K]>;
1645
+ };
1167
1646
  type MaybeField<TKey extends string, TValue> = [TValue] extends [never] ? {} : {
1168
1647
  readonly [K in TKey]: TValue;
1169
1648
  };
@@ -1195,7 +1674,7 @@ interface ProgramRuntimeExtensionCarrier<TOperations extends AnyProgramOperation
1195
1674
  }
1196
1675
  type ProgramOperationsOf<TProgram> = TProgram extends ProgramRuntimeExtensionCarrier<infer TOperations> ? TOperations : ProgramOperations;
1197
1676
  type MergeProgramOperations<TBase extends AnyProgramOperations, TExtension extends AnyProgramOperations> = ProgramOperations<Extract<MergeField<InstructionOperationsOf<TBase>, InstructionOperationsOf<TExtension>>, InstructionOperationNamespace | EmptyRecord>, Extract<MergeField<TransactionOperationsOf<TBase>, TransactionOperationsOf<TExtension>>, TransactionOperationNamespace | EmptyRecord>, Extract<MergeField<FlowOperationsOf<TBase>, FlowOperationsOf<TExtension>>, FlowOperationNamespace | EmptyRecord>>;
1198
- type ExtendedProgramDefinition<TBase extends ProgramSdkDefinition, TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never> = TBase & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath> & ProgramRuntimeExtensionCarrier<MergeProgramOperations<ProgramOperationsOf<TBase>, TOperations>>;
1677
+ type ExtendedProgramDefinition<TBase extends ProgramSdkDefinition, TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never> = Omit<TBase, 'definitionHash'> & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath> & ProgramRuntimeExtensionCarrier<MergeProgramOperations<ProgramOperationsOf<TBase>, TOperations>>;
1199
1678
  interface ProgramExtensionInput<TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition, TMath = never> {
1200
1679
  readonly pdas?: Record<string, unknown>;
1201
1680
  readonly accounts?: Record<string, unknown>;
@@ -1222,6 +1701,7 @@ declare function extendPrograms<TPrograms extends Record<string, ProgramSdkDefin
1222
1701
  };
1223
1702
  declare function getProgramRuntimeExtensions<TProgram extends ProgramSdkDefinition>(program: TProgram): ProgramRuntimeExtensions<ProgramOperationsOf<TProgram>, TProgram> | undefined;
1224
1703
  interface StackRuntimeExtensions<TRead = EmptyRecord, TFlows extends FlowOperationNamespace | EmptyRecord = EmptyRecord, TClient = unknown> {
1704
+ readonly readArgCounts?: ReadArgumentCounts<TRead>;
1225
1705
  readonly createRead?: (client: TClient) => TRead;
1226
1706
  readonly createFlows?: (client: TClient) => TFlows;
1227
1707
  }
@@ -1238,16 +1718,22 @@ interface StackExtensionInput<TAddresses = never, TConstants = never, TDefaults
1238
1718
  readonly constants?: TConstants;
1239
1719
  readonly defaults?: TDefaults;
1240
1720
  readonly math?: TMath;
1721
+ readonly readArgCounts?: ReadArgumentCounts<TRead>;
1241
1722
  readonly createRead?: (client: TClient) => TRead;
1242
1723
  readonly createFlows?: (client: TClient) => TFlows;
1243
1724
  }
1725
+ type ReadArgumentCountRequirement<TExtension> = TExtension extends {
1726
+ readonly createRead: (...args: any[]) => infer TRead;
1727
+ } ? {
1728
+ readonly readArgCounts: ReadArgumentCounts<TRead>;
1729
+ } : {};
1244
1730
  type StackExtensionClient<TBase extends StackDefinition, TAddresses = never, TConstants = never, TDefaults = never, TMath = never> = Arete$1<TBase> & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath>;
1245
- declare function defineStackExtensions<TBase extends StackDefinition>(): <TExtension extends StackExtensionInput<any, any, any, any, any, FlowOperationNamespace | EmptyRecord, any>>(extensions: TExtension & {
1731
+ declare function defineStackExtensions<TBase extends StackDefinition>(): <const TExtension extends StackExtensionInput<any, any, any, any, any, FlowOperationNamespace | EmptyRecord, any>>(extensions: TExtension & ReadArgumentCountRequirement<TExtension> & {
1246
1732
  readonly createRead?: (client: StackExtensionClient<TBase, any, any, any, any>) => unknown;
1247
1733
  readonly createFlows?: (client: StackExtensionClient<TBase, any, any, any, any>) => FlowOperationNamespace | EmptyRecord;
1248
1734
  }) => TExtension;
1249
- declare function extendStack<TBase extends StackDefinition, TExtension extends StackExtensionInput<any, any, any, any, any, any, any>>(stack: TBase, extensions: 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>>;
1250
- declare function getStackRuntimeExtensions<TStack extends StackDefinition>(stack: TStack): StackRuntimeExtensions | undefined;
1735
+ 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>>;
1736
+ declare function getStackRuntimeExtensions<TStack extends StackDefinition>(stack: TStack): StackRuntimeExtensions<StackReadOf<TStack>> | undefined;
1251
1737
  declare function applyConnectedStackExtensions<TClient extends object, TStack extends StackDefinition>(client: TClient, stack: TStack): ConnectedStackClient<TClient, TStack>;
1252
1738
 
1253
1739
  type ProgramMap = Record<string, ProgramSdkDefinition>;
@@ -1268,11 +1754,21 @@ interface ConnectOptions<TPrograms extends ProgramMap | undefined = undefined> {
1268
1754
  transport?: 'ws' | 'http';
1269
1755
  storage?: StorageAdapter;
1270
1756
  maxEntriesPerView?: number | null;
1757
+ /** Connect immediately when the client is created (defaults to true). */
1758
+ autoConnect?: boolean;
1759
+ /** Reconnect automatically after an established connection is lost (defaults to true). */
1271
1760
  autoReconnect?: boolean;
1272
1761
  reconnectIntervals?: number[];
1273
1762
  maxReconnectAttempts?: number;
1274
1763
  flushIntervalMs?: number;
1764
+ /**
1765
+ * Generated schemas are always applied to normalize typed entities. Set this
1766
+ * to `false` to suppress console warnings for rejected frames while keeping
1767
+ * schema normalization and `onFrameValidationError` active.
1768
+ */
1275
1769
  validateFrames?: boolean;
1770
+ /** Observe generated-schema rejections without scraping console warnings. */
1771
+ onFrameValidationError?: (diagnostic: FrameValidationDiagnostic) => void;
1276
1772
  /** Authentication configuration */
1277
1773
  auth?: AuthConfig;
1278
1774
  /** Default wallet adapter used for instruction execution (overridable per call). */
@@ -1294,9 +1790,11 @@ interface AreteOptionsWithStorage<TStack extends StackDefinition> extends AreteO
1294
1790
  wallet?: WalletAdapter;
1295
1791
  fetch?: typeof fetch;
1296
1792
  execution?: OperationExecutionOptions<any>;
1793
+ onFrameValidationError?: (diagnostic: FrameValidationDiagnostic) => void;
1297
1794
  }
1298
1795
  interface TransactionOptions<TSigner = unknown> {
1299
1796
  wallet?: WalletAdapter;
1797
+ transactionTransport?: TransactionTransport;
1300
1798
  send?: SendOptions;
1301
1799
  errors?: ErrorMetadata[];
1302
1800
  signers?: readonly TSigner[];
@@ -1365,10 +1863,12 @@ declare class Arete$1<TStack extends StackDefinition> {
1365
1863
  private readonly storage;
1366
1864
  private readonly processor;
1367
1865
  private readonly subscriptionRegistry;
1866
+ private readonly queryStore;
1368
1867
  private readonly _views;
1369
1868
  private readonly _queries;
1370
1869
  private readonly _programs;
1371
1870
  private readonly _chain;
1871
+ private readonly _transactions;
1372
1872
  private readonly stack;
1373
1873
  private readonly httpBaseUrl;
1374
1874
  private readonly fetchImpl;
@@ -1392,6 +1892,7 @@ declare class Arete$1<TStack extends StackDefinition> {
1392
1892
  get queries(): QueriesInterface<TStack['queries']>;
1393
1893
  get programs(): ProgramsInterface<TStack['programs']>;
1394
1894
  get chain(): ChainClient;
1895
+ get transactions(): TransactionTransport;
1395
1896
  /** The default wallet adapter, if one was configured. */
1396
1897
  get wallet(): WalletAdapter | undefined;
1397
1898
  /** The connected wallet address, if a default wallet was configured. */
@@ -1415,11 +1916,20 @@ declare class Arete$1<TStack extends StackDefinition> {
1415
1916
  */
1416
1917
  transaction(instructions: readonly BuiltInstruction[], options?: TransactionOptions): Promise<ExecutionResult>;
1417
1918
  execute<TPrepared extends PreparedOperation, TSigner = unknown>(prepared: TPrepared, options?: OperationExecutionOptions<TSigner, TPrepared>): Promise<OperationReceiptFor<TPrepared>>;
1919
+ /** Inspect one prepared instruction/transaction without signing or submitting it. */
1920
+ inspectOperation(prepared: PreparedOperation, options?: OperationInspectionOptions): Promise<OperationInspection>;
1418
1921
  /** Error metadata from every handler in the stack, deduped by code. */
1419
1922
  private aggregateErrors;
1420
1923
  get connectionState(): ConnectionState;
1421
1924
  get stackName(): string;
1422
1925
  get store(): StorageAdapter;
1926
+ /** Highest Solana slot whose streamed frame has been stored locally. */
1927
+ get processedSlot(): bigint | null;
1928
+ /**
1929
+ * Wait until a frame at or beyond `slot` has been applied to local storage.
1930
+ * Buffered frames satisfy the wait only after their storage batch is flushed.
1931
+ */
1932
+ waitForProcessedSlot(slot: number | bigint, options?: WaitForProcessedSlotOptions): Promise<bigint>;
1423
1933
  onConnectionStateChange(callback: ConnectionStateCallback): UnsubscribeFn;
1424
1934
  onFrame(callback: (frame: Frame) => void): UnsubscribeFn;
1425
1935
  onSocketIssue(callback: SocketIssueCallback): UnsubscribeFn;
@@ -1430,6 +1940,7 @@ declare class Arete$1<TStack extends StackDefinition> {
1430
1940
  getStore(): StorageAdapter;
1431
1941
  getConnection(): ConnectionManager;
1432
1942
  getSubscriptionRegistry(): SubscriptionRegistry;
1943
+ getQueryStore(): QueryStore;
1433
1944
  }
1434
1945
 
1435
1946
  /**
@@ -1458,6 +1969,7 @@ interface SessionMemberOptions<TPrograms extends Record<string, ProgramSdkDefini
1458
1969
  transport?: 'ws' | 'http';
1459
1970
  auth?: AuthConfig;
1460
1971
  storage?: StorageAdapter;
1972
+ autoConnect?: boolean;
1461
1973
  autoReconnect?: boolean;
1462
1974
  programs?: TPrograms;
1463
1975
  }
@@ -1466,6 +1978,8 @@ interface SessionOptions<TDef extends SessionDefinition = SessionDefinition, TSt
1466
1978
  wallet?: WalletAdapter;
1467
1979
  /** Canonical chain reader shared by the session when explicitly provided. */
1468
1980
  chain?: ChainClient;
1981
+ /** Transaction transport override; defaults to the execution host's authenticated client. */
1982
+ transactions?: TransactionTransport;
1469
1983
  auth?: AuthConfig;
1470
1984
  fetch?: typeof fetch;
1471
1985
  /** Default transport for all members ('ws' unless overridden). */
@@ -1504,6 +2018,7 @@ interface Session<TDef extends SessionDefinition = SessionDefinition, TStackProg
1504
2018
  readonly wallet: WalletAdapter | undefined;
1505
2019
  readonly signerRegistry: SignerRegistry<any>;
1506
2020
  readonly chain: ChainClient;
2021
+ readonly transactions: TransactionTransport;
1507
2022
  transaction(instructions: readonly BuiltInstruction[], options?: TransactionOptions): Promise<ExecutionResult>;
1508
2023
  execute<TPrepared extends PreparedOperation, TSigner = unknown>(prepared: TPrepared, options?: OperationExecutionOptions<TSigner, TPrepared>): Promise<OperationReceiptFor<TPrepared>>;
1509
2024
  setWallet(wallet: WalletAdapter | undefined): void;
@@ -1549,6 +2064,8 @@ declare function parseUiAmountToRaw(value: string | number, decimals: number): b
1549
2064
  declare function formatRawToUi(raw: bigint | string | number, decimals: number): string;
1550
2065
  /** Resolve an {@link AmountInput} to raw base units with known decimals. */
1551
2066
  declare function toRawAmount(amount: AmountInput, decimals: number): bigint;
2067
+ /** Convert an amount to raw units without throwing on invalid user input. */
2068
+ declare function safeToRawAmount(amount: AmountInput, decimals: number): SchemaResult<bigint>;
1552
2069
  /** Fetch a mint's decimals via the chain read endpoint, throwing when unavailable. */
1553
2070
  declare function getMintDecimals(chain: ChainClient, mint: string): Promise<number>;
1554
2071
  /**
@@ -1570,6 +2087,24 @@ declare function resolveAmountsToRaw<TInputs extends Record<string, AmountResolu
1570
2087
  [K in keyof TInputs]: bigint;
1571
2088
  }>;
1572
2089
 
2090
+ /**
2091
+ * Recursively convert bigints to their decimal string form.
2092
+ *
2093
+ * Streamed entities contain bigints, which makes them unsafe to pass through
2094
+ * anything that JSON-stringifies (React's dev-mode performance tooling, log
2095
+ * pipelines, `JSON.stringify` persistence). Prefer stack-provided UI fields
2096
+ * (e.g. `deployedPerSquareUi`) when they exist; use this for the remaining
2097
+ * raw values such as account snapshots.
2098
+ *
2099
+ * Arrays and plain objects are converted structurally and the return type
2100
+ * maps every `bigint` to `string`; class instances (PublicKey, Date, …) are
2101
+ * returned untouched.
2102
+ */
2103
+ type StringifiedBigints<T> = T extends bigint ? string : T extends readonly (infer U)[] ? readonly StringifiedBigints<U>[] : T extends object ? {
2104
+ [K in keyof T]: StringifiedBigints<T[K]>;
2105
+ } : T;
2106
+ declare function stringifyBigints<T>(value: T): StringifiedBigints<T>;
2107
+
1573
2108
  declare class ReadRequestError extends Error {
1574
2109
  readonly status: number;
1575
2110
  readonly path: string;
@@ -1600,63 +2135,6 @@ declare function stackQuery<TParams = unknown, TResult = unknown>(input: {
1600
2135
  schema?: Schema<TResult>;
1601
2136
  }): StackQueryDefinition<TParams, TResult>;
1602
2137
 
1603
- interface FrameProcessorConfig {
1604
- maxEntriesPerView?: number | null;
1605
- /**
1606
- * Interval in milliseconds to buffer frames before flushing to storage.
1607
- * Set to 0 for immediate processing (no buffering).
1608
- * Default: 0 (immediate)
1609
- *
1610
- * For React applications, 16ms (one frame at 60fps) is recommended to
1611
- * reduce unnecessary re-renders during high-frequency updates.
1612
- */
1613
- flushIntervalMs?: number;
1614
- schemas?: Record<string, Schema<unknown>>;
1615
- patchSchemas?: Record<string, Schema<unknown>>;
1616
- }
1617
- declare class FrameProcessor {
1618
- private storage;
1619
- private maxEntriesPerView;
1620
- private flushIntervalMs;
1621
- private schemas?;
1622
- private patchSchemas?;
1623
- private pendingUpdates;
1624
- private flushTimer;
1625
- private isProcessing;
1626
- constructor(storage: StorageAdapter, config?: FrameProcessorConfig);
1627
- private getSchema;
1628
- private normalizeEntity;
1629
- private hasSchema;
1630
- private normalizePathSegment;
1631
- private normalizePath;
1632
- private normalizeSortConfig;
1633
- private normalizeAppendPaths;
1634
- private extractSeq;
1635
- private getInternalSeq;
1636
- private attachInternalSeq;
1637
- handleFrame<T>(frame: Frame<T>): void;
1638
- /**
1639
- * Immediately flush all pending updates.
1640
- * Useful for ensuring all updates are processed before reading state.
1641
- */
1642
- flush(): void;
1643
- /**
1644
- * Clean up any pending timers. Call when disposing the processor.
1645
- */
1646
- dispose(): void;
1647
- private scheduleFlush;
1648
- private flushPendingUpdates;
1649
- private processFrame;
1650
- private processFrameWithoutEnforce;
1651
- private handleSubscribedFrame;
1652
- private handleSnapshotFrame;
1653
- private handleSnapshotFrameWithoutEnforce;
1654
- private handleEntityFrame;
1655
- private handleEntityFrameWithoutEnforce;
1656
- private emitRichUpdate;
1657
- private enforceMaxEntries;
1658
- }
1659
-
1660
2138
  declare class MemoryAdapter implements StorageAdapter {
1661
2139
  private views;
1662
2140
  private updateCallbacks;
@@ -1679,11 +2157,12 @@ declare class MemoryAdapter implements StorageAdapter {
1679
2157
  notifyRichUpdate<T>(viewPath: string, key: string, update: RichUpdate<T>): void;
1680
2158
  }
1681
2159
 
1682
- declare function createUpdateStream<T>(storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, subscription: Subscription, keyFilter?: string): AsyncIterable<Update<T>>;
1683
- declare function createEntityStream<T>(storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, subscription: Subscription, options?: WatchOptions<any>, keyFilter?: string): AsyncIterable<T>;
1684
- declare function createRichUpdateStream<T>(storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, subscription: Subscription, keyFilter?: string): AsyncIterable<RichUpdate<T>>;
2160
+ declare function createUpdateStream<T>(_storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, query: SubscriptionQuery, keyFilter?: string, snapshotEnabled?: boolean): AsyncIterable<Update<T>>;
2161
+ declare function createEntityStream<T>(_storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, query: SubscriptionQuery, options?: WatchOptions<any>, keyFilter?: string): AsyncIterable<T>;
2162
+ declare function createRichUpdateStream<T>(_storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry, query: SubscriptionQuery, keyFilter?: string, snapshotEnabled?: boolean): AsyncIterable<RichUpdate<T>>;
1685
2163
 
1686
- declare function createTypedStateView<T>(viewDef: ViewDef<T, 'state'>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedStateView<T>;
2164
+ declare function serializeViewKey<TKey>(viewDef: ViewDef<unknown, 'state', TKey>, key: TKey): string;
2165
+ declare function createTypedStateView<T, TKey = unknown>(viewDef: ViewDef<T, 'state', TKey>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedStateView<T, DefaultViewKey<TKey>>;
1687
2166
  declare function createTypedListView<T>(viewDef: ViewDef<T, 'list'>, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedListView<T>;
1688
2167
  declare function createTypedViews<TStack extends StackDefinition>(stack: TStack, storage: StorageAdapter, subscriptionRegistry: SubscriptionRegistry): TypedViews<TStack['views']>;
1689
2168
 
@@ -1691,5 +2170,5 @@ declare const Arete: typeof Arete$1 & {
1691
2170
  session: typeof createSession;
1692
2171
  };
1693
2172
 
1694
- export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, FrameProcessor, InstructionError, MemoryAdapter, OperationExecutionError, PROGRAM_OPERATION_EXTENSIONS, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, chainAccountLoader, createChainClient, createEntityStream, createInstructionExecutor, createInstructionHandler, createPreparedFlow, createPreparedInstruction, createPreparedTransaction, createPreparedTransactionBody, createProgramPdas, createPublicKeySeed, createRichUpdateStream, createSeed, createSession, createSignerRegistry, 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, getProgramRuntimeExtensions, getStackRuntimeExtensions, instructionOperation, isEntityFrame, isSnapshotFrame, isSubscribedFrame, isValidFrame, literal, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, serializeInstructionData, stackQuery, toJsonValue, toRawAmount, transactionOperation, validateAccountResolution, withPrograms };
1695
- export type { AccountCategory, AccountLoader, AccountMeta, AccountResolutionOptions, AccountResolutionResult, AmountInput, AnyOperation, AreteConfig, AreteOptions, AreteOptionsWithStorage, ArgSchema, ArgType, AuthConfig, AuthTokenResult, BuildOptions, BuiltAccountMeta, BuiltInstruction, ChainClient, ChainClock, ConfirmationLevel, ConnectOptions, ConnectedArete, ConnectedStackClient, ConnectionState, ConnectionStateCallback, CreatePreparedFlowInput, CreatePreparedInstructionInput, CreatePreparedTransactionInput, EntityFrame, ErrorMetadata, ExecuteOptions, ExecutionResult, ExtendedProgramDefinition, ExtendedStackDefinition, FlowOperation, FlowOperationNamespace, FlowOperationReceipt, Frame, FrameMode, FrameOp, FrameProcessorConfig, InstructionExecutor, InstructionHandler, InstructionHandlerConfig, InstructionOperation, InstructionOperationNamespace, JsonObject, JsonPrimitive, JsonValue, MergeProgramMaps, MintAccountInfo, NonEmptyReadonlyArray, OperationExecutionEvent, OperationExecutionHost, OperationExecutionOptions, OperationExecutionSuccessEvent, OperationKind, OperationNamespace, OperationPlan, OperationReceiptFor, OperationTransactionReceipt, PdaConfig, PdaDeriveContext, PdaFactory, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramRuntimeExtensionCarrier, ProgramRuntimeExtensions, ProgramSdkDefinition, ProgramsInterface, QueriesInterface, RawAccountInfo, RawInstructionsInterface, RawProgramsInterface, ReadTransportMethod, ResolvedAccount, ResolvedAccounts, RichUpdate, RichUpdateCallback, Schema, SchemaResult, SeedDef, SendOptions, SendResult, Session, SessionDefinition, SessionMemberOptions, SessionOptions, SignerRegistry, SingleTransactionOperationReceipt, SnapshotEntity, SnapshotFrame, SocketIssue, SocketIssueCallback, SortConfig, SortOrder, StackConnectedExtensions, StackDefinition, StackEndpoints, StackExtensionClient, StackExtensionInput, StackQueryDefinition, StackRuntimeExtensionCarrier, StackRuntimeExtensions, StackWithAttachedPrograms, StorageAdapter, StorageAdapterConfig, SubscribeCallback, SubscribedFrame, Subscription, TokenAccountInfo, TokenBalanceInfo, TransactionOperation, TransactionOperationNamespace, TransactionOptions, TypedAccountReader, TypedInstruction, TypedListView, TypedQueryExecutor, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, Update, UpdateCallback, ViewDef, ViewGroup, ViewSortConfig, WalletAdapter, WalletConnectOptions, WalletState, WatchOptions, WebSocketFactoryInit };
2173
+ export { ASSOCIATED_TOKEN_PROGRAM_ADDRESS, Arete, AreteError, ConnectionManager, DEFAULT_CONFIG, DEFAULT_MAX_ENTRIES_PER_VIEW, FrameProcessor, InstructionError, MemoryAdapter, OperationCallbackError, OperationExecutionError, PROGRAM_OPERATION_EXTENSIONS, ProcessedSlotTimeoutError, QueryStore, ReadRequestError, SPL_TOKEN_PROGRAM_ADDRESS, STACK_RUNTIME_EXTENSIONS, SYSTEM_PROGRAM_ADDRESS, SubscriptionRegistry, TOKEN_2022_PROGRAM_ADDRESS, TransactionExecutionError, TransactionTransportError, account, appendFlowTransactions, appendTransactionInstructions, applyConnectedStackExtensions, arg, buildInstruction, bytes, canonicalQueryKey, chainAccountLoader, createChainClient, createEntityStream, 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, getProgramRuntimeExtensions, getStackRuntimeExtensions, getTransactionFailureOutcome, inspectPreparedOperation, instructionOperation, isEntityFrame, isErrorFrame, isHostedAreteEndpoint, isSnapshotFrame, isSubscribedFrame, isUnsubscribedFrame, isValidFrame, literal, normalizeSubscription, normalizeSubscriptionQuery, normalizeSubscriptionRequest, normalizeTransactionError, parseFrame, parseFrameFromBlob, parseInstructionError, parseUiAmountToRaw, pda, prependFlowTransactionInstructions, prependTransactionInstructions, programAccountRead, programQuery, resolveAccounts, resolveAmount, resolveAmountToRaw, resolveAmountsToRaw, resolveTokenProgramAddress, safeToRawAmount, serializeInstructionData, serializeViewKey, stackQuery, stringifyBigints, toJsonValue, toRawAmount, transactionOperation, unwrapOperationExecutionError, validateAccountResolution, validateSubscriptionId, withPrograms };
2174
+ export type { AccountCategory, AccountLoader, AccountMeta, AccountResolutionOptions, AccountResolutionResult, AmountInput, AnyOperation, AreteConfig, AreteOptions, AreteOptionsWithStorage, ArgSchema, ArgType, AuthConfig, AuthTokenRequest, AuthTokenResult, BuildOptions, BuiltAccountMeta, BuiltInstruction, ChainClient, ChainClock, ChainFailedTransactionOutcome, 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, InstructionExecutor, InstructionHandler, InstructionHandlerConfig, InstructionOperation, InstructionOperationNamespace, JsonObject, JsonPrimitive, JsonValue, LatestBlockhashResult, MergeProgramMaps, MintAccountInfo, NativeBalanceInfo, NonEmptyReadonlyArray, NotSubmittedTransactionOutcome, OperationCallbackPhase, OperationExecutionEvent, OperationExecutionHost, OperationExecutionOptions, OperationExecutionSuccessEvent, OperationInspection, OperationInspectionOptions, OperationKind, OperationNamespace, OperationPlan, OperationReceiptFor, OperationTransactionReceipt, PdaConfig, PdaDeriveContext, PdaFactory, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramRuntimeExtensionCarrier, ProgramRuntimeExtensions, ProgramSdkDefinition, ProgramsInterface, QueriesInterface, QueryLease, QuerySnapshot, RawAccountInfo, RawInstructionsInterface, RawProgramsInterface, ReadArgumentCount, ReadArgumentCounts, ReadTransportMethod, ResolvedAccount, ResolvedAccounts, RichUpdate, RichUpdateCallback, Schema, SchemaResult, SeedDef, SendOptions, SendResult, Session, SessionDefinition, SessionMemberOptions, SessionOptions, SignerRegistry, SingleTransactionOperationReceipt, SnapshotEntity, SnapshotFrame, SocketIssue, SocketIssueCallback, SortConfig, SortOrder, StackConnectedExtensions, StackDefinition, StackEndpoints, StackExtensionClient, StackExtensionInput, StackQueryDefinition, StackRuntimeExtensionCarrier, StackRuntimeExtensions, StackWithAttachedPrograms, StorageAdapter, StorageAdapterConfig, StringifiedBigints, SubmittedUnknownTransactionOutcome, SubscribeCallback, SubscribedFrame, Subscription, SubscriptionIdentity, SubscriptionOptions, SubscriptionQuery, SubscriptionRequest, SubscriptionSnapshotOptions, TokenAccountInfo, TokenBalanceInfo, TokenBalanceInput, TransactionCommitment, TransactionFailureOutcome, TransactionFailurePhase, TransactionFailureStatus, TransactionFeeResult, TransactionInspectionOptions, TransactionInspectionResult, TransactionOperation, TransactionOperationNamespace, TransactionOptions, TransactionOutcome, TransactionRequestContext, TransactionSendOptions, TransactionSendResult, TransactionSignatureStatus, TransactionSimulationOptions, TransactionSimulationResult, TransactionTransport, TransactionTransportErrorBody, TypedAccountReader, TypedInstruction, TypedListView, TypedQueryExecutor, TypedStateView, TypedViewGroup, TypedViews, UnsubscribeFn, UnsubscribedFrame, Update, UpdateCallback, ViewDef, ViewGroup, ViewKeyFields, ViewKeyValue, ViewSortConfig, WaitForProcessedSlotOptions, WalletAdapter, WalletConnectOptions, WalletExecutionContext, WalletState, WatchOptions, WebSocketFactoryInit };