eth_call RPC 方法
To use the eth_call 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_call",6"params": [7{8"from": null,9"to": "0x6b175474e89094c44da98b954eedeac495271d0f",10"data": "0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"11},12「最新」13],14"id": 1,15"jsonrpc": "2.0"16}'
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_call",6"params": [7{8"from": null,9"to": "0x6b175474e89094c44da98b954eedeac495271d0f",10"data": "0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"11},12「最新」13],14"id": 1,15"jsonrpc": "2.0"16}'
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67核心.客戶端8.call({9account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',10data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',11to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',12})13.then(res => console.log(res))14
1import { 核心 } from '@quicknode/sdk'23const 核心 = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67核心.客戶端8.call({9account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',10data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',11to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',12})13.then(res => console.log(res))14
1import { ethers } from "ethers";2(async () => {3const abi = [4{5constant: true,6inputs: [{ internalType: "address", name: "", type: "address" }],7name: "balanceOf",8outputs: [{ internalType: "uint256", name: "", type: "uint256" }],9payable: false,10stateMutability: "view",11type: "function",12},13];14const provider = new ethers.JsonRpcProvider(15"https://docs-demo.avalanche-mainnet.quiknode.pro"16);17const contract = new ethers.Contract(18'0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',19abi,20provider21)22const response = await contract.balanceOf(23"0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE"24);25console.log(response);26})();27
1import { ethers } from "ethers";2(async () => {3const abi = [4{5constant: true,6inputs: [{ internalType: "address", name: "", type: "address" }],7name: "balanceOf",8outputs: [{ internalType: "uint256", name: "", type: "uint256" }],9payable: false,10stateMutability: "view",11type: "function",12},13];14const provider = new ethers.JsonRpcProvider(15"https://docs-demo.avalanche-mainnet.quiknode.pro"16);17const contract = new ethers.Contract(18'0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',19abi,20provider21)22const response = await contract.balanceOf(23"0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE"24);25console.log(response);26})();27
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3abi = '[{"constant":True,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"}]'4myContract = w3.eth.contract(address="0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", abi=abi)5response = myContract.functions.balanceOf("0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE").call()6列印(回應)
1出自 web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.avalanche-mainnet.quiknode.pro'))3abi = '[{"constant":True,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"}]'4myContract = w3.eth.contract(address="0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", abi=abi)5response = myContract.functions.balanceOf("0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE").call()6列印(回應)