quorum_sdk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,432 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ # source: lib/proto/chain.proto
5
+
6
+ require 'google/protobuf'
7
+
8
+ Google::Protobuf::DescriptorPool.generated_pool.build do
9
+ add_file('lib/proto/chain.proto', syntax: :proto3) do
10
+ add_message 'quorum.pb.Package' do
11
+ optional :type, :enum, 1, 'quorum.pb.PackageType'
12
+ optional :Data, :bytes, 2
13
+ end
14
+ add_message 'quorum.pb.Trx' do
15
+ optional :TrxId, :string, 1
16
+ optional :Type, :enum, 2, 'quorum.pb.TrxType'
17
+ optional :GroupId, :string, 3
18
+ optional :Data, :bytes, 4
19
+ optional :TimeStamp, :int64, 5
20
+ optional :Version, :string, 6
21
+ optional :Expired, :int64, 7
22
+ optional :ResendCount, :int64, 8
23
+ optional :Nonce, :int64, 9
24
+ optional :SenderPubkey, :string, 10
25
+ optional :SenderSign, :bytes, 11
26
+ optional :StorageType, :enum, 12, 'quorum.pb.TrxStroageType'
27
+ end
28
+ 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
+ optional :GroupId, :string, 1
84
+ optional :UserPeerId, :string, 2
85
+ optional :UserPubkey, :string, 3
86
+ optional :UserSign, :string, 4
87
+ optional :Memo, :string, 5
88
+ end
89
+ add_message 'quorum.pb.AskPeerIdResp' do
90
+ optional :GroupId, :string, 1
91
+ optional :RespPeerId, :string, 2
92
+ optional :RespPeerPubkey, :string, 3
93
+ optional :RespSign, :string, 4
94
+ optional :IsDirectConnected, :bool, 5
95
+ end
96
+ add_message 'quorum.pb.BlockProduced' do
97
+ optional :BlockItem, :message, 1, 'quorum.pb.Block'
98
+ end
99
+ add_message 'quorum.pb.ReqBlockResp' do
100
+ optional :Result, :enum, 1, 'quorum.pb.ReqBlkResult'
101
+ optional :ProviderPubkey, :string, 2
102
+ optional :RequesterPubkey, :string, 3
103
+ optional :GroupId, :string, 4
104
+ optional :BlockId, :string, 5
105
+ optional :Block, :bytes, 6
106
+ end
107
+ add_message 'quorum.pb.PostItem' do
108
+ optional :TrxId, :string, 1
109
+ optional :PublisherPubkey, :string, 2
110
+ optional :Content, :bytes, 3
111
+ optional :TimeStamp, :int64, 4
112
+ end
113
+ add_message 'quorum.pb.ProducerItem' do
114
+ optional :GroupId, :string, 1
115
+ optional :ProducerPubkey, :string, 2
116
+ optional :GroupOwnerPubkey, :string, 3
117
+ optional :GroupOwnerSign, :string, 4
118
+ optional :TimeStamp, :int64, 5
119
+ optional :Action, :enum, 6, 'quorum.pb.ActionType'
120
+ optional :BlockProduced, :int64, 7
121
+ optional :Memo, :string, 8
122
+ end
123
+ add_message 'quorum.pb.UserItem' do
124
+ optional :GroupId, :string, 1
125
+ optional :UserPubkey, :string, 2
126
+ optional :EncryptPubkey, :string, 3
127
+ optional :GroupOwnerPubkey, :string, 4
128
+ optional :GroupOwnerSign, :string, 5
129
+ optional :TimeStamp, :int64, 6
130
+ optional :Action, :enum, 7, 'quorum.pb.ActionType'
131
+ optional :Memo, :string, 8
132
+ end
133
+ add_message 'quorum.pb.AnnounceItem' do
134
+ optional :GroupId, :string, 1
135
+ optional :SignPubkey, :string, 2
136
+ optional :EncryptPubkey, :string, 3
137
+ optional :AnnouncerSignature, :string, 4
138
+ optional :Type, :enum, 5, 'quorum.pb.AnnounceType'
139
+ optional :OwnerPubkey, :string, 6
140
+ optional :OwnerSignature, :string, 7
141
+ optional :Result, :enum, 8, 'quorum.pb.ApproveType'
142
+ optional :TimeStamp, :int64, 9
143
+ optional :Action, :enum, 10, 'quorum.pb.ActionType'
144
+ optional :Memo, :string, 11
145
+ 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
+ add_message 'quorum.pb.GroupItem' do
156
+ optional :GroupId, :string, 1
157
+ optional :GroupName, :string, 2
158
+ optional :OwnerPubKey, :string, 3
159
+ optional :UserSignPubkey, :string, 4
160
+ optional :UserEncryptPubkey, :string, 5
161
+ optional :LastUpdate, :int64, 6
162
+ optional :HighestHeight, :int64, 7
163
+ optional :HighestBlockId, :string, 8
164
+ optional :GenesisBlock, :message, 9, 'quorum.pb.Block'
165
+ optional :EncryptType, :enum, 10, 'quorum.pb.GroupEncryptType'
166
+ optional :ConsenseType, :enum, 11, 'quorum.pb.GroupConsenseType'
167
+ optional :CipherKey, :string, 12
168
+ optional :AppKey, :string, 13
169
+ end
170
+ add_message 'quorum.pb.ChainConfigItem' do
171
+ optional :GroupId, :string, 1
172
+ optional :Type, :enum, 2, 'quorum.pb.ChainConfigType'
173
+ optional :Data, :bytes, 3
174
+ optional :OwnerPubkey, :string, 4
175
+ optional :OwnerSignature, :string, 5
176
+ optional :TimeStamp, :int64, 6
177
+ optional :Memo, :string, 7
178
+ end
179
+ add_message 'quorum.pb.ChainSendTrxRuleListItem' do
180
+ optional :Action, :enum, 1, 'quorum.pb.ActionType'
181
+ optional :Pubkey, :string, 3
182
+ repeated :Type, :enum, 4, 'quorum.pb.TrxType'
183
+ end
184
+ add_message 'quorum.pb.SetTrxAuthModeItem' do
185
+ optional :Type, :enum, 1, 'quorum.pb.TrxType'
186
+ optional :Mode, :enum, 2, 'quorum.pb.TrxAuthMode'
187
+ 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
+ add_message 'quorum.pb.AppConfigItem' do
205
+ optional :GroupId, :string, 1
206
+ optional :Action, :enum, 2, 'quorum.pb.ActionType'
207
+ optional :Name, :string, 3
208
+ optional :Type, :enum, 4, 'quorum.pb.AppConfigType'
209
+ optional :Value, :string, 5
210
+ optional :OwnerPubkey, :string, 6
211
+ optional :OwnerSign, :string, 7
212
+ optional :Memo, :string, 8
213
+ optional :TimeStamp, :int64, 9
214
+ 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
+ add_message 'quorum.pb.GroupSeed' do
222
+ optional :GenesisBlock, :message, 1, 'quorum.pb.Block'
223
+ optional :GroupId, :string, 2
224
+ optional :GroupName, :string, 3
225
+ optional :OwnerPubkey, :string, 4
226
+ optional :ConsensusType, :string, 5
227
+ optional :EncryptionType, :string, 6
228
+ optional :CipherKey, :string, 7
229
+ optional :AppKey, :string, 8
230
+ optional :Signature, :string, 9
231
+ end
232
+ add_message 'quorum.pb.NodeSDKGroupItem' do
233
+ optional :Group, :message, 1, 'quorum.pb.GroupItem'
234
+ optional :EncryptAlias, :string, 2
235
+ optional :SignAlias, :string, 3
236
+ repeated :ApiUrl, :string, 4
237
+ optional :GroupSeed, :string, 5
238
+ 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
+ add_message 'quorum.pb.HBTrxBundle' do
245
+ repeated :Trxs, :message, 1, 'quorum.pb.Trx'
246
+ end
247
+ add_message 'quorum.pb.BroadcastMsg' do
248
+ optional :SenderPubkey, :string, 1
249
+ optional :Type, :enum, 2, 'quorum.pb.BroadcastMsgType'
250
+ optional :Epoch, :int64, 3
251
+ optional :Payload, :bytes, 4
252
+ end
253
+ add_message 'quorum.pb.Proof' do
254
+ optional :RootHash, :bytes, 1
255
+ repeated :Proof, :bytes, 2
256
+ optional :Index, :int64, 3
257
+ optional :Leaves, :int64, 4
258
+ optional :ProposerPubkey, :bytes, 5
259
+ optional :ProposerSign, :bytes, 6
260
+ end
261
+ add_message 'quorum.pb.Ready' do
262
+ optional :RootHash, :bytes, 1
263
+ optional :ProoferPubkey, :bytes, 2
264
+ optional :ProposerPubkey, :bytes, 3
265
+ optional :ProposerSign, :bytes, 4
266
+ end
267
+ add_message 'quorum.pb.AgreementMsg' do
268
+ optional :Type, :enum, 1, 'quorum.pb.AgreementMsgType'
269
+ optional :ProposerId, :string, 2
270
+ optional :SenderId, :string, 3
271
+ optional :Epoch, :int64, 4
272
+ optional :Payload, :bytes, 5
273
+ end
274
+ add_message 'quorum.pb.Bval' do
275
+ optional :Value, :bool, 1
276
+ end
277
+ add_message 'quorum.pb.Aux' do
278
+ optional :Value, :bool, 1
279
+ end
280
+ add_enum 'quorum.pb.PackageType' do
281
+ value :TRX, 0
282
+ value :BLOCK, 1
283
+ value :SNAPSHOT, 2
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
301
+ end
302
+ add_enum 'quorum.pb.AnnounceType' do
303
+ value :AS_USER, 0
304
+ value :AS_PRODUCER, 1
305
+ value :AS_USER_ENCRYPT, 2
306
+ end
307
+ add_enum 'quorum.pb.ApproveType' do
308
+ value :ANNOUNCED, 0
309
+ value :APPROVED, 1
310
+ value :REJECTED, 2
311
+ end
312
+ add_enum 'quorum.pb.ActionType' do
313
+ value :ADD, 0
314
+ value :REMOVE, 1
315
+ end
316
+ add_enum 'quorum.pb.TrxStroageType' do
317
+ value :CHAIN, 0
318
+ value :CACHE, 1
319
+ end
320
+ add_enum 'quorum.pb.SnapShotItemType' do
321
+ value :SNAPSHOT_APP_CONFIG, 0
322
+ value :SNAPSHOT_CHAIN_CONFIG, 1
323
+ value :SNAPSHOT_PRODUCER, 2
324
+ value :SNAPSHOT_USER, 3
325
+ value :SNAPSHOT_ANNOUNCE, 4
326
+ end
327
+ add_enum 'quorum.pb.ReqBlkResult' do
328
+ value :BLOCK_IN_TRX, 0
329
+ value :BLOCK_NOT_FOUND, 1
330
+ end
331
+ add_enum 'quorum.pb.GroupEncryptType' do
332
+ value :PUBLIC, 0
333
+ value :PRIVATE, 1
334
+ end
335
+ add_enum 'quorum.pb.GroupConsenseType' do
336
+ value :POA, 0
337
+ value :POS, 1
338
+ end
339
+ add_enum 'quorum.pb.RoleV0' do
340
+ value :GROUP_PRODUCER, 0
341
+ value :GROUP_USER, 1
342
+ end
343
+ add_enum 'quorum.pb.ChainConfigType' do
344
+ value :SET_TRX_AUTH_MODE, 0
345
+ value :UPD_DNY_LIST, 1
346
+ value :UPD_ALW_LIST, 2
347
+ end
348
+ add_enum 'quorum.pb.TrxAuthMode' do
349
+ value :FOLLOW_ALW_LIST, 0
350
+ value :FOLLOW_DNY_LIST, 1
351
+ end
352
+ add_enum 'quorum.pb.AuthListType' do
353
+ value :ALLOW_LIST, 0
354
+ value :DENY_LIST, 1
355
+ end
356
+ add_enum 'quorum.pb.AppConfigType' do
357
+ value :INT, 0
358
+ value :BOOL, 1
359
+ value :STRING, 2
360
+ end
361
+ add_enum 'quorum.pb.HBBMsgType' do
362
+ value :AGREEMENT, 0
363
+ value :BROADCAST, 1
364
+ end
365
+ add_enum 'quorum.pb.BroadcastMsgType' do
366
+ value :PROOF, 0
367
+ value :READY, 1
368
+ end
369
+ add_enum 'quorum.pb.AgreementMsgType' do
370
+ value :BVAL, 0
371
+ value :AUX, 1
372
+ end
373
+ end
374
+ end
375
+
376
+ module Quorum
377
+ module Pb
378
+ Package = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Package').msgclass
379
+ Trx = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Trx').msgclass
380
+ 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
+ ReqBlock = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ReqBlock').msgclass
386
+ BlockSynced = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BlockSynced').msgclass
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
390
+ ReqBlockResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ReqBlockResp').msgclass
391
+ PostItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.PostItem').msgclass
392
+ ProducerItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ProducerItem').msgclass
393
+ UserItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.UserItem').msgclass
394
+ AnnounceItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AnnounceItem').msgclass
395
+ SchemaItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SchemaItem').msgclass
396
+ GroupItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupItem').msgclass
397
+ ChainConfigItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ChainConfigItem').msgclass
398
+ ChainSendTrxRuleListItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ChainSendTrxRuleListItem').msgclass
399
+ SetTrxAuthModeItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SetTrxAuthModeItem').msgclass
400
+ GroupItemV0 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupItemV0').msgclass
401
+ AppConfigItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AppConfigItem').msgclass
402
+ PSPing = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.PSPing').msgclass
403
+ GroupSeed = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupSeed').msgclass
404
+ NodeSDKGroupItem = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.NodeSDKGroupItem').msgclass
405
+ HBMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBMsg').msgclass
406
+ HBTrxBundle = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBTrxBundle').msgclass
407
+ BroadcastMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BroadcastMsg').msgclass
408
+ Proof = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Proof').msgclass
409
+ Ready = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Ready').msgclass
410
+ AgreementMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AgreementMsg').msgclass
411
+ Bval = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Bval').msgclass
412
+ Aux = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.Aux').msgclass
413
+ PackageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.PackageType').enummodule
414
+ TrxType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxType').enummodule
415
+ AnnounceType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AnnounceType').enummodule
416
+ ApproveType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ApproveType').enummodule
417
+ ActionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ActionType').enummodule
418
+ TrxStroageType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxStroageType').enummodule
419
+ SnapShotItemType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.SnapShotItemType').enummodule
420
+ ReqBlkResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ReqBlkResult').enummodule
421
+ GroupEncryptType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupEncryptType').enummodule
422
+ GroupConsenseType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.GroupConsenseType').enummodule
423
+ RoleV0 = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.RoleV0').enummodule
424
+ ChainConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.ChainConfigType').enummodule
425
+ TrxAuthMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.TrxAuthMode').enummodule
426
+ AuthListType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AuthListType').enummodule
427
+ AppConfigType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AppConfigType').enummodule
428
+ HBBMsgType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.HBBMsgType').enummodule
429
+ BroadcastMsgType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.BroadcastMsgType').enummodule
430
+ AgreementMsgType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup('quorum.pb.AgreementMsgType').enummodule
431
+ end
432
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api/light_node'
4
+
5
+ module QuorumSdk
6
+ # Quorum account
7
+ class Account < ::Eth::Key
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module QuorumSdk
4
+ class API
5
+ # Wrapper for HTTP APIs for chain
6
+ module Chain
7
+ def trx(trx_id)
8
+ path = "api/v1/trx/#{group_id}/#{trx_id}"
9
+ client.get path
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,88 @@
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
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'api/light_node'
4
+
5
+ module QuorumSdk
6
+ # HTTP Client wrapper
7
+ class Client
8
+ attr_reader :domains
9
+
10
+ def initialize(domains)
11
+ @domains = domains || []
12
+ @conn = Faraday.new(url: @domains.first) do |f|
13
+ f.request :json
14
+ f.response :json
15
+ f.response :logger
16
+ end
17
+ end
18
+
19
+ def post(path, **body)
20
+ @conn.post path, body.to_json
21
+ end
22
+
23
+ def get(path, **params)
24
+ @conn.post path, **params
25
+ end
26
+ end
27
+ end