Get Balance

Request

Returns the balance of given account address in the smallest unit.
There are two params
  • chain includes: mainnet testnet devnet localnet
  • address of wallet
curl
Unity
curl --location 'localhost:9680/sui/getBalance' \
--header 'Content-Type: application/json' \
--data '{
"chain": "testnet",
"address": "0xed272a655dcca880aeab1f89bdc8185d4049ab7f9ea72fd6a04153d0239a15f8"
}'
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
public class GetAccounts: MonoBehaviour
{
void Start()
{
StartCoroutine(Accounts());
}
private IEnumerator Accounts()
{
string jsonString = "{ \"chain\": \"testnet\", \"address\": \"0xed272a655dcca880aeab1f89bdc8185d4049ab7f9ea72fd6a04153d0239a15f8\" }";
byte[] jsonBytes = System.Text.Encoding.UTF8.GetBytes(jsonString);
UnityWebRequest request = new UnityWebRequest("localhost:9680/sui/getBalance", "POST");
request.uploadHandler = new UploadHandlerRaw(jsonBytes);
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
Debug.Log(request.error);
Debug.Log(request.downloadHandler.text);
}
}

Response

Balance will be in mist.
First Tab
Error
2769926164
{
"message": "error description here"
}