Walletrpc.WalletService.WalletServiceClient.GetTransactions C# (CSharp) Method

GetTransactions() public method

public GetTransactions ( global request, CallOptions options ) : global::Walletrpc.GetTransactionsResponse
request global
options CallOptions
return global::Walletrpc.GetTransactionsResponse
      public global::Walletrpc.GetTransactionsResponse GetTransactions(global::Walletrpc.GetTransactionsRequest request, CallOptions options)
      {
        var call = CreateCall(__Method_GetTransactions, options);
        return Calls.BlockingUnaryCall(call, request);
      }
      public AsyncUnaryCall<global::Walletrpc.GetTransactionsResponse> GetTransactionsAsync(global::Walletrpc.GetTransactionsRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))

Same methods

WalletService.WalletServiceClient::GetTransactions ( global request, Metadata headers = null, DateTime deadline = null, CancellationToken cancellationToken = default(CancellationToken) ) : global::Walletrpc.GetTransactionsResponse

Usage Example

Ejemplo n.º 1
0
        public async Task<TransactionSet> GetTransactionsAsync(int minRecentTransactions, int minRecentBlocks)
        {
            var client = new WalletService.WalletServiceClient(_channel);
            var request = new GetTransactionsRequest
            {
                // TODO: include these.  With these uncommented, all transactions are loaded.
                //StartingBlockHeight = -minRecentBlocks,
                //MinimumRecentTransactions = minRecentTransactions
            };

            var responseStream = client.GetTransactions(request, cancellationToken: _tokenSource.Token).ResponseStream;
            var minedTransactions = new List<Block>();
            Dictionary<Blake256Hash, WalletTransaction> unminedTransactions = null;
            while (await responseStream.MoveNext())
            {
                var msg = responseStream.Current;
                if (msg.MinedTransactions != null)
                    minedTransactions.Add(MarshalBlock(msg.MinedTransactions));
                else
                    unminedTransactions = msg.UnminedTransactions.Select(MarshalWalletTransaction).ToDictionary(tx => tx.Hash);
            }
            return new TransactionSet(minedTransactions, unminedTransactions ?? new Dictionary<Blake256Hash, WalletTransaction>());
        }