Class: MVM::Scan

Inherits:
Object
  • Object
show all
Defined in:
lib/mvm/scan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeScan

Returns a new instance of Scan.



7
8
9
# File 'lib/mvm/scan.rb', line 7

def initialize
  @client = Client.new 'scan.mvm.dev'
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/mvm/scan.rb', line 5

def client
  @client
end

Instance Method Details

#tokens(address, type: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mvm/scan.rb', line 11

def tokens(address, type: nil)
  path = '/api'
  r = client.get(
    path,
    address:,
    action: 'tokenlist',
    module: 'account'
  )['result']

  r = r.filter(&->(token) { token['type'] == type }) if type.present?

  r
end