/** * Blockaid integration types * * Types for Blockaid security scanning and validation services */ export type BlockaidValidationResultType = 'Benign' | 'Warning' | 'Malicious' export interface BlockaidValidation { classification?: string | null description?: string | null features: { type: 'Malicious' | 'Warning' | 'Benign' | 'Info' feature_id: string description: string address?: string | null metadata?: Record | null }[] reason?: string | null result_type: BlockaidValidationResultType status: string error?: string | null } export interface BlockaidAssetDiff { asset: Record in: Record[] out: Record[] asset_type?: string | null } export interface BlockaidSimulation { account_address: string account_summary: Record address_details: Record assets_diffs: Record block: number chain: string exposures: Record status: string total_usd_diff: Record total_usd_exposure: Record transaction_action: string session_key: Record params?: Record | null contract_management?: Record | null missing_balances?: Record[] | null simulation_run_count?: number | null } // Validation options for the scan export type BlockaidValidationOption = | 'validation' | 'simulation' | 'gas_estimation' | 'events' // EIP-7702 Authorization for transaction export interface BlockaidAuthorization { address: string chainId?: string nonce?: string yParity?: string r?: string s?: string eoa?: string } // Transaction data object export interface BlockaidScanEvmTxData { from: string to?: string data?: string value?: string gas?: string gas_price?: string authorization_list?: BlockaidAuthorization[] } // Metadata when transaction is initiated by a dApp export interface BlockaidMetadataDapp { domain: string } // Metadata when transaction is not initiated by a dApp export interface BlockaidMetadataNonDapp { non_dapp?: boolean } // State override for testing purposes export interface BlockaidAddressStateOverride { balance?: string nonce?: string code?: string state?: Record stateDiff?: Record movePrecompileToAddress?: string } // Main request type for scanning EVM transactions export interface BlockaidScanEvmTxRequest { chain: string data: BlockaidScanEvmTxData metadata?: BlockaidMetadataDapp | BlockaidMetadataNonDapp account_address: string options?: BlockaidValidationOption[] block?: number | string state_override?: Record simulate_with_estimated_gas?: boolean } // Event emitted during transaction scan export interface BlockaidTransactionScanEvent { emitter_address: string emitter_name?: string name?: string params?: BlockaidTransactionScanLogParamInfo[] topics: string[] data: string } export interface BlockaidTransactionScanLogParamInfo { type: string value: string | Record | any[] internalType?: string name?: string } export interface BlockaidTransactionScanGasEstimation { status: 'Success' used: string estimate: string } export interface BlockaidTransactionScanGasEstimationError { status: 'Error' error: string } export interface BlockaidUserOperationGasEstimation { status: 'Success' pre_verification_gas_estimate: string verification_gas_estimate: string call_gas_estimate: string paymaster_verification_gas_estimate?: string } // Response type for scanning EVM transactions export interface BlockaidScanEvmTxResponse { data: { rawResponse: { validation?: BlockaidValidation simulation?: BlockaidSimulation events?: BlockaidTransactionScanEvent[] gas_estimation?: | BlockaidTransactionScanGasEstimation | BlockaidTransactionScanGasEstimationError user_operation_gas_estimation?: | BlockaidUserOperationGasEstimation | BlockaidTransactionScanGasEstimationError features?: Record block: string chain: string account_address?: string } } } export type BlockaidSolanaChain = | 'mainnet' | 'testnet' | 'devnet' | 'eclipse_mainnet' | 'eclipse_devnet' | 'sonic_mainnet' export type BlockaidSolanaOptions = 'validation' | 'simulation' export interface BlockaidSolanaRequestMetadata { url?: string | null } export type BlockaidSolanaEncoding = 'base58' | 'base64' export interface BlockaidScanSolanaTxRequest { account_address: string transactions: string[] metadata?: BlockaidSolanaRequestMetadata encoding?: BlockaidSolanaEncoding chain: string options?: BlockaidSolanaOptions[] method?: string } export interface BlockaidSolanaAssetDiffSchema { usd_price?: number | null summary?: string | null value: number raw_value: number } export interface BlockaidSolanaSplFungibleAssetDetails { type: 'TOKEN' name: string symbol: string address: string decimals: number logo?: string | null } export interface BlockaidSolanaSplNonFungibleAssetDetails { type: 'NFT' name: string symbol: string address: string decimals?: 0 logo?: string | null } export interface BlockaidSolanaCnftDetails { type: 'CNFT' name: string symbol: string address: string decimals?: 0 logo?: string | null } export interface BlockaidSolanaTotalUsdDiff { in: number out: number total?: number } interface BlockaidScanSolanaMessageAssetDiffMovement { usd_price: number summary: string value: number raw_value: number } export interface BlockaidScanSolanaMessageAssetDiff { asset: Record in: BlockaidScanSolanaMessageAssetDiffMovement | null out: BlockaidScanSolanaMessageAssetDiffMovement | null } export interface BlockaidScanSolanaMessageAccountDetails { type: string account_address: string [k: string]: string | boolean | null } export interface BlockaidSolanaScanMessageCombinedValidationResult { validation?: { features: string[] reason: string result_type: BlockaidValidationResultType } simulation?: { account_summary: { account_assets_diff: BlockaidScanSolanaMessageAssetDiff[] [k: string]: any } accounts_details: BlockaidScanSolanaMessageAccountDetails[] assets_diff: Record assets_ownership_diff: Record[]> delegations: Record[]> } | null } export interface BlockaidScanSolanaTxResponse { data: { rawResponse: { encoding?: string status?: string error?: string | null error_details?: Record | null request_id?: string | null result?: BlockaidSolanaScanMessageCombinedValidationResult | null } } } export type BlockaidValidationResultTypeWithError = | 'Malicious' | 'Warning' | 'Benign' | 'Error' export type BlockaidFeatureType = 'Benign' | 'Info' | 'Warning' | 'Malicious' export interface BlockaidAddressFeature { type: BlockaidFeatureType feature_id: string description: string } export interface BlockaidAddressScanResponse { data: { rawResponse: { result_type: BlockaidValidationResultTypeWithError features: BlockaidAddressFeature[] | string[] error?: string } } } // Unified Address Scan Types export interface BlockaidAddressScanRequest { chain: string address: string metadata?: BlockaidMetadataDapp | BlockaidMetadataNonDapp } // URL/Site Scan Types export interface BlockaidCatalogRequestMetadata { type: 'catalog' } export interface BlockaidWalletRequestMetadata { type: 'wallet' walletconnect_name?: string walletconnect_description?: string account_address: string } export interface BlockaidMultipleWalletRequestMetadata { type: 'wallet' walletconnect_name?: string walletconnect_description?: string account_addresses: string[] } export type BlockaidSiteScanMetadata = | BlockaidCatalogRequestMetadata | BlockaidWalletRequestMetadata | BlockaidMultipleWalletRequestMetadata export interface BlockaidSiteScanRequest { url: string metadata?: BlockaidSiteScanMetadata } export interface BlockaidAttackEntry { score: number threshold: number } export interface BlockaidContractOperations { contract_addresses: string[] functions: Record } export interface BlockaidSiteScanHitResponse { status: 'hit' url: string scan_start_time: string scan_end_time: string malicious_score: number is_reachable: boolean is_web3_site: boolean is_malicious: boolean attack_types: Record network_operations: string[] json_rpc_operations: string[] contract_write: BlockaidContractOperations contract_read: BlockaidContractOperations } export interface BlockaidSiteScanMissResponse { status: 'miss' } export type BlockaidSiteScanResponse = { data: { rawResponse: BlockaidSiteScanHitResponse | BlockaidSiteScanMissResponse } } // Token Scan Types export interface BlockaidTokenMetadata { domain?: string | null } export interface BlockaidBulkTokenScanRequest { chain: string tokens: string[] metadata?: BlockaidTokenMetadata } export type BlockaidTokenResultType = | 'Benign' | 'Warning' | 'Malicious' | 'Spam' export interface BlockaidAttackType { score: string threshold?: string features?: Record } export interface BlockaidAmount { amount?: number | null amount_wei?: string | null } export interface BlockaidFees { transfer?: number | null transfer_fee_max_amount?: number | null buy?: number | null sell?: number | null } export interface BlockaidFeature { feature_id: string type: BlockaidFeatureType description: string } export interface BlockaidTradingLimits { max_buy?: BlockaidAmount | null max_sell?: BlockaidAmount | null max_holding?: BlockaidAmount | null sell_limit_per_block?: BlockaidAmount | null } export interface BlockaidTopHolder { address?: string | null holding_percentage?: number | null } export interface BlockaidFinancialStats { supply?: number | null holders_count?: number | null usd_price_per_unit?: number | null burned_liquidity_percentage?: number | null locked_liquidity_percentage?: number | null top_holders?: BlockaidTopHolder[] total_reserve_in_usd?: number | null dev_holding_percentage?: number | null initial_snipers_holding_percentage?: number | null snipers_holding_percentage?: number | null bundlers_holding_percentage?: number | null insiders_holding_percentage?: number | null } export interface BlockaidExternalLinks { homepage?: string | null twitter_page?: string | null telegram_channel_id?: string | null } export interface BlockaidEvmMetadataToken { type?: string | null name?: string | null symbol?: string | null decimals?: number | null image_url?: string | null description?: string | null deployer?: string | null deployer_balance?: BlockaidAmount | null contract_balance?: BlockaidAmount | null owner_balance?: BlockaidAmount | null owner?: string | null creation_timestamp?: string | null external_links?: BlockaidExternalLinks urls?: string[] | null malicious_urls?: string[] | null token_creation_initiator?: string | null } export interface BlockaidSolanaMetadataToken { type?: string | null name?: string | null symbol?: string | null decimals?: number | null image_url?: string | null description?: string | null deployer?: string | null deployer_balance?: BlockaidAmount | null contract_balance?: BlockaidAmount | null owner_balance?: BlockaidAmount | null owner?: string | null creation_timestamp?: string | null external_links?: BlockaidExternalLinks urls?: string[] | null malicious_urls?: string[] | null token_creation_initiator?: string | null mint_authority?: string | null update_authority?: string | null freeze_authority?: string | null permanent_delegate?: string | null } export interface BlockaidBitcoinMetadataToken { type?: string | null name?: string | null symbol?: string | null decimals?: number | null id?: string | null number?: number | null formatted_name?: string | null } export interface BlockaidTokenValidationResponse { result_type: BlockaidTokenResultType malicious_score: string attack_types: Record chain: string address: string metadata: | BlockaidEvmMetadataToken | BlockaidSolanaMetadataToken | BlockaidBitcoinMetadataToken fees: BlockaidFees features?: BlockaidFeature[] | null trading_limits: BlockaidTradingLimits financial_stats: BlockaidFinancialStats } export interface BlockaidBulkTokenScanResponse { data: { rawResponse: { results: Record } } }