@usearete/sdk 0.7.1 → 0.8.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 +9 -5
- package/dist/index.cjs +56 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -17
- package/dist/index.esm.js +56 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1818,16 +1818,18 @@ interface ProgramOperationContext<TProgram extends ProgramSdkDefinition = Progra
|
|
|
1818
1818
|
readonly wallet: WalletAdapter | undefined;
|
|
1819
1819
|
readonly program: ProgramInterface<TProgram>;
|
|
1820
1820
|
}
|
|
1821
|
-
interface ProgramRuntimeExtensions<TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition> {
|
|
1822
|
-
readonly createOperations
|
|
1821
|
+
interface ProgramRuntimeExtensions<TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition, TRead = EmptyRecord> {
|
|
1822
|
+
readonly createOperations?: (context: ProgramOperationContext<TProgram>) => TOperations;
|
|
1823
|
+
readonly createRead?: (context: ProgramOperationContext<TProgram>) => TRead;
|
|
1823
1824
|
}
|
|
1824
|
-
interface ProgramRuntimeExtensionCarrier<TOperations extends AnyProgramOperations = ProgramOperations> {
|
|
1825
|
-
readonly [PROGRAM_OPERATION_EXTENSIONS]?: ProgramRuntimeExtensions<TOperations, any>;
|
|
1825
|
+
interface ProgramRuntimeExtensionCarrier<TOperations extends AnyProgramOperations = ProgramOperations, TRead = EmptyRecord> {
|
|
1826
|
+
readonly [PROGRAM_OPERATION_EXTENSIONS]?: ProgramRuntimeExtensions<TOperations, any, TRead>;
|
|
1826
1827
|
}
|
|
1827
|
-
type ProgramOperationsOf<TProgram> = TProgram extends ProgramRuntimeExtensionCarrier<infer TOperations> ? TOperations : ProgramOperations;
|
|
1828
|
+
type ProgramOperationsOf<TProgram> = TProgram extends ProgramRuntimeExtensionCarrier<infer TOperations, any> ? TOperations : ProgramOperations;
|
|
1829
|
+
type ProgramReadOf<TProgram> = TProgram extends ProgramRuntimeExtensionCarrier<any, infer TRead> ? TRead : EmptyRecord;
|
|
1828
1830
|
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>>;
|
|
1829
|
-
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>>;
|
|
1830
|
-
interface ProgramExtensionInput<TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition, TMath = never> {
|
|
1831
|
+
type ExtendedProgramDefinition<TBase extends ProgramSdkDefinition, TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never, TRead = never> = Omit<TBase, 'sdkDefinitionHash'> & MaybeField<'addresses', TAddresses> & MaybeField<'constants', TConstants> & MaybeField<'defaults', TDefaults> & MaybeField<'math', TMath> & ProgramRuntimeExtensionCarrier<MergeProgramOperations<ProgramOperationsOf<TBase>, TOperations>, MergeField<ProgramReadOf<TBase>, TRead>>;
|
|
1832
|
+
interface ProgramExtensionInput<TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TProgram extends ProgramSdkDefinition = ProgramSdkDefinition, TMath = never, TRead = never> {
|
|
1831
1833
|
readonly pdas?: Record<string, unknown>;
|
|
1832
1834
|
readonly accounts?: Record<string, unknown>;
|
|
1833
1835
|
readonly queries?: Record<string, unknown>;
|
|
@@ -1837,21 +1839,24 @@ interface ProgramExtensionInput<TAddresses = never, TConstants = never, TDefault
|
|
|
1837
1839
|
readonly defaults?: TDefaults;
|
|
1838
1840
|
readonly math?: TMath;
|
|
1839
1841
|
readonly createOperations?: (context: ProgramOperationContext<TProgram>) => TOperations;
|
|
1842
|
+
readonly createRead?: (context: ProgramOperationContext<TProgram>) => TRead;
|
|
1840
1843
|
}
|
|
1841
|
-
|
|
1844
|
+
type DefinedProgramExtensions<TBase extends ProgramSdkDefinition, TAddresses, TConstants, TDefaults, TOperations extends AnyProgramOperations, TMath, TRead> = Omit<ProgramExtensionInput<any, any, any, any, any, any, any>, 'addresses' | 'constants' | 'defaults' | 'math' | 'createOperations' | 'createRead'> & {
|
|
1842
1845
|
readonly addresses?: TAddresses;
|
|
1843
1846
|
readonly constants?: TConstants;
|
|
1844
1847
|
readonly defaults?: TDefaults;
|
|
1845
1848
|
readonly math?: TMath;
|
|
1846
|
-
readonly createOperations?: (context: ProgramOperationContext<ExtendedProgramDefinition<TBase, TAddresses, TConstants, TDefaults, ProgramOperations, TMath>>) => TOperations;
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
+
readonly createOperations?: (context: ProgramOperationContext<ExtendedProgramDefinition<TBase, TAddresses, TConstants, TDefaults, ProgramOperations, TMath, TRead>>) => TOperations;
|
|
1850
|
+
readonly createRead?: (context: ProgramOperationContext<ExtendedProgramDefinition<TBase, TAddresses, TConstants, TDefaults, ProgramOperations, TMath, never>>) => TRead;
|
|
1851
|
+
};
|
|
1852
|
+
declare function defineProgramExtensions<TBase extends ProgramSdkDefinition>(): <TAddresses = never, TConstants = never, TDefaults = never, TOperations extends AnyProgramOperations = ProgramOperations, TMath = never, TRead = never>(extensions: DefinedProgramExtensions<TBase, TAddresses, TConstants, TDefaults, TOperations, TMath, TRead>) => DefinedProgramExtensions<TBase, TAddresses, TConstants, TDefaults, TOperations, TMath, TRead>;
|
|
1853
|
+
declare function extendProgram<TBase extends ProgramSdkDefinition, TExtension extends ProgramExtensionInput<any, any, any, any, any, any, any>>(program: TBase, extensions: TExtension): ExtendedProgramDefinition<TBase, MergeField<Field<TBase, 'addresses'>, Field<TExtension, 'addresses'>>, MergeField<Field<TBase, 'constants'>, Field<TExtension, 'constants'>>, MergeField<Field<TBase, 'defaults'>, Field<TExtension, 'defaults'>>, Extract<FactoryReturn<TExtension, 'createOperations'>, AnyProgramOperations>, MergeField<Field<TBase, 'math'>, Field<TExtension, 'math'>>, FactoryReturn<TExtension, 'createRead'>>;
|
|
1849
1854
|
declare function extendPrograms<TPrograms extends Record<string, ProgramSdkDefinition>, TExtensions extends Partial<{
|
|
1850
|
-
[K in keyof TPrograms]: ProgramExtensionInput<any, any, any, any, any, any>;
|
|
1855
|
+
[K in keyof TPrograms]: ProgramExtensionInput<any, any, any, any, any, any, any>;
|
|
1851
1856
|
}>>(programs: TPrograms, extensions: TExtensions): {
|
|
1852
|
-
readonly [K in keyof TPrograms]: K extends keyof TExtensions ? NonNullable<TExtensions[K]> extends ProgramExtensionInput<infer TAddresses, infer THelpers, infer TTypes, infer TOperations, any, infer TMath> ? ExtendedProgramDefinition<TPrograms[K], TAddresses, THelpers, TTypes, TOperations, TMath> : TPrograms[K] : TPrograms[K];
|
|
1857
|
+
readonly [K in keyof TPrograms]: K extends keyof TExtensions ? NonNullable<TExtensions[K]> extends ProgramExtensionInput<infer TAddresses, infer THelpers, infer TTypes, infer TOperations, any, infer TMath, infer TRead> ? ExtendedProgramDefinition<TPrograms[K], TAddresses, THelpers, TTypes, TOperations, TMath, TRead> : TPrograms[K] : TPrograms[K];
|
|
1853
1858
|
};
|
|
1854
|
-
declare function getProgramRuntimeExtensions<TProgram extends ProgramSdkDefinition>(program: TProgram): ProgramRuntimeExtensions<ProgramOperationsOf<TProgram>, TProgram
|
|
1859
|
+
declare function getProgramRuntimeExtensions<TProgram extends ProgramSdkDefinition>(program: TProgram): ProgramRuntimeExtensions<ProgramOperationsOf<TProgram>, TProgram, ProgramReadOf<TProgram>> | undefined;
|
|
1855
1860
|
interface StackRuntimeExtensions<TRead = EmptyRecord, TFlows extends FlowOperationNamespace | EmptyRecord = EmptyRecord, TClient = unknown> {
|
|
1856
1861
|
readonly readArgCounts?: ReadArgumentCounts<TRead>;
|
|
1857
1862
|
readonly createRead?: (client: TClient) => TRead;
|
|
@@ -2003,6 +2008,7 @@ type ProgramInterface<TProgram extends ProgramSdkDefinition> = {
|
|
|
2003
2008
|
constants: ProgramNamespace<TProgram['constants']>;
|
|
2004
2009
|
defaults: ProgramNamespace<TProgram['defaults']>;
|
|
2005
2010
|
math: ProgramNamespace<TProgram['math']>;
|
|
2011
|
+
read: ProgramNamespace<ProgramReadOf<TProgram>>;
|
|
2006
2012
|
instructions: OperationField<ProgramOperationsOf<TProgram>, 'instructions'>;
|
|
2007
2013
|
transactions: OperationField<ProgramOperationsOf<TProgram>, 'transactions'>;
|
|
2008
2014
|
flows: OperationField<ProgramOperationsOf<TProgram>, 'flows'>;
|
|
@@ -2121,7 +2127,7 @@ interface SessionDefinition<TPrograms extends Record<string, ProgramSdkDefinitio
|
|
|
2121
2127
|
readonly mode?: 'composition';
|
|
2122
2128
|
readonly stacks?: Record<string, StackDefinition>;
|
|
2123
2129
|
readonly programs?: TPrograms;
|
|
2124
|
-
/** Generated
|
|
2130
|
+
/** @deprecated Generated program cartridges carry defaults; use only for complete overrides. */
|
|
2125
2131
|
readonly programReads?: ProgramReadDescriptors<TPrograms>;
|
|
2126
2132
|
}
|
|
2127
2133
|
type SessionStackPrograms<TDef extends SessionDefinition> = Partial<{
|
|
@@ -2214,6 +2220,14 @@ declare function createSession<TDef extends SessionDefinition, TStackPrograms ex
|
|
|
2214
2220
|
readonly mode: 'composition';
|
|
2215
2221
|
} ? [options: CompositionSessionOptions<TDef, TStackPrograms>] : [options?: SessionOptions<TDef, TStackPrograms>]): Promise<Session<TDef, TStackPrograms>>;
|
|
2216
2222
|
|
|
2223
|
+
/**
|
|
2224
|
+
* Bundle a generated program definition with its default read descriptor.
|
|
2225
|
+
*
|
|
2226
|
+
* Generated SDK entries call this automatically. The descriptor is deliberately
|
|
2227
|
+
* non-enumerable so it remains an implementation detail of the program cartridge.
|
|
2228
|
+
*/
|
|
2229
|
+
declare function withProgramRead<TProgram extends ProgramSdkDefinition>(program: TProgram, descriptor: ProgramReadDescriptor): TProgram;
|
|
2230
|
+
|
|
2217
2231
|
interface HostedSolanaGatewayTransportOptions {
|
|
2218
2232
|
readonly auth?: AuthConfig;
|
|
2219
2233
|
readonly fetch?: typeof fetch;
|
|
@@ -2388,5 +2402,5 @@ declare const Arete: typeof Arete$1 & {
|
|
|
2388
2402
|
session: typeof createSession;
|
|
2389
2403
|
};
|
|
2390
2404
|
|
|
2391
|
-
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 };
|
|
2392
|
-
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, PdaProgram, PdaProgramSelector, 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 };
|
|
2405
|
+
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, withProgramRead, withPrograms };
|
|
2406
|
+
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, PdaProgram, PdaProgramSelector, PdaSeed, PreparedFlow, PreparedInstruction, PreparedOperation, PreparedOperationDescription, PreparedTransaction, PreparedTransactionBody, PreparedTransactionInstruction, PreparedTransactionOperation, ProgramAccountBatchItem, ProgramAccountBatchResult, ProgramAccountReadDefinition, ProgramError, ProgramExtensionInput, ProgramInterface, ProgramOperationContext, ProgramOperations, ProgramOperationsOf, ProgramPdas, ProgramQueryDefinition, ProgramReadBinding, ProgramReadBindingAuthTarget, ProgramReadDescriptor, ProgramReadDescriptors, ProgramReadOf, 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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -5293,6 +5293,31 @@ function createProgramPdas(pdas) {
|
|
|
5293
5293
|
return pdas;
|
|
5294
5294
|
}
|
|
5295
5295
|
|
|
5296
|
+
/** Opaque generated-program metadata used to carry its default read transport. */
|
|
5297
|
+
const PROGRAM_READ_DESCRIPTOR = Symbol.for('@usearete/sdk/program-read-descriptor');
|
|
5298
|
+
/**
|
|
5299
|
+
* Bundle a generated program definition with its default read descriptor.
|
|
5300
|
+
*
|
|
5301
|
+
* Generated SDK entries call this automatically. The descriptor is deliberately
|
|
5302
|
+
* non-enumerable so it remains an implementation detail of the program cartridge.
|
|
5303
|
+
*/
|
|
5304
|
+
function withProgramRead(program, descriptor) {
|
|
5305
|
+
const properties = Object.getOwnPropertyDescriptors(program);
|
|
5306
|
+
Reflect.deleteProperty(properties, PROGRAM_READ_DESCRIPTOR);
|
|
5307
|
+
const bundled = Object.create(Object.getPrototypeOf(program), properties);
|
|
5308
|
+
Object.defineProperty(bundled, PROGRAM_READ_DESCRIPTOR, {
|
|
5309
|
+
value: descriptor,
|
|
5310
|
+
enumerable: false,
|
|
5311
|
+
configurable: false,
|
|
5312
|
+
writable: false,
|
|
5313
|
+
});
|
|
5314
|
+
return bundled;
|
|
5315
|
+
}
|
|
5316
|
+
/** Resolve the default read descriptor carried by a generated program SDK. */
|
|
5317
|
+
function getProgramReadDescriptor(program) {
|
|
5318
|
+
return program?.[PROGRAM_READ_DESCRIPTOR];
|
|
5319
|
+
}
|
|
5320
|
+
|
|
5296
5321
|
const STACK_RUNTIME_EXTENSIONS = '__areteStackRuntimeExtensions';
|
|
5297
5322
|
const PROGRAM_OPERATION_EXTENSIONS = '__areteProgramOperationExtensions';
|
|
5298
5323
|
function defineProgramExtensions() {
|
|
@@ -5319,6 +5344,10 @@ function mergeOperations(base, extension) {
|
|
|
5319
5344
|
function extendProgram(program, extensions) {
|
|
5320
5345
|
const base = program;
|
|
5321
5346
|
const extended = { ...program };
|
|
5347
|
+
const readDescriptor = Object.getOwnPropertyDescriptor(program, PROGRAM_READ_DESCRIPTOR);
|
|
5348
|
+
if (readDescriptor) {
|
|
5349
|
+
Object.defineProperty(extended, PROGRAM_READ_DESCRIPTOR, readDescriptor);
|
|
5350
|
+
}
|
|
5322
5351
|
delete extended.sdkDefinitionHash;
|
|
5323
5352
|
for (const key of ['pdas', 'accounts', 'queries', 'addresses', 'constants', 'defaults', 'math']) {
|
|
5324
5353
|
const extensionValue = extensions[key];
|
|
@@ -5331,7 +5360,9 @@ function extendProgram(program, extensions) {
|
|
|
5331
5360
|
}
|
|
5332
5361
|
const baseFactory = base[PROGRAM_OPERATION_EXTENSIONS]?.createOperations;
|
|
5333
5362
|
const extensionFactory = extensions.createOperations;
|
|
5334
|
-
|
|
5363
|
+
const baseReadFactory = base[PROGRAM_OPERATION_EXTENSIONS]?.createRead;
|
|
5364
|
+
const extensionReadFactory = extensions.createRead;
|
|
5365
|
+
if (baseFactory || extensionFactory || baseReadFactory || extensionReadFactory) {
|
|
5335
5366
|
Object.defineProperty(extended, PROGRAM_OPERATION_EXTENSIONS, {
|
|
5336
5367
|
value: {
|
|
5337
5368
|
createOperations(context) {
|
|
@@ -5344,6 +5375,14 @@ function extendProgram(program, extensions) {
|
|
|
5344
5375
|
}
|
|
5345
5376
|
return mergeOperations(baseOperations, extensionFactory?.(context));
|
|
5346
5377
|
},
|
|
5378
|
+
createRead(context) {
|
|
5379
|
+
const baseRead = baseReadFactory?.(context);
|
|
5380
|
+
if (baseRead) {
|
|
5381
|
+
const connectedProgram = context.program;
|
|
5382
|
+
connectedProgram.read = mergeNamespace(connectedProgram.read, baseRead);
|
|
5383
|
+
}
|
|
5384
|
+
return mergeNamespace(baseRead, extensionReadFactory?.(context));
|
|
5385
|
+
},
|
|
5347
5386
|
},
|
|
5348
5387
|
enumerable: false,
|
|
5349
5388
|
configurable: false,
|
|
@@ -6149,7 +6188,9 @@ function createTransactionTransport(baseUrl, authenticatedFetch) {
|
|
|
6149
6188
|
}
|
|
6150
6189
|
|
|
6151
6190
|
function effectiveProgramRead(stack, name, override) {
|
|
6152
|
-
return override
|
|
6191
|
+
return override
|
|
6192
|
+
?? stack.programReads?.[name]
|
|
6193
|
+
?? getProgramReadDescriptor(stack.programs?.[name]);
|
|
6153
6194
|
}
|
|
6154
6195
|
function validateReleaseIdentity(programName, definition, release) {
|
|
6155
6196
|
if (release
|
|
@@ -6223,7 +6264,10 @@ function validateProgramReads(stack, overrides, validateDescriptorKeys = true) {
|
|
|
6223
6264
|
validateProgramReadDescriptor(key, overrides[key]);
|
|
6224
6265
|
}
|
|
6225
6266
|
for (const [name, definition] of Object.entries(stack.programs ?? {})) {
|
|
6226
|
-
|
|
6267
|
+
const bundled = getProgramReadDescriptor(definition);
|
|
6268
|
+
if (bundled)
|
|
6269
|
+
validateProgramReadDescriptor(name, bundled);
|
|
6270
|
+
validateReleaseIdentity(name, definition, effectiveProgramRead(stack, name, overrides?.[name])?.release);
|
|
6227
6271
|
validateReleaseIdentity(name, definition, overrides?.[name]?.release);
|
|
6228
6272
|
}
|
|
6229
6273
|
}
|
|
@@ -6413,18 +6457,21 @@ let Arete$1 = class Arete {
|
|
|
6413
6457
|
const base = bases[name];
|
|
6414
6458
|
const connectedProgram = {
|
|
6415
6459
|
...base,
|
|
6460
|
+
read: {},
|
|
6416
6461
|
instructions: {},
|
|
6417
6462
|
transactions: {},
|
|
6418
6463
|
flows: {},
|
|
6419
6464
|
};
|
|
6420
6465
|
const runtime = getProgramRuntimeExtensions(definition);
|
|
6421
|
-
const
|
|
6466
|
+
const context = {
|
|
6422
6467
|
chain: this._chain,
|
|
6423
6468
|
get wallet() {
|
|
6424
6469
|
return client._wallet;
|
|
6425
6470
|
},
|
|
6426
6471
|
program: connectedProgram,
|
|
6427
|
-
}
|
|
6472
|
+
};
|
|
6473
|
+
connectedProgram.read = runtime?.createRead?.(context) ?? {};
|
|
6474
|
+
const operations = runtime?.createOperations?.(context);
|
|
6428
6475
|
connectedProgram.instructions = operations?.instructions ?? {};
|
|
6429
6476
|
connectedProgram.transactions = operations?.transactions ?? {};
|
|
6430
6477
|
connectedProgram.flows = operations?.flows ?? {};
|
|
@@ -6864,7 +6911,9 @@ function resolveMemberConnectOptions(stack, member, options, forceHttpOnly) {
|
|
|
6864
6911
|
function validateCompositionProgramReads(stack, member, options) {
|
|
6865
6912
|
const overrides = resolveSessionProgramReads(stack, member, options);
|
|
6866
6913
|
for (const [name, program] of Object.entries(stack.programs ?? {})) {
|
|
6867
|
-
const descriptor = overrides?.[name]
|
|
6914
|
+
const descriptor = overrides?.[name]
|
|
6915
|
+
?? stack.programReads?.[name]
|
|
6916
|
+
?? getProgramReadDescriptor(program);
|
|
6868
6917
|
if (descriptor)
|
|
6869
6918
|
validateProgramReadDescriptor(name, descriptor);
|
|
6870
6919
|
if (Object.keys(program.accounts ?? {}).length === 0)
|
|
@@ -7347,5 +7396,5 @@ function stringifyBigints(value) {
|
|
|
7347
7396
|
|
|
7348
7397
|
const Arete = Object.assign(Arete$1, { session: createSession });
|
|
7349
7398
|
|
|
7350
|
-
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 };
|
|
7399
|
+
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, withProgramRead, withPrograms };
|
|
7351
7400
|
//# sourceMappingURL=index.esm.js.map
|