quorum_sdk 0.1.0 → 0.3.0
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 +21 -23
- data/README.md +40 -17
- data/lib/proto/chain.proto +169 -234
- data/lib/proto/chain_pb.rb +123 -193
- data/lib/quorum_sdk/account.rb +0 -2
- data/lib/quorum_sdk/chain/chain.rb +18 -0
- data/lib/quorum_sdk/chain/group.rb +69 -0
- data/lib/quorum_sdk/chain/management.rb +143 -0
- data/lib/quorum_sdk/chain/node.rb +18 -0
- data/lib/quorum_sdk/chain.rb +26 -0
- data/lib/quorum_sdk/client.rb +23 -10
- data/lib/quorum_sdk/node/announce.rb +52 -0
- data/lib/quorum_sdk/node/app_config.rb +25 -0
- data/lib/quorum_sdk/node/auth.rb +32 -0
- data/lib/quorum_sdk/node/group.rb +32 -0
- data/lib/quorum_sdk/node/trx.rb +78 -0
- data/lib/quorum_sdk/node.rb +44 -0
- data/lib/quorum_sdk/utils.rb +58 -28
- data/lib/quorum_sdk/version.rb +1 -1
- data/lib/quorum_sdk.rb +2 -2
- metadata +14 -23
- data/activity_stream_pb.rb +0 -146
- data/lib/proto/activity_stream.proto +0 -134
- data/lib/proto/activity_stream_pb.rb +0 -146
- data/lib/quorum_sdk/api/chain.rb +0 -13
- data/lib/quorum_sdk/api/light_node.rb +0 -88
- data/lib/quorum_sdk/api.rb +0 -32
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quorum_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sha3
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.0'
|
118
|
-
type: :runtime
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '1.0'
|
125
111
|
description: A API wrapper for Quorum
|
126
112
|
email:
|
127
113
|
- an.lee.work@gmail.com
|
@@ -137,17 +123,22 @@ files:
|
|
137
123
|
- LICENSE.txt
|
138
124
|
- README.md
|
139
125
|
- Rakefile
|
140
|
-
- activity_stream_pb.rb
|
141
|
-
- lib/proto/activity_stream.proto
|
142
|
-
- lib/proto/activity_stream_pb.rb
|
143
126
|
- lib/proto/chain.proto
|
144
127
|
- lib/proto/chain_pb.rb
|
145
128
|
- lib/quorum_sdk.rb
|
146
129
|
- lib/quorum_sdk/account.rb
|
147
|
-
- lib/quorum_sdk/
|
148
|
-
- lib/quorum_sdk/
|
149
|
-
- lib/quorum_sdk/
|
130
|
+
- lib/quorum_sdk/chain.rb
|
131
|
+
- lib/quorum_sdk/chain/chain.rb
|
132
|
+
- lib/quorum_sdk/chain/group.rb
|
133
|
+
- lib/quorum_sdk/chain/management.rb
|
134
|
+
- lib/quorum_sdk/chain/node.rb
|
150
135
|
- lib/quorum_sdk/client.rb
|
136
|
+
- lib/quorum_sdk/node.rb
|
137
|
+
- lib/quorum_sdk/node/announce.rb
|
138
|
+
- lib/quorum_sdk/node/app_config.rb
|
139
|
+
- lib/quorum_sdk/node/auth.rb
|
140
|
+
- lib/quorum_sdk/node/group.rb
|
141
|
+
- lib/quorum_sdk/node/trx.rb
|
151
142
|
- lib/quorum_sdk/utils.rb
|
152
143
|
- lib/quorum_sdk/version.rb
|
153
144
|
- sig/quorum_sdk.rbs
|
@@ -174,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
165
|
- !ruby/object:Gem::Version
|
175
166
|
version: '0'
|
176
167
|
requirements: []
|
177
|
-
rubygems_version: 3.4.
|
168
|
+
rubygems_version: 3.4.7
|
178
169
|
signing_key:
|
179
170
|
specification_version: 4
|
180
171
|
summary: A Quorum SDK implemented in Ruby
|
data/activity_stream_pb.rb
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: activity_stream.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require 'google/protobuf/timestamp_pb'
|
9
|
-
require 'google/protobuf/any_pb'
|
10
|
-
|
11
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
12
|
-
add_file('activity_stream.proto', syntax: :proto3) do
|
13
|
-
add_message 'quorum.pb.AnyObj' do
|
14
|
-
optional :any, :message, 1, 'google.protobuf.Any'
|
15
|
-
end
|
16
|
-
add_message 'quorum.pb.Object' do
|
17
|
-
optional :id, :string, 1
|
18
|
-
optional :type, :string, 2
|
19
|
-
repeated :attachments, :message, 3, 'quorum.pb.Object'
|
20
|
-
repeated :attributedTo, :message, 4, 'quorum.pb.Object'
|
21
|
-
optional :audience, :message, 5, 'quorum.pb.Object'
|
22
|
-
optional :content, :string, 6
|
23
|
-
optional :context, :message, 7, 'quorum.pb.Object'
|
24
|
-
optional :name, :string, 8
|
25
|
-
optional :endtime, :message, 9, 'google.protobuf.Timestamp'
|
26
|
-
optional :generator, :message, 10, 'quorum.pb.Object'
|
27
|
-
repeated :icon, :message, 11, 'quorum.pb.Object'
|
28
|
-
repeated :image, :message, 12, 'quorum.pb.Image'
|
29
|
-
optional :inreplyto, :message, 13, 'quorum.pb.Reply'
|
30
|
-
optional :location, :message, 14, 'quorum.pb.Object'
|
31
|
-
optional :preview, :message, 15, 'quorum.pb.Object'
|
32
|
-
optional :published, :message, 16, 'google.protobuf.Timestamp'
|
33
|
-
optional :replies, :message, 17, 'quorum.pb.Object'
|
34
|
-
optional :startTime, :message, 18, 'google.protobuf.Timestamp'
|
35
|
-
optional :summary, :string, 19
|
36
|
-
repeated :tag, :message, 20, 'quorum.pb.Object'
|
37
|
-
optional :updated, :message, 21, 'google.protobuf.Timestamp'
|
38
|
-
repeated :url, :message, 22, 'quorum.pb.Link'
|
39
|
-
repeated :to, :message, 23, 'quorum.pb.Object'
|
40
|
-
repeated :bto, :message, 24, 'quorum.pb.Object'
|
41
|
-
repeated :cc, :message, 25, 'quorum.pb.Object'
|
42
|
-
repeated :bcc, :message, 26, 'quorum.pb.Object'
|
43
|
-
optional :mediaType, :string, 27
|
44
|
-
optional :duration, :string, 28
|
45
|
-
optional :file, :message, 29, 'quorum.pb.File'
|
46
|
-
end
|
47
|
-
add_message 'quorum.pb.Link' do
|
48
|
-
optional :href, :string, 1
|
49
|
-
repeated :rel, :string, 2
|
50
|
-
optional :mediaType, :string, 3
|
51
|
-
optional :name, :string, 4
|
52
|
-
optional :hreflang, :string, 5
|
53
|
-
optional :height, :uint32, 6
|
54
|
-
optional :width, :uint32, 7
|
55
|
-
optional :preview, :message, 8, 'quorum.pb.Object'
|
56
|
-
end
|
57
|
-
add_message 'quorum.pb.Reply' do
|
58
|
-
optional :trxid, :string, 1
|
59
|
-
optional :groupid, :string, 2
|
60
|
-
end
|
61
|
-
add_message 'quorum.pb.Image' do
|
62
|
-
optional :id, :string, 1
|
63
|
-
optional :name, :string, 2
|
64
|
-
optional :mediaType, :string, 3
|
65
|
-
optional :content, :bytes, 4
|
66
|
-
optional :url, :string, 5
|
67
|
-
end
|
68
|
-
add_message 'quorum.pb.File' do
|
69
|
-
optional :id, :string, 1
|
70
|
-
optional :name, :string, 2
|
71
|
-
optional :mediaType, :string, 3
|
72
|
-
optional :compression, :enum, 4, 'quorum.pb.File.Compression'
|
73
|
-
optional :content, :bytes, 5
|
74
|
-
optional :url, :string, 6
|
75
|
-
end
|
76
|
-
add_enum 'quorum.pb.File.Compression' do
|
77
|
-
value :none, 0
|
78
|
-
value :gz, 1
|
79
|
-
value :zip, 2
|
80
|
-
value :zstd, 3
|
81
|
-
end
|
82
|
-
add_message 'quorum.pb.Person' do
|
83
|
-
optional :id, :string, 1
|
84
|
-
optional :name, :string, 2
|
85
|
-
optional :image, :message, 3, 'quorum.pb.Image'
|
86
|
-
repeated :wallet, :message, 11, 'quorum.pb.Payment'
|
87
|
-
end
|
88
|
-
add_message 'quorum.pb.Payment' do
|
89
|
-
optional :id, :string, 1
|
90
|
-
optional :type, :string, 2
|
91
|
-
optional :name, :string, 3
|
92
|
-
end
|
93
|
-
add_message 'quorum.pb.Activity' do
|
94
|
-
optional :id, :string, 1
|
95
|
-
optional :type, :string, 2
|
96
|
-
repeated :attachments, :message, 3, 'quorum.pb.Object'
|
97
|
-
repeated :attributedTo, :message, 4, 'quorum.pb.Object'
|
98
|
-
optional :audience, :message, 5, 'quorum.pb.Object'
|
99
|
-
optional :content, :string, 6
|
100
|
-
optional :context, :message, 7, 'quorum.pb.Object'
|
101
|
-
optional :name, :string, 8
|
102
|
-
optional :endtime, :message, 9, 'google.protobuf.Timestamp'
|
103
|
-
optional :generator, :message, 10, 'quorum.pb.Object'
|
104
|
-
repeated :icon, :message, 11, 'quorum.pb.Object'
|
105
|
-
repeated :image, :message, 12, 'quorum.pb.Object'
|
106
|
-
optional :inReplyTo, :message, 13, 'quorum.pb.Object'
|
107
|
-
optional :location, :message, 14, 'quorum.pb.Object'
|
108
|
-
optional :preview, :message, 15, 'quorum.pb.Object'
|
109
|
-
optional :published, :message, 16, 'google.protobuf.Timestamp'
|
110
|
-
optional :replies, :message, 17, 'quorum.pb.Object'
|
111
|
-
optional :startTime, :message, 18, 'google.protobuf.Timestamp'
|
112
|
-
optional :summary, :string, 19
|
113
|
-
repeated :tag, :message, 20, 'quorum.pb.Object'
|
114
|
-
optional :updated, :message, 21, 'google.protobuf.Timestamp'
|
115
|
-
repeated :url, :message, 22, 'quorum.pb.Link'
|
116
|
-
repeated :to, :message, 23, 'quorum.pb.Object'
|
117
|
-
repeated :bto, :message, 24, 'quorum.pb.Object'
|
118
|
-
repeated :cc, :message, 25, 'quorum.pb.Object'
|
119
|
-
repeated :bcc, :message, 26, 'quorum.pb.Object'
|
120
|
-
optional :mediaType, :string, 27
|
121
|
-
optional :duration, :string, 28
|
122
|
-
optional :actor, :message, 29, 'quorum.pb.Object'
|
123
|
-
optional :object, :message, 30, 'quorum.pb.Object'
|
124
|
-
optional :target, :message, 31, 'quorum.pb.Object'
|
125
|
-
optional :result, :message, 32, 'quorum.pb.Object'
|
126
|
-
optional :origin, :message, 33, 'quorum.pb.Object'
|
127
|
-
optional :instrument, :message, 34, 'quorum.pb.Object'
|
128
|
-
optional :person, :message, 35, 'quorum.pb.Person'
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
module Quorum
|
134
|
-
module Pb
|
135
|
-
AnyObj = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AnyObj').msgclass
|
136
|
-
Object = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Object').msgclass
|
137
|
-
Link = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Link').msgclass
|
138
|
-
Reply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Reply').msgclass
|
139
|
-
Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Image').msgclass
|
140
|
-
File = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.File').msgclass
|
141
|
-
File::Compression = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.File.Compression').enummodule
|
142
|
-
Person = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Person').msgclass
|
143
|
-
Payment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Payment').msgclass
|
144
|
-
Activity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Activity').msgclass
|
145
|
-
end
|
146
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
/* https://github.com/rumsystem/quorum/blob/main/pkg/pb/activity_stream.proto */
|
2
|
-
syntax = "proto3";
|
3
|
-
package quorum.pb;
|
4
|
-
option go_package = "github.com/rumsystem/quorum/pkg/pb";
|
5
|
-
|
6
|
-
import "google/protobuf/timestamp.proto";
|
7
|
-
import "google/protobuf/any.proto";
|
8
|
-
|
9
|
-
message AnyObj {
|
10
|
-
google.protobuf.Any any=1;
|
11
|
-
}
|
12
|
-
|
13
|
-
message Object {
|
14
|
-
string id = 1;
|
15
|
-
string type = 2;
|
16
|
-
repeated Object attachments = 3;
|
17
|
-
repeated Object attributedTo = 4;
|
18
|
-
Object audience = 5;
|
19
|
-
string content = 6;
|
20
|
-
Object context = 7;
|
21
|
-
string name = 8;
|
22
|
-
google.protobuf.Timestamp endtime = 9;
|
23
|
-
Object generator= 10;
|
24
|
-
repeated Object icon = 11;
|
25
|
-
repeated Image image = 12;
|
26
|
-
Reply inreplyto = 13;
|
27
|
-
Object location = 14;
|
28
|
-
Object preview = 15;
|
29
|
-
google.protobuf.Timestamp published = 16;
|
30
|
-
Object replies = 17;
|
31
|
-
google.protobuf.Timestamp startTime = 18;
|
32
|
-
string summary = 19;
|
33
|
-
repeated Object tag = 20;
|
34
|
-
google.protobuf.Timestamp updated = 21;
|
35
|
-
repeated Link url = 22;
|
36
|
-
repeated Object to = 23;
|
37
|
-
repeated Object bto = 24;
|
38
|
-
repeated Object cc = 25;
|
39
|
-
repeated Object bcc = 26;
|
40
|
-
string mediaType= 27;
|
41
|
-
string duration = 28;
|
42
|
-
File file = 29;
|
43
|
-
}
|
44
|
-
|
45
|
-
message Link {
|
46
|
-
string href = 1;
|
47
|
-
repeated string rel = 2;
|
48
|
-
string mediaType= 3;
|
49
|
-
string name = 4;
|
50
|
-
string hreflang = 5;
|
51
|
-
uint32 height = 6;
|
52
|
-
uint32 width = 7;
|
53
|
-
Object preview =8;
|
54
|
-
}
|
55
|
-
|
56
|
-
message Reply {
|
57
|
-
string trxid = 1;
|
58
|
-
string groupid = 2;
|
59
|
-
}
|
60
|
-
|
61
|
-
message Image {
|
62
|
-
string id = 1;
|
63
|
-
string name = 2;
|
64
|
-
string mediaType= 3;
|
65
|
-
bytes content = 4;
|
66
|
-
string url = 5;
|
67
|
-
}
|
68
|
-
|
69
|
-
message File {
|
70
|
-
string id = 1;
|
71
|
-
string name = 2;
|
72
|
-
string mediaType= 3;
|
73
|
-
enum Compression {
|
74
|
-
none = 0;
|
75
|
-
gz = 1;
|
76
|
-
zip = 2;
|
77
|
-
zstd = 3;
|
78
|
-
}
|
79
|
-
Compression compression = 4;
|
80
|
-
bytes content = 5;
|
81
|
-
string url = 6;
|
82
|
-
}
|
83
|
-
|
84
|
-
message Person {
|
85
|
-
string id = 1;
|
86
|
-
string name = 2;
|
87
|
-
Image image = 3;
|
88
|
-
repeated Payment wallet = 11;
|
89
|
-
}
|
90
|
-
|
91
|
-
message Payment {
|
92
|
-
string id = 1;
|
93
|
-
string type = 2;
|
94
|
-
string name = 3;
|
95
|
-
}
|
96
|
-
|
97
|
-
message Activity {
|
98
|
-
string id = 1;
|
99
|
-
string type = 2;
|
100
|
-
repeated Object attachments = 3;
|
101
|
-
repeated Object attributedTo = 4;
|
102
|
-
Object audience = 5;
|
103
|
-
string content = 6;
|
104
|
-
Object context = 7;
|
105
|
-
string name = 8;
|
106
|
-
google.protobuf.Timestamp endtime = 9;
|
107
|
-
Object generator= 10;
|
108
|
-
repeated Object icon = 11;
|
109
|
-
repeated Object image = 12;
|
110
|
-
Object inReplyTo = 13;
|
111
|
-
Object location = 14;
|
112
|
-
Object preview = 15;
|
113
|
-
google.protobuf.Timestamp published = 16;
|
114
|
-
Object replies = 17;
|
115
|
-
google.protobuf.Timestamp startTime = 18;
|
116
|
-
string summary = 19;
|
117
|
-
repeated Object tag = 20;
|
118
|
-
google.protobuf.Timestamp updated = 21;
|
119
|
-
repeated Link url = 22;
|
120
|
-
repeated Object to = 23;
|
121
|
-
repeated Object bto = 24;
|
122
|
-
repeated Object cc = 25;
|
123
|
-
repeated Object bcc = 26;
|
124
|
-
string mediaType = 27;
|
125
|
-
string duration = 28;
|
126
|
-
|
127
|
-
Object actor = 29;
|
128
|
-
Object object = 30;
|
129
|
-
Object target = 31;
|
130
|
-
Object result = 32;
|
131
|
-
Object origin = 33;
|
132
|
-
Object instrument = 34;
|
133
|
-
Person person = 35;
|
134
|
-
}
|
@@ -1,146 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source: lib/proto/activity_stream.proto
|
5
|
-
|
6
|
-
require 'google/protobuf'
|
7
|
-
|
8
|
-
require 'google/protobuf/timestamp_pb'
|
9
|
-
require 'google/protobuf/any_pb'
|
10
|
-
|
11
|
-
Google::Protobuf::DescriptorPool.generated_pool.build do
|
12
|
-
add_file('lib/proto/activity_stream.proto', syntax: :proto3) do
|
13
|
-
add_message 'quorum.pb.AnyObj' do
|
14
|
-
optional :any, :message, 1, 'google.protobuf.Any'
|
15
|
-
end
|
16
|
-
add_message 'quorum.pb.Object' do
|
17
|
-
optional :id, :string, 1
|
18
|
-
optional :type, :string, 2
|
19
|
-
repeated :attachments, :message, 3, 'quorum.pb.Object'
|
20
|
-
repeated :attributedTo, :message, 4, 'quorum.pb.Object'
|
21
|
-
optional :audience, :message, 5, 'quorum.pb.Object'
|
22
|
-
optional :content, :string, 6
|
23
|
-
optional :context, :message, 7, 'quorum.pb.Object'
|
24
|
-
optional :name, :string, 8
|
25
|
-
optional :endtime, :message, 9, 'google.protobuf.Timestamp'
|
26
|
-
optional :generator, :message, 10, 'quorum.pb.Object'
|
27
|
-
repeated :icon, :message, 11, 'quorum.pb.Object'
|
28
|
-
repeated :image, :message, 12, 'quorum.pb.Image'
|
29
|
-
optional :inreplyto, :message, 13, 'quorum.pb.Reply'
|
30
|
-
optional :location, :message, 14, 'quorum.pb.Object'
|
31
|
-
optional :preview, :message, 15, 'quorum.pb.Object'
|
32
|
-
optional :published, :message, 16, 'google.protobuf.Timestamp'
|
33
|
-
optional :replies, :message, 17, 'quorum.pb.Object'
|
34
|
-
optional :startTime, :message, 18, 'google.protobuf.Timestamp'
|
35
|
-
optional :summary, :string, 19
|
36
|
-
repeated :tag, :message, 20, 'quorum.pb.Object'
|
37
|
-
optional :updated, :message, 21, 'google.protobuf.Timestamp'
|
38
|
-
repeated :url, :message, 22, 'quorum.pb.Link'
|
39
|
-
repeated :to, :message, 23, 'quorum.pb.Object'
|
40
|
-
repeated :bto, :message, 24, 'quorum.pb.Object'
|
41
|
-
repeated :cc, :message, 25, 'quorum.pb.Object'
|
42
|
-
repeated :bcc, :message, 26, 'quorum.pb.Object'
|
43
|
-
optional :mediaType, :string, 27
|
44
|
-
optional :duration, :string, 28
|
45
|
-
optional :file, :message, 29, 'quorum.pb.File'
|
46
|
-
end
|
47
|
-
add_message 'quorum.pb.Link' do
|
48
|
-
optional :href, :string, 1
|
49
|
-
repeated :rel, :string, 2
|
50
|
-
optional :mediaType, :string, 3
|
51
|
-
optional :name, :string, 4
|
52
|
-
optional :hreflang, :string, 5
|
53
|
-
optional :height, :uint32, 6
|
54
|
-
optional :width, :uint32, 7
|
55
|
-
optional :preview, :message, 8, 'quorum.pb.Object'
|
56
|
-
end
|
57
|
-
add_message 'quorum.pb.Reply' do
|
58
|
-
optional :trxid, :string, 1
|
59
|
-
optional :groupid, :string, 2
|
60
|
-
end
|
61
|
-
add_message 'quorum.pb.Image' do
|
62
|
-
optional :id, :string, 1
|
63
|
-
optional :name, :string, 2
|
64
|
-
optional :mediaType, :string, 3
|
65
|
-
optional :content, :bytes, 4
|
66
|
-
optional :url, :string, 5
|
67
|
-
end
|
68
|
-
add_message 'quorum.pb.File' do
|
69
|
-
optional :id, :string, 1
|
70
|
-
optional :name, :string, 2
|
71
|
-
optional :mediaType, :string, 3
|
72
|
-
optional :compression, :enum, 4, 'quorum.pb.File.Compression'
|
73
|
-
optional :content, :bytes, 5
|
74
|
-
optional :url, :string, 6
|
75
|
-
end
|
76
|
-
add_enum 'quorum.pb.File.Compression' do
|
77
|
-
value :none, 0
|
78
|
-
value :gz, 1
|
79
|
-
value :zip, 2
|
80
|
-
value :zstd, 3
|
81
|
-
end
|
82
|
-
add_message 'quorum.pb.Person' do
|
83
|
-
optional :id, :string, 1
|
84
|
-
optional :name, :string, 2
|
85
|
-
optional :image, :message, 3, 'quorum.pb.Image'
|
86
|
-
repeated :wallet, :message, 11, 'quorum.pb.Payment'
|
87
|
-
end
|
88
|
-
add_message 'quorum.pb.Payment' do
|
89
|
-
optional :id, :string, 1
|
90
|
-
optional :type, :string, 2
|
91
|
-
optional :name, :string, 3
|
92
|
-
end
|
93
|
-
add_message 'quorum.pb.Activity' do
|
94
|
-
optional :id, :string, 1
|
95
|
-
optional :type, :string, 2
|
96
|
-
repeated :attachments, :message, 3, 'quorum.pb.Object'
|
97
|
-
repeated :attributedTo, :message, 4, 'quorum.pb.Object'
|
98
|
-
optional :audience, :message, 5, 'quorum.pb.Object'
|
99
|
-
optional :content, :string, 6
|
100
|
-
optional :context, :message, 7, 'quorum.pb.Object'
|
101
|
-
optional :name, :string, 8
|
102
|
-
optional :endtime, :message, 9, 'google.protobuf.Timestamp'
|
103
|
-
optional :generator, :message, 10, 'quorum.pb.Object'
|
104
|
-
repeated :icon, :message, 11, 'quorum.pb.Object'
|
105
|
-
repeated :image, :message, 12, 'quorum.pb.Object'
|
106
|
-
optional :inReplyTo, :message, 13, 'quorum.pb.Object'
|
107
|
-
optional :location, :message, 14, 'quorum.pb.Object'
|
108
|
-
optional :preview, :message, 15, 'quorum.pb.Object'
|
109
|
-
optional :published, :message, 16, 'google.protobuf.Timestamp'
|
110
|
-
optional :replies, :message, 17, 'quorum.pb.Object'
|
111
|
-
optional :startTime, :message, 18, 'google.protobuf.Timestamp'
|
112
|
-
optional :summary, :string, 19
|
113
|
-
repeated :tag, :message, 20, 'quorum.pb.Object'
|
114
|
-
optional :updated, :message, 21, 'google.protobuf.Timestamp'
|
115
|
-
repeated :url, :message, 22, 'quorum.pb.Link'
|
116
|
-
repeated :to, :message, 23, 'quorum.pb.Object'
|
117
|
-
repeated :bto, :message, 24, 'quorum.pb.Object'
|
118
|
-
repeated :cc, :message, 25, 'quorum.pb.Object'
|
119
|
-
repeated :bcc, :message, 26, 'quorum.pb.Object'
|
120
|
-
optional :mediaType, :string, 27
|
121
|
-
optional :duration, :string, 28
|
122
|
-
optional :actor, :message, 29, 'quorum.pb.Object'
|
123
|
-
optional :object, :message, 30, 'quorum.pb.Object'
|
124
|
-
optional :target, :message, 31, 'quorum.pb.Object'
|
125
|
-
optional :result, :message, 32, 'quorum.pb.Object'
|
126
|
-
optional :origin, :message, 33, 'quorum.pb.Object'
|
127
|
-
optional :instrument, :message, 34, 'quorum.pb.Object'
|
128
|
-
optional :person, :message, 35, 'quorum.pb.Person'
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
module Quorum
|
134
|
-
module Pb
|
135
|
-
AnyObj = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AnyObj').msgclass
|
136
|
-
Object = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Object').msgclass
|
137
|
-
Link = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Link').msgclass
|
138
|
-
Reply = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Reply').msgclass
|
139
|
-
Image = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Image').msgclass
|
140
|
-
File = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.File').msgclass
|
141
|
-
File::Compression = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.File.Compression').enummodule
|
142
|
-
Person = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Person').msgclass
|
143
|
-
Payment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Payment').msgclass
|
144
|
-
Activity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Activity').msgclass
|
145
|
-
end
|
146
|
-
end
|
data/lib/quorum_sdk/api/chain.rb
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module QuorumSdk
|
4
|
-
class API
|
5
|
-
# Wrapper for HTTP APIs for light node
|
6
|
-
module LightNode
|
7
|
-
ARGUMENTS_FOR_BUILD_TRX = %i[private_key data].freeze
|
8
|
-
def build_trx(**kwargs)
|
9
|
-
raise ArgumentError, "Keyword arguments #{ARGUMENTS_FOR_BUILD_TRX} must be provided" unless ARGUMENTS_FOR_BUILD_TRX.all?(&->(arg) { arg.in? kwargs.keys })
|
10
|
-
raise ArgumentError, 'data should be instance of Google::Protobuf::MessageExts' unless kwargs[:data].is_a?(Google::Protobuf::MessageExts)
|
11
|
-
|
12
|
-
kwargs = kwargs.merge(
|
13
|
-
group_id:,
|
14
|
-
cipher_key:
|
15
|
-
)
|
16
|
-
QuorumSdk::Utils.encrypt_trx(**kwargs)
|
17
|
-
end
|
18
|
-
|
19
|
-
def send_trx(trx_item)
|
20
|
-
path = "api/v1/node/trx/#{group_id}"
|
21
|
-
client.post(path, TrxItem: trx_item).body
|
22
|
-
end
|
23
|
-
|
24
|
-
def list_trx(**kwargs)
|
25
|
-
params = {
|
26
|
-
group_id:,
|
27
|
-
start_trx: kwargs[:start_trx],
|
28
|
-
num: kwargs[:num] || 100,
|
29
|
-
senders: kwargs[:senders].presence || [],
|
30
|
-
trx_types: kwargs[:trx_types].presence || []
|
31
|
-
}.compact
|
32
|
-
params[:reverse] =
|
33
|
-
if kwargs[:reverse]
|
34
|
-
'true'
|
35
|
-
else
|
36
|
-
'false'
|
37
|
-
end
|
38
|
-
params[:include_start_trx] =
|
39
|
-
if kwargs[:include_start_trx]
|
40
|
-
'true'
|
41
|
-
else
|
42
|
-
'false'
|
43
|
-
end
|
44
|
-
|
45
|
-
encrypted_params = QuorumSdk::Utils.aes_encrypt({
|
46
|
-
Req: params
|
47
|
-
}.to_json, key: cipher_key)
|
48
|
-
|
49
|
-
payload = {
|
50
|
-
Req: Base64.strict_encode64(encrypted_params)
|
51
|
-
}
|
52
|
-
|
53
|
-
path = "api/v1/node/groupctn/#{group_id}"
|
54
|
-
list = client.post(path, **payload).body
|
55
|
-
|
56
|
-
return list unless list.is_a?(Array)
|
57
|
-
|
58
|
-
list.each do |trx|
|
59
|
-
data = Base64.strict_decode64 trx['Data']
|
60
|
-
trx['Data'] = QuorumSdk::Utils.decrypt_trx_data data, key: cipher_key
|
61
|
-
end
|
62
|
-
|
63
|
-
list
|
64
|
-
end
|
65
|
-
|
66
|
-
def chain_data(params, type)
|
67
|
-
path = "api/v1/node/getchaindata/#{group_id}"
|
68
|
-
encrypted_params = QuorumSdk::Utils.aes_encrypt params.to_json, key: cipher_key
|
69
|
-
encoded_params = Base64.strict_encode64 encrypted_params
|
70
|
-
|
71
|
-
payload = {
|
72
|
-
Req: encoded_params,
|
73
|
-
ReqType: type
|
74
|
-
}
|
75
|
-
|
76
|
-
client.post(path, **payload).body
|
77
|
-
end
|
78
|
-
|
79
|
-
def group_info
|
80
|
-
chain_data({ GroupId: group_id }, 'group_info')
|
81
|
-
end
|
82
|
-
|
83
|
-
def auth_type(trx_type)
|
84
|
-
chain_data({ GroupId: group_id, TrxType: trx_type }, 'auth_type')
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
data/lib/quorum_sdk/api.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'api/chain'
|
4
|
-
require_relative 'api/light_node'
|
5
|
-
require_relative 'client'
|
6
|
-
|
7
|
-
module QuorumSdk
|
8
|
-
# Wrapper for HTTP APIs
|
9
|
-
class API
|
10
|
-
attr_reader :group_id, :group_name, :consensus_type, :encryption_type, :app_key, :owner_pubkey, :signature,
|
11
|
-
:cipher_key, :chain_urls, :client
|
12
|
-
|
13
|
-
def initialize(seed_url)
|
14
|
-
r = QuorumSdk::Utils.parse_seed_url seed_url
|
15
|
-
|
16
|
-
@group_id = r[:group_id]
|
17
|
-
@group_name = r[:group_name]
|
18
|
-
@consensus_type = r[:consensus_type]
|
19
|
-
@encryption_type = r[:encryption_type]
|
20
|
-
@app_key = r[:app_key]
|
21
|
-
@owner_pubkey = r[:owner_pubkey]
|
22
|
-
@signature = r[:signature]
|
23
|
-
@cipher_key = r[:cipher_key]
|
24
|
-
@chain_urls = r[:chain_urls]
|
25
|
-
|
26
|
-
@client = QuorumSdk::Client.new(@chain_urls)
|
27
|
-
end
|
28
|
-
|
29
|
-
include QuorumSdk::API::Chain
|
30
|
-
include QuorumSdk::API::LightNode
|
31
|
-
end
|
32
|
-
end
|