Méthode RPC « eth_call »
To use the eth_call method on the Avalanche C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.
Paramètres
transaction
objet
Chargement...
from
chaîne de caractères
Chargement...
to
chaîne de caractères
OBLIGATOIRE
Chargement...
gaz
entier
Chargement...
gasPrice
entier
Chargement...
valeur
entier
Chargement...
données
chaîne de caractères
Chargement...
numéro de bloc/balise
chaîne de caractères
OBLIGATOIRE
Chargement...
Renvoie
données
chaîne de caractères
Chargement...
Requête
1curl https://docs-demo.avalanche-mainnet.quiknode.pro \2-X POST \3-H "Content-Type: application/json" \4--données '{5« method » : « eth_call »,6"params": [7{8"from": null,9"to": "0x6b175474e89094c44da98b954eedeac495271d0f",10"data" : "0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"11},12"latest"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--données '{5« method » : « eth_call »,6"params": [7{8"from": null,9"to": "0x6b175474e89094c44da98b954eedeac495271d0f",10"data" : "0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"11},12"latest"13],14"id": 1,15"jsonrpc": "2.0"16}'
1import { Core } from '@quicknode/sdk'23const core = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67core.client8.call({9account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',10data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',11to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',12})13.then(res => console.log(res))14
1import { Core } from '@quicknode/sdk'23const core = new Core({4endpointUrl: "https://docs-demo.avalanche-mainnet.quiknode.pro",5})67core.client8.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,20fournisseur21)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,20fournisseur21)22const response = await contract.balanceOf(23"0x6E0d01A76C3Cf4288372a29124A26D4353EE51BE"24);25console.log(response);26})();27
1from 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()6print(response)
1from 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()6print(response)
Vous n'avez pas encore de compte ?
Créez votre endpoint Quicknode en quelques secondes et commencez à développer
Commencez gratuitement