Module: TencentTrustsql::Api::AssetIssue

Included in:
Client
Defined in:
lib/tencent_trustsql/api.rb,
lib/tencent_trustsql/api/asset_issue.rb

Constant Summary collapse

URL_BASE =
"http://123.207.249.116:15910"

Instance Method Summary collapse

Instance Method Details

#asset_apply(node_ip, node_port, options = {}) ⇒ Object



5
6
7
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 5

def asset_apply(node_ip, node_port, options={})
  asset_apply_base __method__, node_ip, node_port, options
end

#asset_apply_base(name, *args) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 37

def asset_apply_base name, *args
  url_map = {
    asset_apply: 'asset_issue_apply',
    asset_transfer_apply: 'asset_transfer_apply'
  }
  tencent_api = url_map[name]

  url = "http://#{args[0]}:#{args[1]}/#{tencent_api}"
  params = asset_base_params.merge(args[2])
  http_post(url,params)
end

#asset_base_paramsObject



10
11
12
13
14
15
16
17
18
# File 'lib/tencent_trustsql/api.rb', line 10

def asset_base_params
  {
      version: '2.0',
      sign_type: 'ECDSA',
      mch_id: mch_id,
      timestamp: Time.now.to_i,
      mch_pubkey: mch_public_key_out
  }
end

#asset_commit_base(name, *args) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 49

def asset_commit_base name, *args
  url_map = {
    commit: 'asset_issue_submit',
    asset_transfer_submit: 'asset_transfer_submit'
  }
  tencent_api = url_map[name]

  url = "http://#{args[0]}:#{args[1]}/#{tencent_api}"
  params = asset_base_params.merge(args[2])
  user_private_key = params.delete(:user_private_key)
  params[:sign_list] = sign_list_sign user_private_key,params[:sign_list]

  http_post(url,params)
end

#asset_transfer_apply(node_ip, node_port, options = {}) ⇒ Object

资产转让申请



14
15
16
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 14

def asset_transfer_apply(node_ip, node_port, options={})
  asset_apply_base __method__, node_ip, node_port, options
end

#asset_transfer_submit(node_ip, node_port, options = {}) ⇒ Object

资产直接转让提交



19
20
21
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 19

def asset_transfer_submit(node_ip, node_port, options={})
  asset_commit_base __method__, node_ip, node_port, options
end

#commit(node_ip, node_port, options = {}) ⇒ Object



9
10
11
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 9

def commit(node_ip, node_port, options={})
  asset_commit_base __method__, node_ip, node_port, options
end

#trans_batch_query(node_ip, node_port, options = {}) ⇒ Object

交易批量查询

"sign_type": "ECDSA",
"chain_id": "chain_id",
"page_limit": 3,
"transaction_id": 'transaction_id'
"page_no": 1



31
32
33
34
35
# File 'lib/tencent_trustsql/api/asset_issue.rb', line 31

def trans_batch_query(node_ip, node_port, options={})
  url = "http://#{node_ip}:#{node_port}/#{__method__}"
  params = asset_base_params.merge(options)
  http_post(url,params)
end