Example #1
0
        public async Task <IActionResult> Genesis(string hash)
        {
            var genesisId = new GenesisId {
                Genesis = hash
            };

            var accountService = await _serviceFactory.GetAsync <AccountService>(HttpContext);

            var txs = await accountService.GetTransactionsAsync(genesisId, TxVerbosity.PubKeySign);

            var model = new GenesisViewModel
            {
                Genesis      = hash,
                Transactions = txs.ToList()
            };

            return(View(model));
        }
Example #2
0
        public async Task <IEnumerable <Transaction> > GetNotificationsAsync(GenesisId genesis,
                                                                             TxVerbosity txVerbosity = TxVerbosity.PubKeySign, CancellationToken token = default)
        {
            token.ThrowIfCancellationRequested();

            if (string.IsNullOrWhiteSpace(genesis?.Genesis))
            {
                throw new ArgumentException("Genesis is required");
            }

            var request = new NexusRequest(new Dictionary <string, string>
            {
                { "genesis", genesis.Genesis },
                { "verbose", ((int)txVerbosity).ToString() }
            });

            var txs = await PostAsync <IEnumerable <Transaction> >("accounts/notifications", request, token);

            return(txs ?? new List <Transaction>());
        }
Example #3
0
        public async Task <Asset> TransferAssetAsync(Asset asset, NexusUser fromUser, GenesisId toUserGenesis, CancellationToken token = default)
        {
            if (string.IsNullOrWhiteSpace(toUserGenesis?.Genesis))
            {
                throw new ArgumentException("Genesis is required");
            }

            return(await TransferAssetAsync(asset, fromUser, ("destination", toUserGenesis.Genesis), token));
        }