ListBalances

List the balances of each asset type in the wallet.

rpc ListBalances

asset_controller_api.v1.ListBalances

List the balances of each asset type in the wallet.

requests ListBalancesRequest

asset_controller.ListBalancesRequest

FieldTypeDescription
verifier optionalstringWallet verifier.
resp, _ := assetcontroller.ListBalancesRequest(ctx, &v1.ListBalancesRequest{
  Verifier: "zWalletPublicKey",
})
fmt.Println(resp)
const listbalancesrequest = new ListBalancesRequest();
listbalancesrequest.setVerifier("zWalletPublicKey");

service.listBalances(listbalancesrequest, (err, value:ListBalancesResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using AssetControllerApi.V1;

namespace main
{
  class Program
  {
    static void Main(string[] args)
    {
      Channel channel = new Channel("wallet.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure); 
      var client = new AssetController.AssetControllerClient(channel); 
      var headers = new Metadata();
      var listBalancesRequest = new listBalancesRequest{
        Verifier = "zWalletPublicKey",
      };
      var reply = client.ListBalances(listBalancesRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import asset_controller_api.v1.AssetController.ListBalancesRequest;
import asset_controller_api.v1.AssetController.ListBalancesResponse;
import wallet_api.v1.CustodialWalletGrpc;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("wallet.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
      .usePlaintext()
      .build();
    CustodialWalletGrpc.CustodialWalletBlockingStub blockStub =
        CustodialWalletGrpc.newBlockingStub(channel);
    
    ListBalancesRequest req_ListBalancesRequest =
        ListBalancesRequest.newBuilder()
          .setVerifier("zWalletPublicKey")
          .build();
    ListBalancesResponse resp = blockStub.listBalances(req_ListBalancesRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const listbalancesrequest = new ListBalancesRequest();
listbalancesrequest.setVerifier("zWalletPublicKey");

service.listBalances(listbalancesrequest, (err, value:ListBalancesResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;

use grpc-sdks::wallet_api::v1::wallet_service_client::CustodialWalletClient;
use grpc-sdks::asset_controller_api::v1::ListBalancesRequest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let channel = Channel::from_static("wallet.YOUR_SANDBOX_ID.knoxnetworks.io")
    .connect()
    .await?;
  let mut client = CustodialWalletClient::new(channel); 

  let request = tonic::Request::new(
    ListBalancesRequest{
      verifier: String::from("zWalletPublicKey")
    });
// sending request and waiting for response
  let response = client.list_asset_files(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import asset_controller_api.v1.AssetController.ListBalancesRequest
import asset_controller_api.v1.AssetController.ListBalancesResponse
import wallet_api.v1.CustodialWalletGrpc

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("wallet.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
            .usePlaintext()
            .build()
    var blockStub = CustodialWalletGrpc.newBlockingStub(channel)
    
    val req_ListBalancesRequest = ListBalancesRequest.newBuilder()
          .setVerifier("zWalletPublicKey")
          .build()
    val resp = blockStub.listBalances(req_ListBalancesRequest)
    println(resp)
    channel.shutdown()
}


returns ListBalancesResponse

asset_controller.ListBalancesResponse

FieldTypeDescription
balancesWalletBalance repeatedList of Wallet Balances by Asset Type
{
  "balances": [
    {
      "amount": {
        "currency_code": "USD",
        "amount": 5700,
        "decimals": 2
      },
      "file_count": 57
    },
    {
      "amount": {
        "currency_code": "EUR",
        "amount": 5700,
        "decimals": 2
      },
      "file_count": 57
    }
  ]
}