GetSupply

Get a list of denomination counts of the digital banknotes held in the Treasury service's vault.

rpc GetSupply

treasury.GetSupply

Get a list of denomination counts of the digital banknotes held in the Treasury service's vault.

requests GetSupplyRequest

treasury.GetSupplyRequest

FieldTypeDescription
currency_codestringThe currency code of the requested supply.
resp, _ := treasury.GetSupply(ctx, &treasury.GetSupplyRequest{
  CurrencyCode: "USD",
})
fmt.Println(resp)
const getsupplyrequest = new GetSupplyRequest();
getsupplyrequest.setCurrencyCode("USD");

service.getSupply(getsupplyrequest, (err, value:GetSupplyResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using Treasury;

namespace main
{
  class Program
  {
    static void Main(string[] args)
    {
      Channel channel = new Channel("treasury.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure); 
      var client = new Treasury.TreasuryClient(channel); 
      var headers = new Metadata();
      var getSupplyRequest = new GetSupplyRequest{
        CurrencyCode = "USD",
      };
      var reply = client.GetSupply(getSupplyRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import treasury.TreasuryGrpc;
import treasury.Treasury.GetSupplyRequest;
import treasury.Treasury.GetSupplyResponse;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("treasury.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
      .usePlaintext()
      .build();
    TreasuryGrpc.TreasuryBlockingStub blockStub =
        TreasuryGrpc.newBlockingStub(channel);
    
    GetSupplyRequest req_GetSupplyRequest =
        GetSupplyRequest.newBuilder()
          .setCurrencyCode("USD")
          .build();
    GetSupplyResponse resp = blockStub.getSupply(req_GetSupplyRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const getsupplyrequest = new GetSupplyRequest();
getsupplyrequest.setCurrencyCode("USD");

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

use grpc-sdks::treasury::treasury_client::TreasuryClient;
use grpc-sdks::treasury::GetSupplyRequest;

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

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

import io.grpc.ManagedChannelBuilder
import treasury.TreasuryGrpc
import treasury.Treasury.GetSupplyRequest
import treasury.Treasury.GetSupplyResponse

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("treasury.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
            .usePlaintext()
            .build()
    var blockStub = TreasuryGrpc.newBlockingStub(channel)
    
    val req_GetSupplyRequest = GetSupplyRequest.newBuilder()
          .setCurrencyCode("USD")
          .build()
    val resp = blockStub.getSupply(req_GetSupplyRequest)
    println(resp)
    channel.shutdown()
}


returns GetSupplyResponse

treasury.GetSupplyResponse

FieldTypeDescription
supplyDenominationCount repeatedA list of denomination counts of the digital banknotes held in supply.
totalAmountgrand total sum of all promissories
{
  "supply": [
    {
      "denomination": {
        "currency_code": "USD",
        "amount": 2000,
        "decimals": 2
      },
      "count": 5,
      "total": {
        "currency_code": "USD",
        "amount": 10000,
        "decimals": 2
      }
    },
    {
      "denomination": {
        "currency_code": "USD",
        "amount": 1000,
        "decimals": 2
      },
      "count": 5,
      "total": {
        "currency_code": "USD",
        "amount": 5000,
        "decimals": 2
      }
    }
  ],
  "total": {
    "currency_code": "USD",
    "amount": 15000,
    "decimals": 2
  }
}