> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portalhq.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Enhance your wallets' security with Hypernative

> Learn how to integrate real-time security scanning for transactions, addresses, tokens, NFTs, and URLs using Portal's Android SDK with Hypernative.

Portal's Android SDK provides comprehensive security scanning capabilities through the `portal.security.hypernative` API. This integration allows you to detect malicious transactions, flagged addresses, compromised tokens, and suspicious URLs before users interact with them.

## Overview

The Hypernative integration enables you to:

* **Scan transactions** before signing or submission (EVM, EIP-712, Solana)
* **Scan addresses** for known malicious actors or compromised contracts
* **Validate tokens** to detect scams, honeypots, or security risks
* **Check NFTs** for fraudulent collections or suspicious activity
* **Verify URLs** to prevent phishing attacks

## Prerequisites

Before using Hypernative security scanning, ensure you have:

* A properly initialized Portal client
* Hypernative integration enabled in your Portal Dashboard (see [Hypernative Integration](../../../integrations/Security/hypernative))

## Scanning EVM Transactions

Use `scanEVMTx` to analyze standard Ethereum transactions before signing or sending. This method scans EVM transactions for malicious contract interactions, suspicious token approvals, and other security risks.

EVM transactions are standard Ethereum transactions that include a chain ID to prevent replay attacks across different networks.

```kotlin theme={null}
lifecycleScope.launch {
    val transaction = ScanEVMTransaction(
        chain = "eip155:1",
        fromAddress = "0x7C01728004d3F2370C1BBC36a4Ad680fE6FE8729",
        toAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        input = "0x095ea7b300000000000000000000000066ba61be3bab35c0c00038f335850a390b086fe300000000000000000000000000000000000000000fffffffffffffffffffffff",
        value = 0,
        nonce = 2340,
        gas = 3000000,
        gasPrice = 3000000
    )
    
    val request = ScanEVMRequest(transaction = transaction)
    
    val result = portal.security.hypernative.scanEVMTx(request)
    
    result.onSuccess { response ->
        val rawResponse = response.data?.rawResponse
        println("Success: ${rawResponse?.success}")
        rawResponse?.data?.let { data ->
            println("Recommendation: ${data.recommendation}")
            println("Assessment ID: ${data.assessmentId}")
            data.findings?.forEach { finding ->
                println("Finding: ${finding.title} (${finding.severity})")
            }
        }
    }.onFailure { error ->
        println("Error scanning EVM transaction: ${error.message}")
    }
}
```

***

## Scanning EIP-712 Typed Messages

Use `scanEip712Tx` to analyze typed structured data before signing. This method is critical for detecting malicious permit signatures, phishing attempts, and unauthorized token approvals.

EIP-712 defines a standard for hashing and signing typed structured data, commonly used for gasless approvals and off-chain signatures.

```kotlin theme={null}
lifecycleScope.launch {
    val types = mapOf(
        "EIP712Domain" to listOf(
            ScanEip712TypeProperty("name", "string"),
            ScanEip712TypeProperty("version", "string"),
            ScanEip712TypeProperty("chainId", "uint256"),
            ScanEip712TypeProperty("verifyingContract", "address")
        ),
        "Permit" to listOf(
            ScanEip712TypeProperty("owner", "address"),
            ScanEip712TypeProperty("spender", "address"),
            ScanEip712TypeProperty("value", "uint256"),
            ScanEip712TypeProperty("nonce", "uint256"),
            ScanEip712TypeProperty("deadline", "uint256")
        )
    )
    
    val domain = ScanEip712Domain(
        name = "MyToken",
        version = "1",
        chainId = "eip155:1",
        verifyingContract = "0xa0b86991c6218b36c1d19d4a2e9Eb0cE3606eB48"
    )
    
    val message = mapOf<String, Any>(
        "owner" to "0x7b1363f33b86d16ef7c8d03d11f4394a37d95c36",
        "spender" to "0x67beb4dd770a9c2cbc7133ba428b9eecdcf09186",
        "value" to 3000,
        "nonce" to 0,
        "deadline" to 50000000000L
    )
    
    val typedData = ScanEip712TypedData(
        primaryType = "Permit",
        types = types,
        domain = domain,
        message = message
    )
    
    val request = ScanEip712Request(
        walletAddress = "0x7b1363f33b86d16ef7c8d03d11f4394a37d95c36",
        chainId = "eip155:1",
        eip712Message = typedData
    )
    
    val result = portal.security.hypernative.scanEip712Tx(request)
    
    result.onSuccess { response ->
        val rawResponse = response.data?.rawResponse
        println("Success: ${rawResponse?.success}")
        rawResponse?.data?.let { data ->
            println("Recommendation: ${data.recommendation}")
            println("Assessment ID: ${data.assessmentId}")
        }
    }.onFailure { error ->
        println("Error scanning EIP-712 transaction: ${error.message}")
    }
}
```

***

## Scanning Solana Transactions

Use `scanSolanaTx` to analyze Solana transactions before signing. This method detects malicious program invocations, suspicious token transfers, and other Solana-specific security risks.

```kotlin theme={null}
lifecycleScope.launch {
    val transaction = ScanSolanaTransaction(
        message = null,
        signatures = null,
        rawTransaction = "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQADCQkVR3SiiKbW0l4c3NBsEn6+zn1o0YsyypPwN0GUhg4K5HK0Tb5GckDLYW+MsovQASt5EZ3bSH3nluRJAE69H61w0BRUDTrpYQcXosUun6/z2BROkRoH/1bL7KLU9s4lCav6k3ZZgV6qeZFwu4pu89WoIGaqUxG4C93XwVmmDy81v8qBaCSP4/UZfdo3q1bud/W+ixymkH8IMe0laQZYrSx4Uhyxec67hYm1VqLV7JTSSYaC/fm7KvWtZOSRzEFT2gMGRm/lIRcy/+ytunLDm+e8jOW7xfcSayxDmzpAAAAAT4tlY/P4mFG1wDJl0ektVggHiZf73lTlHBVJ3fK0nDoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANG5fPtlMEOI/eXV7aPDlpcdLUKm8L3VoW6k/oJlCNLaBQYABQLARQQABgAJAwYAAAAAAAAABzwACQoLCwgyMzQMNQ0ONjcPEDg5EgETFBUWOhEXGBkaGxwdHh8gISI7IyQlJicCKCkqKywtAwQuLzAxPBFVCg8JAQcHBgYBAAAAAwHwCgYBExUbBgICAAAPAwIAAAYBISMoEQQBGQAPAwIAAAYBLjA2DwMCAAAGAgIAAAAIBgYICAADAQkGCQUFBgACBQAEBwEAAAgCAAUMAgAAADwaAAAAAAAABgAFBGDMBQAEPPm21Wu6wrmHu23/ZFNIumpp+ADooZjd4JQgvjnBxkUJAgEDBqWqCgmmCAUIBwu1tp+gcP/+Ri3C1tRXUbPdgqo6rVsj/qnqC959wTdC/mRARysLz9HS09TW19jZ2tsC1QYsNrdxMcm5Nq5FXZrM0IXpEA+ApFa+pz/JvkLz0+2vnwuztLW2t7i5uru8vgAPvBv8VUeRwDy9yD1NHIH5Ji6ZA+zrmpHejKOz4MP8SwrKy8zNzs/S09TVAdY=",
        version = "0"
    )
    
    val request = ScanSolanaRequest(
        transaction = transaction,
        showFullFindings = true
    )
    
    val result = portal.security.hypernative.scanSolanaTx(request)
    
    result.onSuccess { response ->
        val rawResponse = response.data?.rawResponse
        println("Success: ${rawResponse?.success}")
        rawResponse?.data?.let { data ->
            println("Recommendation: ${data.recommendation}")
            println("Assessment ID: ${data.assessmentId}")
        }
    }.onFailure { error ->
        println("Error scanning Solana transaction: ${error.message}")
    }
}
```

***

## Scanning Addresses

Use `scanAddresses` to check multiple addresses for known security risks. This method identifies malicious contracts, compromised wallets, sanctioned addresses, and other flagged entities.

```kotlin theme={null}
lifecycleScope.launch {
    val request = ScanAddressesRequest(
        addresses = listOf(
            "0x31c05d73f2333b5a176cfdbb7c5ef96ec7bb04ac",
            "0x2753a0d37a2ad09be3ccc0afcb650bea8ea57a8f"
        )
    )
    
    val result = portal.security.hypernative.scanAddresses(request)
    
    result.onSuccess { response ->
        response.data?.rawResponse?.forEach { item ->
            println("Address: ${item.address}")
            println("Recommendation: ${item.recommendation}")
            println("Severity: ${item.severity}")
            item.flags?.forEach { flag ->
                println("Flag: ${flag.title} (${flag.severity})")
            }
        }
    }.onFailure { error ->
        println("Error scanning addresses: ${error.message}")
    }
}
```

***

## Scanning NFTs

Use `scanNfts` to validate NFT collections before displaying or allowing interactions. This method detects fraudulent collections, compromised contracts, and suspicious NFT activity.

```kotlin theme={null}
lifecycleScope.launch {
    val request = ScanNftsRequest(
        nfts = listOf(
            ScanNftsRequestItem(
                address = "0x5C1B9caA8492585182eD994633e76d744A876548",
                evmChainId = "eip155:1"
            ),
            ScanNftsRequestItem(
                address = "0xC2e0cA5FE0b9AbE1B86f3cC0b865448908D20A16",
                evmChainId = "eip155:1"
            )
        )
    )
    
    val result = portal.security.hypernative.scanNfts(request)
    
    result.onSuccess { response ->
        response.data?.rawResponse?.data?.nfts?.forEach { nft ->
            println("NFT: ${nft.address}")
            println("Accept: ${nft.accept}")
            println("Chain: ${nft.evmChainId ?: nft.chain}")
        }
    }.onFailure { error ->
        println("Error scanning NFTs: ${error.message}")
    }
}
```

***

## Scanning Tokens

Use `scanTokens` to validate ERC-20 tokens before allowing swaps, transfers, or approvals. This method detects honeypots, scam tokens, and compromised token contracts.

```kotlin theme={null}
lifecycleScope.launch {
    val request = ScanTokensRequest(
        tokens = listOf(
            ScanTokensRequestItem(
                address = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",  // USDC
                evmChainId = "eip155:1"
            )
        )
    )
    
    val result = portal.security.hypernative.scanTokens(request)
    
    result.onSuccess { response ->
        response.data?.rawResponse?.data?.tokens?.forEach { token ->
            println("Token: ${token.address}")
            println("Chain: ${token.evmChainId ?: token.chain}")
            println("Reputation: ${token.reputation?.recommendation ?: "N/A"}")
        }
    }.onFailure { error ->
        println("Error scanning tokens: ${error.message}")
    }
}
```

***

## Scanning URLs

Use `scanURL` to detect phishing sites and malicious domains before users navigate to them. This method is critical for protecting users from social engineering attacks.

```kotlin theme={null}
lifecycleScope.launch {
    val request = ScanUrlRequest(url = "curve.fi")
    
    val result = portal.security.hypernative.scanURL(request)
    
    result.onSuccess { response ->
        val isMalicious = response.data?.rawResponse?.data?.isMalicious ?: false
        val status = if (isMalicious) "⚠️ MALICIOUS" else "✅ SAFE"
        
        println("URL: curve.fi")
        println("Status: $status")
        println("Is Malicious: $isMalicious")
    }.onFailure { error ->
        println("Error scanning URL: ${error.message}")
    }
}
```

***

## Next Steps

* Learn about [signing transactions](./sign-a-transaction)
* Explore [transaction evaluation](./evaluate-a-transaction)
* Review [Portal API methods](./portal-api-methods)
* Check out the [Hypernative Integration setup](../../../integrations/Security/hypernative)
