Module: Glueby::Internal::RPC

Defined in:
lib/glueby/internal/rpc.rb

Class Method Summary collapse

Class Method Details

.clientObject



6
7
8
# File 'lib/glueby/internal/rpc.rb', line 6

def client
  @rpc ||= Tapyrus::RPC::TapyrusCoreClient.new(@config)
end

.configure(config) ⇒ Object



10
11
12
# File 'lib/glueby/internal/rpc.rb', line 10

def configure(config)
  @config = config
end

.perform_as(wallet) ⇒ Object

Perform RPC call on the specific wallet. This method needs block, and pass a client as as block argument. You can call RPCs on the wallet using the client object. See an example below. ## Example “‘ruby perform_as(’mywallet’) do |client|

client.getbalance

end “‘

Parameters:

  • wallet (string)

    name on Tapyrus Core Wallet

Returns:

  • (Object)

    The return object of the block



26
27
28
29
30
31
32
# File 'lib/glueby/internal/rpc.rb', line 26

def perform_as(wallet)
  before = client.config[:wallet]
  client.config[:wallet] = wallet
  yield(client)
ensure
  client.config[:wallet] = before
end