Sha256: c5f444e2ab85a195a19c569d6d3502806df9fbed376387d6360634a96a3b4830
Contents?: true
Size: 804 Bytes
Versions: 1
Compression:
Stored size: 804 Bytes
Contents
require 'jsonrpc-client' require 'zilliqa/util/bech32' 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 GetBalance(*args) formatted = args.map { |addr| Util::Bech32.to_checksum_address(addr).downcase.sub('0x', '') } @client.invoke('GetBalance', formatted) 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.2 | lib/zilliqa/jsonrpc/provider.rb |