Sha256: bb9922bf9bfb2023ecf5820fd41c77efe47ca98a321499afd3cb2ca50798a346

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

require 'stellar'

account = Stellar::Account.from_seed("s3fu5vCMrfYouKuk2uB1gCD7EsuuBKY9M4qmnniQMBFMWR6Gaqm") 
client  = Stellar::Client.default_testnet()

# load the first page of transactions
transactions = client.transactions({
  account: account, 
  order: :chronological
}) # => #<TransactionPage count=50 [...]> 

# TransactionPage implements Enumerable...
transactions.first # => #<Stellar::Transaction ...>
transactions.each{|tx| p tx}
transactions.take(3) # => [...]

# ...but also has methods to advance pages
newer_transactions = transactions.next_page
older_transactions = transactions.prev_page # => []

# we can also just advance the current page in place
transactions.next_page!
transactions.prev_page!

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
stellar-sdk-0.3.0 examples/03_transaction_history.rb
stellar-sdk-0.2.0 examples/03_transaction_history.rb
stellar-sdk-0.1.1 examples/03_transaction_history.rb
stellar-sdk-0.1.0 examples/03_transaction_history.rb
stellar-lib-0.0.2 examples/03_transaction_history.rb