Exemplo n.º 1
0
        public async Task TestExchangeRate()
        {
            var api  = new KzApiWhatsOnChain();
            var rate = await api.GetExchangeRate();

            Assert.True(rate > 0 && rate < 1000000);
        }
Exemplo n.º 2
0
        async Task JarvisMain()
        {
            var woc = new KzApiWhatsOnChain();

            var unspent = (List <KzApiWhatsOnChain.ByAddressUnspent>)null;

            while (!_signalCleanup)
            {
                // Wait for funding...
                unspent = await woc.GetUnspentTransactionsByAddress(FundingAddress);

                if (unspent.Count > 0)
                {
                    break;
                }
                Console.WriteLine($"Please fund{FundingAddress} with a few mBSV...");
                await Task.Delay(TimeSpan.FromSeconds(10));
            }

            Debug.Assert(unspent.Count == 1);

            var txid = unspent[0].tx_hash.ToKzUInt256();
            var tx   = await woc.GetTransactionsByHash(txid);

            Debug.Assert(tx != null);

            // Let's see if we have data to decode:
            var txb = new KzBTransaction(tx);
            var ors = txb.FindPushDataByProtocol(_magic).ToArray();

            Debug.Assert(ors.Length < 2);

            if (ors.Length == 1)
            {
                // Recover wallet state from transaction output data.
            }
        }