tencent_trustsql 0.1.4 → 0.1.5

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
  SHA256:
3
- metadata.gz: c1cd411c73f893212e5c97582485f89fc038ce37488e8190d583e89950709763
4
- data.tar.gz: 50a752c905fd83c8b572a2fa3dce1876bbe9f075ff71dce98208a065ed90a1db
3
+ metadata.gz: e0d5b4a45a258e6c8d2d3ab1e468a47e3ae475ac8bd55651df6859e89fb97db1
4
+ data.tar.gz: 8f61e96fc4fccbe735b4d289b16e1d8d58f9b3b6219bbcaaf14878373f8c6335
5
5
  SHA512:
6
- metadata.gz: 96b22b7402ed062a67866ea2557afa0aa3405068142c06facc63a984962e0410f0aa8a0c70914e10a08593c10368f2cf80591dbf95fd4cc464efe3c00d4bbbed
7
- data.tar.gz: b5a99f4c544e18a9a50af00bcce82e9ca4f3e4ada2e08c5e8e0a96fa5245040ce9124ceb3a607ee01112aa42bdc4195c8bf819d2de8a42bfc76f59746e07f9c5
6
+ metadata.gz: f8fdf7a2ac079a2175b9cfbd1456cfb7cace75f82e2ff7d654b0b5b1c542b0db5df859b39fa63a7d4ab323a51f6e774510234d6c7cbe742cf473fe6c6079db73
7
+ data.tar.gz: 02dcc5fed2d267ab4e5c9f9b3657a7ce6895c66e8dd15fcf55f59adaa0c892595c473584edad5977905f5efd9264f23525c033cfda8a2b6b1aa0fef2cc830b8c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tencent_trustsql (0.1.4)
4
+ tencent_trustsql (0.1.5)
5
5
  ecdsa (~> 1.2)
6
6
  http (~> 2.2)
7
7
 
@@ -37,4 +37,4 @@ DEPENDENCIES
37
37
  tencent_trustsql!
38
38
 
39
39
  BUNDLED WITH
40
- 2.0.1
40
+ 2.0.2
data/README.md CHANGED
@@ -73,3 +73,36 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERN
73
73
 
74
74
  Everyone interacting in the TencentTrustsql project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tencent_trustsql/blob/master/CODE_OF_CONDUCT.md).
75
75
 
76
+ ### update to 0.1.5
77
+
78
+ - Attention
79
+
80
+ nested json params
81
+
82
+ ```json
83
+ params = {
84
+ chain_id: 'xxx',
85
+ "extra_info": {
86
+ "asset_name": "asset.name",
87
+ "asset_type": "asset.asset_type",
88
+ "note": "note 中文",
89
+ "test_array": [1, 2, "中文 value"],
90
+ "test_hash": {"k": "v"}
91
+ }
92
+ }
93
+ ```
94
+
95
+ - New Features
96
+
97
+ 交易批量查询
98
+
99
+ ```ruby
100
+ query_options = {
101
+ "chain_id": 'ch_tencent_testchain',
102
+ "page_limit": 3,
103
+ "transaction_id": 'transaction_id_xxx',
104
+ "page_no": 1
105
+ }
106
+
107
+ client.trans_batch_query(node_ip, node_port, query_options)
108
+ ```
@@ -20,6 +20,20 @@ module TencentTrustsql
20
20
  asset_commit_base __method__, node_ip, node_port, options
21
21
  end
22
22
 
23
+ # 交易批量查询
24
+ # {
25
+ # "sign_type": "ECDSA",
26
+ # "chain_id": "chain_id",
27
+ # "page_limit": 3,
28
+ # "transaction_id": 'transaction_id'
29
+ # "page_no": 1
30
+ # }
31
+ def trans_batch_query(node_ip, node_port, options={})
32
+ url = "http://#{node_ip}:#{node_port}/#{__method__}"
33
+ params = asset_base_params.merge(options)
34
+ http_post(url,params)
35
+ end
36
+
23
37
  def asset_apply_base name, *args
24
38
  url_map = {
25
39
  asset_apply: 'asset_issue_apply',
@@ -36,15 +36,16 @@ module TencentTrustsql
36
36
 
37
37
  def http_post url, params
38
38
  # sign
39
- query = TencentTrustsql.params_to_string(params).gsub(':', '').gsub('=>', ':').gsub(' ', '')
39
+ query = TencentTrustsql.params_to_string(params)
40
40
  mch_sign = TencentTrustsql.output_formatter.out_sign(TencentTrustsql.sign(mch_private_key, query))
41
-
41
+ p 'http_post mch_sign used query' + query
42
42
  params.merge!(mch_sign: mch_sign)
43
43
 
44
44
  p params
45
45
  p url
46
46
 
47
47
  response =HTTP.post(url, json: params)
48
+ puts response.body
48
49
  JSON.parse(response.body) rescue nil
49
50
  end
50
51
 
@@ -13,9 +13,11 @@ module TencentTrustsql
13
13
 
14
14
  def params_to_string items
15
15
  query = items.sort.map do |k, v|
16
+ v = v.to_json if v.class != String
16
17
  "#{k}=#{v}" if v.to_s != ''
17
18
  end.compact.join('&')
18
- p query
19
+ puts query
20
+ query
19
21
  end
20
22
 
21
23
  def sign private_key, data
@@ -1,3 +1,3 @@
1
1
  module TencentTrustsql
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tencent_trustsql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - jack
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-09 00:00:00.000000000 Z
11
+ date: 2019-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http