Module: Harmony::Api::V1::Transactions::Transaction

Included in:
Client
Defined in:
lib/harmony/api/v1/transactions/transaction.rb

Instance Method Summary collapse

Instance Method Details

#get_send_raw_transaction(hash) ⇒ Object



8
9
10
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 8

def get_send_raw_transaction(hash)
  response(post('getBalance', params: [hash]))
end

#get_transaction_by_block_hash_and_index(hash, index) ⇒ Object



25
26
27
28
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 25

def get_transaction_by_block_hash_and_index(hash, index)
  params = [hash, Harmony::Api::Utilities.int_to_hex(index)]
  response(post('getTransactionByBlockHashAndIndex', params: params))
end

#get_transaction_by_block_number_and_index(block_number, index) ⇒ Object



20
21
22
23
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 20

def get_transaction_by_block_number_and_index(block_number, index)
  params = [Harmony::Api::Utilities.int_to_hex(block_number), Harmony::Api::Utilities.int_to_hex(index)]
  response(post('getTransactionByBlockNumberAndIndex', params: params))
end

#get_transaction_by_hash(hash) ⇒ Object



12
13
14
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 12

def get_transaction_by_hash(hash)
  response(post('getTransactionByHash', params: [hash]))
end

#get_transaction_receipt(hash) ⇒ Object



16
17
18
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 16

def get_transaction_receipt(hash)
  response(post('getTransactionReceipt', params: [hash]))
end

#get_transactions_history(address, page_index: 0, page_size: 1000, full_txs: false, tx_type: :all, order: :asc) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 34

def get_transactions_history(address, page_index: 0, page_size: 1000, full_txs: false, tx_type: :all, order: :asc)
  params = [
    {
      'address'   => address,
      'pageIndex' => page_index,
      'pageSize'  => page_size,
      'fullTx'    => full_txs,
      'txType'    => tx_type.to_s.upcase,
      'order'     => order.to_s.upcase
    }
  ]
  
  response(post('getTransactionsHistory', params: params))
end

#pending_transactionsObject



30
31
32
# File 'lib/harmony/api/v1/transactions/transaction.rb', line 30

def pending_transactions
  response(post('getTransactionByBlockHashAndIndex'))
end