Module: Infura

Defined in:
lib/infura.rb,
lib/infura/api.rb,
lib/infura/call.rb,
lib/infura/version.rb

Defined Under Namespace

Classes: Call, InfuraCallError, InvalidEthereumAddressError

Constant Summary collapse

VERSION =
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.chainObject

Returns the value of attribute chain.



11
12
13
# File 'lib/infura.rb', line 11

def chain
  @chain
end

.loggerObject

Returns the value of attribute logger.



10
11
12
# File 'lib/infura.rb', line 10

def logger
  @logger
end

.tokenObject

Returns the value of attribute token.



11
12
13
# File 'lib/infura.rb', line 11

def token
  @token
end

Class Method Details

.eth_block_numberObject



3
4
5
6
# File 'lib/infura/api.rb', line 3

def eth_block_number
  call = Call.new(:get, 'eth_blockNumber')
  call.fetch
end

.eth_call(object:, tag: 'latest') ⇒ Object



38
39
40
41
42
# File 'lib/infura/api.rb', line 38

def eth_call(object:, tag: 'latest')
  call = Call.new(:get, 'eth_call')
  call.params = [object, tag]
  call.fetch
end

.eth_get_balance(address:, tag: 'latest') ⇒ Object



8
9
10
11
12
# File 'lib/infura/api.rb', line 8

def eth_get_balance(address:, tag: 'latest')
  call = Call.new(:get, 'eth_getBalance')
  call.params = [address, tag]
  call.fetch
end

.eth_get_block_by_number(tag: 'latest', boolean: true) ⇒ Object



44
45
46
47
48
# File 'lib/infura/api.rb', line 44

def eth_get_block_by_number(tag: 'latest', boolean: true)
  call = Call.new(:get, 'eth_getBlockByNumber')
  call.params = [tag, boolean]
  call.fetch
end

.eth_get_transaction_by_hash(txhash:) ⇒ Object



14
15
16
17
18
# File 'lib/infura/api.rb', line 14

def eth_get_transaction_by_hash(txhash:)
  call = Call.new(:get, 'eth_getTransactionByHash')
  call.params = [txhash]
  call.fetch
end

.eth_get_transaction_count(address:, tag: 'latest') ⇒ Object



32
33
34
35
36
# File 'lib/infura/api.rb', line 32

def eth_get_transaction_count(address:, tag: 'latest')
  call = Call.new(:get, 'eth_getTransactionCount')
  call.params = [address, tag]
  call.fetch
end

.eth_get_transaction_receipt(txhash:) ⇒ Object



20
21
22
23
24
# File 'lib/infura/api.rb', line 20

def eth_get_transaction_receipt(txhash:)
  call = Call.new(:get, 'eth_getTransactionReceipt')
  call.params = [txhash]
  call.fetch
end

.eth_send_raw_transaction(data:) ⇒ Object



26
27
28
29
30
# File 'lib/infura/api.rb', line 26

def eth_send_raw_transaction(data:)
  call = Call.new(:post, 'eth_sendRawTransaction')
  call.params = [data]
  call.fetch
end