@naculus/connect-appkit-core 0.5.0 → 0.7.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.cjs +63 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -2
- package/dist/index.d.ts +70 -2
- package/dist/index.js +58 -9
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -484,6 +484,15 @@ declare function createNotificationSettingsStorage(): NotificationSettingsStorag
|
|
|
484
484
|
declare function loadNotificationSettings(storage: NotificationSettingsStorage): Promise<NotificationSettings | null>;
|
|
485
485
|
declare function saveNotificationSettings(storage: NotificationSettingsStorage, settings: NotificationSettings): void;
|
|
486
486
|
declare function updateNotificationSettings(current: NotificationSettings, update: Partial<NotificationSettings>): NotificationSettings;
|
|
487
|
+
/** One settings change, computed from the settings it applies to. */
|
|
488
|
+
type NotificationSettingsUpdate = (current: NotificationSettings) => Partial<NotificationSettings>;
|
|
489
|
+
/**
|
|
490
|
+
* The settings once the persisted ones finish loading: every change made
|
|
491
|
+
* before the load resolved, replayed in order on top of what was persisted
|
|
492
|
+
* (or the defaults when nothing was). Without this the late load overwrote
|
|
493
|
+
* those changes, e.g. a chain muted during the first render came back.
|
|
494
|
+
*/
|
|
495
|
+
declare function replayNotificationSettings(persisted: NotificationSettings | null, updates: readonly NotificationSettingsUpdate[]): NotificationSettings;
|
|
487
496
|
declare function channelsUpdate(channels: string[]): Partial<NotificationSettings>;
|
|
488
497
|
declare function mutedChainSettings(settings: NotificationSettings, chainId: string, muted: boolean): Partial<NotificationSettings>;
|
|
489
498
|
declare function createNotification(item: Omit<NotificationItem, "id" | "timestamp">): NotificationItem;
|
|
@@ -890,6 +899,60 @@ interface PaymentRecord {
|
|
|
890
899
|
*/
|
|
891
900
|
declare function describePayment(input: RequestInfo | URL, result: PaymentFetchResult): PaymentRecord | null;
|
|
892
901
|
|
|
902
|
+
/** Request options accepted by a caller-built MPP session fetch. */
|
|
903
|
+
interface MppSessionRequestInit extends RequestInit {
|
|
904
|
+
units?: bigint;
|
|
905
|
+
}
|
|
906
|
+
/** An open MPP payment channel, represented without depending on payments-mpp. */
|
|
907
|
+
interface MppSessionChannel {
|
|
908
|
+
channelId: string;
|
|
909
|
+
payer: string;
|
|
910
|
+
payee: string;
|
|
911
|
+
mint: string;
|
|
912
|
+
channelProgram: string;
|
|
913
|
+
deposit: bigint;
|
|
914
|
+
gracePeriodSeconds: number;
|
|
915
|
+
openSlot: bigint;
|
|
916
|
+
salt: bigint;
|
|
917
|
+
}
|
|
918
|
+
/** A successful MPP receipt, represented structurally. */
|
|
919
|
+
interface MppSessionReceipt {
|
|
920
|
+
status: "success";
|
|
921
|
+
method: string;
|
|
922
|
+
timestamp: string;
|
|
923
|
+
reference: string;
|
|
924
|
+
[field: string]: unknown;
|
|
925
|
+
}
|
|
926
|
+
interface MppSessionFetchResult {
|
|
927
|
+
response: Response;
|
|
928
|
+
receipt: unknown;
|
|
929
|
+
channel: unknown;
|
|
930
|
+
}
|
|
931
|
+
type MppSessionRequest = (input: RequestInfo | URL, init?: MppSessionRequestInit) => Promise<MppSessionFetchResult>;
|
|
932
|
+
interface MppSessionForceCloseResult {
|
|
933
|
+
requestCloseTxHash: string;
|
|
934
|
+
withdrawPayer(): Promise<string>;
|
|
935
|
+
}
|
|
936
|
+
interface MppSessionMeter {
|
|
937
|
+
add(units: bigint): void;
|
|
938
|
+
readonly pending: bigint;
|
|
939
|
+
}
|
|
940
|
+
/** The caller-owned session surface consumed by the React and Vue shells. */
|
|
941
|
+
interface MppSessionFetch extends MppSessionRequest {
|
|
942
|
+
readonly meter: MppSessionMeter;
|
|
943
|
+
readonly channels: readonly unknown[];
|
|
944
|
+
close(): Promise<MppSessionFetchResult>;
|
|
945
|
+
forceClose(): Promise<MppSessionForceCloseResult>;
|
|
946
|
+
}
|
|
947
|
+
/** Return a channel only when all public fields have the expected shape. */
|
|
948
|
+
declare function readMppSessionChannel(value: unknown): MppSessionChannel | null;
|
|
949
|
+
/** Return the newest structurally valid channel currently held by a session. */
|
|
950
|
+
declare function readCurrentMppSessionChannel(session: Pick<MppSessionFetch, "channels">): MppSessionChannel | null;
|
|
951
|
+
/** Return a receipt only when it has the public success-receipt shape. */
|
|
952
|
+
declare function readMppSessionReceipt(value: unknown): MppSessionReceipt | null;
|
|
953
|
+
/** A post-send channel-open failure carries the channel that can be recovered. */
|
|
954
|
+
declare function readMppRecoveryChannelId(error: unknown): string | null;
|
|
955
|
+
|
|
893
956
|
/**
|
|
894
957
|
* Solana session keys for the appkit shells (connect-lib STATE thread 18).
|
|
895
958
|
*
|
|
@@ -946,7 +1009,12 @@ interface RetryOptions {
|
|
|
946
1009
|
label?: string;
|
|
947
1010
|
}
|
|
948
1011
|
declare function withRetry<T>(fn: () => Promise<T>, options: RetryOptions): Promise<T>;
|
|
949
|
-
/**
|
|
1012
|
+
/**
|
|
1013
|
+
* Convert EIP-1193 chainChanged values into the CAIP-2 form used by sessions.
|
|
1014
|
+
* Refuses chain 0 and anything above `Number.MAX_SAFE_INTEGER`, as
|
|
1015
|
+
* connect-core's `normalizeEip155ChainId` does; switch to that export once
|
|
1016
|
+
* the connect-lib release that adds it is the minimum supported version.
|
|
1017
|
+
*/
|
|
950
1018
|
declare function normalizeEip155ChainId(value: unknown): string | undefined;
|
|
951
1019
|
declare function toEip155Accounts(accounts: unknown[], chainId: string): string[];
|
|
952
1020
|
/**
|
|
@@ -1011,4 +1079,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
|
|
|
1011
1079
|
refreshedAt: null;
|
|
1012
1080
|
};
|
|
1013
1081
|
|
|
1014
|
-
export { type AddressValidationLevel, type AtomicSupport, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, type DecimalsCache, type DelegationFrameworkAdapterOptions, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DelegationTypedData, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type PaymentFetch, type PaymentFetchResult, type PaymentRecord, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RedemptionCodec, type RedemptionRpc, type RedemptionTransaction, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaOwnerSigner, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSessionKeyFlow, type SolanaSessionKeyFlowDeps, type SolanaSigner, type SolanaWalletFeatures, type TokenIdentity, type TransactionSimulationContext, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, __resetResolverForTests, addInAppNotification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, fetchUserOperationReceipt, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readDecimals, readSolanaRoles, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
|
|
1082
|
+
export { type AddressValidationLevel, type AtomicSupport, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, type DecimalsCache, type DelegationFrameworkAdapterOptions, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DelegationTypedData, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, type MppSessionChannel, type MppSessionFetch, type MppSessionFetchResult, type MppSessionForceCloseResult, type MppSessionMeter, type MppSessionReceipt, type MppSessionRequest, type MppSessionRequestInit, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type NotificationSettingsUpdate, type PaymentFetch, type PaymentFetchResult, type PaymentRecord, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RedemptionCodec, type RedemptionRpc, type RedemptionTransaction, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaOwnerSigner, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSessionKeyFlow, type SolanaSessionKeyFlowDeps, type SolanaSigner, type SolanaWalletFeatures, type TokenIdentity, type TransactionSimulationContext, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, __resetResolverForTests, addInAppNotification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, fetchUserOperationReceipt, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readCurrentMppSessionChannel, readDecimals, readMppRecoveryChannelId, readMppSessionChannel, readMppSessionReceipt, readSolanaRoles, replayNotificationSettings, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
|
package/dist/index.d.ts
CHANGED
|
@@ -484,6 +484,15 @@ declare function createNotificationSettingsStorage(): NotificationSettingsStorag
|
|
|
484
484
|
declare function loadNotificationSettings(storage: NotificationSettingsStorage): Promise<NotificationSettings | null>;
|
|
485
485
|
declare function saveNotificationSettings(storage: NotificationSettingsStorage, settings: NotificationSettings): void;
|
|
486
486
|
declare function updateNotificationSettings(current: NotificationSettings, update: Partial<NotificationSettings>): NotificationSettings;
|
|
487
|
+
/** One settings change, computed from the settings it applies to. */
|
|
488
|
+
type NotificationSettingsUpdate = (current: NotificationSettings) => Partial<NotificationSettings>;
|
|
489
|
+
/**
|
|
490
|
+
* The settings once the persisted ones finish loading: every change made
|
|
491
|
+
* before the load resolved, replayed in order on top of what was persisted
|
|
492
|
+
* (or the defaults when nothing was). Without this the late load overwrote
|
|
493
|
+
* those changes, e.g. a chain muted during the first render came back.
|
|
494
|
+
*/
|
|
495
|
+
declare function replayNotificationSettings(persisted: NotificationSettings | null, updates: readonly NotificationSettingsUpdate[]): NotificationSettings;
|
|
487
496
|
declare function channelsUpdate(channels: string[]): Partial<NotificationSettings>;
|
|
488
497
|
declare function mutedChainSettings(settings: NotificationSettings, chainId: string, muted: boolean): Partial<NotificationSettings>;
|
|
489
498
|
declare function createNotification(item: Omit<NotificationItem, "id" | "timestamp">): NotificationItem;
|
|
@@ -890,6 +899,60 @@ interface PaymentRecord {
|
|
|
890
899
|
*/
|
|
891
900
|
declare function describePayment(input: RequestInfo | URL, result: PaymentFetchResult): PaymentRecord | null;
|
|
892
901
|
|
|
902
|
+
/** Request options accepted by a caller-built MPP session fetch. */
|
|
903
|
+
interface MppSessionRequestInit extends RequestInit {
|
|
904
|
+
units?: bigint;
|
|
905
|
+
}
|
|
906
|
+
/** An open MPP payment channel, represented without depending on payments-mpp. */
|
|
907
|
+
interface MppSessionChannel {
|
|
908
|
+
channelId: string;
|
|
909
|
+
payer: string;
|
|
910
|
+
payee: string;
|
|
911
|
+
mint: string;
|
|
912
|
+
channelProgram: string;
|
|
913
|
+
deposit: bigint;
|
|
914
|
+
gracePeriodSeconds: number;
|
|
915
|
+
openSlot: bigint;
|
|
916
|
+
salt: bigint;
|
|
917
|
+
}
|
|
918
|
+
/** A successful MPP receipt, represented structurally. */
|
|
919
|
+
interface MppSessionReceipt {
|
|
920
|
+
status: "success";
|
|
921
|
+
method: string;
|
|
922
|
+
timestamp: string;
|
|
923
|
+
reference: string;
|
|
924
|
+
[field: string]: unknown;
|
|
925
|
+
}
|
|
926
|
+
interface MppSessionFetchResult {
|
|
927
|
+
response: Response;
|
|
928
|
+
receipt: unknown;
|
|
929
|
+
channel: unknown;
|
|
930
|
+
}
|
|
931
|
+
type MppSessionRequest = (input: RequestInfo | URL, init?: MppSessionRequestInit) => Promise<MppSessionFetchResult>;
|
|
932
|
+
interface MppSessionForceCloseResult {
|
|
933
|
+
requestCloseTxHash: string;
|
|
934
|
+
withdrawPayer(): Promise<string>;
|
|
935
|
+
}
|
|
936
|
+
interface MppSessionMeter {
|
|
937
|
+
add(units: bigint): void;
|
|
938
|
+
readonly pending: bigint;
|
|
939
|
+
}
|
|
940
|
+
/** The caller-owned session surface consumed by the React and Vue shells. */
|
|
941
|
+
interface MppSessionFetch extends MppSessionRequest {
|
|
942
|
+
readonly meter: MppSessionMeter;
|
|
943
|
+
readonly channels: readonly unknown[];
|
|
944
|
+
close(): Promise<MppSessionFetchResult>;
|
|
945
|
+
forceClose(): Promise<MppSessionForceCloseResult>;
|
|
946
|
+
}
|
|
947
|
+
/** Return a channel only when all public fields have the expected shape. */
|
|
948
|
+
declare function readMppSessionChannel(value: unknown): MppSessionChannel | null;
|
|
949
|
+
/** Return the newest structurally valid channel currently held by a session. */
|
|
950
|
+
declare function readCurrentMppSessionChannel(session: Pick<MppSessionFetch, "channels">): MppSessionChannel | null;
|
|
951
|
+
/** Return a receipt only when it has the public success-receipt shape. */
|
|
952
|
+
declare function readMppSessionReceipt(value: unknown): MppSessionReceipt | null;
|
|
953
|
+
/** A post-send channel-open failure carries the channel that can be recovered. */
|
|
954
|
+
declare function readMppRecoveryChannelId(error: unknown): string | null;
|
|
955
|
+
|
|
893
956
|
/**
|
|
894
957
|
* Solana session keys for the appkit shells (connect-lib STATE thread 18).
|
|
895
958
|
*
|
|
@@ -946,7 +1009,12 @@ interface RetryOptions {
|
|
|
946
1009
|
label?: string;
|
|
947
1010
|
}
|
|
948
1011
|
declare function withRetry<T>(fn: () => Promise<T>, options: RetryOptions): Promise<T>;
|
|
949
|
-
/**
|
|
1012
|
+
/**
|
|
1013
|
+
* Convert EIP-1193 chainChanged values into the CAIP-2 form used by sessions.
|
|
1014
|
+
* Refuses chain 0 and anything above `Number.MAX_SAFE_INTEGER`, as
|
|
1015
|
+
* connect-core's `normalizeEip155ChainId` does; switch to that export once
|
|
1016
|
+
* the connect-lib release that adds it is the minimum supported version.
|
|
1017
|
+
*/
|
|
950
1018
|
declare function normalizeEip155ChainId(value: unknown): string | undefined;
|
|
951
1019
|
declare function toEip155Accounts(accounts: unknown[], chainId: string): string[];
|
|
952
1020
|
/**
|
|
@@ -1011,4 +1079,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
|
|
|
1011
1079
|
refreshedAt: null;
|
|
1012
1080
|
};
|
|
1013
1081
|
|
|
1014
|
-
export { type AddressValidationLevel, type AtomicSupport, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, type DecimalsCache, type DelegationFrameworkAdapterOptions, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DelegationTypedData, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type PaymentFetch, type PaymentFetchResult, type PaymentRecord, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RedemptionCodec, type RedemptionRpc, type RedemptionTransaction, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaOwnerSigner, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSessionKeyFlow, type SolanaSessionKeyFlowDeps, type SolanaSigner, type SolanaWalletFeatures, type TokenIdentity, type TransactionSimulationContext, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, __resetResolverForTests, addInAppNotification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, fetchUserOperationReceipt, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readDecimals, readSolanaRoles, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
|
|
1082
|
+
export { type AddressValidationLevel, type AtomicSupport, type ChainCapabilities, type ChainInfo, type CompareCosts, type CompareCostsInput, type ConnectionStatus, type CostComparison, type CostComparisonOperation, type CostComparisonOptions, DEFAULT_NOTIFICATION_SETTINGS, type DecimalsCache, type DelegationFrameworkAdapterOptions, type DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DelegationTypedData, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, type MppSessionChannel, type MppSessionFetch, type MppSessionFetchResult, type MppSessionForceCloseResult, type MppSessionMeter, type MppSessionReceipt, type MppSessionRequest, type MppSessionRequestInit, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type NotificationSettingsUpdate, type PaymentFetch, type PaymentFetchResult, type PaymentRecord, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, type RedemptionCodec, type RedemptionRpc, type RedemptionTransaction, type RetryOptions, type RouteQuote, type RouteQuoteInput, type RouteQuoteOptions, type SimulationCallClient, type SimulationTransaction, type SiwxLocation, type SiwxMessageLike, type SiwxResultLike, type SmartAccountOptionsLike, type SmartAccountType, type SolanaIdentity, type SolanaOwnerSigner, type SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, type SolanaSessionKeyFlow, type SolanaSessionKeyFlowDeps, type SolanaSigner, type SolanaWalletFeatures, type TokenIdentity, type TransactionSimulationContext, type ViemChainShape, type WalletChain, type Web3Action, type Web3State, __resetResolverForTests, addInAppNotification, assertHexSignature, atomicSupportFor, bareEvmAddress, buildDelegationPolicyMessage, buildSmartAccountConfig, chainNamespace, chainNumber, chainsForNamespace, channelsUpdate, clearOneInAppNotification, compareCostsKey, createDecimalsCache, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, createSolanaSessionKeyFlow, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, describePayment, eip155ChainIdToNumber, encodeErc20Approve, encodeErc20Transfer, encodeErc20TransferFrom, fetchUserOperationReceipt, getResolver, getSharedSessionKeyManager, initialWeb3State, isBurnDestination, isEvmChainId, isPositiveIntegerAmount, isQuotableInput, isSiwxExpired, isSiwxNotBeforeValid, isVerifiablePolicy, loadNotificationSettings, mutedChainSettings, normalizeCapabilities, normalizeEip155ChainId, parseUserOperationReceipt, readCurrentMppSessionChannel, readDecimals, readMppRecoveryChannelId, readMppSessionChannel, readMppSessionReceipt, readSolanaRoles, replayNotificationSettings, resetSharedSessionKeyManager, resolveChain, resolveContextSimulationEndpoint, resolveEvmChainId, resolveRevertReason, resolveSimulationEndpoint, resolveUserOpChain, sameExecutionIntent, saveNotificationSettings, selectChainCapabilities, sessionKeyConfigFingerprint, simulateTransactionPreview, siwxResultToSession, toChainSwitchError, toEip155Accounts, toExecuteRouteError, toViemChain, tokenChainMismatch, tokenKey, updateNotificationSettings, validateDestination, validateRouteRecipient, web3Reducer, withRetry, withTimeout, writeDecimals };
|
package/dist/index.js
CHANGED
|
@@ -478,6 +478,13 @@ function saveNotificationSettings(storage, settings) {
|
|
|
478
478
|
function updateNotificationSettings(current, update) {
|
|
479
479
|
return { ...current, ...update };
|
|
480
480
|
}
|
|
481
|
+
function replayNotificationSettings(persisted, updates) {
|
|
482
|
+
let settings = persisted ?? DEFAULT_NOTIFICATION_SETTINGS;
|
|
483
|
+
for (const update of updates) {
|
|
484
|
+
settings = updateNotificationSettings(settings, update(settings));
|
|
485
|
+
}
|
|
486
|
+
return settings;
|
|
487
|
+
}
|
|
481
488
|
function channelsUpdate(channels) {
|
|
482
489
|
const update = {};
|
|
483
490
|
if (channels.includes("telegram")) update.telegram = true;
|
|
@@ -1347,6 +1354,36 @@ function describePayment(input, result) {
|
|
|
1347
1354
|
};
|
|
1348
1355
|
}
|
|
1349
1356
|
|
|
1357
|
+
// src/mpp-session.ts
|
|
1358
|
+
function record2(value) {
|
|
1359
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
1360
|
+
}
|
|
1361
|
+
function readMppSessionChannel(value) {
|
|
1362
|
+
const channel = record2(value);
|
|
1363
|
+
if (!channel || typeof channel.channelId !== "string" || typeof channel.payer !== "string" || typeof channel.payee !== "string" || typeof channel.mint !== "string" || typeof channel.channelProgram !== "string" || typeof channel.deposit !== "bigint" || typeof channel.gracePeriodSeconds !== "number" || typeof channel.openSlot !== "bigint" || typeof channel.salt !== "bigint") {
|
|
1364
|
+
return null;
|
|
1365
|
+
}
|
|
1366
|
+
return channel;
|
|
1367
|
+
}
|
|
1368
|
+
function readCurrentMppSessionChannel(session) {
|
|
1369
|
+
for (let index = session.channels.length - 1; index >= 0; index--) {
|
|
1370
|
+
const channel = readMppSessionChannel(session.channels[index]);
|
|
1371
|
+
if (channel) return channel;
|
|
1372
|
+
}
|
|
1373
|
+
return null;
|
|
1374
|
+
}
|
|
1375
|
+
function readMppSessionReceipt(value) {
|
|
1376
|
+
const receipt = record2(value);
|
|
1377
|
+
if (receipt?.status !== "success" || typeof receipt.method !== "string" || typeof receipt.timestamp !== "string" || typeof receipt.reference !== "string") {
|
|
1378
|
+
return null;
|
|
1379
|
+
}
|
|
1380
|
+
return receipt;
|
|
1381
|
+
}
|
|
1382
|
+
function readMppRecoveryChannelId(error) {
|
|
1383
|
+
const channelId = record2(error)?.channelId;
|
|
1384
|
+
return typeof channelId === "string" && channelId !== "" ? channelId : null;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1350
1387
|
// src/solana-session-key.ts
|
|
1351
1388
|
import {
|
|
1352
1389
|
verifySignedOwnerTransaction,
|
|
@@ -1465,18 +1502,25 @@ async function withRetry(fn, options) {
|
|
|
1465
1502
|
}
|
|
1466
1503
|
function normalizeEip155ChainId(value) {
|
|
1467
1504
|
if (typeof value !== "string") return void 0;
|
|
1505
|
+
let raw;
|
|
1506
|
+
if (value.startsWith("eip155:")) {
|
|
1507
|
+
raw = value.slice("eip155:".length);
|
|
1508
|
+
if (!/^\d+$/.test(raw)) return void 0;
|
|
1509
|
+
} else if (/^0x[0-9a-f]+$/i.test(value) || /^\d+$/.test(value)) {
|
|
1510
|
+
raw = value;
|
|
1511
|
+
} else {
|
|
1512
|
+
return void 0;
|
|
1513
|
+
}
|
|
1514
|
+
let numeric;
|
|
1468
1515
|
try {
|
|
1469
|
-
|
|
1470
|
-
const reference = value.slice("eip155:".length);
|
|
1471
|
-
if (!/^\d+$/.test(reference)) return void 0;
|
|
1472
|
-
return `eip155:${BigInt(reference).toString(10)}`;
|
|
1473
|
-
}
|
|
1474
|
-
if (/^0x[0-9a-f]+$/i.test(value) || /^\d+$/.test(value)) {
|
|
1475
|
-
return `eip155:${BigInt(value).toString(10)}`;
|
|
1476
|
-
}
|
|
1516
|
+
numeric = BigInt(raw);
|
|
1477
1517
|
} catch {
|
|
1518
|
+
return void 0;
|
|
1478
1519
|
}
|
|
1479
|
-
|
|
1520
|
+
if (numeric <= 0n || numeric > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
1521
|
+
return void 0;
|
|
1522
|
+
}
|
|
1523
|
+
return `eip155:${numeric.toString(10)}`;
|
|
1480
1524
|
}
|
|
1481
1525
|
function toEip155Accounts(accounts, chainId) {
|
|
1482
1526
|
const reference = chainId.split(":")[1];
|
|
@@ -1606,8 +1650,13 @@ export {
|
|
|
1606
1650
|
normalizeCapabilities,
|
|
1607
1651
|
normalizeEip155ChainId,
|
|
1608
1652
|
parseUserOperationReceipt,
|
|
1653
|
+
readCurrentMppSessionChannel,
|
|
1609
1654
|
readDecimals,
|
|
1655
|
+
readMppRecoveryChannelId,
|
|
1656
|
+
readMppSessionChannel,
|
|
1657
|
+
readMppSessionReceipt,
|
|
1610
1658
|
readSolanaRoles,
|
|
1659
|
+
replayNotificationSettings,
|
|
1611
1660
|
resetSharedSessionKeyManager,
|
|
1612
1661
|
resolveChain,
|
|
1613
1662
|
resolveContextSimulationEndpoint,
|