Sha256: e66b87935e961bdd29f394580e3b28581f16b029a2e732141ad4fbf85796d8a9

Contents?: true

Size: 1.66 KB

Versions: 4

Compression:

Stored size: 1.66 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,
                'pageIndex' => 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

4 entries across 4 versions & 1 rubygems

Version Path
harmony-api-0.1.3 lib/harmony/api/v1/transactions/transaction.rb
harmony-api-0.1.2 lib/harmony/api/v1/transactions/transaction.rb
harmony-api-0.1.1 lib/harmony/api/v1/transactions/transaction.rb
harmony-api-0.1.0 lib/harmony/api/v1/transactions/transaction.rb