Method: SolanaRpcRuby::WebsocketsMethodsWrapper#block_subscribe
- Defined in:
- lib/solana_rpc_ruby/websocket_methods_wrapper.rb
#block_subscribe(filter, commitment: nil, encoding: '', transaction_details: '', show_rewards: nil, &block) ⇒ Integer
This subscription is unstable and only available if the validator was started with the –rpc-pubsub-enable-block-subscription flag. The format of this subscription may change in the future
Subscribe to receive notification anytime a new block is Confirmed or Finalized.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/solana_rpc_ruby/websocket_methods_wrapper.rb', line 87 def block_subscribe( filter, commitment: nil, encoding: '', transaction_details: '', show_rewards: nil, &block ) method = create_method_name(__method__) params = [] param_filter = nil params_hash = {} param_filter = filter == 'all' ? filter : { 'mentionsAccountOrProgram': filter} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['encoding'] = encoding unless blank?(encoding) params_hash['transactionDetails'] = transaction_details unless blank?(transaction_details) params_hash['showRewards'] = show_rewards unless blank?(show_rewards) params << param_filter params << params_hash if params_hash.any? subscribe(method, method_params: params, &block) end |