Sha256: 73decc98ea8e5e3ea4dad2a1de9131ef9bab52820425f882680e48cba64aadae

Contents?: true

Size: 1.7 KB

Versions: 1

Compression:

Stored size: 1.7 KB

Contents

# frozen_string_literal: true

module Harmony
  module Api
    module V1
      module Transactions
        module Transaction
          def get_send_raw_transaction(hash)
            response(post('getBalance', params: [hash]))
          end

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

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

          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

          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

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

          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
          
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
harmony-api-0.1.4 lib/harmony/api/v1/transactions/transaction.rb