electrb 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/electrb/client.rb +8 -6
- data/lib/electrb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8db5d61b586324df5e97bbbd9c70e071cdf6518eaccdb9fe17b510ddf00da9d0
|
4
|
+
data.tar.gz: 4f2222ae0ab648a9e58dc631c3885473d994b6e30e0c320c2c176ee17585fc58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5b2292a752af6ebe22547385f1851255d1bc6d53d36e41ffac4eea45fd7e8630c292d3a53df5728e527bc9f8377edae0cfcd6fa45383975f4b578844d0d1454
|
7
|
+
data.tar.gz: eeb31033a16bd4f49c658a76bb2ced8000b90ee9688f0fe78e9eaa5ce9a4a8c4891137192258bbfe7c4b8e5ef666fa12473b560f3d4338c412f0b480ac71ada2
|
data/README.md
CHANGED
@@ -32,12 +32,12 @@ require 'electrb'
|
|
32
32
|
client = Electrb::Client.new("localhost", 50001)
|
33
33
|
|
34
34
|
# get server version
|
35
|
-
client.
|
35
|
+
client.request('server.version', ['1.9.5', '0.6'])
|
36
36
|
=> ["electrs 0.7.0", "1.4"]
|
37
37
|
|
38
38
|
# get transaction
|
39
39
|
txid = 'd513c8fa051336fc8059958a7c99dc390c741a693503b67783392d0a84029bcb'
|
40
|
-
client.
|
40
|
+
client.request('blockchain.transaction.get', txid)
|
41
41
|
=> '02000000000101592110a2310082589362bc14e5dd5f6baad9705235995594aabacbc5b88e537f01000000171600142fd1a396731d8a4eb616791f7c1799eb6f446aacfeffffff02a5aba1800700000017a9146cfe9a5230d6a30815440ae32afe029f3864634287bcb720000000000017a914c6953679a4a0aeaf71317150b38e5b5cfae76415870247304402203c47f3d32e572bc4b382f2ecebeb34d1254936811d2e778cc107dfe5dc41663c02201a1eb3e73bf8f79578ec921c42436ba36ca95ace830311c26a9d15eb06a28d470121030af582d65f02f1ec50b466dd40bca58378d9117dcf443adaf1b14753a377539e94ea1700'
|
42
42
|
|
43
43
|
```
|
data/lib/electrb/client.rb
CHANGED
@@ -8,14 +8,16 @@ module Electrb
|
|
8
8
|
@client = Jsonrpctcp::Client.new(host, port)
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
# Send RPC request.
|
12
|
+
# @param [String] method_name Method name to be called by RPC.
|
13
|
+
# @return [String] RPC result.
|
14
|
+
def request(method_name, *args)
|
15
|
+
send_request(method_name, *args)
|
15
16
|
end
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
private
|
19
|
+
|
20
|
+
def send_request(method_name, *args)
|
19
21
|
response = client.send(method_name, *args)
|
20
22
|
response['result']
|
21
23
|
end
|
data/lib/electrb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: electrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonrpctcp
|