Sha256: 6698ebf6804eef0886fbaaecb6a86d93d9ca5d7aa83510917fde38e97ca997d9
Contents?: true
Size: 724 Bytes
Versions: 5
Compression:
Stored size: 724 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 end end end
Version data entries
5 entries across 5 versions & 1 rubygems