Sha256: 704f9d9afef588b992cf687790969c6c11c32927ee81fde49414f2e9f7cd79a9

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 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

client = ScaleRb::HttpClient.new('https://polkadot-rpc.dwellir.com')
fetch_some_storages(client, 21711742)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scale_rb-0.4.2 examples/http_client_2.rb
scale_rb-0.4.1 examples/http_client_2.rb
scale_rb-0.4.0 examples/http_client_2.rb