ListContracts

Lists the history of all Contracts for a given wallet.

rpc ListContracts

asset_controller_api.v1.ListContracts

Lists the history of all Contracts for a given wallet.

requests ListContractsRequest

asset_controller.ListContractsRequest

FieldTypeDescription
pageint32Page number for pagination. First page is '0'.
page_sizeint32Elements per page for pagination.
verifier optionalstringWallet verifier.
resp, _ := assetcontroller.ListContracts(ctx, &v1.ListContractsRequest{
  Page: 0,
  PageSize: 10000,
  Verifier: "zWalletPublicKey",
})
fmt.Println(resp)
const listcontractsrequest = new ListContractsRequest();
listcontractsrequest.setPage(0);
listcontractsrequest.setPageSize(10000);
listcontractsrequest.setVerifier("zWalletPublicKey");

service.listContracts(listcontractsrequest, (err, value:ListContractsResponse|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 listContractsRequest = new ListContractsRequest{
        Page = 0,
        PageSize = 10000,
        Verifier = "zWalletPublicKey",
      };
      var reply = client.ListContracts(listContractsRequest, 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.ListContractsRequest;
import asset_controller_api.v1.AssetController.ListContractsResponse;
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);
    
    ListContractsRequest req_ListContractsRequest =
        ListContractsRequest.newBuilder()
          .setPage(0)
      		.setPageSize(10000)
          .setVerifier("zWalletPublicKey")
          .build();
    ListContractsResponse resp = blockStub.listContracts(req_ListContractsRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const listcontractsrequest = new ListContractsRequest();
listcontractsrequest.setPage(0);
listcontractsrequest.setPageSize(10000);
listcontractsrequest.setVerifier("zWalletPublicKey");

service.listContracts(listcontractsrequest, (err, value:ListContractsResponse|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::ListContractsRequest;

#[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(
    ListContractsRequest{
      page: 0,
      page_size: 10000,
      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.ListContractsRequest
import asset_controller_api.v1.AssetController.ListContractsResponse
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_ListContractsRequest = ListContractsRequest.newBuilder()
          .setAssetType"BankAssetType")
      		.setPage(0)
      		.setPageSize(10000)
          .setVerifier("zWalletPublicKey")
          .build()
    val resp = blockStub.listContracts(req_ListContractsRequest)
    println(resp)
    channel.shutdown()
}


returns ListContractsResponse

asset_controller.ListContractsResponse

FieldTypeDescription
contractsContractSummary repeatedList of contracts with status metadata
totalCountuint32Total number of contracts
{
  "contracts": [
    {
      "contract_id": "9628a2d9-f932-41f0-b2da-b9de3103d945",
      "contract_type": "Swap",
      "created": "2022-12-19T16:39:57-08:00",
      "counterparties": [
        "zCounterpartyPublicKeyMultibase58Encoded",
        "zCounterpartyPublicKeyMultibase58Encoded2"
      ],
      "status": 1
    },
    {
      "contract_id": "9628a2d9-f932-41f0-b2da-b9de3103d945",
      "contract_type": "Swap",
      "created": "2022-12-19T16:39:57-08:00",
      "counterparties": [
        "zCounterpartyPublicKeyMultibase58Encoded",
        "zCounterpartyPublicKeyMultibase58Encoded2"
      ],
      "status": 1
    }
  ],
  "totalCount": 2
}