Module: MixinBot::API::Rpc

Included in:
MixinBot::API
Defined in:
lib/mixin_bot/api/rpc.rb

Instance Method Summary collapse

Instance Method Details

#get_snapshot(hash, access_token: nil) ⇒ Object



29
30
31
# File 'lib/mixin_bot/api/rpc.rb', line 29

def get_snapshot(hash, access_token: nil)
  rpc_proxy 'getsnapshot', [hash], access_token:
end

#get_transaction(hash, access_token: nil) ⇒ Object



21
22
23
# File 'lib/mixin_bot/api/rpc.rb', line 21

def get_transaction(hash, access_token: nil)
  rpc_proxy('gettransaction', [hash], access_token:)
end

#get_utxo(hash, index = 0, access_token: nil) ⇒ Object



25
26
27
# File 'lib/mixin_bot/api/rpc.rb', line 25

def get_utxo(hash, index = 0, access_token: nil)
  rpc_proxy 'getutxo', [hash, index], access_token:
end

#list_mint_distributions(offset = 0, count = 10, txn: false, access_token: nil) ⇒ Object



41
42
43
# File 'lib/mixin_bot/api/rpc.rb', line 41

def list_mint_distributions(offset = 0, count = 10, txn: false, access_token: nil)
  rpc_proxy 'listmintdistributions', [offset, count, txn], access_token:
end

#list_mint_works(offset = 0, access_token: nil) ⇒ Object



37
38
39
# File 'lib/mixin_bot/api/rpc.rb', line 37

def list_mint_works(offset = 0, access_token: nil)
  rpc_proxy 'listmintworks', [offset], access_token:
end

#list_snapshots(offset = 0, count = 10, sig: false, txn: false, access_token: nil) ⇒ Object



33
34
35
# File 'lib/mixin_bot/api/rpc.rb', line 33

def list_snapshots(offset = 0, count = 10, sig: false, txn: false, access_token: nil)
  rpc_proxy 'listsnapshots', [offset, count, sig, txn], access_token:
end

#rpc_proxy(method, params = [], access_token: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/mixin_bot/api/rpc.rb', line 6

def rpc_proxy(method, params = [], access_token: nil)
  path = '/external/kernel'
  payload = {
    method:,
    params:
  }

  client.post path, **payload, access_token:
end

#send_raw_transaction(raw, access_token: nil) ⇒ Object

send a signed transaction to main net



17
18
19
# File 'lib/mixin_bot/api/rpc.rb', line 17

def send_raw_transaction(raw, access_token: nil)
  rpc_proxy('sendrawtransaction', [raw], access_token:)
end