@usearete/sdk 0.3.0 → 0.4.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/README.md +58 -0
- package/dist/index.cjs +808 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +214 -20
- package/dist/index.esm.js +807 -80
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -751,10 +751,26 @@ interface StackEndpoints {
|
|
|
751
751
|
type ReadTransportMethod = 'GET' | 'POST';
|
|
752
752
|
interface ProgramAccountReadDefinition<T> {
|
|
753
753
|
readonly account: string;
|
|
754
|
-
readonly path: string;
|
|
755
754
|
readonly schema?: Schema<T>;
|
|
756
755
|
readonly _result?: T;
|
|
757
756
|
}
|
|
757
|
+
type ProgramAccountBatchItem<T> = {
|
|
758
|
+
readonly address: string;
|
|
759
|
+
readonly status: 'ok';
|
|
760
|
+
readonly value: T;
|
|
761
|
+
} | {
|
|
762
|
+
readonly address: string;
|
|
763
|
+
readonly status: 'missing';
|
|
764
|
+
} | {
|
|
765
|
+
readonly address: string;
|
|
766
|
+
readonly status: 'error';
|
|
767
|
+
readonly error: {
|
|
768
|
+
readonly code: string;
|
|
769
|
+
};
|
|
770
|
+
};
|
|
771
|
+
interface ProgramAccountBatchResult<T> {
|
|
772
|
+
readonly items: readonly ProgramAccountBatchItem<T>[];
|
|
773
|
+
}
|
|
758
774
|
interface ProgramQueryDefinition<TParams = unknown, TResult = unknown> {
|
|
759
775
|
readonly name: string;
|
|
760
776
|
readonly path: string;
|
|
@@ -774,8 +790,11 @@ interface StackQueryDefinition<TParams = unknown, TResult = unknown> {
|
|
|
774
790
|
interface ProgramSdkDefinition {
|
|
775
791
|
readonly name: string;
|
|
776
792
|
readonly programId?: string;
|
|
777
|
-
/**
|
|
778
|
-
readonly
|
|
793
|
+
/** Typed identity of the generated program behavior and compiler provenance. */
|
|
794
|
+
readonly sdkDefinitionHash?: string;
|
|
795
|
+
readonly programSpecHash?: string;
|
|
796
|
+
readonly idlContentHash?: string;
|
|
797
|
+
readonly normalizedIdlHash?: string;
|
|
779
798
|
readonly schemas?: Record<string, Schema<unknown>>;
|
|
780
799
|
readonly pdas?: Record<string, unknown>;
|
|
781
800
|
readonly accounts?: Record<string, ProgramAccountReadDefinition<unknown>>;
|
|
@@ -786,14 +805,88 @@ interface ProgramSdkDefinition {
|
|
|
786
805
|
readonly defaults?: unknown;
|
|
787
806
|
readonly math?: unknown;
|
|
788
807
|
}
|
|
789
|
-
interface
|
|
808
|
+
interface ProgramReleaseReference {
|
|
809
|
+
readonly programReleaseHash: string;
|
|
810
|
+
readonly programSpecHash: string;
|
|
811
|
+
}
|
|
812
|
+
/** Public, non-secret metadata describing how an HTTP bearer token is acquired. */
|
|
813
|
+
interface HttpAuthMetadata {
|
|
814
|
+
readonly required?: boolean;
|
|
815
|
+
readonly mode?: string;
|
|
816
|
+
readonly sessionEndpoint: string;
|
|
817
|
+
readonly jwksUrl?: string;
|
|
818
|
+
readonly tokenTransport?: string;
|
|
819
|
+
readonly audience?: string;
|
|
820
|
+
readonly targetKind: 'program-read-binding';
|
|
821
|
+
readonly targetId: string;
|
|
822
|
+
readonly scopes?: readonly string[];
|
|
823
|
+
readonly acceptedKeyClasses?: readonly string[];
|
|
824
|
+
}
|
|
825
|
+
interface ProgramReadBinding {
|
|
826
|
+
readonly endpoint: string;
|
|
827
|
+
readonly programReadBindingId: string;
|
|
828
|
+
readonly auth: HttpAuthMetadata;
|
|
829
|
+
}
|
|
830
|
+
type SolanaGatewayAuthScope = 'read' | 'transaction:inspect' | 'transaction:send';
|
|
831
|
+
/** Complete public auth metadata emitted for a hosted Solana gateway binding. */
|
|
832
|
+
interface SolanaGatewayAuthMetadata {
|
|
833
|
+
readonly required: boolean;
|
|
834
|
+
readonly mode: string;
|
|
835
|
+
readonly sessionEndpoint: string;
|
|
836
|
+
readonly jwksUrl: string;
|
|
837
|
+
readonly tokenTransport: string;
|
|
838
|
+
readonly audience: 'arete:solana-gateway';
|
|
839
|
+
readonly targetKind: 'solana-gateway-binding';
|
|
840
|
+
readonly targetId: string;
|
|
841
|
+
readonly scopes: readonly SolanaGatewayAuthScope[];
|
|
842
|
+
readonly acceptedKeyClasses: readonly string[];
|
|
843
|
+
readonly transactionEntitlementRequired: boolean;
|
|
844
|
+
}
|
|
845
|
+
/** One generated, non-inheriting hosted Solana gateway capability binding. */
|
|
846
|
+
interface HostedSolanaGatewayCapabilityBinding {
|
|
847
|
+
readonly endpoint: string;
|
|
848
|
+
readonly authPolicy: string;
|
|
849
|
+
readonly solanaGatewayBindingId: string;
|
|
850
|
+
readonly cluster: string;
|
|
851
|
+
readonly region: string;
|
|
852
|
+
readonly auth: SolanaGatewayAuthMetadata;
|
|
853
|
+
}
|
|
854
|
+
interface HostedSolanaGatewayBindings {
|
|
855
|
+
readonly chain: HostedSolanaGatewayCapabilityBinding;
|
|
856
|
+
readonly transactions: HostedSolanaGatewayCapabilityBinding;
|
|
857
|
+
}
|
|
858
|
+
/** Generated release identity with one explicit, non-inheriting read transport. */
|
|
859
|
+
type ProgramReadDescriptor = {
|
|
860
|
+
readonly release: ProgramReleaseReference;
|
|
861
|
+
readonly transport: {
|
|
862
|
+
readonly kind: 'local-http';
|
|
863
|
+
readonly endpointSource: 'connect-http-url';
|
|
864
|
+
};
|
|
865
|
+
} | {
|
|
866
|
+
readonly release: ProgramReleaseReference;
|
|
867
|
+
readonly transport: {
|
|
868
|
+
readonly kind: 'hosted-binding';
|
|
869
|
+
readonly binding: ProgramReadBinding;
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
/** Runtime overrides replace the complete generated descriptor. */
|
|
873
|
+
type ProgramReadOverride = ProgramReadDescriptor;
|
|
874
|
+
type ProgramReadDescriptors<TPrograms extends Record<string, ProgramSdkDefinition> | undefined> = TPrograms extends Record<string, ProgramSdkDefinition> ? {
|
|
875
|
+
readonly [K in keyof TPrograms]: ProgramReadDescriptor;
|
|
876
|
+
} : Record<string, never>;
|
|
877
|
+
type ProgramReadOverrides<TPrograms extends Record<string, ProgramSdkDefinition> | undefined> = TPrograms extends Record<string, ProgramSdkDefinition> ? {
|
|
878
|
+
readonly [K in keyof TPrograms]?: ProgramReadOverride;
|
|
879
|
+
} : Record<string, never>;
|
|
880
|
+
interface StackDefinition<TPrograms extends Record<string, ProgramSdkDefinition> = Record<string, ProgramSdkDefinition>> {
|
|
790
881
|
readonly name: string;
|
|
791
882
|
readonly endpoints: StackEndpoints;
|
|
792
883
|
readonly views: Record<string, ViewGroup>;
|
|
793
884
|
readonly schemas?: Record<string, Schema<unknown>>;
|
|
794
885
|
readonly patchSchemas?: Record<string, Schema<unknown>>;
|
|
795
886
|
readonly queries?: Record<string, StackQueryDefinition<unknown, unknown>>;
|
|
796
|
-
readonly programs?:
|
|
887
|
+
readonly programs?: TPrograms;
|
|
888
|
+
/** Release and transport metadata keyed in parallel with `programs`. */
|
|
889
|
+
readonly programReads?: ProgramReadDescriptors<TPrograms>;
|
|
797
890
|
}
|
|
798
891
|
interface ViewGroup {
|
|
799
892
|
state?: ViewDef<any, 'state', any>;
|
|
@@ -886,9 +979,27 @@ interface AuthTokenResult {
|
|
|
886
979
|
expires_at?: number;
|
|
887
980
|
scopes?: readonly string[];
|
|
888
981
|
}
|
|
889
|
-
interface
|
|
890
|
-
|
|
891
|
-
|
|
982
|
+
interface ProgramReadBindingAuthTarget {
|
|
983
|
+
readonly targetKind: 'program-read-binding';
|
|
984
|
+
readonly targetId: string;
|
|
985
|
+
readonly programReleaseHash: string;
|
|
986
|
+
}
|
|
987
|
+
interface SolanaGatewayBindingAuthTarget {
|
|
988
|
+
readonly targetKind: 'solana-gateway-binding';
|
|
989
|
+
readonly targetId: string;
|
|
990
|
+
readonly programReleaseHash?: never;
|
|
991
|
+
}
|
|
992
|
+
type AuthTokenTarget = ProgramReadBindingAuthTarget | SolanaGatewayBindingAuthTarget;
|
|
993
|
+
type AuthTokenRequest = {
|
|
994
|
+
readonly scopes: readonly string[];
|
|
995
|
+
readonly targetKind?: never;
|
|
996
|
+
readonly targetId?: never;
|
|
997
|
+
readonly programReleaseHash?: never;
|
|
998
|
+
} | ({
|
|
999
|
+
readonly scopes: readonly string[];
|
|
1000
|
+
} & ProgramReadBindingAuthTarget) | ({
|
|
1001
|
+
readonly scopes: readonly string[];
|
|
1002
|
+
} & SolanaGatewayBindingAuthTarget);
|
|
892
1003
|
interface WebSocketFactoryInit {
|
|
893
1004
|
headers?: Record<string, string>;
|
|
894
1005
|
}
|
|
@@ -924,6 +1035,8 @@ interface AreteConfig {
|
|
|
924
1035
|
maxEntriesPerView?: number | null;
|
|
925
1036
|
/** Authentication configuration */
|
|
926
1037
|
auth?: AuthConfig;
|
|
1038
|
+
/** Fetch implementation used for authentication token requests. */
|
|
1039
|
+
fetch?: typeof fetch;
|
|
927
1040
|
}
|
|
928
1041
|
interface SocketIssue {
|
|
929
1042
|
error: string;
|
|
@@ -1054,6 +1167,7 @@ declare class ConnectionManager {
|
|
|
1054
1167
|
private tokenRefreshTimeout;
|
|
1055
1168
|
private tokenRefreshInFlight;
|
|
1056
1169
|
private tokenRequestInFlight;
|
|
1170
|
+
private readonly httpAuthTokenStates;
|
|
1057
1171
|
private currentState;
|
|
1058
1172
|
private subscriptionQueue;
|
|
1059
1173
|
private activeSubscriptions;
|
|
@@ -1063,6 +1177,7 @@ declare class ConnectionManager {
|
|
|
1063
1177
|
private stateHandlers;
|
|
1064
1178
|
private socketIssueHandlers;
|
|
1065
1179
|
private authConfig?;
|
|
1180
|
+
private readonly authFetch;
|
|
1066
1181
|
private currentToken?;
|
|
1067
1182
|
private tokenExpiry?;
|
|
1068
1183
|
private tokenScopes;
|
|
@@ -1078,8 +1193,14 @@ declare class ConnectionManager {
|
|
|
1078
1193
|
private tokenCovers;
|
|
1079
1194
|
private getOrRefreshToken;
|
|
1080
1195
|
private fetchAuthToken;
|
|
1196
|
+
private requestAuthToken;
|
|
1197
|
+
private updateHttpTokenState;
|
|
1198
|
+
private getTargetedHttpAuthToken;
|
|
1199
|
+
private touchHttpAuthTokenState;
|
|
1200
|
+
private trimHttpAuthTokenStates;
|
|
1081
1201
|
private createTokenEndpointRequestBody;
|
|
1082
1202
|
private fetchTokenFromEndpoint;
|
|
1203
|
+
private isExpiryExpired;
|
|
1083
1204
|
private isTokenExpired;
|
|
1084
1205
|
private scheduleTokenRefresh;
|
|
1085
1206
|
private clearTokenRefreshTimeout;
|
|
@@ -1094,7 +1215,14 @@ declare class ConnectionManager {
|
|
|
1094
1215
|
getState(): ConnectionState;
|
|
1095
1216
|
getHttpAuthToken(forceRefresh?: boolean): Promise<string | undefined>;
|
|
1096
1217
|
getHttpAuthToken(requiredScopes?: readonly string[], forceRefresh?: boolean): Promise<string | undefined>;
|
|
1218
|
+
getHttpAuthToken(request: AuthTokenRequest, forceRefresh?: boolean): Promise<string | undefined>;
|
|
1219
|
+
getHttpAuthToken(target: AuthTokenTarget, forceRefresh?: boolean): Promise<string | undefined>;
|
|
1220
|
+
getHttpAuthToken(target: AuthTokenTarget, requiredScopes: readonly string[], forceRefresh?: boolean): Promise<string | undefined>;
|
|
1221
|
+
getHttpAuthToken(requiredScopes: readonly string[], target: AuthTokenTarget, forceRefresh?: boolean): Promise<string | undefined>;
|
|
1222
|
+
getHttpAuthToken(requiredScopes: readonly string[], forceRefresh: boolean, target: AuthTokenTarget): Promise<string | undefined>;
|
|
1097
1223
|
clearHttpAuthToken(): void;
|
|
1224
|
+
clearHttpAuthToken(request: AuthTokenRequest): void;
|
|
1225
|
+
clearHttpAuthToken(target: AuthTokenTarget, requiredScopes?: readonly string[]): void;
|
|
1098
1226
|
onFrame(handler: FrameHandler): () => void;
|
|
1099
1227
|
onStateChange(handler: ConnectionStateCallback): () => void;
|
|
1100
1228
|
onSocketIssue(handler: SocketIssueCallback): () => void;
|
|
@@ -1674,7 +1802,7 @@ interface ProgramRuntimeExtensionCarrier<TOperations extends AnyProgramOperation
|
|
|
1674
1802
|
}
|
|
1675
1803
|
type ProgramOperationsOf<TProgram> = TProgram extends ProgramRuntimeExtensionCarrier<infer TOperations> ? TOperations : ProgramOperations;
|
|
1676
1804
|
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>>;
|
|
1677
|
-
type ExtendedProgramDefinition<TBase extends ProgramSdkDefinition, TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never> = Omit<TBase, '
|
|
1805
|
+
type ExtendedProgramDefinition<TBase extends ProgramSdkDefinition, TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never> = Omit<TBase, 'sdkDefinitionHash'> & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath> & ProgramRuntimeExtensionCarrier<MergeProgramOperations<ProgramOperationsOf<TBase>, TOperations>>;
|
|
1678
1806
|
interface ProgramExtensionInput<TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition, TMath = never> {
|
|
1679
1807
|
readonly pdas?: Record<string, unknown>;
|
|
1680
1808
|
readonly accounts?: Record<string, unknown>;
|
|
@@ -1742,8 +1870,9 @@ type MergeProgramMaps<TStackPrograms, TAttachedPrograms> = Omit<NormalizeProgram
|
|
|
1742
1870
|
type StackWithAttachedPrograms<TStack extends StackDefinition, TAttachedPrograms extends ProgramMap | undefined> = Omit<TStack, 'programs'> & {
|
|
1743
1871
|
programs: MergeProgramMaps<TStack['programs'], TAttachedPrograms>;
|
|
1744
1872
|
};
|
|
1873
|
+
declare function validateProgramReadDescriptor(programName: string, descriptor: ProgramReadDescriptor): void;
|
|
1745
1874
|
declare function withPrograms<TStack extends StackDefinition, TAttachedPrograms extends ProgramMap | undefined>(stack: TStack, attachedPrograms: TAttachedPrograms): StackWithAttachedPrograms<TStack, TAttachedPrograms>;
|
|
1746
|
-
interface ConnectOptions<TPrograms extends ProgramMap | undefined = undefined> {
|
|
1875
|
+
interface ConnectOptions<TPrograms extends ProgramMap | undefined = undefined, TStackPrograms extends ProgramMap | undefined = ProgramMap> {
|
|
1747
1876
|
url?: string;
|
|
1748
1877
|
httpUrl?: string;
|
|
1749
1878
|
/**
|
|
@@ -1777,6 +1906,12 @@ interface ConnectOptions<TPrograms extends ProgramMap | undefined = undefined> {
|
|
|
1777
1906
|
fetch?: typeof fetch;
|
|
1778
1907
|
/** Additional program SDKs exposed under client.programs.<key>. */
|
|
1779
1908
|
programs?: TPrograms;
|
|
1909
|
+
/** Per-program complete descriptor replacements. */
|
|
1910
|
+
programReads?: ProgramReadOverrides<MergeProgramMaps<TStackPrograms, TPrograms>>;
|
|
1911
|
+
/** Explicit chain transport, used by composition sessions. */
|
|
1912
|
+
chain?: ChainClient;
|
|
1913
|
+
/** Explicit transaction transport, used by composition sessions. */
|
|
1914
|
+
transactions?: TransactionTransport;
|
|
1780
1915
|
/** Default semantic-operation execution settings. */
|
|
1781
1916
|
execution?: OperationExecutionOptions<any>;
|
|
1782
1917
|
}
|
|
@@ -1790,6 +1925,8 @@ interface AreteOptionsWithStorage<TStack extends StackDefinition> extends AreteO
|
|
|
1790
1925
|
wallet?: WalletAdapter;
|
|
1791
1926
|
fetch?: typeof fetch;
|
|
1792
1927
|
execution?: OperationExecutionOptions<any>;
|
|
1928
|
+
chain?: ChainClient;
|
|
1929
|
+
transactions?: TransactionTransport;
|
|
1793
1930
|
onFrameValidationError?: (diagnostic: FrameValidationDiagnostic) => void;
|
|
1794
1931
|
}
|
|
1795
1932
|
interface TransactionOptions<TSigner = unknown> {
|
|
@@ -1813,7 +1950,7 @@ interface TypedInstruction<TParams, TError> {
|
|
|
1813
1950
|
}
|
|
1814
1951
|
interface TypedAccountReader<T> {
|
|
1815
1952
|
fetch(address: string): Promise<T | null>;
|
|
1816
|
-
fetchMany(addresses: readonly string[]): Promise<
|
|
1953
|
+
fetchMany(addresses: readonly string[]): Promise<ProgramAccountBatchResult<T>>;
|
|
1817
1954
|
exists(address: string): Promise<boolean>;
|
|
1818
1955
|
}
|
|
1819
1956
|
type TypedQueryExecutor<TParams, TResult> = (params: TParams) => Promise<TResult>;
|
|
@@ -1871,7 +2008,10 @@ declare class Arete$1<TStack extends StackDefinition> {
|
|
|
1871
2008
|
private readonly _transactions;
|
|
1872
2009
|
private readonly stack;
|
|
1873
2010
|
private readonly httpBaseUrl;
|
|
2011
|
+
private readonly connectHttpUrl;
|
|
2012
|
+
private readonly programReadOverrides;
|
|
1874
2013
|
private readonly fetchImpl;
|
|
2014
|
+
private readonly auth;
|
|
1875
2015
|
private readonly executionDefaults?;
|
|
1876
2016
|
private _wallet?;
|
|
1877
2017
|
private _aggregatedErrors?;
|
|
@@ -1880,14 +2020,16 @@ declare class Arete$1<TStack extends StackDefinition> {
|
|
|
1880
2020
|
private buildQueries;
|
|
1881
2021
|
private buildPrograms;
|
|
1882
2022
|
private createTypedInstruction;
|
|
2023
|
+
private createProgramTransport;
|
|
1883
2024
|
private createAccountReader;
|
|
1884
2025
|
private createQueryExecutor;
|
|
1885
2026
|
private readJson;
|
|
1886
2027
|
private authenticatedFetch;
|
|
2028
|
+
private authenticatedStackFetch;
|
|
1887
2029
|
private resolveReadUrl;
|
|
1888
2030
|
/** Merge the client's default wallet into call options (call options win). */
|
|
1889
2031
|
private withWallet;
|
|
1890
|
-
static connect<T extends StackDefinition, TPrograms extends ProgramMap | undefined = undefined>(stack: T, options?: ConnectOptions<TPrograms>): Promise<ConnectedArete<StackWithAttachedPrograms<T, TPrograms>, T>>;
|
|
2032
|
+
static connect<T extends StackDefinition, TPrograms extends ProgramMap | undefined = undefined>(stack: T, options?: ConnectOptions<TPrograms, T['programs']>): Promise<ConnectedArete<StackWithAttachedPrograms<T, TPrograms>, T>>;
|
|
1891
2033
|
get views(): TypedViews<TStack['views']>;
|
|
1892
2034
|
get queries(): QueriesInterface<TStack['queries']>;
|
|
1893
2035
|
get programs(): ProgramsInterface<TStack['programs']>;
|
|
@@ -1951,9 +2093,12 @@ declare class Arete$1<TStack extends StackDefinition> {
|
|
|
1951
2093
|
* composition of programs + views, and a standalone program member reuses the
|
|
1952
2094
|
* exact same machinery as a stack with no views, connected HTTP-only.
|
|
1953
2095
|
*/
|
|
1954
|
-
interface SessionDefinition {
|
|
2096
|
+
interface SessionDefinition<TPrograms extends Record<string, ProgramSdkDefinition> = Record<string, ProgramSdkDefinition>> {
|
|
2097
|
+
readonly mode?: 'composition';
|
|
1955
2098
|
readonly stacks?: Record<string, StackDefinition>;
|
|
1956
|
-
readonly programs?:
|
|
2099
|
+
readonly programs?: TPrograms;
|
|
2100
|
+
/** Generated descriptors keyed in parallel with standalone `programs`. */
|
|
2101
|
+
readonly programReads?: ProgramReadDescriptors<TPrograms>;
|
|
1957
2102
|
}
|
|
1958
2103
|
type SessionStackPrograms<TDef extends SessionDefinition> = Partial<{
|
|
1959
2104
|
[K in keyof NonNullable<TDef['stacks']>]: Record<string, ProgramSdkDefinition> | undefined;
|
|
@@ -1972,6 +2117,10 @@ interface SessionMemberOptions<TPrograms extends Record<string, ProgramSdkDefini
|
|
|
1972
2117
|
autoConnect?: boolean;
|
|
1973
2118
|
autoReconnect?: boolean;
|
|
1974
2119
|
programs?: TPrograms;
|
|
2120
|
+
/** Override applied to every program owned by this member. */
|
|
2121
|
+
programRead?: ProgramReadOverride;
|
|
2122
|
+
/** Per-program overrides for this member. */
|
|
2123
|
+
programReads?: Readonly<Record<string, ProgramReadOverride>>;
|
|
1975
2124
|
}
|
|
1976
2125
|
interface SessionOptions<TDef extends SessionDefinition = SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> {
|
|
1977
2126
|
/** One wallet governs execution across every member. */
|
|
@@ -1998,7 +2147,18 @@ interface SessionOptions<TDef extends SessionDefinition = SessionDefinition, TSt
|
|
|
1998
2147
|
[K in keyof NonNullable<TDef['stacks']>]?: SessionMemberOptions<K extends keyof TStackPrograms ? TStackPrograms[K] : undefined>;
|
|
1999
2148
|
};
|
|
2000
2149
|
programs?: Record<string, SessionMemberOptions>;
|
|
2001
|
-
|
|
2150
|
+
/** Override applied to every program in the session. */
|
|
2151
|
+
programRead?: ProgramReadOverride;
|
|
2152
|
+
/** Session-wide per-program overrides, keyed by program key. */
|
|
2153
|
+
programReads?: Readonly<Record<string, ProgramReadOverride>>;
|
|
2154
|
+
}
|
|
2155
|
+
type CompositionSessionOptions<TDef extends SessionDefinition = SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> = Omit<SessionOptions<TDef, TStackPrograms>, 'chain' | 'transactions' | 'endpoints'> & {
|
|
2156
|
+
/** Chain reads never inherit a live member's HTTP endpoint. */
|
|
2157
|
+
chain: ChainClient;
|
|
2158
|
+
/** Transactions never inherit a live member's HTTP endpoint. */
|
|
2159
|
+
transactions: TransactionTransport;
|
|
2160
|
+
endpoints?: never;
|
|
2161
|
+
};
|
|
2002
2162
|
type SessionStacks<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> = {
|
|
2003
2163
|
readonly [K in keyof NonNullable<TDef['stacks']>]: NonNullable<TDef['stacks']>[K] extends StackDefinition ? K extends keyof TStackPrograms ? ConnectedArete<StackWithAttachedPrograms<NonNullable<TDef['stacks']>[K], TStackPrograms[K]>, NonNullable<TDef['stacks']>[K]> : ConnectedArete<NonNullable<TDef['stacks']>[K], NonNullable<TDef['stacks']>[K]> : never;
|
|
2004
2164
|
};
|
|
@@ -2011,7 +2171,9 @@ type PromotedSessionPrograms<TDef extends SessionDefinition, TStackPrograms exte
|
|
|
2011
2171
|
type ExplicitSessionPrograms<TDef extends SessionDefinition> = {
|
|
2012
2172
|
readonly [K in keyof NonNullable<TDef['programs']>]: NonNullable<TDef['programs']>[K] extends ProgramSdkDefinition ? ProgramInterface<NonNullable<TDef['programs']>[K]> : never;
|
|
2013
2173
|
};
|
|
2014
|
-
type SessionPrograms<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> =
|
|
2174
|
+
type SessionPrograms<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> = TDef extends {
|
|
2175
|
+
readonly mode: 'composition';
|
|
2176
|
+
} ? ExplicitSessionPrograms<TDef> : Omit<PromotedSessionPrograms<TDef, TStackPrograms>, keyof NonNullable<TDef['programs']>> & ExplicitSessionPrograms<TDef>;
|
|
2015
2177
|
interface Session<TDef extends SessionDefinition = SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}> {
|
|
2016
2178
|
readonly stacks: SessionStacks<TDef, TStackPrograms>;
|
|
2017
2179
|
readonly programs: SessionPrograms<TDef, TStackPrograms>;
|
|
@@ -2024,7 +2186,23 @@ interface Session<TDef extends SessionDefinition = SessionDefinition, TStackProg
|
|
|
2024
2186
|
setWallet(wallet: WalletAdapter | undefined): void;
|
|
2025
2187
|
close(): void;
|
|
2026
2188
|
}
|
|
2027
|
-
declare function createSession<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}>(definition: TDef,
|
|
2189
|
+
declare function createSession<TDef extends SessionDefinition, TStackPrograms extends SessionStackPrograms<TDef> = {}>(definition: TDef, ...args: TDef extends {
|
|
2190
|
+
readonly mode: 'composition';
|
|
2191
|
+
} ? [options: CompositionSessionOptions<TDef, TStackPrograms>] : [options?: SessionOptions<TDef, TStackPrograms>]): Promise<Session<TDef, TStackPrograms>>;
|
|
2192
|
+
|
|
2193
|
+
interface HostedSolanaGatewayTransportOptions {
|
|
2194
|
+
readonly auth?: AuthConfig;
|
|
2195
|
+
readonly fetch?: typeof fetch;
|
|
2196
|
+
}
|
|
2197
|
+
interface HostedSolanaGatewayTransports {
|
|
2198
|
+
readonly chain: ChainClient;
|
|
2199
|
+
readonly transactions: TransactionTransport;
|
|
2200
|
+
}
|
|
2201
|
+
/**
|
|
2202
|
+
* Construct explicit hosted chain and transaction transports from generated
|
|
2203
|
+
* gateway descriptors. Tokens are isolated by exact binding target and scope.
|
|
2204
|
+
*/
|
|
2205
|
+
declare function createHostedSolanaGatewayTransports(bindings: HostedSolanaGatewayBindings, options?: HostedSolanaGatewayTransportOptions): HostedSolanaGatewayTransports;
|
|
2028
2206
|
|
|
2029
2207
|
interface AccountLoader {
|
|
2030
2208
|
getAccount(address: string): Promise<{
|
|
@@ -2119,7 +2297,6 @@ declare class ReadRequestError extends Error {
|
|
|
2119
2297
|
}
|
|
2120
2298
|
declare function programAccountRead<T>(input: {
|
|
2121
2299
|
account: string;
|
|
2122
|
-
path: string;
|
|
2123
2300
|
schema?: Schema<T>;
|
|
2124
2301
|
}): ProgramAccountReadDefinition<T>;
|
|
2125
2302
|
declare function programQuery<TParams = unknown, TResult = unknown>(input: {
|
|
@@ -2135,6 +2312,23 @@ declare function stackQuery<TParams = unknown, TResult = unknown>(input: {
|
|
|
2135
2312
|
schema?: Schema<TResult>;
|
|
2136
2313
|
}): StackQueryDefinition<TParams, TResult>;
|
|
2137
2314
|
|
|
2315
|
+
type ProgramReadRequest = {
|
|
2316
|
+
readonly operation: 'fetch';
|
|
2317
|
+
readonly account: string;
|
|
2318
|
+
readonly address: string;
|
|
2319
|
+
} | {
|
|
2320
|
+
readonly operation: 'fetchMany';
|
|
2321
|
+
readonly account: string;
|
|
2322
|
+
readonly addresses: readonly string[];
|
|
2323
|
+
} | {
|
|
2324
|
+
readonly operation: 'exists';
|
|
2325
|
+
readonly account: string;
|
|
2326
|
+
readonly address: string;
|
|
2327
|
+
};
|
|
2328
|
+
interface ProgramReadTransport {
|
|
2329
|
+
read<T>(request: ProgramReadRequest): Promise<T>;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2138
2332
|
declare class MemoryAdapter implements StorageAdapter {
|
|
2139
2333
|
private views;
|
|
2140
2334
|
private updateCallbacks;
|
|
@@ -2170,5 +2364,5 @@ declare const Arete: typeof Arete$1 & {
|
|
|
2170
2364
|
session: typeof createSession;
|
|
2171
2365
|
};
|
|
2172
2366
|
|
|
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 };
|
|
2367
|
+
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, 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, 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, validateProgramReadDescriptor, validateSubscriptionId, withPrograms };
|
|
2368
|
+
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, OperationNamespace, OperationPlan, OperationReceiptFor, OperationTransactionReceipt, PdaConfig, PdaDeriveContext, PdaFactory, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountBatchItem, ProgramAccountBatchResult, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramReadBinding, ProgramReadBindingAuthTarget, ProgramReadDescriptor, ProgramReadDescriptors, ProgramReadOverride, ProgramReadOverrides, ProgramReadRequest, ProgramReadTransport, ProgramReleaseReference, 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, SolanaGatewayAuthMetadata, SolanaGatewayAuthScope, SolanaGatewayBindingAuthTarget, 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 };
|