Méthode RPC « eth_call »
Paramètres
transaction
objet
OBLIGATOIRE
Chargement...
from
chaîne de caractères
Chargement...
to
chaîne de caractères
OBLIGATOIRE
Chargement...
gaz
chaîne de caractères
Chargement...
gasPrice
chaîne de caractères
Chargement...
valeur
chaîne de caractères
Chargement...
données
chaîne de caractères
Chargement...
numéro de bloc/balise
chaîne de caractères
OBLIGATOIRE
Chargement...
Object
objet
Chargement...
solde
chaîne de caractères
Chargement...
Nonce
chaîne de caractères
Chargement...
code
chaîne de caractères
Chargement...
state
objet
Chargement...
stateDiff
entier
Chargement...
Renvoie
résultat
chaîne de caractères
Chargement...
Requête
1curl -X POST "https://docs-demo.optimism.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5« method » : « eth_call »,6"params": [7{8"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",9"gas" : "0x7a120",10"data": "0x919840ad"11},12"pending"13],14"id": 115}'
1curl -X POST "https://docs-demo.optimism.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5« method » : « eth_call »,6"params": [7{8"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",9"gas" : "0x7a120",10"data": "0x919840ad"11},12"pending"13],14"id": 115}'
1import { ethers } from "ethers";23async function main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.optimism.quiknode.pro/");5const réponse = await fournisseur.send(« eth_call », [6{7"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",8« gaz »: « 0x7a120 »,9"data": "0x919840ad"10},11"pending"12]);13console.log(response);14}1516main();
1import { ethers } from "ethers";23async function main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.optimism.quiknode.pro/");5const réponse = await fournisseur.send(« eth_call », [6{7"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",8« gaz »: « 0x7a120 »,9"data": "0x919840ad"10},11"pending"12]);13console.log(response);14}1516main();
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.optimism.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="0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460", abi=abi)5réponse = myContract.fonctions.balanceOf(« 0x0000000000000000000000000000000000000000 »).appel()6print(response)
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.optimism.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="0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460", abi=abi)5réponse = myContract.fonctions.balanceOf(« 0x0000000000000000000000000000000000000000 »).appel()6print(response)
1import { createPublicClient, http } from 'viem'23async function main() {4const client = createPublicClient({5transport: http('https://docs-demo.optimism.quiknode.pro/')6})78const result = await client.request({9méthode: « eth_call »,10params: [11{12"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",13« gaz »: « 0x7a120 »,14"data": "0x919840ad"15},16"pending"17]18})1920console.log(result)21}2223main()
1import { createPublicClient, http } from 'viem'23async function main() {4const client = createPublicClient({5transport: http('https://docs-demo.optimism.quiknode.pro/')6})78const result = await client.request({9méthode: « eth_call »,10params: [11{12"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",13« gaz »: « 0x7a120 »,14"data": "0x919840ad"15},16"pending"17]18})1920console.log(result)21}2223main()
1import { Core } from '@quicknode/sdk'23const core = new Core({4endpointUrl: "https://docs-demo.optimism.quiknode.pro/",5})67core.client8.request({9méthode: « eth_call »,10params: [{"to":"0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460","gas":"0x7a120","data":"0x919840ad"},"pending"]11})12.then(res => console.log(res))
1import { Core } from '@quicknode/sdk'23const core = new Core({4endpointUrl: "https://docs-demo.optimism.quiknode.pro/",5})67core.client8.request({9méthode: « eth_call »,10params: [{"to":"0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460","gas":"0x7a120","data":"0x919840ad"},"pending"]11})12.then(res => console.log(res))
1const body = {2jsonrpc: '2.0',3méthode: « eth_call »,4params: [{"to":"0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460","gas":"0x7a120","data":"0x919840ad"},"pending"],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.optimism.quiknode.pro/', {10method: 'POST',11headers: {'Content-Type': 'application/json'},12body: JSON.stringify(body)13})14const data = await response.json()15console.log(data)16}1718main()
1const body = {2jsonrpc: '2.0',3méthode: « eth_call »,4params: [{"to":"0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460","gas":"0x7a120","data":"0x919840ad"},"pending"],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.optimism.quiknode.pro/', {10method: 'POST',11headers: {'Content-Type': 'application/json'},12body: JSON.stringify(body)13})14const data = await response.json()15console.log(data)16}1718main()
1import requests2import json34url = "https://docs-demo.optimism.quiknode.pro/"56payload = json.dumps({7"jsonrpc": "2.0",8« méthode »: « eth_call »,9"params": [10{11"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",12« gaz »: « 0x7a120 »,13"data": "0x919840ad"14},15"pending"16],17"id": 118})19headers = {20'Content-Type': 'application/json'21}2223response = requests.request("POST", url, headers=headers, data=payload)2425print(response.text)
1import requests2import json34url = "https://docs-demo.optimism.quiknode.pro/"56payload = json.dumps({7"jsonrpc": "2.0",8« méthode »: « eth_call »,9"params": [10{11"to": "0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460",12« gaz »: « 0x7a120 »,13"data": "0x919840ad"14},15"pending"16],17"id": 118})19headers = {20'Content-Type': 'application/json'21}2223response = requests.request("POST", url, headers=headers, data=payload)2425print(response.text)
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.optimism.quiknode.pro/")67payload = {8jsonrpc: "2.0",9id: 1,10méthode: « eth_call »,11params: [{"to":"0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460","gas":"0x7a120","data":"0x919840ad"},"pending"]12}1314request = Net::HTTP::Post.new(uri)15request["Content-Type"] = "application/json"16request.body = JSON.generate(payload)1718response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|19http.request(request)20end2122puts response.body
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.optimism.quiknode.pro/")67payload = {8jsonrpc: "2.0",9id: 1,10méthode: « eth_call »,11params: [{"to":"0x0fd43c8fabe26d70dfa4c8b6fa680db39f147460","gas":"0x7a120","data":"0x919840ad"},"pending"]12}1314request = Net::HTTP::Post.new(uri)15request["Content-Type"] = "application/json"16request.body = JSON.generate(payload)1718response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|19http.request(request)20end2122puts response.body
Réponse
1{2"jsonrpc": "2.0",3"id": 1,4« résultat »: « 0x »5}
1{2"jsonrpc": "2.0",3"id": 1,4« résultat »: « 0x »5}
Vous n'avez pas encore de compte ?
Créez votre endpoint Quicknode en quelques secondes et commencez à développer
Commencez gratuitement