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
整数
正在加载...
值
整数
正在加载...
数据
字符串
正在加载...
blockNumber/tag简体中文(大陆)
字符串
必填
正在加载...
退货
数据
字符串
正在加载...
请求
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,20提供商21)22const response = await contract.balanceOf(23"0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE"24);25控制台.log(响应);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,20提供商21)22const response = await contract.balanceOf(23"0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE"24);25控制台.log(响应);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打印(响应)