eth_gasPrice RPC 方法
To use the eth_gasPrice method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.
參數
此方法不接受任何參數
退貨
gasPrice
字串
載入中...
請求
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_gasPrice",6"params": [],7"id": 1,8"jsonrpc": "2.0"9}'
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_gasPrice",6"params": [],7"id": 1,8"jsonrpc": "2.0"9}'
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67core.client.getGasPrice()8
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67core.client.getGasPrice()8
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider(4"https://docs-demo.avalanche-mainnet.quiknode.pro"5);6const response = await provider.send('eth_gasPrice', [])7console.log(response)8})();9
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider(4"https://docs-demo.avalanche-mainnet.quiknode.pro"5);6const response = await provider.send('eth_gasPrice', [])7console.log(response)8})();9
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3print (w3.eth.gas_price)
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3print (w3.eth.gas_price)