# omnia\_decodeTransaction

**Returns the Transaction.data field of an Ethereum transaction.**

**Parameters**

1. `DATA, 20 bytes` - contract\_address. The address of the smart contract called.
2. `DATA, variable length`- data. Transaction.data field to be decoded. <mark style="color:red;">REQUIRED</mark>
3. `DATA, 20 bytes` - signer. Address corresponding to the signer of the transaction.

**Note**: contract\_address and signer parameters are not required, but providing them might help to recover more details about the decoded input.

**Returns**

`Object with following details:`

| Parameter              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Notice                                                                                                                                                                                                                                                 |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `method`               | It describes the method name in ABI, for example, "transfer".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |                                                                                                                                                                                                                                                        |
| `type`                 | It describes the parameter type in ABI, for example, "address", "uint256", and "bool".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                                                                                                                                                                                                                                        |
| `name`                 | It describes the parameter name in ABI, for example "\_from", "\_to", "\_value".                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                                                        |
| `input`                | It describes the input data in ABI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                        |
| `address_info`         | <p>It describes the info about the address as a parameter.<br>The info includes: (1) "is\_contract" describes whether the address is a contract. "1" means true; "0" means false.<br>(2) "contract\_name" describes the contract name if the address is a contract.<br>(3) "standard" describes the standard type of the contract. Example:"erc20".<br>(4) "symbol" describes the token symbol if the address is an ERC20 contract.<br>(5) "name" describes the token name if the address is an ERC20 contract.<br>(6) "malicious\_address" describes whether the address is a suspected malicious contract.<br>"1" means true;<br>"0" means that we have not found malicious behavior of this address.</p> | <p>When the address is not a contract ("is\_contract"=0), "contract\_name", "standard", "symbol", and "name" will return "null".<br>When the address is a contract but not an erc20 contract, "standard", "symbol", and "name" will return "null".</p> |
| `contract_name`        | The name of the contract that the user is interacting with.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                                                                                                                                                                                                                                        |
| `contract_description` | Description of the contract.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |                                                                                                                                                                                                                                                        |
| `malicious_contract`   | It tells if the contract that the user is interacting with is a malicious contract.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                                                                                                                                                                                                                                        |
| `signature_detail`     | It explains the function of the method.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                        |
| `risky_signature`      | It tells if the transaction that users are signing contains risk.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | Even non-malicious, commonly used, well-known contracts can be highly risky if not used properly.                                                                                                                                                      |
| `risk`                 | It explains why the transaction that users are signing contains risk.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Even non-malicious, commonly used, well-known contracts can be highly risky if not used properly.                                                                                                                                                      |

<br>

## Example

#### Request

```bash
curl --request POST \
     --url https://endpoints.omniatech.io/v1/RPC_ENDPOINT \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "omnia_decodeTransaction",
    "params": [
        {
            "contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
            "data": "0x095ea7b30000000000000000000000009901bac880caecad999e292811db9c1db3e86f8a000000000000000000000000000000000000000000000000000000000001951b",
            "signer": "0x822FC93407C81BA1401838Cb2991130D2bE36a94"
        }
    ]
}
'
```

#### Response

```json
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "method": "approve",
        "risk": null,
        "params": [
            {
                "type": "address",
                "name": "spender",
                "input": "0x9901bac880caecad999e292811db9c1db3e86f8a",
                "struct": null,
                "tuple": null,
                "address_info": {
                    "standard": "OTHER",
                    "symbol": null,
                    "name": null,
                    "contract_name": null,
                    "malicious_address": 0,
                    "is_contract": 1
                }
            },
            {
                "type": "uint256",
                "name": "amount",
                "input": "103707",
                "struct": null,
                "tuple": null,
                "address_info": null
            }
        ],
        "contract_name": null,
        "contract_description": null,
        "malicious_contract": null,
        "signature_detail": null,
        "risky_signature": null
    }
}
```
