import { BaseResource, Chain } from '@webacy-xyz/sdk-core'; import { ScanTransactionRequest, ScanEIP712Request, ScanResponse, ScanEIP712Response, ScanOptions, RiskScanOptions, RiskScanResponse, RiskScanStatusResponse } from '../types/scan'; /** * Resource for transaction and message scanning * * Provides pre-signing security analysis for: * - Raw transaction scanning * - EIP-712 typed message scanning * * Note: This resource uses numeric chain IDs (1, 56, 137, etc.) in the request body * rather than the Chain enum, as required by the underlying API. * * @example * ```typescript * // Scan a transaction before signing * const result = await client.scan.scanTransaction('0xSigner', { * tx: { from: '0xSigner', raw: '0xRawTx...' }, * chain: 1, // Ethereum * }); * * // Scan an EIP-712 message * const result = await client.scan.scanEip712('0xSigner', { * msg: { * from: '0xSigner', * data: { types: {...}, primaryType: 'Permit', domain: {...}, message: {...} }, * }, * }); * ``` */ export declare class ScanResource extends BaseResource { constructor(httpClient: import('@webacy-xyz/sdk-core').HttpClient, _defaultChain?: Chain); /** * Scan a transaction for security risks before signing * * Analyzes raw transaction data and returns: * - Risk assessment and warnings * - Simulated asset changes * - Contract interaction details * - Domain reputation (if provided) * * @param fromAddress - The signer address * @param request - Transaction scan request * @param options - Request options * @returns Transaction scan result * * @example * ```typescript * const result = await client.scan.scanTransaction('0xSigner...', { * tx: { * from: '0xSigner...', * raw: '0x02f8...', * }, * chain: 1, // Ethereum mainnet * domain: 'uniswap.org', * }); * * if (result.riskLevel === 'high' || result.riskLevel === 'critical') { * console.warn('High risk transaction!'); * for (const warning of result.warnings) { * console.warn(`${warning.severity}: ${warning.description}`); * } * } * * // Check simulated asset changes * if (result.assetChanges) { * for (const change of result.assetChanges) { * console.log(`${change.type}: ${change.amount} ${change.symbol}`); * } * } * ``` */ scanTransaction(fromAddress: string, request: ScanTransactionRequest, options?: ScanOptions): Promise; /** * Scan an EIP-712 typed message for security risks before signing * * Analyzes EIP-712 typed data and returns: * - Risk assessment and warnings * - Message type analysis (permit, order, etc.) * - Spender analysis for approvals * - Domain reputation (if provided) * * @param fromAddress - The signer address * @param request - EIP-712 scan request * @param options - Request options * @returns EIP-712 scan result * * @example * ```typescript * const result = await client.scan.scanEip712('0xSigner...', { * msg: { * from: '0xSigner...', * data: { * types: { * EIP712Domain: [ * { name: 'name', type: 'string' }, * { name: 'version', type: 'string' }, * { name: 'chainId', type: 'uint256' }, * { name: 'verifyingContract', type: 'address' }, * ], * Permit: [ * { name: 'owner', type: 'address' }, * { name: 'spender', type: 'address' }, * { name: 'value', type: 'uint256' }, * { name: 'nonce', type: 'uint256' }, * { name: 'deadline', type: 'uint256' }, * ], * }, * primaryType: 'Permit', * domain: { * name: 'Token', * version: '1', * chainId: 1, * verifyingContract: '0xToken...', * }, * message: { * owner: '0xSigner...', * spender: '0xSpender...', * value: '1000000000000000000', * nonce: 0, * deadline: 1735689600, * }, * }, * }, * domain: 'app.uniswap.org', * }); * * if (result.messageType?.isPermit) { * console.log('This is a permit/approval signature'); * if (result.spenderAnalysis?.riskLevel === 'high') { * console.warn('High risk spender!'); * } * } * ``` */ scanEip712(fromAddress: string, request: ScanEIP712Request, options?: ScanOptions): Promise; /** * Initiate a wallet risk score scan * * Starts an asynchronous risk analysis for the given address. * Use `getRiskScanStatus()` to poll for completion. * * @param address - Wallet address to scan * @param options - Request options (chain is optional if defaultChain is set) * @returns Scan initiation response * * @example * ```typescript * // Start a risk scan * const result = await client.scan.startRiskScan('0x...', { chain: Chain.ETH }); * * // Poll for completion * const status = await client.scan.getRiskScanStatus('0x...', { chain: Chain.ETH }); * ``` */ startRiskScan(address: string, options?: RiskScanOptions): Promise; /** * Get the status of a wallet risk score scan * * Polls the status of a previously initiated risk scan. * Returns scan progress and results when complete. * * @param address - Wallet address that was scanned * @param options - Request options (chain is optional if defaultChain is set) * @returns Scan status response * * @example * ```typescript * const status = await client.scan.getRiskScanStatus('0x...', { chain: Chain.ETH }); * if (status.status === 'complete') { * console.log(`Risk score: ${status.score}`); * } * ``` */ getRiskScanStatus(address: string, options?: RiskScanOptions): Promise; /** * Validate signer address format (basic non-empty check) * * Note: This is a simpler validation than the chain-aware validation in BaseResource, * as scan requests accept EVM addresses only. */ private validateSignerAddress; /** * Validate that the signer address matches the address in the request */ private validateSignerAddressMatch; /** * Validate transaction scan request */ private validateTransactionRequest; /** * Validate EIP-712 scan request */ private validateEip712Request; } //# sourceMappingURL=scan.d.ts.map