etherscan 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etherscan.gemspec +1 -1
- data/lib/etherscan/api.rb +68 -5
- data/lib/etherscan/call.rb +11 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162fef7b44672379a239a71273e0c6a158ac06ae
|
4
|
+
data.tar.gz: 45f2c323c007296d21ccd2f7192fa034a5e45106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
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
|
117
|
-
call = Etherscan::Call.new(Etherscan.chain, 'proxy', '
|
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.
|
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
|
132
|
-
call = Etherscan::Call.new(Etherscan.chain, 'proxy', '
|
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
|
data/lib/etherscan/call.rb
CHANGED
@@ -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
|
|