Published 28 June 2019

Examples: C#: Get Balance

Project:

https://github.com/CREDITSCOM/examples.git

Branch:

https://github.com/CREDITSCOM/examples/tree/master/API/CreditsCSharpDemo

This example illustrates how to perform a simple method of getting balance with the Credits API. Operation is implemented in the class Client

Implementation

class Client : IDisposable

{    

  ...

  public WalletBalanceGetResult WalletGetBalance()

    {    

      // Here a transformed wallet public key is shared to the method

      // Transformation is done in the class keys

      return api.WalletBalanceGet(keys.PublicKeyBytes);

    }

  ...

}

Usage

static void Main(string[] args)

{        

  Console.WriteLine("Credits API Simple Demo");

  ...

  using (var client = new Client(args[0], Convert.ToInt32(args[1]), args[2], args[3], args[4]))

  {            

    var balance = client.WalletGetBalance();

    Console.WriteLine($"[{client.keys.PublicKey}] Balance: {balance.Balance.ToString()}");

  }

  ...

  Console.WriteLine("Press [Enter] to exit...");

  Console.ReadLine();

}        

Votes 0, average rating 0

Contents