vchain_client 1.0.22 → 1.0.23

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: 65340391974700636c2d48e309226cae1e472797
4
- data.tar.gz: 132f978b2d7e25377f9efdbc108e4f744a0d74a3
3
+ metadata.gz: 92c2df9b16d843b7be9c12ce8cc83f10b643e725
4
+ data.tar.gz: c07b86f7d21307c62cc54ccca8975b62c11b0ae0
5
5
  SHA512:
6
- metadata.gz: 110cf09f708a3b23d8de059a9cbb9d14fbfbc48f7dbd4ef7a1f1a3097cb42345fc2b6ed62116fecd60553ad1f2e9a9779914991f0a9bc6602469a6205a4683f1
7
- data.tar.gz: 959022c40a2975fb038ac62599bcdb320d4101d318fbe82565e3d470770171e8905fd9603356cd6836879b2bd8b717dc09ed90735d1d382967c9bff696bba78c
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"] > 5
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"] > 5
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[3..op_return.length]
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
@@ -549,9 +549,8 @@ module VChainClient
549
549
  }
550
550
 
551
551
  return {
552
- "status" => "success",
553
- "validated" => result,
554
- "hashed_input" => sent_document
552
+ "status" => "success",
553
+ "result" => "NO_DATA"
555
554
  }
556
555
 
557
556
  end
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.22
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-31 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: log4r