quorum_sdk 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +23 -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/{api → chain}/group.rb +31 -1
- data/lib/quorum_sdk/{api → chain}/management.rb +19 -4
- data/lib/quorum_sdk/chain/node.rb +18 -0
- data/lib/quorum_sdk/chain.rb +26 -0
- data/lib/quorum_sdk/client.rb +20 -11
- 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 +40 -15
- data/lib/quorum_sdk/version.rb +1 -1
- data/lib/quorum_sdk.rb +2 -4
- metadata +13 -9
- 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 -26
- data/lib/quorum_sdk/api/light_node.rb +0 -84
- data/lib/quorum_sdk/api.rb +0 -41
data/lib/proto/chain_pb.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
4
|
-
# source:
|
4
|
+
# source: chain.proto
|
5
5
|
|
6
6
|
require 'google/protobuf'
|
7
7
|
|
8
8
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
-
add_file('
|
9
|
+
add_file('chain.proto', syntax: :proto3) do
|
10
10
|
add_message 'quorum.pb.Package' do
|
11
11
|
optional :type, :enum, 1, 'quorum.pb.PackageType'
|
12
12
|
optional :Data, :bytes, 2
|
@@ -20,93 +20,44 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
20
20
|
optional :Version, :string, 6
|
21
21
|
optional :Expired, :int64, 7
|
22
22
|
optional :ResendCount, :int64, 8
|
23
|
-
optional :Nonce, :int64, 9
|
24
23
|
optional :SenderPubkey, :string, 10
|
25
24
|
optional :SenderSign, :bytes, 11
|
26
25
|
optional :StorageType, :enum, 12, 'quorum.pb.TrxStroageType'
|
27
26
|
end
|
28
27
|
add_message 'quorum.pb.Block' do
|
29
|
-
optional :BlockId, :string, 1
|
30
|
-
optional :GroupId, :string, 2
|
31
|
-
optional :PrevBlockId, :string, 3
|
32
|
-
optional :PreviousHash, :bytes, 4
|
33
|
-
repeated :Trxs, :message, 5, 'quorum.pb.Trx'
|
34
|
-
optional :ProducerPubKey, :string, 6
|
35
|
-
optional :Hash, :bytes, 7
|
36
|
-
optional :Signature, :bytes, 8
|
37
|
-
optional :TimeStamp, :int64, 9
|
38
|
-
end
|
39
|
-
add_message 'quorum.pb.Snapshot' do
|
40
|
-
optional :SnapshotId, :string, 1
|
41
|
-
optional :SnapshotPackageId, :string, 2
|
42
|
-
optional :TotalCount, :int64, 3
|
43
|
-
optional :GroupId, :string, 4
|
44
|
-
optional :Nonce, :int64, 5
|
45
|
-
repeated :SnapshotItems, :message, 6, 'quorum.pb.SnapshotItem'
|
46
|
-
optional :SenderPubkey, :string, 7
|
47
|
-
optional :Singature, :bytes, 8
|
48
|
-
optional :TimeStamp, :int64, 9
|
49
|
-
optional :HighestHeight, :int64, 10
|
50
|
-
optional :HighestBlockId, :string, 11
|
51
|
-
optional :ItemsHash, :bytes, 12
|
52
|
-
end
|
53
|
-
add_message 'quorum.pb.SnapshotItem' do
|
54
|
-
optional :SnapshotItemId, :string, 1
|
55
|
-
optional :Type, :enum, 2, 'quorum.pb.SnapShotItemType'
|
56
|
-
optional :Data, :bytes, 3
|
57
|
-
end
|
58
|
-
add_message 'quorum.pb.SnapShotTag' do
|
59
|
-
optional :TimeStamp, :int64, 1
|
60
|
-
optional :HighestHeight, :int64, 2
|
61
|
-
optional :HighestBlockId, :string, 3
|
62
|
-
optional :ItemsHash, :bytes, 4
|
63
|
-
optional :Nonce, :int64, 5
|
64
|
-
optional :SnapshotPackageId, :string, 6
|
65
|
-
optional :SenderPubkey, :string, 7
|
66
|
-
end
|
67
|
-
add_message 'quorum.pb.BlockDbChunk' do
|
68
|
-
optional :BlockId, :string, 1
|
69
|
-
optional :BlockItem, :message, 2, 'quorum.pb.Block'
|
70
|
-
optional :ParentBlockId, :string, 3
|
71
|
-
repeated :SubBlockId, :string, 4
|
72
|
-
optional :Height, :int64, 6
|
73
|
-
end
|
74
|
-
add_message 'quorum.pb.ReqBlock' do
|
75
|
-
optional :BlockId, :string, 1
|
76
|
-
optional :GroupId, :string, 2
|
77
|
-
optional :UserId, :string, 3
|
78
|
-
end
|
79
|
-
add_message 'quorum.pb.BlockSynced' do
|
80
|
-
optional :BlockItem, :message, 1, 'quorum.pb.Block'
|
81
|
-
end
|
82
|
-
add_message 'quorum.pb.AskPeerId' do
|
83
28
|
optional :GroupId, :string, 1
|
84
|
-
optional :
|
85
|
-
optional :
|
86
|
-
optional :
|
87
|
-
optional :
|
29
|
+
optional :BlockId, :uint64, 2
|
30
|
+
optional :Epoch, :uint64, 3
|
31
|
+
optional :PrevHash, :bytes, 4
|
32
|
+
optional :ProducerPubkey, :string, 5
|
33
|
+
repeated :Trxs, :message, 6, 'quorum.pb.Trx'
|
34
|
+
optional :Sudo, :bool, 7
|
35
|
+
optional :TimeStamp, :int64, 8
|
36
|
+
optional :BlockHash, :bytes, 9
|
37
|
+
optional :ProducerSign, :bytes, 10
|
88
38
|
end
|
89
|
-
add_message 'quorum.pb.
|
39
|
+
add_message 'quorum.pb.ReqBlock' do
|
90
40
|
optional :GroupId, :string, 1
|
91
|
-
optional :
|
92
|
-
optional :
|
93
|
-
optional :
|
94
|
-
optional :IsDirectConnected, :bool, 5
|
41
|
+
optional :FromBlock, :uint64, 2
|
42
|
+
optional :BlksRequested, :int32, 3
|
43
|
+
optional :ReqPubkey, :string, 4
|
95
44
|
end
|
96
|
-
add_message 'quorum.pb.
|
97
|
-
|
45
|
+
add_message 'quorum.pb.BlocksBundle' do
|
46
|
+
repeated :Blocks, :message, 1, 'quorum.pb.Block'
|
98
47
|
end
|
99
48
|
add_message 'quorum.pb.ReqBlockResp' do
|
100
|
-
optional :
|
101
|
-
optional :
|
102
|
-
optional :
|
103
|
-
optional :
|
104
|
-
optional :
|
105
|
-
optional :
|
49
|
+
optional :GroupId, :string, 1
|
50
|
+
optional :RequesterPubkey, :string, 2
|
51
|
+
optional :ProviderPubkey, :string, 3
|
52
|
+
optional :Result, :enum, 4, 'quorum.pb.ReqBlkResult'
|
53
|
+
optional :FromBlock, :uint64, 5
|
54
|
+
optional :BlksRequested, :int32, 6
|
55
|
+
optional :BlksProvided, :int32, 7
|
56
|
+
optional :Blocks, :message, 8, 'quorum.pb.BlocksBundle'
|
106
57
|
end
|
107
58
|
add_message 'quorum.pb.PostItem' do
|
108
59
|
optional :TrxId, :string, 1
|
109
|
-
optional :
|
60
|
+
optional :SenderPubkey, :string, 2
|
110
61
|
optional :Content, :bytes, 3
|
111
62
|
optional :TimeStamp, :int64, 4
|
112
63
|
end
|
@@ -115,11 +66,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
115
66
|
optional :ProducerPubkey, :string, 2
|
116
67
|
optional :GroupOwnerPubkey, :string, 3
|
117
68
|
optional :GroupOwnerSign, :string, 4
|
118
|
-
optional :
|
119
|
-
optional :
|
120
|
-
optional :
|
69
|
+
optional :Action, :enum, 5, 'quorum.pb.ActionType'
|
70
|
+
optional :WithnessBlocks, :int64, 6
|
71
|
+
optional :TimeStamp, :int64, 7
|
121
72
|
optional :Memo, :string, 8
|
122
73
|
end
|
74
|
+
add_message 'quorum.pb.BFTProducerBundleItem' do
|
75
|
+
repeated :Producers, :message, 1, 'quorum.pb.ProducerItem'
|
76
|
+
end
|
123
77
|
add_message 'quorum.pb.UserItem' do
|
124
78
|
optional :GroupId, :string, 1
|
125
79
|
optional :UserPubkey, :string, 2
|
@@ -143,15 +97,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
143
97
|
optional :Action, :enum, 10, 'quorum.pb.ActionType'
|
144
98
|
optional :Memo, :string, 11
|
145
99
|
end
|
146
|
-
add_message 'quorum.pb.SchemaItem' do
|
147
|
-
optional :GroupId, :string, 1
|
148
|
-
optional :GroupOwnerPubkey, :string, 2
|
149
|
-
optional :GroupOwnerSign, :string, 3
|
150
|
-
optional :Type, :string, 4
|
151
|
-
optional :Rule, :string, 5
|
152
|
-
optional :TimeStamp, :int64, 6
|
153
|
-
optional :Action, :enum, 7, 'quorum.pb.ActionType'
|
154
|
-
end
|
155
100
|
add_message 'quorum.pb.GroupItem' do
|
156
101
|
optional :GroupId, :string, 1
|
157
102
|
optional :GroupName, :string, 2
|
@@ -159,13 +104,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
159
104
|
optional :UserSignPubkey, :string, 4
|
160
105
|
optional :UserEncryptPubkey, :string, 5
|
161
106
|
optional :LastUpdate, :int64, 6
|
162
|
-
optional :
|
163
|
-
optional :
|
164
|
-
optional :
|
165
|
-
optional :
|
166
|
-
optional :
|
167
|
-
optional :CipherKey, :string, 12
|
168
|
-
optional :AppKey, :string, 13
|
107
|
+
optional :GenesisBlock, :message, 7, 'quorum.pb.Block'
|
108
|
+
optional :EncryptType, :enum, 8, 'quorum.pb.GroupEncryptType'
|
109
|
+
optional :ConsenseType, :enum, 9, 'quorum.pb.GroupConsenseType'
|
110
|
+
optional :CipherKey, :string, 10
|
111
|
+
optional :AppKey, :string, 11
|
169
112
|
end
|
170
113
|
add_message 'quorum.pb.ChainConfigItem' do
|
171
114
|
optional :GroupId, :string, 1
|
@@ -185,22 +128,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
185
128
|
optional :Type, :enum, 1, 'quorum.pb.TrxType'
|
186
129
|
optional :Mode, :enum, 2, 'quorum.pb.TrxAuthMode'
|
187
130
|
end
|
188
|
-
add_message 'quorum.pb.GroupItemV0' do
|
189
|
-
optional :GroupId, :string, 1
|
190
|
-
optional :GroupName, :string, 2
|
191
|
-
optional :OwnerPubKey, :string, 3
|
192
|
-
optional :UserSignPubkey, :string, 4
|
193
|
-
optional :UserEncryptPubkey, :string, 5
|
194
|
-
optional :UserRole, :enum, 6, 'quorum.pb.RoleV0'
|
195
|
-
optional :LastUpdate, :int64, 7
|
196
|
-
optional :HighestHeight, :int64, 8
|
197
|
-
optional :HighestBlockId, :string, 9
|
198
|
-
optional :GenesisBlock, :message, 10, 'quorum.pb.Block'
|
199
|
-
optional :EncryptType, :enum, 11, 'quorum.pb.GroupEncryptType'
|
200
|
-
optional :ConsenseType, :enum, 12, 'quorum.pb.GroupConsenseType'
|
201
|
-
optional :CipherKey, :string, 13
|
202
|
-
optional :AppKey, :string, 14
|
203
|
-
end
|
204
131
|
add_message 'quorum.pb.AppConfigItem' do
|
205
132
|
optional :GroupId, :string, 1
|
206
133
|
optional :Action, :enum, 2, 'quorum.pb.ActionType'
|
@@ -212,12 +139,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
212
139
|
optional :Memo, :string, 8
|
213
140
|
optional :TimeStamp, :int64, 9
|
214
141
|
end
|
215
|
-
add_message 'quorum.pb.PSPing' do
|
216
|
-
optional :Seqnum, :int32, 1
|
217
|
-
optional :IsResp, :bool, 2
|
218
|
-
optional :TimeStamp, :int64, 3
|
219
|
-
optional :Payload, :bytes, 4
|
220
|
-
end
|
221
142
|
add_message 'quorum.pb.GroupSeed' do
|
222
143
|
optional :GenesisBlock, :message, 1, 'quorum.pb.Block'
|
223
144
|
optional :GroupId, :string, 2
|
@@ -236,73 +157,85 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
236
157
|
repeated :ApiUrl, :string, 4
|
237
158
|
optional :GroupSeed, :string, 5
|
238
159
|
end
|
239
|
-
add_message 'quorum.pb.HBMsg' do
|
240
|
-
optional :MsgId, :string, 1
|
241
|
-
optional :MsgType, :enum, 2, 'quorum.pb.HBBMsgType'
|
242
|
-
optional :Payload, :bytes, 3
|
243
|
-
end
|
244
160
|
add_message 'quorum.pb.HBTrxBundle' do
|
245
161
|
repeated :Trxs, :message, 1, 'quorum.pb.Trx'
|
246
162
|
end
|
247
|
-
add_message 'quorum.pb.
|
248
|
-
optional :
|
249
|
-
optional :
|
250
|
-
optional :
|
163
|
+
add_message 'quorum.pb.HBMsgv1' do
|
164
|
+
optional :MsgId, :string, 1
|
165
|
+
optional :Epoch, :uint64, 2
|
166
|
+
optional :PayloadType, :enum, 3, 'quorum.pb.HBMsgPayloadType'
|
251
167
|
optional :Payload, :bytes, 4
|
252
168
|
end
|
253
|
-
add_message 'quorum.pb.
|
169
|
+
add_message 'quorum.pb.RBCMsg' do
|
170
|
+
optional :Type, :enum, 1, 'quorum.pb.RBCMsgType'
|
171
|
+
optional :Payload, :bytes, 2
|
172
|
+
end
|
173
|
+
add_message 'quorum.pb.InitPropose' do
|
254
174
|
optional :RootHash, :bytes, 1
|
255
175
|
repeated :Proof, :bytes, 2
|
256
176
|
optional :Index, :int64, 3
|
257
177
|
optional :Leaves, :int64, 4
|
258
|
-
optional :
|
259
|
-
optional :
|
178
|
+
optional :OriginalDataSize, :int64, 5
|
179
|
+
optional :RecvNodePubkey, :string, 6
|
180
|
+
optional :ProposerPubkey, :string, 7
|
181
|
+
optional :ProposerSign, :bytes, 8
|
182
|
+
end
|
183
|
+
add_message 'quorum.pb.Echo' do
|
184
|
+
optional :RootHash, :bytes, 1
|
185
|
+
repeated :Proof, :bytes, 2
|
186
|
+
optional :Index, :int64, 3
|
187
|
+
optional :Leaves, :int64, 4
|
188
|
+
optional :OriginalDataSize, :int64, 5
|
189
|
+
optional :OriginalProposerPubkey, :string, 6
|
190
|
+
optional :EchoProviderPubkey, :string, 7
|
191
|
+
optional :EchoProviderSign, :bytes, 8
|
260
192
|
end
|
261
193
|
add_message 'quorum.pb.Ready' do
|
262
194
|
optional :RootHash, :bytes, 1
|
263
|
-
optional :
|
264
|
-
optional :
|
265
|
-
optional :
|
195
|
+
optional :OriginalProposerPubkey, :string, 2
|
196
|
+
optional :ReadyProviderPubkey, :string, 3
|
197
|
+
optional :ReadyProviderSign, :bytes, 4
|
266
198
|
end
|
267
|
-
add_message 'quorum.pb.
|
268
|
-
optional :Type, :enum, 1, 'quorum.pb.
|
269
|
-
optional :
|
270
|
-
optional :SenderId, :string, 3
|
271
|
-
optional :Epoch, :int64, 4
|
272
|
-
optional :Payload, :bytes, 5
|
199
|
+
add_message 'quorum.pb.BBAMsg' do
|
200
|
+
optional :Type, :enum, 1, 'quorum.pb.BBAMsgType'
|
201
|
+
optional :Payload, :bytes, 2
|
273
202
|
end
|
274
203
|
add_message 'quorum.pb.Bval' do
|
275
|
-
optional :
|
204
|
+
optional :ProposerId, :string, 1
|
205
|
+
optional :SenderPubkey, :string, 2
|
206
|
+
optional :Epoch, :int64, 3
|
207
|
+
optional :Value, :bool, 4
|
276
208
|
end
|
277
209
|
add_message 'quorum.pb.Aux' do
|
278
|
-
optional :
|
210
|
+
optional :ProposerId, :string, 1
|
211
|
+
optional :SenderPubkey, :string, 2
|
212
|
+
optional :Epoch, :uint64, 3
|
213
|
+
optional :Value, :bool, 4
|
214
|
+
end
|
215
|
+
add_message 'quorum.pb.GroupItemV0' do
|
216
|
+
optional :GroupId, :string, 1
|
217
|
+
optional :GroupName, :string, 2
|
218
|
+
optional :OwnerPubKey, :string, 3
|
219
|
+
optional :UserSignPubkey, :string, 4
|
220
|
+
optional :UserEncryptPubkey, :string, 5
|
221
|
+
optional :UserRole, :enum, 6, 'quorum.pb.RoleV0'
|
222
|
+
optional :LastUpdate, :int64, 7
|
223
|
+
optional :HighestHeight, :int64, 8
|
224
|
+
optional :HighestBlockId, :string, 9
|
225
|
+
optional :GenesisBlock, :message, 10, 'quorum.pb.Block'
|
226
|
+
optional :EncryptType, :enum, 11, 'quorum.pb.GroupEncryptType'
|
227
|
+
optional :ConsenseType, :enum, 12, 'quorum.pb.GroupConsenseType'
|
228
|
+
optional :CipherKey, :string, 13
|
229
|
+
optional :AppKey, :string, 14
|
279
230
|
end
|
280
231
|
add_enum 'quorum.pb.PackageType' do
|
281
232
|
value :TRX, 0
|
282
233
|
value :BLOCK, 1
|
283
|
-
value :
|
284
|
-
value :HBB, 3
|
285
|
-
end
|
286
|
-
add_enum 'quorum.pb.TrxType' do
|
287
|
-
value :POST, 0
|
288
|
-
value :SCHEMA, 2
|
289
|
-
value :PRODUCER, 3
|
290
|
-
value :ANNOUNCE, 4
|
291
|
-
value :REQ_BLOCK_FORWARD, 5
|
292
|
-
value :REQ_BLOCK_BACKWARD, 6
|
293
|
-
value :REQ_BLOCK_RESP, 7
|
294
|
-
value :BLOCK_SYNCED, 8
|
295
|
-
value :BLOCK_PRODUCED, 9
|
296
|
-
value :USER, 10
|
297
|
-
value :ASK_PEERID, 11
|
298
|
-
value :ASK_PEERID_RESP, 12
|
299
|
-
value :CHAIN_CONFIG, 13
|
300
|
-
value :APP_CONFIG, 14
|
234
|
+
value :HBB, 2
|
301
235
|
end
|
302
236
|
add_enum 'quorum.pb.AnnounceType' do
|
303
237
|
value :AS_USER, 0
|
304
238
|
value :AS_PRODUCER, 1
|
305
|
-
value :AS_USER_ENCRYPT, 2
|
306
239
|
end
|
307
240
|
add_enum 'quorum.pb.ApproveType' do
|
308
241
|
value :ANNOUNCED, 0
|
@@ -317,16 +250,20 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
317
250
|
value :CHAIN, 0
|
318
251
|
value :CACHE, 1
|
319
252
|
end
|
320
|
-
add_enum 'quorum.pb.
|
321
|
-
value :
|
322
|
-
value :
|
323
|
-
value :
|
324
|
-
value :
|
325
|
-
value :
|
253
|
+
add_enum 'quorum.pb.TrxType' do
|
254
|
+
value :POST, 0
|
255
|
+
value :ANNOUNCE, 1
|
256
|
+
value :PRODUCER, 2
|
257
|
+
value :USER, 3
|
258
|
+
value :REQ_BLOCK, 4
|
259
|
+
value :REQ_BLOCK_RESP, 5
|
260
|
+
value :CHAIN_CONFIG, 6
|
261
|
+
value :APP_CONFIG, 7
|
326
262
|
end
|
327
263
|
add_enum 'quorum.pb.ReqBlkResult' do
|
328
|
-
value :
|
329
|
-
value :
|
264
|
+
value :BLOCK_IN_RESP, 0
|
265
|
+
value :BLOCK_IN_RESP_ON_TOP, 1
|
266
|
+
value :BLOCK_NOT_FOUND, 2
|
330
267
|
end
|
331
268
|
add_enum 'quorum.pb.GroupEncryptType' do
|
332
269
|
value :PUBLIC, 0
|
@@ -358,15 +295,16 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
358
295
|
value :BOOL, 1
|
359
296
|
value :STRING, 2
|
360
297
|
end
|
361
|
-
add_enum 'quorum.pb.
|
362
|
-
value :
|
363
|
-
value :
|
298
|
+
add_enum 'quorum.pb.HBMsgPayloadType' do
|
299
|
+
value :RBC, 0
|
300
|
+
value :BBA, 1
|
364
301
|
end
|
365
|
-
add_enum 'quorum.pb.
|
366
|
-
value :
|
367
|
-
value :
|
302
|
+
add_enum 'quorum.pb.RBCMsgType' do
|
303
|
+
value :INIT_PROPOSE, 0
|
304
|
+
value :ECHO, 1
|
305
|
+
value :READY, 2
|
368
306
|
end
|
369
|
-
add_enum 'quorum.pb.
|
307
|
+
add_enum 'quorum.pb.BBAMsgType' do
|
370
308
|
value :BVAL, 0
|
371
309
|
value :AUX, 1
|
372
310
|
end
|
@@ -378,45 +316,37 @@ module Quorum
|
|
378
316
|
Package = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Package').msgclass
|
379
317
|
Trx = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Trx').msgclass
|
380
318
|
Block = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Block').msgclass
|
381
|
-
Snapshot = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Snapshot').msgclass
|
382
|
-
SnapshotItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SnapshotItem').msgclass
|
383
|
-
SnapShotTag = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SnapShotTag').msgclass
|
384
|
-
BlockDbChunk = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BlockDbChunk').msgclass
|
385
319
|
ReqBlock = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ReqBlock').msgclass
|
386
|
-
|
387
|
-
AskPeerId = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AskPeerId').msgclass
|
388
|
-
AskPeerIdResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AskPeerIdResp').msgclass
|
389
|
-
BlockProduced = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BlockProduced').msgclass
|
320
|
+
BlocksBundle = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BlocksBundle').msgclass
|
390
321
|
ReqBlockResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ReqBlockResp').msgclass
|
391
322
|
PostItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.PostItem').msgclass
|
392
323
|
ProducerItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ProducerItem').msgclass
|
324
|
+
BFTProducerBundleItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BFTProducerBundleItem').msgclass
|
393
325
|
UserItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.UserItem').msgclass
|
394
326
|
AnnounceItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AnnounceItem').msgclass
|
395
|
-
SchemaItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SchemaItem').msgclass
|
396
327
|
GroupItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupItem').msgclass
|
397
328
|
ChainConfigItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ChainConfigItem').msgclass
|
398
329
|
ChainSendTrxRuleListItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ChainSendTrxRuleListItem').msgclass
|
399
330
|
SetTrxAuthModeItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SetTrxAuthModeItem').msgclass
|
400
|
-
GroupItemV0 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupItemV0').msgclass
|
401
331
|
AppConfigItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AppConfigItem').msgclass
|
402
|
-
PSPing = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.PSPing').msgclass
|
403
332
|
GroupSeed = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupSeed').msgclass
|
404
333
|
NodeSDKGroupItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.NodeSDKGroupItem').msgclass
|
405
|
-
HBMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBMsg').msgclass
|
406
334
|
HBTrxBundle = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBTrxBundle').msgclass
|
407
|
-
|
408
|
-
|
335
|
+
HBMsgv1 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBMsgv1').msgclass
|
336
|
+
RBCMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.RBCMsg').msgclass
|
337
|
+
InitPropose = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.InitPropose').msgclass
|
338
|
+
Echo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Echo').msgclass
|
409
339
|
Ready = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Ready').msgclass
|
410
|
-
|
340
|
+
BBAMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BBAMsg').msgclass
|
411
341
|
Bval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Bval').msgclass
|
412
342
|
Aux = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Aux').msgclass
|
343
|
+
GroupItemV0 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupItemV0').msgclass
|
413
344
|
PackageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.PackageType').enummodule
|
414
|
-
TrxType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxType').enummodule
|
415
345
|
AnnounceType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AnnounceType').enummodule
|
416
346
|
ApproveType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ApproveType').enummodule
|
417
347
|
ActionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ActionType').enummodule
|
418
348
|
TrxStroageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxStroageType').enummodule
|
419
|
-
|
349
|
+
TrxType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxType').enummodule
|
420
350
|
ReqBlkResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ReqBlkResult').enummodule
|
421
351
|
GroupEncryptType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupEncryptType').enummodule
|
422
352
|
GroupConsenseType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupConsenseType').enummodule
|
@@ -425,8 +355,8 @@ module Quorum
|
|
425
355
|
TrxAuthMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxAuthMode').enummodule
|
426
356
|
AuthListType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AuthListType').enummodule
|
427
357
|
AppConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AppConfigType').enummodule
|
428
|
-
|
429
|
-
|
430
|
-
|
358
|
+
HBMsgPayloadType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBMsgPayloadType').enummodule
|
359
|
+
RBCMsgType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.RBCMsgType').enummodule
|
360
|
+
BBAMsgType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BBAMsgType').enummodule
|
431
361
|
end
|
432
362
|
end
|
data/lib/quorum_sdk/account.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module QuorumSdk
|
4
|
+
class Chain
|
5
|
+
# Wrapper for HTTP APIs for chain
|
6
|
+
module Chain
|
7
|
+
def block(group_id, _block_id)
|
8
|
+
path = "api/v1/block/#{group_id}/#{trx_id}"
|
9
|
+
client.get(path).body
|
10
|
+
end
|
11
|
+
|
12
|
+
def trx(group_id, trx_id)
|
13
|
+
path = "api/v1/trx/#{group_id}/#{trx_id}"
|
14
|
+
client.get(path).body
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,9 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module QuorumSdk
|
4
|
-
class
|
4
|
+
class Chain
|
5
5
|
# Wrapper for HTTP APIs for group
|
6
6
|
module Group
|
7
|
+
def group(group_id)
|
8
|
+
path = "api/v1/group/#{group_id}"
|
9
|
+
client.get(path).body
|
10
|
+
end
|
11
|
+
|
7
12
|
ARGUMENTS_FOR_CREATE_GROUP = %i[app_key group_name].freeze
|
8
13
|
def create_group(**kwargs)
|
9
14
|
raise ArgumentError, "Keyword arguments #{ARGUMENTS_FOR_CREATE_GROUP} must be provided" unless ARGUMENTS_FOR_CREATE_GROUP.all?(&->(arg) { arg.in? kwargs.keys })
|
@@ -34,6 +39,31 @@ module QuorumSdk
|
|
34
39
|
path = "api/v1/group/#{group_id}/seed"
|
35
40
|
client.get(path).body
|
36
41
|
end
|
42
|
+
|
43
|
+
def join_group(seed)
|
44
|
+
path = 'api/v2/group/join'
|
45
|
+
payload = { seed: }
|
46
|
+
client.post(path, **payload).body
|
47
|
+
end
|
48
|
+
|
49
|
+
def clear_group(group_id)
|
50
|
+
path = 'api/v1/group/clear'
|
51
|
+
payload = { group_id: }
|
52
|
+
client.post(path, **payload).body
|
53
|
+
end
|
54
|
+
|
55
|
+
def leave_group(group_id)
|
56
|
+
path = 'api/v1/group/leave'
|
57
|
+
payload = { group_id: }
|
58
|
+
client.post(path, **payload).body
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_content(group_id, data = nil, **kwargs)
|
62
|
+
data ||= kwargs
|
63
|
+
path = "api/v1/group/#{group_id}/content"
|
64
|
+
payload = { data: }
|
65
|
+
client.post(path, **payload).body
|
66
|
+
end
|
37
67
|
end
|
38
68
|
end
|
39
69
|
end
|
@@ -1,23 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module QuorumSdk
|
4
|
-
class
|
4
|
+
class Chain
|
5
5
|
# Wrapper for HTTP APIs for chain
|
6
6
|
module Management
|
7
7
|
def allow_list(group_id: nil)
|
8
8
|
group_id ||= @group_id
|
9
|
+
raise ArgumentError, 'group_id must be provided' if group_id.blank?
|
10
|
+
|
9
11
|
path = "api/v1/group/#{group_id}/trx/allowlist"
|
10
12
|
client.get(path).body
|
11
13
|
end
|
12
14
|
|
13
15
|
def deny_list(group_id: nil)
|
14
16
|
group_id ||= @group_id
|
17
|
+
raise ArgumentError, 'group_id must be provided' if group_id.blank?
|
18
|
+
|
15
19
|
path = "api/v1/group/#{group_id}/trx/denylist"
|
16
20
|
client.get(path).body
|
17
21
|
end
|
18
22
|
|
19
23
|
def auth_type(trx_type, group_id: nil)
|
20
24
|
group_id ||= @group_id
|
25
|
+
raise ArgumentError, 'group_id must be provided' if group_id.blank?
|
26
|
+
|
21
27
|
path = "api/v1/group/#{group_id}/trx/auth/#{trx_type}"
|
22
28
|
client.get(path).body
|
23
29
|
end
|
@@ -55,8 +61,11 @@ module QuorumSdk
|
|
55
61
|
trx_auth_mode = kwargs[:trx_auth_mode]
|
56
62
|
raise ArgumentError, 'trx_auth_mode must be one of follow_alw_list/follow_dny_list' unless trx_auth_mode.in? %w[follow_alw_list follow_dny_list]
|
57
63
|
|
64
|
+
group_id = kwargs[:group_id] || @group_id
|
65
|
+
raise ArgumentError, 'group_id must be provided' if group_id.blank?
|
66
|
+
|
58
67
|
update_chain_config(
|
59
|
-
group_id
|
68
|
+
group_id:,
|
60
69
|
type: 'set_trx_auth_mode',
|
61
70
|
config: {
|
62
71
|
trx_type:,
|
@@ -83,8 +92,11 @@ module QuorumSdk
|
|
83
92
|
pubkey = Base64.urlsafe_encode64(pubkey)
|
84
93
|
end
|
85
94
|
|
95
|
+
group_id = kwargs[:group_id] || @group_id
|
96
|
+
raise ArgumentError, 'group_id must be provided' if group_id.blank?
|
97
|
+
|
86
98
|
update_chain_config(
|
87
|
-
group_id
|
99
|
+
group_id:,
|
88
100
|
type: 'upd_alw_list',
|
89
101
|
config: {
|
90
102
|
trx_type:,
|
@@ -112,8 +124,11 @@ module QuorumSdk
|
|
112
124
|
pubkey = Base64.urlsafe_encode64(pubkey)
|
113
125
|
end
|
114
126
|
|
127
|
+
group_id = kwargs[:group_id] || @group_id
|
128
|
+
raise ArgumentError, 'group_id must be provided' if group_id.blank?
|
129
|
+
|
115
130
|
update_chain_config(
|
116
|
-
group_id
|
131
|
+
group_id:,
|
117
132
|
type: 'upd_dny_list',
|
118
133
|
config: {
|
119
134
|
trx_type:,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module QuorumSdk
|
4
|
+
class Chain
|
5
|
+
# Wrapper for HTTP APIs for chain
|
6
|
+
module Node
|
7
|
+
def network
|
8
|
+
path = 'api/v1/network'
|
9
|
+
client.get(path).body
|
10
|
+
end
|
11
|
+
|
12
|
+
def node
|
13
|
+
path = 'api/v1/node'
|
14
|
+
client.get(path).body
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'chain/chain'
|
4
|
+
require_relative 'chain/group'
|
5
|
+
require_relative 'chain/management'
|
6
|
+
require_relative 'chain/node'
|
7
|
+
require_relative 'client'
|
8
|
+
|
9
|
+
module QuorumSdk
|
10
|
+
# Wrapper for HTTP APIs as chain admin
|
11
|
+
class Chain
|
12
|
+
attr_reader :chain_url, :jwt, :client
|
13
|
+
|
14
|
+
def initialize(**kwargs)
|
15
|
+
@chain_url = kwargs[:chain_url]
|
16
|
+
@jwt = kwargs[:jwt]
|
17
|
+
|
18
|
+
@client = QuorumSdk::Client.new(@chain_url, @jwt)
|
19
|
+
end
|
20
|
+
|
21
|
+
include QuorumSdk::Chain::Chain
|
22
|
+
include QuorumSdk::Chain::Group
|
23
|
+
include QuorumSdk::Chain::Management
|
24
|
+
include QuorumSdk::Chain::Node
|
25
|
+
end
|
26
|
+
end
|