/// <summary> /// Получить историю транзакций кошелька /// </summary> /// <param name="year">Год отчёта</param> /// <param name="show_addresses">Отобразить в результате запроса адреса IN & OUT</param> /// <param name="show_fiat">Отобразить суммы</param> public WalletTransactionsHistoryResponseClass GetTransactionsHistoryWallet(bool?show_addresses = null, bool?show_fiat = null, bool show_fees = false, int?year = null, long?from_height = null, long?to_height = null) { GetTransactionsHistoryWalletMethodClass electrum_history_transaction_method = new GetTransactionsHistoryWalletMethodClass(this) { year = year, show_addresses = show_addresses, show_fiat = show_fiat, show_fees = show_fees, from_height = from_height, to_height = to_height }; WalletTransactionsHistoryResponseClass walletHistory = (WalletTransactionsHistoryResponseClass)electrum_history_transaction_method.execute(); return(walletHistory); }
public override object execute() { if (year != null) { options.Add("year", year.ToString()); } if (show_addresses != null) { options.Add("show_addresses", show_addresses.ToString()); } if (show_fiat != null) { options.Add("show_fiat", show_fiat.ToString()); } if (show_fees != null) { options.Add("show_fees", show_fees.ToString()); } if (from_height != null && from_height > 0) { options.Add("from_height", from_height.ToString()); } if (to_height != null) { options.Add("to_height", to_height.ToString()); } string jsonrpc_raw_data = Client.Execute(method, options); WalletTransactionsHistoryResponseClass result = new WalletTransactionsHistoryResponseClass(); return(result.ReadObject(jsonrpc_raw_data)); }
protected override void ScheduleBodyAsyncAction() { WalletTransactionsHistoryResponseClass transactions = ElectrumClient.GetTransactionsHistoryWallet(true, true, true, null, TransactionsHistoryFromHeight); if (EnableFullRawTracert) { SetStatus("jsonrpc_response_raw: " + ElectrumClient.jsonrpc_response_raw, StatusTypes.DebugStatus); } if (transactions is null) { SetStatus("Ошибка загрузки транзакций Electrum. transactions is null", StatusTypes.ErrorStatus); SetStatus(null); return; } if (transactions.error != null) { SetStatus("Ошибка загрузки транзакций Electrum. transactions.error != null: [code:" + transactions.error.code + "][message:" + transactions.error.message + "]", StatusTypes.ErrorStatus); SetStatus(null); return; } if (transactions.result?.transactions == null) { SetStatus("Ошибка загрузки транзакций Electrum. transactions.result?.transactions == null", StatusTypes.ErrorStatus); SetStatus(null); return; } if (transactions.result.transactions.Length == 0) { SetStatus("Ошибка загрузки транзакций Electrum. transactions.result.transactions.Length == 0", StatusTypes.ErrorStatus); SetStatus(null); return; } lock (Transactions) { Transactions = new ConcurrentBag <TransactionWalletHistoryResponseClass>(transactions.result.transactions); } lock (AddressesWalet) { if (AddressesWalet.Count == 0) { try { string[] walet_addresses = ElectrumClient.GetListWalletAddresses().result; if (EnableFullRawTracert) { SetStatus("jsonrpc_response_raw: " + ElectrumClient.jsonrpc_response_raw, StatusTypes.DebugStatus); } if (walet_addresses != null && walet_addresses.Length > 0) { AddressesWalet = new ConcurrentBag <string>(walet_addresses); } else { SetStatus("Ошибка загрузки доступных адресов кошелька Electrum. Запрос доступных адресов пустой", StatusTypes.ErrorStatus); SetStatus(null); return; } } catch (Exception e) { SetStatus("Внутреннее исключение загрузки доступных адресов кошелька Electrum: " + e.Message, StatusTypes.ErrorStatus); SetStatus(null); return; } } } }