Module: PWN::Blockchain::ETH
- Defined in:
- lib/pwn/blockchain/eth.rb
Overview
This plugin interacts with BitCoin's Blockchain API.
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
0day Inc.
-
.get_block_details(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::Blockchain::ETH.get_block_details( height: 'required - block height number', token: 'optional - API token for higher rate limits' ).
-
.get_latest_block(opts = {}) ⇒ Object
- Supported Method Parameters
latest_block = PWN::Blockchain::ETH.get_latest_block( token: 'optional - API token for higher rate limits' ).
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.authors ⇒ Object
- Author(s)
0day Inc. [email protected]
135 136 137 138 139 |
# File 'lib/pwn/blockchain/eth.rb', line 135 public_class_method def self. "AUTHOR(S): 0day Inc. <[email protected]> " end |
.get_block_details(opts = {}) ⇒ Object
- Supported Method Parameters
PWN::Blockchain::ETH.get_block_details( height: 'required - block height number', token: 'optional - API token for higher rate limits' )
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/pwn/blockchain/eth.rb', line 120 public_class_method def self.get_block_details(opts = {}) height = opts[:height] params = {} params[:token] = opts[:token] if opts[:token] rest_call = "main/blocks/#{height}" response = eth_rest_call(rest_call: rest_call, params: params) JSON.parse(response.body, symbolize_names: true) rescue StandardError => e raise e end |
.get_latest_block(opts = {}) ⇒ Object
- Supported Method Parameters
latest_block = PWN::Blockchain::ETH.get_latest_block( token: 'optional - API token for higher rate limits' )
103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/pwn/blockchain/eth.rb', line 103 public_class_method def self.get_latest_block(opts = {}) params = {} params[:token] = opts[:token] if opts[:token] rest_call = 'main' response = eth_rest_call(rest_call: rest_call, params: params) JSON.parse(response.body, symbolize_names: true) rescue StandardError => e raise e end |
.help ⇒ Object
Display Usage for this Module
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/pwn/blockchain/eth.rb', line 143 public_class_method def self.help puts "USAGE: # Run get latest block and return its result #{self}.get_latest_block( token: 'optional - API token for higher rate limits' ) # Run get block details and return its result #{self}.get_block_details( height: 'required - block height number', token: 'optional - API token for higher rate limits' ) # Print the AUTHOR(S) string for this module. #{self}.authors " constants.sort end |