AddAsset

Insert a new Governed Asset type to the Authority.

rpc AddAsset

authority_api.v1.AddAsset

Insert a new Governed Asset type to the Authority.

requests AddAssetRequest

authority_api.v1.AddAssetRequest

FieldTypeDescription
currency_codestringCurrency code to be added.
asset_denominationAssetDenominationAsset denominations allowed for new asset.
resp, _ := authority.AddAsset(ctx, &v1.AddAssetRequest{
  CurrencyCode: "USD",
  AssetDenomination: &common.AssetDenomination{
    Denominations: []{1, 5, 10, 25, 100, 200, 500, 1000},
    Precision: 2,
  }
})
fmt.Println(resp)
const addassetrequest = new AddAssetRequest();
addassetrequest.setCurrencyCode("USD");
addassetrequest.setDenominations([1, 5, 10, 25, 100, 200, 500, 1000]);

service.addAsset(addassetrequest, (err, value:AddAssetResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using AuthorityApi.V1;
using Google.Protobuf;
using System.Text;

namespace main
{
  class Program
  {
    static void Main(string[] args)
    {
      Channel channel = new Channel("authority.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure); 
      var client = new Authority.AuthorityClient(channel); 
      var headers = new Metadata();
      var addAssetRequest = new AddAssetRequest{
        CurrencyCode = "USD",
        Denominations = {1, 5, 10, 25, 100, 200, 500, 1000},
      };
      var reply = client.AddAsset(addAssetRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import authority_api.v1.Authority.AddAssetRequest;
import authority_api.v1.Authority.AddAssetResponse;
import authority_api.v1.AuthorityGrpc;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("authority.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
      .usePlaintext()
      .build();
    AuthorityGrpc.AuthorityBlockingStub blockStub =
        AuthorityGrpc.newBlockingStub(channel);
    
    AddAssetRequest req_AddAssetRequest =
        AddAssetRequest.newBuilder()
          .setCurrencyCode("USD")
      		.setDenominations(new int[]{1, 5, 10, 25, 100, 200, 500, 1000})
          .build();
    AddAssetResponse resp = blockStub.addAsset(req_AddAssetRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const addassetrequest = new AddAssetRequest();
addassetrequest.setCurrencyCode("USD");
addassetrequest.setDenominations([1, 5, 10, 25, 100, 200, 500, 1000]);

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

use grpc-sdks::authority_api::v1::authority_service_client::AuthorityClient;
use grpc-sdks::authority_api::v1::AddAssetRequest;

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

  let request = tonic::Request::new(
    AddAssetRequest{
      currency_code: String::from("USD"),
      denominations: Vec::from([1, 5, 10, 25, 50, 100, 200, 500, 1000])
    });
// sending request and waiting for response
  let response = client.add_asset(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import authority_api.v1.Authority.AddAssetRequest
import authority_api.v1.Authority.AddAssetResponse
import authority_api.v1.AuthorityGrpc

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("authority.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
            .usePlaintext()
            .build()
    var blockStub = AuthorityGrpc.newBlockingStub(channel)
    
    val req_AddAssetRequest = AddAssetRequest.newBuilder()
          .setCurrencyCode("USD")
          .setDenominations(new int[]{1, 5, 10, 25, 100, 200, 500, 1000})
          .build()
    val resp = blockStub.addAsset(req_AddAssetRequest)
    println(resp)
    channel.shutdown()
}


returns AddAssetResponse

authority_api.v1.AddAssetResponse

{}