etherscan 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd1bba3e4b131a069593627bf0e5ac9fdd26de76
4
- data.tar.gz: 335e038046944878b6d97441ac4a0dac349bc4da
3
+ metadata.gz: 162fef7b44672379a239a71273e0c6a158ac06ae
4
+ data.tar.gz: 45f2c323c007296d21ccd2f7192fa034a5e45106
5
5
  SHA512:
6
- metadata.gz: e02bd1e2e92aa4cc1a7b8eb9fca4c2fe19bb2b67d0e138c119f5b45897781e381761bb7ddf74528bf5213064192aefdf939c2b0e45066f910f76871f6c6af3d9
7
- data.tar.gz: c3ff7a3153008b782744854057f5947b36fb8511187dd39ac2f3729f6838ec71c288942f9886b0914d7ba717b8af7cb022bdfc4ef0658bdc15f9f03a430b966d
6
+ metadata.gz: bef1a81c3b21fdbac3bb8ce63b4713624a6d21779a3960bf55bd4fb31d0dfdf6bcb7c280c564e690e8a04f46d0f548523c0731755128eaa3422d4e835847e552
7
+ data.tar.gz: 05b47e66677a5078483108ddbd7f33bdbaf95750b13e1bcc8fc3ad1b9c81cb31aebbe5137e4403f8f5c2e785acdbff1396daba9b40675b15c083d06624d0017e
data/etherscan.gemspec CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'etherscan'
8
- spec.version = '0.0.8'
8
+ spec.version = '0.0.9'
9
9
  spec.authors = ['wuminzhe']
10
10
  spec.email = ['wuminzhe@gmail.com']
11
11
  spec.description = 'Forked from: https://github.com/sebs/etherscanio-rb. 3rd party using to the API at etherscan.io'
data/lib/etherscan/api.rb CHANGED
@@ -113,10 +113,33 @@ module Etherscan
113
113
  call.fetch
114
114
  end
115
115
 
116
- def eth_send_raw_transaction(hex)
117
- call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_sendRawTransaction')
116
+ def eth_get_transaction_by_hash(txhash)
117
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getTransactionByHash')
118
118
  call.api_key = Etherscan.api_key
119
- call.hex = hex
119
+ call.txhash = txhash
120
+ call.fetch
121
+ end
122
+
123
+ def eth_get_uncle_by_block_number_and_index(tag, index)
124
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getUncleByBlockNumberAndIndex')
125
+ call.api_key = Etherscan.api_key
126
+ call.tag = tag
127
+ call.index = index
128
+ call.fetch
129
+ end
130
+
131
+ def eth_get_block_transaction_count_by_number(tag)
132
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getBlockTransactionCountByNumber')
133
+ call.api_key = Etherscan.api_key
134
+ call.tag = tag
135
+ call.fetch
136
+ end
137
+
138
+ def eth_get_transaction_by_block_number_and_index(tag, index)
139
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getTransactionByBlockNumberAndIndex')
140
+ call.api_key = Etherscan.api_key
141
+ call.tag = tag
142
+ call.index = index
120
143
  call.fetch
121
144
  end
122
145
 
@@ -128,8 +151,15 @@ module Etherscan
128
151
  call.fetch
129
152
  end
130
153
 
131
- def eth_get_transaction_by_hash(txhash)
132
- call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getTransactionByHash')
154
+ def eth_send_raw_transaction(hex)
155
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_sendRawTransaction')
156
+ call.api_key = Etherscan.api_key
157
+ call.hex = hex
158
+ call.fetch
159
+ end
160
+
161
+ def eth_get_transaction_receipt(txhash)
162
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getTransactionReceipt')
133
163
  call.api_key = Etherscan.api_key
134
164
  call.txhash = txhash
135
165
  call.fetch
@@ -143,6 +173,39 @@ module Etherscan
143
173
  call.tag = tag
144
174
  call.fetch
145
175
  end
176
+
177
+ def eth_get_code(address, tag)
178
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getCode')
179
+ call.api_key = Etherscan.api_key
180
+ call.address = address
181
+ call.tag = tag
182
+ call.fetch
183
+ end
184
+
185
+ def eth_get_storage_at(address, position, tag)
186
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_getStorageAt')
187
+ call.api_key = Etherscan.api_key
188
+ call.address = address
189
+ call.position = position
190
+ call.tag = tag
191
+ call.fetch
192
+ end
193
+
194
+ def eth_gas_price
195
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_gasPrice')
196
+ call.api_key = Etherscan.api_key
197
+ call.fetch
198
+ end
199
+
200
+ def eth_estimate_gas(to, value, gas_price, gas)
201
+ call = Etherscan::Call.new(Etherscan.chain, 'proxy', 'eth_estimateGas')
202
+ call.api_key = Etherscan.api_key
203
+ call.to = to
204
+ call.value = value
205
+ call.gasPrice = gas_price
206
+ call.gas = gas
207
+ call.fetch
208
+ end
146
209
  end
147
210
  end
148
211
  end
@@ -21,7 +21,11 @@ module Etherscan
21
21
  :hex,
22
22
  :boolean,
23
23
  :data,
24
- :to
24
+ :to,
25
+ :index,
26
+ :position,
27
+ :gasPrice,
28
+ :gas
25
29
 
26
30
  CHAINS = {
27
31
  mainnet: 'http://api.etherscan.io/api?',
@@ -68,6 +72,12 @@ module Etherscan
68
72
  uri += '&tag=' + tag if tag
69
73
  uri += '&hex=' + hex if hex
70
74
  uri += '&boolean=' + boolean if boolean
75
+ uri += '&data=' + data if data
76
+ uri += '&to=' + to if to
77
+ uri += '&index=' + index if index
78
+ uri += '&position=' + position if position
79
+ uri += '&gasPrice=' + gasPrice if gasPrice
80
+ uri += '&gas=' + gas if gas
71
81
  @base + uri
72
82
  end
73
83
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etherscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - wuminzhe