# Wallet

## Get gas prices

#### Method

get

#### Path

/v1/wallet/gas\_market

#### Parameters

* `chain_id` : required, chain id, eg: `eth`, `bsc`, `xdai`, [for more info](https://docs.cloud.debank.com/en/readme/chain#returns-1).

#### Returns

`Array` of `Object` - An object with following fields:

* `level`: `string` - The gas price level. (eg. slow, normal, fast)
* `price`: `integer` - Gas price.

Request

{% tabs %}
{% tab title="Curl" %}

```bash
curl -X 'GET' \
  'https://pro-openapi.debank.com/v1/wallet/gas_market?chain_id=eth' \
  -H 'accept: application/json' \
  -H 'AccessKey: YOUR_ACCESSKEY'
```

{% endtab %}
{% endtabs %}

Result

```json
[
  {
    "level": "slow",
    "price": 30000000000
  },
  {
    "level": "normal",
    "price": 37000000000
  },
  {
    "level": "fast",
    "price": 43000000000
  }
]
```

## Enhanced transaction pre-execution

The chain list that currently supports this feature：eth, bsc, matic, avax, boba, op, hmy, ftm, cro, xdai, mobm, movr, metis, astar, sdn, nova

#### Method

post

#### Path

/v1/wallet/pre\_*exec\_tx*

#### Parameters

* `tx`: required, [for more info](https://docs.open.debank.com/en/reference/api-models/transactionobject).
* `pending_tx_list`: pending tx list. Transaction Pre-Execute API supports simulating the execution of multiple transactions at the same time. A common use case happens when swapping on dex, where the ERC20 token needs to be approved before the swap.Simulation of the swap transaction will fail unless multiple transactions can be pre-executed simultaneously.\\

  So you just need to put the transaction you want to execute in advance into the pending\_tx\_list,

  and we will execute the transactions in the pending\_tx\_list before the main transaction.

#### Returns

Request

{% tabs %}
{% tab title="Curl" %}

```bash
curl 'https://pro-openapi.debank.com/v1/wallet/pre_exec_tx' \
  -H 'content-type: application/json' \
  -H 'AccessKey: YOUR_ACCESSKEY' \
  --data-raw '{"tx":{"chainId":1,"from":"0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb85","to":"0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb81","value":"0x16345785d8a0000","data":"0x","gas":"","maxFeePerGas":"0x4e3b29200","maxPriorityFeePerGas":"0x4e3b29200","nonce":"0x1"}}' \
  --compressed
```

{% endtab %}
{% endtabs %}

Result

An object with following fields:

* `balance_change` - balance change info
  * success: whether the balance change detection is success or not.
  * error: return [error msg](https://docs.cloud.debank.com/en/readme/error-code/pre-exec-error-code), if the balance change detection is fail, otherwise is null.
  * send\_toke&#x6E;*\_*&#x6C;ist: list of send token info.
  * receive\_token\_list: list of receive token info.
  * send\_nft\_list: list of send nft info.
  * receiver\_nf&#x74;*\_*&#x6C;is&#x74;*:* list of receive nft info.
  * usd\_*value\_*&#x63;hange: change in the value of the dollar.
* `gas` - gas estimate info.
  * success: whether the gas estimate is success or not.
  * error: return [error msg](https://docs.cloud.debank.com/en/readme/error-code/pre-exec-error-code), if the gas estimate is fail, otherwise is null.
  * gas\_used: gas used.
* `pre_exec` - pre exec info
  * success: whether pre exec is success or not.
  * error: return [error msg](https://docs.cloud.debank.com/en/readme/error-code/pre-exec-error-code), if the pre exec is fail, otherwise is null.
* `is_multisig` - whether it is a multisig tx
* `multisig` - if it is a multisig tx, it will return info which include the same format as the above info.

```json
{
    "balance_change": {
        "success": true,
        "error": null,
        "send_token_list": [
            {
                "id": "op",
                "chain": "op",
                "name": "ETH",
                "symbol": "ETH",
                "display_symbol": null,
                "optimized_symbol": "ETH",
                "decimals": 18,
                "logo_url": "https://static.debank.com/image/op_token/logo_url/op/d61441782d4a08a7479d54aea211679e.png",
                "protocol_id": "",
                "price": 1568.24,
                "is_verified": true,
                "is_core": true,
                "is_wallet": true,
                "time_at": null,
                "amount": 0.001,
                "usd_value": 1.56824
            }
        ],
        "receive_token_list": [
            {
                "id": "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58",
                "chain": "op",
                "name": "Tether USD",
                "symbol": "USDT",
                "display_symbol": null,
                "optimized_symbol": "USDT",
                "decimals": 6,
                "logo_url": "https://static.debank.com/image/op_token/logo_url/0x94b008aa00579c1307b0ef2c499ad98a8ce58e58/37c9c2ddceb0c83f0f4c07ea4fa53e9d.png",
                "protocol_id": "",
                "price": 1.0,
                "is_verified": true,
                "is_core": true,
                "is_wallet": true,
                "time_at": null,
                "amount": 1.552832,
                "usd_value": 1.552832
            }
        ],
        "send_nft_list": [],
        "receive_nft_list": [],
        "usd_value_change": -0.015408000000000088
    },
    "gas": {
        "success": true,
        "error": null,
        "gas_used": 354856
    },
    "is_multisig": false,
    "multisig": null,
    "pre_exec": {
        "success": true,
        "error": null
    }   
}

```

## Explain Tx

#### Method

post

#### Path

/v1/wallet/explain\_tx

#### Parameters

* `tx`: required, [for more info](https://docs.open.debank.com/en/reference/api-models/transactionobject).

#### Returns

Request

{% tabs %}
{% tab title="Curl" %}

```bash
curl 'https://pro-openapi.debank.com/v1/wallet/explain_tx' \
  -H 'content-type: application/json' \
  -H 'AccessKey: YOUR_ACCESSKEY' \
  --data-raw '{"tx":{"chainId":1,"from":"0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb85","to":"0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb81","value":"0x16345785d8a0000","data":"0x","gas":"","maxFeePerGas":"0x4e3b29200","maxPriorityFeePerGas":"0x4e3b29200","nonce":"0x1"}}' \
  --compressed
```

{% endtab %}
{% endtabs %}

Result

An object with following fields:

* abi - abi info
  * func : string - Method of call function name
  * params: list - call params
* actions: list - action list， [for more info](https://docs.cloud.debank.com/en/readme/api-models/actionobject)

```json
{
    "abi": {
        "func": "setApprovalForAll",
        "params": [
            "0x1E0049783F008A0085193E00003D00cd54003c71",
            false
        ]
    },
    "actions": [
        {
            "type": "revoke_nft_collection_approval",
            "owner": "0x5853ed4f26a3fcea565b3fbc698bb19cdf6deb85",
            "spender": {
                "id": "0x1E0049783F008A0085193E00003D00cd54003c71",
                "protocol": {
                    "id": "opensea",
                    "name": "OpenSea",
                    "logo_url": "https://static.debank.com/image/project/logo_url/opensea/4b23246fac2d4ce53bd8e8079844821c.png"
                }
            },
            "collection": {
                "id": "0x253954d29386e174ed4bc69902391a8ed3fd51ca",
                "chain": "eth",
                "name": "NFTflow Membership Pass",
                "symbol": "NFTflow",
                "is_core": false,
                "time_at": 1646883614,
                "collection": null
            }
        }
    ]
}
```
