istox 0.1.42.10 → 0.1.42.11
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 +4 -4
- data/Gemfile.lock +13 -4
- data/istox.gemspec +1 -1
- data/lib/istox/helpers/graphql_client.rb +7 -15
- data/lib/istox/models/concerns/blockchain_receipt_query.rb +16 -7
- data/lib/istox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aeea6491522e99bfd517e218c63cb60069354655b53441f9ee80949c651e73b
|
4
|
+
data.tar.gz: 563e2c0ee9b971e97ab59cec044d05f02e536c15754aae300cf725ca297301ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '048c3c0f5ad9be34d796402282460b13916cb5ba6e66527fe107eb0cc6d3f8452c3c826341de35b291353fd01df0044e041d085a44fe52f2f0c904e9b6ac8a16'
|
7
|
+
data.tar.gz: 68abbbf6661bbc2e63aa3e398bb597d05955fc3cfa9edaeaf9e6fa9d93da191ff41ecdff973878236a4d6f87a33678a09fe84846ee1cdaa0c92b214c8203e2e1
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
istox (0.1.42.
|
4
|
+
istox (0.1.42.10)
|
5
5
|
bunny (>= 2.12.0)
|
6
|
-
|
6
|
+
graphlient
|
7
7
|
gruf
|
8
8
|
paranoia (~> 2.2)
|
9
9
|
|
@@ -71,16 +71,24 @@ GEM
|
|
71
71
|
railties (>= 3.0.0)
|
72
72
|
faker (1.7.3)
|
73
73
|
i18n (~> 0.5)
|
74
|
+
faraday (0.15.4)
|
75
|
+
multipart-post (>= 1.2, < 3)
|
76
|
+
faraday_middleware (0.13.1)
|
77
|
+
faraday (>= 0.7.4, < 1.0)
|
74
78
|
globalid (0.4.2)
|
75
79
|
activesupport (>= 4.2.0)
|
76
|
-
google-protobuf (3.7.0
|
80
|
+
google-protobuf (3.7.0)
|
77
81
|
googleapis-common-protos-types (1.0.3)
|
78
82
|
google-protobuf (~> 3.0)
|
83
|
+
graphlient (0.3.5)
|
84
|
+
faraday
|
85
|
+
faraday_middleware
|
86
|
+
graphql-client
|
79
87
|
graphql (1.9.3)
|
80
88
|
graphql-client (0.14.0)
|
81
89
|
activesupport (>= 3.0, < 6.0)
|
82
90
|
graphql (~> 1.6)
|
83
|
-
grpc (1.19.0
|
91
|
+
grpc (1.19.0)
|
84
92
|
google-protobuf (~> 3.1)
|
85
93
|
googleapis-common-protos-types (~> 1.0.0)
|
86
94
|
grpc-tools (1.19.0)
|
@@ -104,6 +112,7 @@ GEM
|
|
104
112
|
mini_mime (1.0.1)
|
105
113
|
mini_portile2 (2.4.0)
|
106
114
|
minitest (5.11.3)
|
115
|
+
multipart-post (2.0.0)
|
107
116
|
nio4r (2.3.1)
|
108
117
|
nokogiri (1.10.1)
|
109
118
|
mini_portile2 (~> 2.4.0)
|
data/istox.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_dependency "bunny", ">= 2.12.0"
|
35
35
|
spec.add_dependency "gruf"
|
36
36
|
spec.add_dependency "paranoia", "~> 2.2"
|
37
|
-
spec.add_dependency "
|
37
|
+
spec.add_dependency "graphlient"
|
38
38
|
spec.add_development_dependency "bundler", "~> 1.16"
|
39
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
40
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -1,6 +1,3 @@
|
|
1
|
-
require "graphql/client"
|
2
|
-
require "graphql/client/http"
|
3
|
-
|
4
1
|
module Istox
|
5
2
|
class GraphqlClient
|
6
3
|
class << self
|
@@ -16,27 +13,22 @@ module Istox
|
|
16
13
|
|
17
14
|
raise "Please make sure you have initialised graphql cient for host #{host_type}" if !client
|
18
15
|
|
19
|
-
result = client.query(query, variables
|
16
|
+
result = client.query(query, variables)
|
20
17
|
end
|
21
18
|
|
22
|
-
def parse(host_type, query)
|
23
|
-
|
19
|
+
# def parse(host_type, query)
|
20
|
+
# client = @@hosts[host_type]
|
24
21
|
|
25
|
-
|
22
|
+
# raise "Please make sure you have initialised graphql cient for host #{host_type}" if !client
|
26
23
|
|
27
|
-
|
28
|
-
end
|
24
|
+
# return client.parse(query)
|
25
|
+
# end
|
29
26
|
|
30
27
|
private
|
31
28
|
|
32
29
|
def init_host(host_type, url)
|
33
|
-
|
34
|
-
def headers(context)
|
35
|
-
{ "User-Agent": "My Client" }
|
36
|
-
end
|
37
|
-
end
|
30
|
+
client = Graphlient::Client.new(url)
|
38
31
|
|
39
|
-
client = GraphQL::Client.new(schema: GraphQL::Client.load_schema(http), execute: http)
|
40
32
|
@@hosts[host_type] = client
|
41
33
|
end
|
42
34
|
|
@@ -1,6 +1,18 @@
|
|
1
1
|
module Istox
|
2
2
|
module BlockchainReceiptQuery
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
# BLOCK_TRANSACTIONS_QUERY = Istox::GraphqlClient.parse("chainhub",
|
6
|
+
# <<-'GRAPHQL'
|
7
|
+
# query($ids: [String!]) {
|
8
|
+
# blockTransactions(hashes: $ids) {
|
9
|
+
# txid
|
10
|
+
# state
|
11
|
+
# }
|
12
|
+
# }
|
13
|
+
# GRAPHQL
|
14
|
+
# )
|
15
|
+
BLOCK_TRANSACTIONS_QUERY = 123
|
4
16
|
|
5
17
|
#overrideable, when blockchain transaction has confirmed
|
6
18
|
def handle_confirm(resource_action)
|
@@ -41,22 +53,19 @@ module Istox
|
|
41
53
|
end
|
42
54
|
|
43
55
|
def blocks_failed?
|
44
|
-
@blocks.any? { |obj| obj
|
56
|
+
@blocks.any? { |obj| obj.status == 'failed' }
|
45
57
|
end
|
46
58
|
|
47
59
|
def blocks_pending?
|
48
|
-
@blocks.empty? || @blocks.any? { |obj| obj
|
60
|
+
@blocks.empty? || @blocks.any? { |obj| obj.status == 'pending' }
|
49
61
|
end
|
50
62
|
|
51
63
|
def blocks_confirmed?
|
52
|
-
!@blocks.any? { |obj| obj
|
64
|
+
!@blocks.any? { |obj| obj.status == 'pending' } && !@blocks.any? { |obj| obj.status == 'failed' }
|
53
65
|
end
|
54
66
|
|
55
67
|
def get_block_transactions(txids)
|
56
|
-
|
57
|
-
status: 'confirmed'
|
58
|
-
}]
|
59
|
-
#to do graphql call to get results
|
68
|
+
Istox::GraphqlClient.query("chainhub", BLOCK_TRANSACTIONS_QUERY, { ids: txids }).data.block_transactions
|
60
69
|
end
|
61
70
|
|
62
71
|
end
|
data/lib/istox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: istox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.42.
|
4
|
+
version: 0.1.42.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Siong Leng
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: graphlient
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|