Get Balance
The "Get Balance" feature in the KrypC wallet-dev Service API allows users to retrieve the current balance of a specified wallet or address on the blockchain, providing a convenient way to monitor and manage network holdings.
This helps in getting the wallet balance with this method.
API Specification
Get Balance
POST https://api.krypcore.com/api/v0/devWallet/getBalance
To get balance under the given instance.
Headers
Name
Type
Description
DappId*
String
DappId
Authorization*
String
User Auth key obtained
SubscriptionId
String
SubscriptionId
ChainId
String
ChainId
Request Body
Name
Type
Description
chainId*
String
Chain ID
address*
String
Address
{
    "Status": "SUCCESS",
    "Code": 200,
    "Message": "",
    "Data": {
        "address": "0xda00A3B956dc90892BD4a9a483342435f7C045DF",
        "balance": 799345352502840531
    }
}{
    "Status": "FAILURE",
    "Code": 400,
    "Message": "mandatory params are missing",
    "Data": null
}Take a look at how you might call this method using our official libraries, or via curl
curl --location 'https://api.krypcore.com/api/v0/devWallet/getBalance' \
--header 'DappId: **********' \
--header 'Authorization: **********' \
--header 'SubscriptionId: ********' \
--header 'ChainId: ********' \
--header 'Content-Type: application/json' \
--data '{
    "chainId": "80001",
    "address": "**********"
}'
  
var myHeaders = new Headers();
myHeaders.append("DappId", "**********");
myHeaders.append("Authorization", "**********");
myHeaders.append("SubscriptionId", "********");
myHeaders.append("ChainId", "********");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
  "chainId": "80001",
  "address": "**********"
});
var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};
fetch("https://api.krypcore.com/api/v0/devWallet/getBalance", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
import requests
import json
url = "https://api.krypcore.com/api/v0/devWallet/getBalance"
payload = json.dumps({
  "chainId": "80001",
  "address": "**********"
})
headers = {
  'DappId': '**********',
  'Authorization': '**********',
  'SubscriptionId': '********',
  'ChainId': '********',
  'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
package main
import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)
func main() {
  url := "https://api.krypcore.com/api/v0/devWallet/getBalance"
  method := "POST"
  payload := strings.NewReader(`{
    "chainId": "80001",
    "address": "**********"
}`)
  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)
  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("DappId", "**********")
  req.Header.Add("Authorization", "**********")
  req.Header.Add("SubscriptionId", "********")
  req.Header.Add("ChainId", "********")
  req.Header.Add("Content-Type", "application/json")
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()
  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}Last updated
Was this helpful?