Sha256: e5043e63ad188a4670767d7a1ce1b8c37d1453df67ba9c2e9f1ed2b1ca7c387a

Contents?: true

Size: 849 Bytes

Versions: 2

Compression:

Stored size: 849 Bytes

Contents

require 'scale_rb'

def fetch_some_storages(client, block_number)
  start_time = Time.now

  block_hash = client.chain_getBlockHash(block_number)
  metadata = client.get_metadata(block_hash)
  puts "event count: #{client.get_storage('System', 'EventCount', block_hash:, metadata:)}"
  puts "treasury proposal #854: #{client.get_storage('Treasury', 'Proposals', [854], block_hash:, metadata:)}"
  puts "all treasury proposals: #{client.get_storage('Treasury', 'Proposals', block_hash:, metadata:)}"
  puts "child bounties: #{client.get_storage('ChildBounties', 'ChildBounties', [11, 1646], block_hash:, metadata:)}"

  end_time = Time.now
  puts "Time taken: #{end_time - start_time} seconds"
end

ScaleRb.logger.level = Logger::DEBUG

ScaleRb::WsClient.start('wss://polkadot-rpc.dwellir.com') do |client|
  fetch_some_storages(client, 21711742)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scale_rb-0.4.1 examples/ws_client_4.rb
scale_rb-0.4.0 examples/ws_client_4.rb