class Eost::Eosscan

classe para acesso dados blockchain EOS

Attributes

url[R]

@return [String] endereco da API blockchain EOS

Public Class Methods

new(www: 'https://eos.greymass.com') click to toggle source

@return [Eosscan] acesso dados blockchain EOS

# File lib/eost/eosscan.rb, line 15
def initialize(www: 'https://eos.greymass.com')
  @url = www
  # load_specs
end

Public Instance Methods

adapter() click to toggle source

@return [<Symbol>] adapter for the connection - default :net_http

# File lib/eost/eosscan.rb, line 21
def adapter
  @adapter ||= Faraday.default_adapter
end
chain_get_account(**args) click to toggle source

@example chain_get_account

{
  'account_name': '...',
  'head_block_num': 138_586_631,
  'head_block_time': '2020-08-26T10:16:05.500',
  'privileged': false,
  'last_code_update': '1970-01-01T00:00:00.000',
  'created': '2018-06-09T13:14:37.000',
  # DEVOLVIDO 'core_liquid_balance': '1232.0226 EOS',
  'ram_quota': 9548,
  'net_weight': 10_001_142,
  'cpu_weight': 10_001_144,
  'total_resources': {
    'owner': '...',
  # DEVOLVIDO   'net_weight': '1000.1142 EOS',
  # DEVOLVIDO   'cpu_weight': '1000.1144 EOS',
    'ram_bytes': 8148
  },
  'net_limit': { 'used': 0, 'available': 1_068_152_841, 'max': 1_068_152_841 },
  'cpu_limit': { 'used': 338, 'available': 90_856, 'max': 91_194 },
  'ram_usage': 3574,
  'permissions': [
    {
      'perm_name': 'active',
      'parent': 'owner',
      'required_auth': {
        'threshold': 1,
        'keys': [{ 'key': '...', 'weight': 1 }],
        'accounts': [],
        'waits': []
      }
    },
    {
      'perm_name': 'owner',
      'parent': '',
      'required_auth': {
        'threshold': 1,
        'keys': [{ 'key': '...', 'weight': 1 }],
        'accounts': [],
        'waits': []
      }
    }
  ],
  'self_delegated_bandwidth': {
    'from': '...', 'to': '...', 'net_weight': '1000.1142 EOS', 'cpu_weight': '1000.1144 EOS'
  },
  'refund_request': nil,
  'voter_info': {
    'owner': '...',
    'proxy': '...',
    'producers': [],
    'staked': 20_002_286,
    'last_vote_weight': '17172913021904.12109375000000000',
    'proxied_vote_weight': '0.00000000000000000',
    'is_proxy': 0,
    'flags1': 0,
    'reserved2': 0,
    'reserved3': '0.0000 EOS'
  },
  'rex_info': nil
}

@return [Hash] dados numa carteira EOS

# File lib/eost/eosscan.rb, line 98
def chain_get_account(**args)
  JSON.parse(conn.post('/v1/chain/get_account', args.to_json, content_type: 'application/json').body)
end
conn() click to toggle source

manage the default properties and the middleware stack for fulfilling an HTTP request

@return [<Faraday::Connection>] connection object with an URL & adapter

# File lib/eost/eosscan.rb, line 28
def conn
  @conn ||=
    Faraday.new(url: url) do |c|
      c.request(:url_encoded)
      c.adapter(adapter)
    end
end
history_get_actions(**args) click to toggle source

@example history_get_actions

{
  'actions' => [
    {
      'account_action_seq': 937,
      'action_trace': {
        'account_ram_deltas': [],
        'act': {
          'account': 'newsblockone',
          'authorization': [
            { 'actor': 'blockonenews', 'permission': 'active' },
            { 'actor': 'newsblockone', 'permission': 'active' }
          ],
          'data': {
            'from': 'newsblockone',
            'memo': '100 million EOS tokens released on the network - EOS Reallocation Program @ get-eos.io',
            'quantity': '1.0000 NEWS',
            'to': '...'
          },
          'hex_data': 'a02685',
          'name': 'transfer'
        },
        'action_ordinal': 20,
        'block_num': 135_581_543,
        'block_time': '2020-08-09T00:45:41.000',
        'closest_unnotified_ancestor_action_ordinal': 10,
        'context_free': false,
        'creator_action_ordinal': 10,
        'elapsed': 17,
        'producer_block_id': '0814cf67c5dfe81e8647be1ddec70a8c84c45e1d65779132ace3561be044a12c',
        'receipt': {
          'abi_sequence': 2,
          'act_digest': '8b2a534341229734f1532430ffcd40c30c7b82da30c3f23446f248c2e1209a68',
          'auth_sequence': [['blockonenews', 485_788], ['newsblockone', 368_458]],
          'code_sequence': 2,
          'global_sequence': 204_352_530_651,
          'receiver': '...',
          'recv_sequence': 900
        },
        'receiver': '...',
        'trx_id': 'de327b9ba02f2fbca9eb2ee3a4e26f8ead6198248b52d184e1f480c578705ba9'
      },
      'block_num': 135_581_543,
      'block_time': '2020-08-09T00:45:41.000',
      # DELETED 'global_action_seq': 204_352_530_651,
      'irreversible': true
    }
  ],
  'head_block_num' => 138_936_528,
  'last_irreversible_block' => 138_936_194
}

@return [Hash] dados das transacoes ligadas a uma carteira EOS

# File lib/eost/eosscan.rb, line 154
def history_get_actions(**args)
  JSON.parse(conn.post('/v1/history/get_actions', args.to_json, content_type: 'application/json').body)
end