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

# 资产与余额变化

> 通过 Simulation API 和 Transaction Trace 返回的 asset_changes 对象访问代币数据和美元价值变化。

RPC 和 API 模拟响应都会以美元价值形式提供交易发生的资产与余额变化信息。显示的美元价值代表**当前美元价值**，并反映来自 [CoinGecko](https://www.coingecko.com/) 的最新市场数据。

支持的代币标准：**ERC20** 和 **ERC721**。

### RPC 响应

当您调用 `tenderly_simulateTransaction`（单笔模拟）和 `tenderly_simulateBundle`（捆绑模拟）RPC 方法时，资产与余额变化始终作为响应的一部分返回。请参阅 [RPC 参考](/node-rpc/rpc-reference)。

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
https://mainnet.gateway.tenderly.co/${TENDERLY_NODE_ACCESS_KEY}
```

按以下路径访问这些信息：

* **资产变化（Asset Changes）**：查看 `result.assetChanges`。这将提供交易期间资产如何发生变化或转移的细分。
* **余额变化（Balance Changes）**：查看 `result.balanceChanges`。这提供了以代币和美元价值表示的余额波动信息。

**响应示例**

```json title="example.json" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "assetChanges": [
    {
      "assetInfo": {
        "standard": "ERC20",
        "type": "Fungible",
        "contractAddress": "0xc02...c2",
        "symbol": "weth",
        "name": "WETH",
        "logo": "https://assets.coingecko.com/coins/images/2518/large/weth.webp?1696503332",
        "decimals": 18,
        "dollarValue": "2195.8701171875"
      },
      "type": "Transfer",
      "from": "0xd8...45",
      "to": "0x20...d6",
      "rawAmount": "0x1",
      "amount": "0.000000000000000001",
      "dollarValue": "10.0071875"
    }
  ],
  "balanceChanges": [
    {
      "address": "0x20...1d6",
      "dollarValue": "0.0000021958701171875",
      "transfers": [
        0
      ]
    },
    {
      "address": "0xd8...045",
      "dollarValue": "0.00021958701171875",
      "transfers": [
        0
      ]
    }
  ]
}
```

### API 响应

当您调用 `simulate`（单笔模拟）端点时，资产与余额变化也会作为 API 响应的一部分返回：

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate
```

以及 `simulate-bundle`（捆绑模拟）端点：

```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_SLUG}/project/${TENDERLY_PROJECT_SLUG}/simulate-bundle
```

在 API 响应中，结构同样直观：

* **资产变化**：查看 `transaction.transaction_info.asset_changes`。在这里，您可以找到变化类型（transfer、mint、burn）、相关地址，以及以代币数量和美元价值表示的金额等详细信息。
* **余额变化**：查看 `transaction.transaction_info.balance_changes`。此部分将以代币和美元形式向您展示交易后余额如何变化。

**响应示例**

```json title="example.json" showLineNumbers theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
{
  "asset_changes": [
    {
      "token_info": {
        "standard": "ERC20",
        "type": "Fungible",
        "contract_address": "0xc02...c2",
        "symbol": "weth",
        "name": "WETH",
        "logo": "https://assets.coingecko.com/coins/images/2518/large/weth.webp?1696503332",
        "decimals": 18,
        "dollar_value": "2195.8701171875"
      },
      "type": "Transfer",
      "from": "0xd8...045",
      "to": "0x20...d6",
      "amount": "0.000000000000000001",
      "raw_amount": "1",
      "dollar_value": "0.0000000000000021958701171875"
    }
  ],
  "balance_changes": [
    {
      "address": "0x20...d6",
      "dollar_value": "0.0000000000000021958701171875",
      "transfers": [
        0
      ]
    },
    {
      "address": "0xd...045",
      "dollar_value": "-0.0000000000000021958701171875",
      "transfers": [
        0
      ]
    }
  ]
}
```

如需更多信息，请查阅 [API 参考](/api-reference) 和 [RPC 参考](/node-rpc/rpc-reference?network=ethereum-mainnet\&method=tenderly_simulateTransaction)。
