@naculus/connect-appkit-core 0.2.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +289 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -2
- package/dist/index.d.ts +113 -2
- package/dist/index.js +293 -27
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
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 } 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,107 @@ 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
|
+
|
|
782
893
|
declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
|
|
783
894
|
interface RetryOptions {
|
|
784
895
|
maxRetries: number;
|
|
@@ -851,4 +962,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
|
|
|
851
962
|
refreshedAt: null;
|
|
852
963
|
};
|
|
853
964
|
|
|
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 };
|
|
965
|
+
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 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, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, 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 } 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,107 @@ 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
|
+
|
|
782
893
|
declare function withTimeout<T>(promise: Promise<T>, ms: number, label?: string): Promise<T>;
|
|
783
894
|
interface RetryOptions {
|
|
784
895
|
maxRetries: number;
|
|
@@ -851,4 +962,4 @@ declare function siwxResultToSession<M extends SiwxMessageLike>(result: SiwxResu
|
|
|
851
962
|
refreshedAt: null;
|
|
852
963
|
};
|
|
853
964
|
|
|
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 };
|
|
965
|
+
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 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, createDelegationFrameworkAdapter, createDelegationPolicyFlow, createNotification, createNotificationSettingsStorage, 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 };
|