public List <AddressNotification> GetNotifications(List <Address> toCheck, LedgerState ledgerState, Ledger ledger)
        {
            var results = new List <AddressNotification>();

            foreach (var address in toCheck)
            {
                if (!addresses.Contains(address))
                {
                    continue;
                }

                if (ledgerState.TryGetAccount(address, out var account))
                {
                    var transactions = ledger.Block.Transactions.Where(_ => _.Transaction.Inputs.Any(__ => __.Address == address) ||
                                                                       _.Transaction.Outputs.Any(__ => __.Address == address)).Select(_ => _.Hash.ToBase64()).ToList();
                    results.Add(new AddressNotification
                    {
                        Address      = account.Address.Encoded,
                        Balance      = account.Balances.ToDictionary(_ => Currency.ToSymbol(_.Currency), __ => Amount.ToWholeDecimal(__.Amount)),
                        Height       = ledger.LedgerLight.Height,
                        Transactions = transactions
                    });
                }
            }
            return(results);
        }
Ejemplo n.º 2
0
        private async Task CheckIfLedgerActiveAsync()
        {
            Console.WriteLine("Waiting for ledger to become active.");
            LedgerState ledgerState = LedgerState.CREATING;

            do
            {
                DescribeLedgerResponse describeResponse = await qldbClient.DescribeLedgerAsync(new DescribeLedgerRequest
                {
                    Name = LedgerName
                });

                ledgerState = describeResponse.State;
            }while (ledgerState != LedgerState.ACTIVE);
            Console.WriteLine("Ledger is active.");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Selects ledger for current request.
 /// </summary>
 /// <param name="state">The ledger state.</param>
 public void SelectLedger(LedgerState state)
 {
     _message.ledger_index = state.ToString().ToLower();
 }
Ejemplo n.º 4
0
 public LedgerPostState(LedgerState previous, long height) : base(GetTree(previous).Clone())
 {
     Height = height;
 }