Sha256: 5a43877b21ffcc37c7979811ecd44d338887dc74fceca9e918ad3e3f6b78487f

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

require 'jsonrpc-client'

module JSONRPC
  class Base
    def self.make_id
      "1"
    end
  end
end

module Zilliqa
  module Jsonrpc
    class Provider
      def initialize(endpoint)
        conn = Faraday.new { |connection|
          connection.adapter Faraday.default_adapter
        }
        @client = JSONRPC::Client.new(endpoint, { connection: conn })
        @endpoint = endpoint
      end

      def method_missing(sym, *args)
        @client.invoke(sym.to_s, args)
      end

      def testnet?
        @endpoint && !@endpoint.match('dev').nil?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zilliqa-0.1.1 lib/zilliqa/jsonrpc/provider.rb