跳转到主要内容
POST
/
v1
/
transaction
/
{chain}
/
estimate-gas-limit
交易 - 估算 Gas 限制
curl --request POST \
  --url https://api-dex.chainstream.io/v1/transaction/{chain}/estimate-gas-limit \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "from": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
  "to": "0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8",
  "data": "0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000",
  "value": "0x0"
}
'
{
  "gasLimit": "0x5208",
  "chain": "ethereum"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

chain
enum<string>
required

支持网络中列出的区块链名称

可用选项:
base,
bsc,
polygon,
arbitrum,
optimism,
avalanche,
eth,
zksync

Body

application/json

用于 gas 估算的交易参数

from
string
required

From address

Example:

"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8"

to
string
required

To address

Example:

"0x742d35Cc6634C0532925a3b8D8C9C4b8a8d4C8b8"

data
string
required

Transaction data (hex)

Example:

"0xa9059cbb000000000000000000000000742d35cc6634c0532925a3b8d8c9c4b8a8d4c8b80000000000000000000000000000000000000000000000000de0b6b3a7640000"

value
string

Value to send (in wei, hex string)

Example:

"0x0"

Response

200 - application/json
gasLimit
string
required

Estimated gas limit (hex string)

Example:

"0x5208"

chain
string
required

Chain symbol

Example:

"ethereum"