Exemplo n.º 1
0
        public override void InsertLocalTransactionCacheEntry(ITransactionEnvelope transactionEnvelope)
        {
            base.InsertLocalTransactionCacheEntry(transactionEnvelope);

            AccountId targetAccountId = transactionEnvelope.Contents.Uuid.Account;

            TotalAPI total = this.GetAccountBalance(targetAccountId, true);

            this.centralCoordinator.PostSystemEvent(NeuraliumSystemEventGenerator.NeuraliumAccountTotalUpdated(targetAccountId.SequenceId, targetAccountId.AccountType, total));
        }
Exemplo n.º 2
0
        public override void UpdateLocalTransactionCacheEntry(TransactionId transactionId, WalletTransactionCache.TransactionStatuses status, long gossipMessageHash)
        {
            base.UpdateLocalTransactionCacheEntry(transactionId, status, gossipMessageHash);

            AccountId targetAccountId = transactionId.Account;

            TotalAPI total = this.GetAccountBalance(targetAccountId, true);

            this.centralCoordinator.PostSystemEvent(NeuraliumSystemEventGenerator.NeuraliumAccountTotalUpdated(targetAccountId.SequenceId, targetAccountId.AccountType, total));
        }
        protected override void LocalAccountSnapshotEntryChanged(Dictionary <AccountId, List <Action> > changedLocalAccounts, IAccountSnapshot newEntry, IWalletAccountSnapshot original)
        {
            base.LocalAccountSnapshotEntryChanged(changedLocalAccounts, newEntry, original);

            if (newEntry is INeuraliumAccountSnapshot neuraliumAccountSnapshot && original is INeuraliumWalletAccountSnapshot neuraliumWalletAccountSnapshot)
            {
                if (neuraliumAccountSnapshot.Balance != neuraliumWalletAccountSnapshot.Balance)
                {
                    AccountId accountId = newEntry.AccountId.ToAccountId();

                    this.InsertChangedLocalAccountsEvent(changedLocalAccounts, accountId, () => {
                        // seems our total was updated for this account

                        TotalAPI total = this.CentralCoordinator.ChainComponentProvider.WalletProvider.GetAccountBalance(accountId, true);
                        this.CentralCoordinator.PostSystemEvent(NeuraliumSystemEventGenerator.NeuraliumAccountTotalUpdated(accountId.SequenceId, accountId.AccountType, total));
                    });
                }
            }
        }