WavesCS - C# client library for Waves API


#21

It’s hidden. You generate public and private keys, then derive address from public key. Then you can give your address to someone, and when he sends funds to this address it will appear in blockchain and you will be able to spend funds using your private key.


#22

Thank you, i understand


#23

Hi @Putu,

We’ve just added new functionality.

Now you can get the last transactions of a certain address:

    var node = new Node(Node.MainNetHost);
    var limit = 100;
    var address = "3PBmsJXAcgnH9cu81oyW8abNh9jsaNzFQKJ";

    var transactions = node.GetTransactions(address, limit);

You can also get a transaction by its Id:

    var transaction = node.GetTransactionById("37nfgadHFw92hNqzyHFZXmGFo5Wmct6Eik1Y2AdYW1Aq");

Here are some examples of how it can be used.

  1. Get all recent TransferTransactions:
    var transferTransactions = node.GetTransactions(address)
                                   .OfType<TransferTransaction>();
  1. List all distinct recipients of MassTransferTransactions with BTC asset:
    var massTransferBTCRecipients = node.GetTransactions(address)
                                 .OfType<MassTransferTransaction>()
                                 .Where(tx => tx.Asset.Id == Assets.BTC.Id)
                                 .SelectMany(tx => tx.Transfers)
                                 .Select(t => t.Recipient)
                                 .Distinct();
  1. List all recently issued custom assets’ names:
    var customAssetsNames = node.GetTransactions(address)
                                .OfType<IssueTransaction>()
                                .Select(tx => tx.Name);
  1. Calculate the total amount of recently leased assets that are still leased:
    var leasedAmount = node.GetTransactions(address)
                         .OfType<LeaseTransaction>()
                         .Where(tx => tx.IsActive)
                         .Sum(tx => tx.Amount);
  1. Count transactions of each type in recent transactions:
    var transactionsByType = node.GetTransactions(address)
                                 .GroupBy(tx => tx.GetType())
                                 .Select(group => new { Type = group.Key.Name, Count = group.Count() })
                                 .OrderByDescending(x => x.Count);

    foreach (var tx in transactionsByType)
        Console.WriteLine($"{tx.Type}\t\t{tx.Count}");

#24

Cool. Any plan to update the nuget package soon?
When I check this page it was last updated 8 days ago.


#25

Sorry for the delay with an answer, the nuget package is updated (v. 1.1.0.2).


#26

Hi,
is there anyway to query the network with this library so as to get a list of every address with a minimum amount of waves, or even to get every address on waves?
I guess most airdrops already use this, how do i do this with this library?

Thanks


#27

Hi,

I was trying to send TransferTransaction with recipient alias and it fails during signing:

var tx = new TransferTransaction(Accounts.Alice.PublicKey, "alias:T:somealias", Assets.WAVES, 0.001m).Sign(Accounts.Alice);

with exception:

System.ArgumentException: Illegal character l at position 1
    at WavesCS.Base58.Decode(String input) in C:\Projects\WavesCS\WavesCS\Base58.cs:line 98
   at WavesCS.Base58.FromBase58(String data) in C:\Projects\WavesCS\WavesCS\Base58.cs:line 162
   at WavesCS.TransferTransaction.GetBody() in C:\Projects\WavesCS\WavesCS\Transactions\TransferTransaction.cs:line 77
   at WavesCS.TransactionExtensons.Sign[T](T transaction, PrivateKeyAccount account, Int32 proofIndex) in C:\Projects\WavesCS\WavesCS\Transactions\Transaction.cs:line 96

In seems that the problem in the prefix “alias:” itself!


#28

The NuGet package is updated (v. 1.1.0.4):

  • FastHash(byte[] message) was added;
  • Node.GetTransactions was added;
  • We add the possibility to generate Id for Transaction and Order instances;
  • Deserialization of ExchangeTx was fixed (FromJson method).

#29

The NuGet package is updated (v. 1.1.0.5):

  • Add the ability to transfer to aliased addresses.
  • Add Node.GetAssetBalances(address) method.
  • Change tests’ structure.

#30

Hi,

It seems that updated nuget packages v. 1.1.0.4 and v. 1.1.0.5 contain updated source files but the binaries (WavesCS.dll) are old. For example if you try to use nuget v. 1.1.0.5 - there is still no method TransactionExtensons.GenerateId!


#31

Thank you, I loaded an update 1.1.0.6, check it please


#32

Hi,

Thanks for the updated binaries in Nuget 1.1.0.6.

Now I’ve found a deserialization exception when trying to create Transfer or MassPayment transaction from using GetJson method output. These tests will fail:

[TestMethod]
        public void TestTransferTransactionFromJson()
        {
            var tx = new TransferTransaction(Accounts.Alice.PublicKey, Accounts.Bob.Address, Assets.WAVES, 0.1m);
            var jsonDict = tx.GetJson();

            var deserializedTx = Transaction.FromJson(jsonDict);
        }
[TestMethod]
        public void TestTransferTransactionJsonConstructor()
        {
            var tx = new TransferTransaction(Accounts.Alice.PublicKey, Accounts.Bob.Address, Assets.WAVES, 0.1m);
            var jsonDict = tx.GetJson();

            var deserializedTx = new TransferTransaction(jsonDict);
        }

Since GetJson method does not add “sender” value which is now required by deserializing constructor.


#33

Hi,
Thanks for your report. We’ve fixed this problem and updated the NuGet package (v. 1.1.0.7).


#34

We published new NuGet package version 1.1.1.1:

  • Add smart assets
  • Add cancelAll transaction

#35

We published new NuGet package version 1.1.1.2:

  • Fix some bugs with JSON without “sender” field