Solana
Solana
Solana
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
getBalance returns the native SOL balance of a single Solana account, given its base-58 address. The amount comes back in lamports, Solana's smallest unit, where 1 SOL equals 1,000,000,000 lamports. It is the lightest way to check how much SOL a wallet or program account holds without pulling its full data. Call it as a JSON-RPC 2.0 POST with positional params against https://solana.therpc.io/YOUR_API_KEY, and add a commitment of processed, confirmed, or finalized in the optional config to control how settled the read is.
commitment: "confirmed" to detect incoming SOL before crediting a user.| # | الاسم | النوع | مطلوب | الوصف |
|---|---|---|---|---|
| 1 | pubkey | string | نعم | Base-58 account address. |
| 2 | config | object | لا | Options: commitment, minContextSlot. |
| النوع | الوصف |
|---|---|
| object | RpcResponse wrapping a u64 lamport balance. Divide by 1e9 for SOL. |
| الكود | الرسالة | السبب |
|---|---|---|
-32602 | Invalid params | A param is missing, of the wrong type, or malformed (e.g. a non-base58 pubkey or a bad config field). |
-32603 | Internal error | The node hit an internal error serving the request — retry, and reduce the requested range/encoding if it persists. |
{ context, value }; read result.value for the lamport amount, not the bare result object.