/** * @name signer/policy-enforcing-wallet * @description Wallet adapter that enforces the configured value-movement policy * before signing any transaction. * * Every SAP SDK tool that writes on-chain (agent register/update/close, escrow * V2, staking, swaps) signs through the `SapClient` wallet. The SDK modules do * not expose pre-sign transaction builders, so the only central, low-risk * interception point is the wallet `signTransaction` method used by the * underlying Anchor provider. Wrapping the wallet here applies the spending * limit (`maxTxValueSol`, `requireApprovalAboveSol`) to ALL local-signer SDK * tools without patching each one. * * If no policy engine is provided the wallet delegates straight to the wrapped * signer, preserving current behavior for hosted/delegated modes. * * @module signer/policy-enforcing-wallet */ import type { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js'; import type { SapPolicyEngine } from '../../core/src/types.js'; /** Minimal signer surface required by the SAP SDK wallet interface. */ export interface SignerWallet { readonly publicKey: PublicKey; signTransaction(tx: T): Promise; signAllTransactions(txs: T[]): Promise; } /** * @name PolicyEnforcingWallet * @description Wraps a signer wallet and enforces the transaction-value policy * before delegating the actual signature. */ export declare class PolicyEnforcingWallet implements SignerWallet { readonly publicKey: PublicKey; private readonly wrapped; private readonly policyEngine?; private readonly toolName; private readonly sapProgramId?; /** * @param wrapped — The underlying wallet/signer that performs the real signature. * @param policyEngine — Policy engine used to evaluate transaction:submit. When * omitted, enforcement is skipped (delegated modes / disabled policy). * @param toolName — Tool name reported to the policy engine for audit context. * @param sapProgramId — Configured SAP program id allowed for SDK metadata writes. */ constructor(wrapped: SignerWallet, policyEngine?: SapPolicyEngine, toolName?: string, sapProgramId?: string); signTransaction(tx: T): Promise; signAllTransactions(txs: T[]): Promise; /** * @name assertPolicy * @description Estimates value moved by the transaction and asks the policy * engine for permission before signing. * * Zero-value transactions (e.g. pure metadata updates) are allowed without a * policy lookup. Token transfers require an explicit approval path because * their SOL-equivalent value cannot be safely inferred without a price oracle. */ private assertPolicy; } //# sourceMappingURL=policy-enforcing-wallet.d.ts.map