@naculus/connect-appkit-core 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, SessionKeyScope, ScopeCheckResult } from '@naculus/connect-core';
1
+ import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, delegationTypedData, SessionKeyScope, ScopeCheckResult, SolanaSessionKeyInfo, SolanaSessionKeyScope, SolanaSessionKeyManager, SolanaPaymentRpc } from '@naculus/connect-core';
2
2
 
3
3
  /**
4
4
  * The types the framework-neutral half of appkit is built on.
@@ -745,12 +745,22 @@ interface DelegationPolicyDeps {
745
745
  delegated: boolean | null;
746
746
  delegate: `0x${string}` | null;
747
747
  };
748
+ /**
749
+ * For `eip7702` policies: the connected wallet's EIP-712 signature
750
+ * (eth_signTypedData_v4) over `{ domain, types, primaryType, message }` —
751
+ * viem-style typed data, without an `EIP712Domain` entry in `types`.
752
+ */
753
+ signTypedData?: (typedData: DelegationTypedData) => Promise<string>;
754
+ /** For `eip7702` policies: the connected EIP-155 chain number, or null. */
755
+ chainId?: () => number | null;
748
756
  /** A host-provided encryption key is required for persistent policies. */
749
757
  encryptionKeyConfigured: boolean;
750
758
  storageAvailable: () => boolean;
751
759
  /** Re-read the policy list after a mutation. */
752
760
  refresh: () => Promise<void>;
753
761
  }
762
+ /** The typed data an owner signs to authorize an `eip7702` policy. */
763
+ type DelegationTypedData = ReturnType<typeof delegationTypedData>;
754
764
  /**
755
765
  * True when the adapter's prepared transaction still means what was
756
766
  * requested. Fail-closed: a field the caller left undefined is not a
@@ -779,6 +789,156 @@ interface DelegationPolicyFlow {
779
789
  }
780
790
  declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): DelegationPolicyFlow;
781
791
 
792
+ /**
793
+ * The execution adapter for `eip7702` policies (MetaMask Delegation Framework
794
+ * v1.3.0; docs/design/eip7702-session-delegation.md in connect-lib).
795
+ *
796
+ * The session key sends `DelegationManager.redeemDelegations` from its own
797
+ * address and pays the gas; the chain enforces the delegation's caveats. The
798
+ * adapter builds that transaction and broadcasts it; the delegation-policy
799
+ * flow signs it with connect-core's `signDelegationRedemption`, which
800
+ * re-encodes the redemption from the stored delegation and refuses anything
801
+ * else.
802
+ *
803
+ * Transaction encoding is the app's (`codec`), so this package takes no
804
+ * dependency: pass viem's `serializeTransaction` / `keccak256`, or
805
+ * wallet-engine's encoder.
806
+ */
807
+ /** An unsigned EIP-1559 transaction, in the codec's terms. */
808
+ interface RedemptionTransaction {
809
+ type: "eip1559";
810
+ chainId: number;
811
+ nonce: number;
812
+ to: `0x${string}`;
813
+ value: bigint;
814
+ data: `0x${string}`;
815
+ gas: bigint;
816
+ maxFeePerGas: bigint;
817
+ maxPriorityFeePerGas: bigint;
818
+ }
819
+ interface RedemptionCodec {
820
+ /** keccak256 of the unsigned transaction's signing payload. */
821
+ signingHash: (tx: RedemptionTransaction) => `0x${string}`;
822
+ /** The raw signed transaction, from a 65-byte r‖s‖v (v 27/28) signature. */
823
+ serialize: (tx: RedemptionTransaction, signature: `0x${string}`) => `0x${string}`;
824
+ }
825
+ interface RedemptionRpc {
826
+ /** Pending nonce of `address`. */
827
+ getTransactionCount: (address: `0x${string}`) => Promise<number>;
828
+ estimateGas: (tx: {
829
+ from: `0x${string}`;
830
+ to: `0x${string}`;
831
+ data: `0x${string}`;
832
+ }) => Promise<bigint>;
833
+ fees: () => Promise<{
834
+ maxFeePerGas: bigint;
835
+ maxPriorityFeePerGas: bigint;
836
+ }>;
837
+ sendRawTransaction: (raw: `0x${string}`) => Promise<`0x${string}`>;
838
+ }
839
+ interface DelegationFrameworkAdapterOptions {
840
+ manager: SessionKeyManager;
841
+ rpc: RedemptionRpc;
842
+ codec: RedemptionCodec;
843
+ /** The connected chain; must be the one the delegation was signed for. */
844
+ chainId: () => number | null;
845
+ }
846
+ declare function createDelegationFrameworkAdapter(options: DelegationFrameworkAdapterOptions): PolicyExecutionAdapter;
847
+
848
+ /**
849
+ * Agentic payments (x402 / MPP) for the appkit shells.
850
+ *
851
+ * The app builds the paying fetch itself — `createX402Fetch` from
852
+ * `@naculus/payments-x402` or `createMppFetch` from `@naculus/payments-mpp`,
853
+ * with the session key and limits it chooses — and the hooks only track its
854
+ * state. So appkit takes no dependency on either package: their results are
855
+ * read here by shape, and a shape this does not recognise is reported as
856
+ * `protocol: "unknown"` rather than guessed at.
857
+ */
858
+ /** What `createX402Fetch` and `createMppFetch` return, structurally. */
859
+ interface PaymentFetchResult {
860
+ response: Response;
861
+ /** The requirement (x402) or charge (MPP) paid; null when nothing was. */
862
+ paid: unknown;
863
+ /** x402 `PAYMENT-RESPONSE`. */
864
+ settlement?: unknown;
865
+ /** MPP `Payment-Receipt`. */
866
+ receipt?: unknown;
867
+ }
868
+ type PaymentFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<PaymentFetchResult>;
869
+ /** One payment, in the terms a UI shows. Amounts are token base units. */
870
+ interface PaymentRecord {
871
+ protocol: "x402" | "mpp" | "unknown";
872
+ /** The URL that was requested. */
873
+ resource: string;
874
+ /** CAIP-2 chain, e.g. `eip155:8453`; null when unknown. */
875
+ chainId: string | null;
876
+ /** Token contract; null when unknown. */
877
+ asset: string | null;
878
+ payTo: string | null;
879
+ amount: string | null;
880
+ /**
881
+ * Settlement transaction hash as the server reported it — unverified; the
882
+ * other fields are what the client signed.
883
+ */
884
+ reference: string | null;
885
+ }
886
+ /**
887
+ * The payment a paying fetch made, or null when it paid nothing. Reads the
888
+ * x402 requirement / settlement (EVM or Solana) or the MPP `evm` / `solana`
889
+ * charge / receipt by shape.
890
+ */
891
+ declare function describePayment(input: RequestInfo | URL, result: PaymentFetchResult): PaymentRecord | null;
892
+
893
+ /**
894
+ * Solana session keys for the appkit shells (connect-lib STATE thread 18).
895
+ *
896
+ * The app builds the `SolanaSessionKeyManager` (its storage and password) and
897
+ * the RPC; the owner is the connected wallet's Solana signer role. Creating a
898
+ * key asks the wallet once to sign an SPL `ApproveChecked` (the key becomes
899
+ * the delegate of the owner's token account for that mint, up to the budget)
900
+ * and broadcasts it; revoking asks it to sign `Revoke`. Payments then go
901
+ * through `createX402Fetch` / `createMppFetch` with
902
+ * `solana: { sessionKey: { manager, id }, rpc }` — no prompt.
903
+ */
904
+ interface SolanaOwnerSigner {
905
+ address: string;
906
+ signTransaction(transaction: Uint8Array): Promise<Uint8Array>;
907
+ }
908
+ interface SolanaSessionKeyFlowDeps {
909
+ manager: SolanaSessionKeyManager;
910
+ /** Must implement `sendTransaction` (e.g. `solanaPaymentRpc(url)`). */
911
+ rpc: SolanaPaymentRpc;
912
+ owner: SolanaOwnerSigner;
913
+ }
914
+ interface SolanaSessionKeyFlow {
915
+ /** The owner's keys, newest first. */
916
+ list(): Promise<SolanaSessionKeyInfo[]>;
917
+ /**
918
+ * Create a key, have the owner approve it, broadcast the approval.
919
+ * Approving replaces any delegate the owner's token account already had.
920
+ *
921
+ * On any failure the new key is revoked here, so it never signs. A failed
922
+ * broadcast does not prove the approval did not land (a timeout after
923
+ * submission): the error then says so, and `revoke(id)` sends the owner's
924
+ * on-chain `Revoke` to be sure.
925
+ */
926
+ create(scope: SolanaSessionKeyScope): Promise<{
927
+ key: SolanaSessionKeyInfo;
928
+ signature: string;
929
+ }>;
930
+ /**
931
+ * Stop the key here at once (before anything else can fail), then have the
932
+ * owner sign `Revoke` and broadcast it. If that fails, the key stays
933
+ * revoked locally; the on-chain delegate stays until a later revoke lands.
934
+ * Also works on a key already revoked locally.
935
+ */
936
+ revoke(id: string): Promise<{
937
+ signature: string;
938
+ }>;
939
+ }
940
+ declare function createSolanaSessionKeyFlow(deps: SolanaSessionKeyFlowDeps): SolanaSessionKeyFlow;
941
+
782
942
  declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
783
943
  interface RetryOptions {
784
944
  maxRetries: number;
@@ -851,4 +1011,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
851
1011
  refreshedAt: null;
852
1012
  };
853
1013
 
854
- 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 DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, 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 SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, 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, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, SessionKeyScope, ScopeCheckResult } from '@naculus/connect-core';
1
+ import { Namespace, UniversalWalletSession, WalletCapabilities, TokenConfig, WalletError, WalletErrorCode, SimulationResult, NameResolverConfig, NameResolver, NotificationSettings, InAppChannel, NotificationItem, SessionKeyManagerConfig, SessionKeyManager, Hex, UserOperationReceipt, Address, SmartAccountConfig, AtomicityRequirement, ExecutionPlan, SessionKeyInfo, SessionKeyTransaction, delegationTypedData, SessionKeyScope, ScopeCheckResult, SolanaSessionKeyInfo, SolanaSessionKeyScope, SolanaSessionKeyManager, SolanaPaymentRpc } from '@naculus/connect-core';
2
2
 
3
3
  /**
4
4
  * The types the framework-neutral half of appkit is built on.
@@ -745,12 +745,22 @@ interface DelegationPolicyDeps {
745
745
  delegated: boolean | null;
746
746
  delegate: `0x${string}` | null;
747
747
  };
748
+ /**
749
+ * For `eip7702` policies: the connected wallet's EIP-712 signature
750
+ * (eth_signTypedData_v4) over `{ domain, types, primaryType, message }` —
751
+ * viem-style typed data, without an `EIP712Domain` entry in `types`.
752
+ */
753
+ signTypedData?: (typedData: DelegationTypedData) => Promise<string>;
754
+ /** For `eip7702` policies: the connected EIP-155 chain number, or null. */
755
+ chainId?: () => number | null;
748
756
  /** A host-provided encryption key is required for persistent policies. */
749
757
  encryptionKeyConfigured: boolean;
750
758
  storageAvailable: () => boolean;
751
759
  /** Re-read the policy list after a mutation. */
752
760
  refresh: () => Promise<void>;
753
761
  }
762
+ /** The typed data an owner signs to authorize an `eip7702` policy. */
763
+ type DelegationTypedData = ReturnType<typeof delegationTypedData>;
754
764
  /**
755
765
  * True when the adapter's prepared transaction still means what was
756
766
  * requested. Fail-closed: a field the caller left undefined is not a
@@ -779,6 +789,156 @@ interface DelegationPolicyFlow {
779
789
  }
780
790
  declare function createDelegationPolicyFlow(deps: DelegationPolicyDeps): DelegationPolicyFlow;
781
791
 
792
+ /**
793
+ * The execution adapter for `eip7702` policies (MetaMask Delegation Framework
794
+ * v1.3.0; docs/design/eip7702-session-delegation.md in connect-lib).
795
+ *
796
+ * The session key sends `DelegationManager.redeemDelegations` from its own
797
+ * address and pays the gas; the chain enforces the delegation's caveats. The
798
+ * adapter builds that transaction and broadcasts it; the delegation-policy
799
+ * flow signs it with connect-core's `signDelegationRedemption`, which
800
+ * re-encodes the redemption from the stored delegation and refuses anything
801
+ * else.
802
+ *
803
+ * Transaction encoding is the app's (`codec`), so this package takes no
804
+ * dependency: pass viem's `serializeTransaction` / `keccak256`, or
805
+ * wallet-engine's encoder.
806
+ */
807
+ /** An unsigned EIP-1559 transaction, in the codec's terms. */
808
+ interface RedemptionTransaction {
809
+ type: "eip1559";
810
+ chainId: number;
811
+ nonce: number;
812
+ to: `0x${string}`;
813
+ value: bigint;
814
+ data: `0x${string}`;
815
+ gas: bigint;
816
+ maxFeePerGas: bigint;
817
+ maxPriorityFeePerGas: bigint;
818
+ }
819
+ interface RedemptionCodec {
820
+ /** keccak256 of the unsigned transaction's signing payload. */
821
+ signingHash: (tx: RedemptionTransaction) => `0x${string}`;
822
+ /** The raw signed transaction, from a 65-byte r‖s‖v (v 27/28) signature. */
823
+ serialize: (tx: RedemptionTransaction, signature: `0x${string}`) => `0x${string}`;
824
+ }
825
+ interface RedemptionRpc {
826
+ /** Pending nonce of `address`. */
827
+ getTransactionCount: (address: `0x${string}`) => Promise<number>;
828
+ estimateGas: (tx: {
829
+ from: `0x${string}`;
830
+ to: `0x${string}`;
831
+ data: `0x${string}`;
832
+ }) => Promise<bigint>;
833
+ fees: () => Promise<{
834
+ maxFeePerGas: bigint;
835
+ maxPriorityFeePerGas: bigint;
836
+ }>;
837
+ sendRawTransaction: (raw: `0x${string}`) => Promise<`0x${string}`>;
838
+ }
839
+ interface DelegationFrameworkAdapterOptions {
840
+ manager: SessionKeyManager;
841
+ rpc: RedemptionRpc;
842
+ codec: RedemptionCodec;
843
+ /** The connected chain; must be the one the delegation was signed for. */
844
+ chainId: () => number | null;
845
+ }
846
+ declare function createDelegationFrameworkAdapter(options: DelegationFrameworkAdapterOptions): PolicyExecutionAdapter;
847
+
848
+ /**
849
+ * Agentic payments (x402 / MPP) for the appkit shells.
850
+ *
851
+ * The app builds the paying fetch itself — `createX402Fetch` from
852
+ * `@naculus/payments-x402` or `createMppFetch` from `@naculus/payments-mpp`,
853
+ * with the session key and limits it chooses — and the hooks only track its
854
+ * state. So appkit takes no dependency on either package: their results are
855
+ * read here by shape, and a shape this does not recognise is reported as
856
+ * `protocol: "unknown"` rather than guessed at.
857
+ */
858
+ /** What `createX402Fetch` and `createMppFetch` return, structurally. */
859
+ interface PaymentFetchResult {
860
+ response: Response;
861
+ /** The requirement (x402) or charge (MPP) paid; null when nothing was. */
862
+ paid: unknown;
863
+ /** x402 `PAYMENT-RESPONSE`. */
864
+ settlement?: unknown;
865
+ /** MPP `Payment-Receipt`. */
866
+ receipt?: unknown;
867
+ }
868
+ type PaymentFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<PaymentFetchResult>;
869
+ /** One payment, in the terms a UI shows. Amounts are token base units. */
870
+ interface PaymentRecord {
871
+ protocol: "x402" | "mpp" | "unknown";
872
+ /** The URL that was requested. */
873
+ resource: string;
874
+ /** CAIP-2 chain, e.g. `eip155:8453`; null when unknown. */
875
+ chainId: string | null;
876
+ /** Token contract; null when unknown. */
877
+ asset: string | null;
878
+ payTo: string | null;
879
+ amount: string | null;
880
+ /**
881
+ * Settlement transaction hash as the server reported it — unverified; the
882
+ * other fields are what the client signed.
883
+ */
884
+ reference: string | null;
885
+ }
886
+ /**
887
+ * The payment a paying fetch made, or null when it paid nothing. Reads the
888
+ * x402 requirement / settlement (EVM or Solana) or the MPP `evm` / `solana`
889
+ * charge / receipt by shape.
890
+ */
891
+ declare function describePayment(input: RequestInfo | URL, result: PaymentFetchResult): PaymentRecord | null;
892
+
893
+ /**
894
+ * Solana session keys for the appkit shells (connect-lib STATE thread 18).
895
+ *
896
+ * The app builds the `SolanaSessionKeyManager` (its storage and password) and
897
+ * the RPC; the owner is the connected wallet's Solana signer role. Creating a
898
+ * key asks the wallet once to sign an SPL `ApproveChecked` (the key becomes
899
+ * the delegate of the owner's token account for that mint, up to the budget)
900
+ * and broadcasts it; revoking asks it to sign `Revoke`. Payments then go
901
+ * through `createX402Fetch` / `createMppFetch` with
902
+ * `solana: { sessionKey: { manager, id }, rpc }` — no prompt.
903
+ */
904
+ interface SolanaOwnerSigner {
905
+ address: string;
906
+ signTransaction(transaction: Uint8Array): Promise<Uint8Array>;
907
+ }
908
+ interface SolanaSessionKeyFlowDeps {
909
+ manager: SolanaSessionKeyManager;
910
+ /** Must implement `sendTransaction` (e.g. `solanaPaymentRpc(url)`). */
911
+ rpc: SolanaPaymentRpc;
912
+ owner: SolanaOwnerSigner;
913
+ }
914
+ interface SolanaSessionKeyFlow {
915
+ /** The owner's keys, newest first. */
916
+ list(): Promise<SolanaSessionKeyInfo[]>;
917
+ /**
918
+ * Create a key, have the owner approve it, broadcast the approval.
919
+ * Approving replaces any delegate the owner's token account already had.
920
+ *
921
+ * On any failure the new key is revoked here, so it never signs. A failed
922
+ * broadcast does not prove the approval did not land (a timeout after
923
+ * submission): the error then says so, and `revoke(id)` sends the owner's
924
+ * on-chain `Revoke` to be sure.
925
+ */
926
+ create(scope: SolanaSessionKeyScope): Promise<{
927
+ key: SolanaSessionKeyInfo;
928
+ signature: string;
929
+ }>;
930
+ /**
931
+ * Stop the key here at once (before anything else can fail), then have the
932
+ * owner sign `Revoke` and broadcast it. If that fails, the key stays
933
+ * revoked locally; the on-chain delegate stays until a later revoke lands.
934
+ * Also works on a key already revoked locally.
935
+ */
936
+ revoke(id: string): Promise<{
937
+ signature: string;
938
+ }>;
939
+ }
940
+ declare function createSolanaSessionKeyFlow(deps: SolanaSessionKeyFlowDeps): SolanaSessionKeyFlow;
941
+
782
942
  declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
783
943
  interface RetryOptions {
784
944
  maxRetries: number;
@@ -851,4 +1011,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
851
1011
  refreshedAt: null;
852
1012
  };
853
1013
 
854
- 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 DelegationPolicyDeps, type DelegationPolicyFlow, type DelegationPolicyPreview, type DestinationIssue, type DestinationValidation, type ExecutableQuote, type ExecuteRoute, type ExecuteRouteError, type ExecuteRouteOptions, type ExecuteRouteResult, type GetRouteQuotes, InvalidUserOperationReceiptError, NOTIFICATION_SETTINGS_KEY, type NotificationSettingsStorage, type PolicyExecutionAdapter, type PolicyExecutionCheck, type PolicyExecutionPreview, type PolicyExecutionRoute, type PolicyExecutionSubmission, type PolicySignatureVerifier, type PreparedPolicyExecution, 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 SolanaPayer, type SolanaRoles, type SolanaRolesAbsence, type SolanaRolesSource, type SolanaRolesState, 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, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, decodeRevertReason, defaultSiwxDomain, defaultSiwxUri, describeChain, 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 };
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 };