Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Credits API Simple Demo");

            if (args.Length != 4)
            {
                Console.WriteLine("Usage: CreditsCSAPIDemo NodeIpAddress YourPublicKey YourPrivateKey TargetPublicKey");
                return;
            }

            var SourceKeys = new Keys
            {
                PublicKey  = args[1],
                PrivateKey = args[2]
            };

            var TargetKeys = new Keys
            {
                PublicKey = args[3],
            };

            using (var transport = new TSocket(args[0], 9090))
            {
                using (var protocol = new TBinaryProtocol(transport))
                {
                    using (var client = new API.Client(protocol))
                    {
                        transport.Open();

                        var balance = client.WalletBalanceGet(SourceKeys.PublicKeyBytes);
                        Console.WriteLine($"[{SourceKeys.PublicKey}] Balance: {balance.Balance.ToString()}");

                        var clientEx = new ClientEx(client, SourceKeys, TargetKeys);
                        Console.WriteLine("Result of the transaction execution:");
                        Console.WriteLine(clientEx.ExecuteTransaction());
                    }
                }
            }

            Console.WriteLine("Press [Enter] to exit...");
            Console.ReadLine();
        }
Exemplo n.º 2
0
 public WalletBalanceGetResult WalletGetBalance()
 {
     return(api.WalletBalanceGet(keys.PublicKeyBytes));
 }