Beispiel #1
0
        public ActionResult <ResponseApiModel> GetTransactionsByWallet(RequestTransactionsApiModel model)
        {
            try
            {
                if (IsModelValid <WalletTransactionsResponseApiModel>(model) is var valid && valid != null)
                {
                    return(valid);
                }

                InitAuthKey(model);

                var res = serviceProvider.GetService <MonitorService>().GetWalletTransactions(model);
                res.Success = true;

                return(Ok(res));
            }
            catch (Exception ex)
            {
                return(BadRequest(new WalletTransactionsResponseApiModel()
                {
                    Success = false,
                    Message = ex.Message
                }));
            }
        }
Beispiel #2
0
        public WalletTransactionsResponseApiModel GetWalletTransactions(RequestTransactionsApiModel model)
        {
            var response = new WalletTransactionsResponseApiModel();

            using (var client = GetClientByModel(model))
            {
                var pKey = SimpleBase.Base58.Bitcoin.Decode(model.PublicKey).ToArray();
                var trxs = client.TransactionsGet(pKey, model.Offset, model.Limit);
                foreach (var tr in trxs.Transactions)
                {
                    response.Transactions.Add(ApiToShorttransaction(tr));
                }
            }

            return(response);
        }