import type { WalletChain } from '../v2/wallet-binding/types.js'; import type { SignedPassport } from '../types/passport.js'; import type { ACPCheckoutSession, ACPLineItem, ACPMoney, ACPAddress, CommerceConfig, CommerceDelegation, CommercePreflightCheck, CommercePreflightResult, CommerceActionReceipt, HumanApprovalRequest, IdempotencyStore } from '../types/commerce.js'; declare const COMMERCE_SCOPES: readonly ["commerce:checkout", "commerce:browse", "commerce:purchase", "commerce:cancel"]; type CommerceScope = typeof COMMERCE_SCOPES[number]; export declare function hasCommerceScope(delegation: CommerceDelegation, required: CommerceScope): boolean; export declare function checkPassportGate(signedPassport: SignedPassport): CommercePreflightCheck; export declare function checkScopeGate(delegation: CommerceDelegation): CommercePreflightCheck; export declare function checkSpendGate(delegation: CommerceDelegation, estimatedTotal: ACPMoney): CommercePreflightCheck; export declare function checkHumanApprovalThreshold(delegation: CommerceDelegation, estimatedTotal: ACPMoney): string | null; export declare function checkMerchantGate(delegation: CommerceDelegation, merchantName: string): CommercePreflightCheck | null; export declare function checkWalletGate(signedPassport: SignedPassport, walletRef: { chain: WalletChain; address: string; }): CommercePreflightCheck; export declare function commercePreflight(_opts: { signedPassport: SignedPassport; delegation: CommerceDelegation; merchantName: string; estimatedTotal: ACPMoney; config?: CommerceConfig; walletRef?: { chain: WalletChain; address: string; }; idempotencyKey?: string; idempotencyStore?: IdempotencyStore; idempotencyWindowSeconds?: number; }): CommercePreflightResult; export declare function createCheckout(_opts: { signedPassport: SignedPassport; delegation: CommerceDelegation; config: CommerceConfig; items: { skuId: string; quantity: number; }[]; customer?: { name?: string; email?: string; }; fulfillmentAddress?: ACPAddress; privateKey: string; }): Promise<{ session: ACPCheckoutSession; receipt: CommerceActionReceipt; }>; export declare function updateCheckout(_opts: { signedPassport: SignedPassport; delegation: CommerceDelegation; config: CommerceConfig; sessionId: string; updates: { items?: { id: string; quantity: number; }[]; fulfillmentAddress?: ACPAddress; fulfillmentOptionId?: string; }; privateKey: string; }): Promise<{ session: ACPCheckoutSession; receipt: CommerceActionReceipt; }>; export declare function completeCheckout(_opts: { signedPassport: SignedPassport; delegation: CommerceDelegation; config: CommerceConfig; sessionId: string; paymentToken: string; paymentMethod?: string; privateKey: string; }): Promise<{ session: ACPCheckoutSession; receipt: CommerceActionReceipt; spendUpdated: CommerceDelegation; }>; export declare function cancelCheckout(_opts: { signedPassport: SignedPassport; delegation: CommerceDelegation; config: CommerceConfig; sessionId: string; privateKey: string; }): Promise<{ session: ACPCheckoutSession; receipt: CommerceActionReceipt; }>; export declare function requestHumanApproval(opts: { agentId: string; delegationId: string; merchantName: string; items: ACPLineItem[]; totalAmount: ACPMoney; reason: string; expiresInMinutes?: number; }): HumanApprovalRequest; export declare function signCommerceReceipt(opts: { agentId: string; delegationId: string; actionType: CommerceActionReceipt['action']['type']; target: string; method: string; session: ACPCheckoutSession; merchantName: string; delegationChain: string[]; beneficiary: string; privateKey: string; }): CommerceActionReceipt; export declare function extractDelegationChain(sp: SignedPassport): string[]; export declare function createCommerceDelegation(opts: { agentId: string; delegationId: string; spendLimit: number; currency?: string; approvedMerchants?: string[]; requireHumanApproval?: boolean; humanApprovalThreshold?: number; additionalScopes?: string[]; }): CommerceDelegation; /** * Record a spend against a commerce delegation and return a NEW delegation with spentAmount * incremented. This is the stateless write primitive that pairs with checkSpendGate: call * checkSpendGate (or commercePreflight) BEFORE a purchase, then recordSpend AFTER it settles, and * PERSIST the returned delegation yourself. The SDK is by-value and stateless: it does not persist * spend between calls, and cumulative enforcement across purchases is the caller's or the gateway's * responsibility. * * recordSpend refuses an amount that is not a finite number >= 0, and refuses a spend that would * push spentAmount past spendLimit (so it doubles as a safe check-and-record on the returned * object). It does not mutate the input. * * NOTE: CommerceDelegation is an UNSIGNED accounting object, so incrementing spentAmount is safe. * The signed core Delegation carries spentAmount only as its spend-at-issue value (0); that field * is part of the signed payload and is therefore immutable. It is never a running total. */ export declare function recordSpend(delegation: CommerceDelegation, amount: number): CommerceDelegation; export declare function getSpendSummary(delegation: CommerceDelegation): { limit: number; spent: number; remaining: number; currency: string; utilizationPercent: number; nearLimit: boolean; }; export declare function verifyCommerceReceipt(receipt: CommerceActionReceipt, publicKey: string): { valid: boolean; errors: string[]; }; export {}; //# sourceMappingURL=commerce.d.ts.map