-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update * update * update
- Loading branch information
Showing
7 changed files
with
70 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
require 'scale_rb' | ||
|
||
# ScaleRb.logger.level = Logger::DEBUG | ||
ScaleRb.logger.level = Logger::DEBUG | ||
|
||
ScaleRb::WsClient.start('wss://polkadot-rpc.dwellir.com') do |client| | ||
block_hash = client.chain_getBlockHash(21585684) | ||
runtime_version = client.state_getRuntimeVersion(block_hash) | ||
puts runtime_version['specName'] | ||
puts runtime_version['specVersion'] | ||
puts runtime_version[:specName] | ||
puts runtime_version[:specVersion] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
require 'scale_rb' | ||
|
||
ScaleRb.logger.level = Logger::DEBUG | ||
|
||
# You can have multiple subscriptions at the same time | ||
ScaleRb::WsClient.start('wss://polkadot-rpc.dwellir.com') do |client| | ||
client.chain_subscribeNewHead do |head| | ||
puts "Received new head at height: #{head['number'].to_i(16)}" | ||
puts "Received new head at height: #{head[:number].to_i(16)}" | ||
end | ||
|
||
client.state_subscribeStorage do |storage| | ||
block_hash = storage[:block] | ||
changes = storage[:changes] | ||
puts "Received #{changes.size} storage changes at block: #{block_hash}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters