vchain_client 1.0.22 → 1.0.23
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92c2df9b16d843b7be9c12ce8cc83f10b643e725
|
4
|
+
data.tar.gz: c07b86f7d21307c62cc54ccca8975b62c11b0ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9119d354ff15ad2a38ac4392b5d9a11238a204213c71a854b126b7c9bf7f04dfccab41655d03c8e26bfdbfcf026882f8003215f6f03976d8af0f039dcb99b83f
|
7
|
+
data.tar.gz: 76e341ee3ca61841b8f270af8abdd331e15c42ce35cd0ba19f85db301c7677d7033bda848cc3c082a0b7269762f8794941743ece67ce886eb14888d8502137ad
|
@@ -4,6 +4,8 @@ module VChainClient
|
|
4
4
|
|
5
5
|
@log = nil
|
6
6
|
|
7
|
+
@config = nil
|
8
|
+
|
7
9
|
@server = nil
|
8
10
|
@port = nil
|
9
11
|
@rpc_username = nil
|
@@ -11,12 +13,14 @@ module VChainClient
|
|
11
13
|
|
12
14
|
@@tx_cache = {}
|
13
15
|
|
14
|
-
def initialize(server, port, rpc_username, rpc_password)
|
16
|
+
def initialize(server, port, rpc_username, rpc_password, config)
|
15
17
|
@server = server
|
16
18
|
@port = port
|
17
19
|
@rpc_username = rpc_username
|
18
20
|
@rpc_password = rpc_password
|
19
21
|
|
22
|
+
@config = config
|
23
|
+
|
20
24
|
@log = Log4r::Logger["vchain_client"]
|
21
25
|
end
|
22
26
|
|
@@ -60,11 +64,16 @@ module VChainClient
|
|
60
64
|
raise e
|
61
65
|
end
|
62
66
|
|
67
|
+
confirmations_threshold = 5
|
68
|
+
if @config.key?("blockchain_confirmations")
|
69
|
+
confirmations_threshold = @config["blockchain_confirmations"]
|
70
|
+
end
|
71
|
+
|
63
72
|
if raw_tx != nil
|
64
73
|
|
65
74
|
if raw_tx.key?("confirmations")
|
66
75
|
|
67
|
-
if raw_tx["confirmations"] >
|
76
|
+
if raw_tx["confirmations"] > confirmations_threshold
|
68
77
|
|
69
78
|
if raw_tx.key?("blockhash")
|
70
79
|
|
@@ -4,10 +4,10 @@ module VChainClient
|
|
4
4
|
|
5
5
|
def self.getAdapter(type, config)
|
6
6
|
if type == "bitcoind"
|
7
|
-
return VChainClient::BitcoindBlockchainAdapter.new(config["server"], config["port"], config["rpc_username"], config["rpc_password"])
|
7
|
+
return VChainClient::BitcoindBlockchainAdapter.new(config["server"], config["port"], config["rpc_username"], config["rpc_password"], config)
|
8
8
|
|
9
9
|
elsif type == "blockcypher"
|
10
|
-
return VChainClient::BlockcypherBlockchainAdapter.new(config["api_token"])
|
10
|
+
return VChainClient::BlockcypherBlockchainAdapter.new(config["api_token"], config)
|
11
11
|
end
|
12
12
|
|
13
13
|
raise "No such adapter '#{type}'"
|
@@ -4,11 +4,15 @@ module VChainClient
|
|
4
4
|
|
5
5
|
@log = nil
|
6
6
|
|
7
|
+
@config = nil
|
8
|
+
|
7
9
|
@api_token = nil
|
8
10
|
|
9
|
-
def initialize(api_token)
|
11
|
+
def initialize(api_token, config)
|
10
12
|
@api_token = api_token
|
11
13
|
|
14
|
+
@config = config
|
15
|
+
|
12
16
|
@log = Log4r::Logger["vchain_client"]
|
13
17
|
end
|
14
18
|
|
@@ -73,11 +77,16 @@ module VChainClient
|
|
73
77
|
|
74
78
|
res = JSON.parse req.body
|
75
79
|
|
80
|
+
confirmations_threshold = 5
|
81
|
+
if @config.key?("blockchain_confirmations")
|
82
|
+
confirmations_threshold = @config["blockchain_confirmations"]
|
83
|
+
end
|
84
|
+
|
76
85
|
if res != nil
|
77
86
|
|
78
87
|
if res.key?("confirmations")
|
79
88
|
|
80
|
-
if res["confirmations"] >
|
89
|
+
if res["confirmations"] > confirmations_threshold
|
81
90
|
|
82
91
|
if res.key?("block_hash")
|
83
92
|
|
@@ -133,7 +142,7 @@ module VChainClient
|
|
133
142
|
prefix = op_return[0..2]
|
134
143
|
|
135
144
|
if prefix == "VCH"
|
136
|
-
op_return = op_return[
|
145
|
+
op_return = op_return[5..op_return.length]
|
137
146
|
|
138
147
|
return {
|
139
148
|
"size" => res["size"],
|
data/lib/vchain_client.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vchain_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aleksandr Gorelik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: log4r
|