Portfolio API
Un appel, un portfolio complet : solde natif, tokens ERC-20 majeurs et valorisation USD en temps réel — sur Ethereum et BSC.
POSThttps://nodeche.com/eth/<clé_api>
Méthodenodeche_getWalletPortfolio · 100 CU
Paramètres
| Paramètre | Type | Description |
|---|---|---|
address | string (40 hex) | Adresse du portefeuille à valoriser |
network | string (opt.) | eth (défaut) ou bsc |
Exemple
Requête — cURL
curl -X POST https://nodeche.com/eth/VOTRE_CLE \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"nodeche_getWalletPortfolio","params":[{"address":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"}]}'Requête — JavaScript (fetch)
const res = await fetch("https://nodeche.com/eth/VOTRE_CLE", { method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1,
method: "nodeche_getWalletPortfolio",
params: [{ address: "0xd8dA…6045" }] })
});
const { result } = await res.json();
console.log("Total USD :", result.totalValueUsd);Réponse attendue
{"jsonrpc":"2.0","id":1,"result":{
"address":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"network":"eth",
"native":{ "symbol":"ETH", "balance":5.7476,
"priceUsd":2701.01, "valueUsd":15523.82 },
"tokens":[
{ "symbol":"USDT", "balance":12000.0, "priceUsd":1.0, "valueUsd":12000.0 },
{ "symbol":"USDC", "balance":500.0, "priceUsd":0.999, "valueUsd":499.5 },
… ],
"totalValueUsd":28412.36 }}
Les soldes sont lus en parallèle sur nos nodes (une salve d'appels), la valorisation vient de la Price API. Ajouter vos propres contrats au registre : [email protected].
Erreurs spécifiques
| Code | Signification |
|---|---|
-32602 | Adresse invalide (40 caractères hexadécimaux attendus) |
-32001 | Clé API invalide ou inexistante |
-32002 | Clé API ou compte utilisateur suspendu |
-32003 | Chaîne non autorisée pour cette clé |