katapaty 1.0.4 → 1.0.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: ca01613f7f978972eb79fd28ab143d744301ad35928eb4564301e09f6d8f9b3c
4
- data.tar.gz: 7484b9a34d49be5b0801fc135073874643fee20f40530a240b62105e789c7b61
3
+ metadata.gz: 61057f7dfa8fa3fb82c4c76d00092a84d0e723f660f9cd4424f14b5d747c65a5
4
+ data.tar.gz: f1b5e9fcc591f838d745de1c84d4c2dd455f52f2dd4e4a80e5d3365e8098470e
5
5
  SHA512:
6
- metadata.gz: 2b08ef5dc3c1e32f06edf3068904d7a44cc03185047a6dc70ca7720f2bbca89ea0ec2368df027db5cfe3b6ad785b3789f56ecf12ef526bb0e0b7ac50aacac1d6
7
- data.tar.gz: 4e63a259b497f68233bd8a4f73cd01f3ac36240f42357631d47ad64997e76226de723d0463853f9149f9eba21d584853fc1702cc16aa580801ecb08ae88493f2
6
+ metadata.gz: 840622006e73b2c9fa26cae2480bba789d146b85dec6368ff810bb777c3f5618592a2f26a8f5ce69fdc759999c4fc0c431a172ea35e0ec345eaa1a0a9fcc20d9
7
+ data.tar.gz: 629ce3181622108ab99d6dbd2d02aeace990679279c1c50668062441bbeb7eedb3363501848c8c0ccaa7421350a81d2df3bc65d7654eeb22eb343f276222232f
@@ -9,11 +9,20 @@ module Katapaty
9
9
  request('get_running_info')
10
10
  end
11
11
 
12
- def address_token_balance(address, token_name)
13
- rs = request('get_balances', {"filters": [{ "field": 'address', "op": '==', "value": address },
14
- { "field": 'asset', "op": '==', "value": token_name }]})
15
- return 0 if rs.blank?
16
- rs.first['quantity'].to_i
12
+ def address_token_balance(address: address, token: token, proxy: false)
13
+ filters_params = {
14
+ "filters": [
15
+ { "field": 'address', "op": '==', "value": address },
16
+ { "field": 'asset', "op": '==', "value": token }
17
+ ]
18
+ }
19
+ if proxy
20
+ response = Katapaty::Block.proxy_to_cp(method: :get_balances, params: filters_params)
21
+ else
22
+ response = request('get_balances', filters_params)
23
+ end
24
+ return 0 if response.blank?
25
+ response.first['quantity'].to_i
17
26
  end
18
27
 
19
28
  def get_asset_info(assets)
@@ -48,8 +57,8 @@ module Katapaty
48
57
  client = RestClient::Resource.new Katapaty.configuration.counterparty_url
49
58
  request = { method: method_name.to_s, params: payload, jsonrpc: '2.0', id: '0' }.to_json
50
59
  response = JSON.parse client.post(request,
51
- accept: 'json',
52
- content_type: 'json' )
60
+ accept: 'json',
61
+ content_type: 'json' )
53
62
  raise Katapaty::JsonResponseError.new response if response.has_key? 'code'
54
63
  raise Katapaty::ResponseError.new response['error'] if response.has_key? 'error'
55
64
  response['result']
@@ -1,3 +1,3 @@
1
1
  module Katapaty
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katapaty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - longhoang.wkm
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-19 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- description:
153
+ description:
154
154
  email:
155
155
  - longhoang@wakumo.vn
156
156
  executables: []
@@ -178,7 +178,7 @@ homepage: https://github.com/longhoangwkm/katapaty
178
178
  licenses:
179
179
  - MIT
180
180
  metadata: {}
181
- post_install_message:
181
+ post_install_message:
182
182
  rdoc_options: []
183
183
  require_paths:
184
184
  - lib
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  requirements: []
196
196
  rubygems_version: 3.1.3
197
- signing_key:
197
+ signing_key:
198
198
  specification_version: 4
199
199
  summary: A ruby gem for communicating with a Counterparty (Bitcoin / XCP) API server
200
200
  test_files: []