@bitgo-beta/sdk-coin-trx 1.2.3-alpha.43 → 1.2.3-alpha.430

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.
Files changed (132) hide show
  1. package/dist/resources/protobuf/Contract.proto +32 -0
  2. package/dist/resources/protobuf/tron.d.ts +1478 -214
  3. package/dist/resources/protobuf/tron.js +6312 -2600
  4. package/dist/resources/protobuf/tron.proto +6 -0
  5. package/dist/src/index.js +6 -2
  6. package/dist/src/lib/constants.d.ts +3 -0
  7. package/dist/src/lib/constants.d.ts.map +1 -0
  8. package/dist/src/lib/constants.js +6 -0
  9. package/dist/src/lib/contractCallBuilder.d.ts +1 -35
  10. package/dist/src/lib/contractCallBuilder.d.ts.map +1 -1
  11. package/dist/src/lib/contractCallBuilder.js +12 -75
  12. package/dist/src/lib/delegateResourceTxBuilder.d.ts +27 -0
  13. package/dist/src/lib/delegateResourceTxBuilder.d.ts.map +1 -0
  14. package/dist/src/lib/delegateResourceTxBuilder.js +98 -0
  15. package/dist/src/lib/enum.d.ts +36 -1
  16. package/dist/src/lib/enum.d.ts.map +1 -1
  17. package/dist/src/lib/enum.js +40 -4
  18. package/dist/src/lib/freezeBalanceTxBuilder.d.ts +71 -0
  19. package/dist/src/lib/freezeBalanceTxBuilder.d.ts.map +1 -0
  20. package/dist/src/lib/freezeBalanceTxBuilder.js +211 -0
  21. package/dist/src/lib/iface.d.ts +220 -2
  22. package/dist/src/lib/iface.d.ts.map +1 -1
  23. package/dist/src/lib/iface.js +1 -1
  24. package/dist/src/lib/index.js +23 -9
  25. package/dist/src/lib/keyPair.d.ts +0 -1
  26. package/dist/src/lib/keyPair.d.ts.map +1 -1
  27. package/dist/src/lib/keyPair.js +31 -18
  28. package/dist/src/lib/resourceManagementTxBuilder.d.ts +72 -0
  29. package/dist/src/lib/resourceManagementTxBuilder.d.ts.map +1 -0
  30. package/dist/src/lib/resourceManagementTxBuilder.js +150 -0
  31. package/dist/src/lib/tokenTransferBuilder.d.ts +1 -1
  32. package/dist/src/lib/tokenTransferBuilder.js +3 -3
  33. package/dist/src/lib/transaction.d.ts.map +1 -1
  34. package/dist/src/lib/transaction.js +92 -6
  35. package/dist/src/lib/transactionBuilder.d.ts +50 -5
  36. package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
  37. package/dist/src/lib/transactionBuilder.js +110 -21
  38. package/dist/src/lib/undelegateResourceTxBuilder.d.ts +27 -0
  39. package/dist/src/lib/undelegateResourceTxBuilder.d.ts.map +1 -0
  40. package/dist/src/lib/undelegateResourceTxBuilder.js +98 -0
  41. package/dist/src/lib/unfreezeBalanceTxBuilder.d.ts +65 -0
  42. package/dist/src/lib/unfreezeBalanceTxBuilder.d.ts.map +1 -0
  43. package/dist/src/lib/unfreezeBalanceTxBuilder.js +204 -0
  44. package/dist/src/lib/utils.d.ts +85 -4
  45. package/dist/src/lib/utils.d.ts.map +1 -1
  46. package/dist/src/lib/utils.js +445 -47
  47. package/dist/src/lib/voteWitnessTxBuilder.d.ts +62 -0
  48. package/dist/src/lib/voteWitnessTxBuilder.d.ts.map +1 -0
  49. package/dist/src/lib/voteWitnessTxBuilder.js +219 -0
  50. package/dist/src/lib/withdrawBuilder.d.ts +49 -0
  51. package/dist/src/lib/withdrawBuilder.d.ts.map +1 -0
  52. package/dist/src/lib/withdrawBuilder.js +167 -0
  53. package/dist/src/lib/withdrawExpireUnfreezeTxBuilder.d.ts +49 -0
  54. package/dist/src/lib/withdrawExpireUnfreezeTxBuilder.d.ts.map +1 -0
  55. package/dist/src/lib/withdrawExpireUnfreezeTxBuilder.js +167 -0
  56. package/dist/src/lib/wrappedBuilder.d.ts +56 -0
  57. package/dist/src/lib/wrappedBuilder.d.ts.map +1 -1
  58. package/dist/src/lib/wrappedBuilder.js +86 -2
  59. package/dist/src/trx.d.ts +78 -4
  60. package/dist/src/trx.d.ts.map +1 -1
  61. package/dist/src/trx.js +436 -147
  62. package/dist/src/trxToken.d.ts +2 -2
  63. package/dist/src/trxToken.d.ts.map +1 -1
  64. package/dist/src/trxToken.js +5 -5
  65. package/dist/test/fixtures.d.ts +40 -0
  66. package/dist/test/fixtures.d.ts.map +1 -0
  67. package/dist/test/fixtures.js +46 -0
  68. package/dist/test/resources.d.ts +586 -0
  69. package/dist/test/resources.d.ts.map +1 -0
  70. package/dist/test/resources.js +746 -0
  71. package/dist/test/unit/index.d.ts +2 -0
  72. package/dist/test/unit/index.d.ts.map +1 -0
  73. package/dist/test/unit/index.js +19 -0
  74. package/dist/test/unit/keyPair.d.ts +2 -0
  75. package/dist/test/unit/keyPair.d.ts.map +1 -0
  76. package/dist/test/unit/keyPair.js +163 -0
  77. package/dist/test/unit/transaction.d.ts +2 -0
  78. package/dist/test/unit/transaction.d.ts.map +1 -0
  79. package/dist/test/unit/transaction.js +38 -0
  80. package/dist/test/unit/transactionBuilder/contractCallBuilder.d.ts +2 -0
  81. package/dist/test/unit/transactionBuilder/contractCallBuilder.d.ts.map +1 -0
  82. package/dist/test/unit/transactionBuilder/contractCallBuilder.js +315 -0
  83. package/dist/test/unit/transactionBuilder/delegateResourceTxBuilder.d.ts +2 -0
  84. package/dist/test/unit/transactionBuilder/delegateResourceTxBuilder.d.ts.map +1 -0
  85. package/dist/test/unit/transactionBuilder/delegateResourceTxBuilder.js +255 -0
  86. package/dist/test/unit/transactionBuilder/freezeBalanceTxBuilder.d.ts +2 -0
  87. package/dist/test/unit/transactionBuilder/freezeBalanceTxBuilder.d.ts.map +1 -0
  88. package/dist/test/unit/transactionBuilder/freezeBalanceTxBuilder.js +285 -0
  89. package/dist/test/unit/transactionBuilder/tokenTransferBuilder.d.ts +2 -0
  90. package/dist/test/unit/transactionBuilder/tokenTransferBuilder.d.ts.map +1 -0
  91. package/dist/test/unit/transactionBuilder/tokenTransferBuilder.js +42 -0
  92. package/dist/test/unit/transactionBuilder/undelegateResourceTxBuilder.d.ts +2 -0
  93. package/dist/test/unit/transactionBuilder/undelegateResourceTxBuilder.d.ts.map +1 -0
  94. package/dist/test/unit/transactionBuilder/undelegateResourceTxBuilder.js +255 -0
  95. package/dist/test/unit/transactionBuilder/unfreezeBalanceTxBuilder.d.ts +2 -0
  96. package/dist/test/unit/transactionBuilder/unfreezeBalanceTxBuilder.d.ts.map +1 -0
  97. package/dist/test/unit/transactionBuilder/unfreezeBalanceTxBuilder.js +256 -0
  98. package/dist/test/unit/transactionBuilder/voteWitnessTxBuilder.d.ts +2 -0
  99. package/dist/test/unit/transactionBuilder/voteWitnessTxBuilder.d.ts.map +1 -0
  100. package/dist/test/unit/transactionBuilder/voteWitnessTxBuilder.js +277 -0
  101. package/dist/test/unit/transactionBuilder/withdrawBalanceBuilder.d.ts +2 -0
  102. package/dist/test/unit/transactionBuilder/withdrawBalanceBuilder.d.ts.map +1 -0
  103. package/dist/test/unit/transactionBuilder/withdrawBalanceBuilder.js +213 -0
  104. package/dist/test/unit/transactionBuilder/withdrawExpireUnfreezeTxBuilder.d.ts +2 -0
  105. package/dist/test/unit/transactionBuilder/withdrawExpireUnfreezeTxBuilder.d.ts.map +1 -0
  106. package/dist/test/unit/transactionBuilder/withdrawExpireUnfreezeTxBuilder.js +213 -0
  107. package/dist/test/unit/transactionBuilder/wrappedBuilder.d.ts +2 -0
  108. package/dist/test/unit/transactionBuilder/wrappedBuilder.d.ts.map +1 -0
  109. package/dist/test/unit/transactionBuilder/wrappedBuilder.js +50 -0
  110. package/dist/test/unit/transactionBuilder.d.ts +2 -0
  111. package/dist/test/unit/transactionBuilder.d.ts.map +1 -0
  112. package/dist/test/unit/transactionBuilder.js +178 -0
  113. package/dist/test/unit/trx.d.ts +2 -0
  114. package/dist/test/unit/trx.d.ts.map +1 -0
  115. package/dist/test/unit/trx.js +639 -0
  116. package/dist/test/unit/util.d.ts +2 -0
  117. package/dist/test/unit/util.d.ts.map +1 -0
  118. package/dist/test/unit/util.js +141 -0
  119. package/dist/test/unit/verifyTransaction.d.ts +2 -0
  120. package/dist/test/unit/verifyTransaction.d.ts.map +1 -0
  121. package/dist/test/unit/verifyTransaction.js +378 -0
  122. package/dist/tsconfig.tsbuildinfo +1 -0
  123. package/package.json +20 -15
  124. package/.eslintignore +0 -5
  125. package/.mocharc.yml +0 -8
  126. package/CHANGELOG.md +0 -118
  127. package/resources/README.md +0 -31
  128. package/resources/protobuf/Contract.proto +0 -256
  129. package/resources/protobuf/Discover.proto +0 -44
  130. package/resources/protobuf/tron.d.ts +0 -11205
  131. package/resources/protobuf/tron.js +0 -33480
  132. package/resources/protobuf/tron.proto +0 -677
@@ -1,677 +0,0 @@
1
- syntax = "proto3";
2
-
3
- import "google/protobuf/any.proto";
4
- import "Discover.proto";
5
-
6
- package protocol;
7
-
8
-
9
- option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file
10
- option java_outer_classname = "Protocol"; //Specify the class name of the generated Java file
11
- option go_package = "github.com/tronprotocol/grpc-gateway/core";
12
-
13
- enum AccountType {
14
- Normal = 0;
15
- AssetIssue = 1;
16
- Contract = 2;
17
- }
18
-
19
- // AccountId, (name, address) use name, (null, address) use address, (name, null) use name,
20
- message AccountId {
21
- bytes name = 1;
22
- bytes address = 2;
23
- }
24
-
25
- // vote message
26
- message Vote {
27
- // the super rep address
28
- bytes vote_address = 1;
29
- // the vote num to this super rep.
30
- int64 vote_count = 2;
31
- }
32
-
33
- // Proposal
34
- message Proposal {
35
- int64 proposal_id = 1;
36
- bytes proposer_address = 2;
37
- map<int64, int64> parameters = 3;
38
- int64 expiration_time = 4;
39
- int64 create_time = 5;
40
- repeated bytes approvals = 6;
41
- enum State {
42
- PENDING = 0;
43
- DISAPPROVED = 1;
44
- APPROVED = 2;
45
- CANCELED = 3;
46
- }
47
- State state = 7;
48
- }
49
-
50
- // Exchange
51
- message Exchange {
52
- int64 exchange_id = 1;
53
- bytes creator_address = 2;
54
- int64 create_time = 3;
55
- bytes first_token_id = 6;
56
- int64 first_token_balance = 7;
57
- bytes second_token_id = 8;
58
- int64 second_token_balance = 9;
59
- }
60
-
61
- message ChainParameters {
62
- repeated ChainParameter chainParameter = 1;
63
- message ChainParameter {
64
- string key = 1;
65
- int64 value = 2;
66
- }
67
- }
68
-
69
- /* Account */
70
- message Account {
71
- /* frozen balance */
72
- message Frozen {
73
- int64 frozen_balance = 1; // the frozen trx balance
74
- int64 expire_time = 2; // the expire time
75
- }
76
- // account nick name
77
- bytes account_name = 1;
78
- AccountType type = 2;
79
- // the create address
80
- bytes address = 3;
81
- // the trx balance
82
- int64 balance = 4;
83
- // the votes
84
- repeated Vote votes = 5;
85
- // the other asset owned by this account
86
- map<string, int64> asset = 6;
87
-
88
- // the other asset owned by this account,key is assetId
89
- map<string, int64> assetV2 = 56;
90
-
91
- // the frozen balance for bandwidth
92
- repeated Frozen frozen = 7;
93
- // bandwidth, get from frozen
94
- int64 net_usage = 8;
95
- //Frozen balance provided by other accounts to this account
96
- int64 acquired_delegated_frozen_balance_for_bandwidth = 41;
97
- //Freeze and provide balances to other accounts
98
- int64 delegated_frozen_balance_for_bandwidth = 42;
99
-
100
- // this account create time
101
- int64 create_time = 0x09;
102
- // this last operation time, including transfer, voting and so on. //FIXME fix grammar
103
- int64 latest_opration_time = 10;
104
- // witness block producing allowance
105
- int64 allowance = 0x0B;
106
- // last withdraw time
107
- int64 latest_withdraw_time = 0x0C;
108
- // not used so far
109
- bytes code = 13;
110
- bool is_witness = 14;
111
- bool is_committee = 15;
112
- // frozen asset(for asset issuer)
113
- repeated Frozen frozen_supply = 16;
114
- // asset_issued_name
115
- bytes asset_issued_name = 17;
116
- bytes asset_issued_ID = 57;
117
- map<string, int64> latest_asset_operation_time = 18;
118
- map<string, int64> latest_asset_operation_timeV2 = 58;
119
- int64 free_net_usage = 19;
120
- map<string, int64> free_asset_net_usage = 20;
121
- map<string, int64> free_asset_net_usageV2 = 59;
122
- int64 latest_consume_time = 21;
123
- int64 latest_consume_free_time = 22;
124
-
125
- // the identity of this account, case insensitive
126
- bytes account_id = 23;
127
-
128
- message AccountResource {
129
- // energy resource, get from frozen
130
- int64 energy_usage = 1;
131
- // the frozen balance for energy
132
- Frozen frozen_balance_for_energy = 2;
133
- int64 latest_consume_time_for_energy = 3;
134
-
135
- //Frozen balance provided by other accounts to this account
136
- int64 acquired_delegated_frozen_balance_for_energy = 4;
137
- //Frozen balances provided to other accounts
138
- int64 delegated_frozen_balance_for_energy = 5;
139
-
140
- // storage resource, get from market
141
- int64 storage_limit = 6;
142
- int64 storage_usage = 7;
143
- int64 latest_exchange_storage_time = 8;
144
-
145
- }
146
- AccountResource account_resource = 26;
147
- bytes codeHash = 30;
148
- Permission owner_permission = 31;
149
- Permission witness_permission = 32;
150
- repeated Permission active_permission = 33;
151
- }
152
-
153
-
154
- message Key {
155
- bytes address = 1;
156
- int64 weight = 2;
157
- }
158
-
159
- message DelegatedResource {
160
- bytes from = 1;
161
- bytes to = 2;
162
- int64 frozen_balance_for_bandwidth = 3;
163
- int64 frozen_balance_for_energy = 4;
164
- int64 expire_time_for_bandwidth = 5;
165
- int64 expire_time_for_energy = 6;
166
- }
167
-
168
- message authority {
169
- AccountId account = 1;
170
- bytes permission_name = 2;
171
- }
172
-
173
- message Permission {
174
- enum PermissionType {
175
- Owner = 0;
176
- Witness = 1;
177
- Active = 2;
178
- }
179
- PermissionType type = 1;
180
- int32 id = 2; //Owner id=0, Witness id=1, Active id start by 2
181
- string permission_name = 3;
182
- int64 threshold = 4;
183
- int32 parent_id = 5;
184
- bytes operations = 6; //1 bit 1 contract
185
- repeated Key keys = 7;
186
- }
187
-
188
- // Witness
189
- message Witness {
190
- bytes address = 1;
191
- int64 voteCount = 2;
192
- bytes pubKey = 3;
193
- string url = 4;
194
- int64 totalProduced = 5;
195
- int64 totalMissed = 6;
196
- int64 latestBlockNum = 7;
197
- int64 latestSlotNum = 8;
198
- bool isJobs = 9;
199
- }
200
-
201
- // Vote Change
202
- message Votes {
203
- bytes address = 1;
204
- repeated Vote old_votes = 2;
205
- repeated Vote new_votes = 3;
206
- }
207
-
208
- // Transcation
209
-
210
- message TXOutput {
211
- int64 value = 1;
212
- bytes pubKeyHash = 2;
213
- }
214
-
215
- message TXInput {
216
- message raw {
217
- bytes txID = 1;
218
- int64 vout = 2;
219
- bytes pubKey = 3;
220
- }
221
- raw raw_data = 1;
222
- bytes signature = 4;
223
- }
224
-
225
- message TXOutputs {
226
- repeated TXOutput outputs = 1;
227
- }
228
-
229
- message ResourceReceipt {
230
- int64 energy_usage = 1;
231
- int64 energy_fee = 2;
232
- int64 origin_energy_usage = 3;
233
- int64 energy_usage_total = 4;
234
- int64 net_usage = 5;
235
- int64 net_fee = 6;
236
- Transaction.Result.contractResult result = 7;
237
- }
238
-
239
- message Transaction {
240
- message Contract {
241
- enum ContractType {
242
- AccountCreateContract = 0;
243
- TransferContract = 1;
244
- TransferAssetContract = 2;
245
- VoteAssetContract = 3;
246
- VoteWitnessContract = 4;
247
- WitnessCreateContract = 5;
248
- AssetIssueContract = 6;
249
- WitnessUpdateContract = 8;
250
- ParticipateAssetIssueContract = 9;
251
- AccountUpdateContract = 10;
252
- FreezeBalanceContract = 11;
253
- UnfreezeBalanceContract = 12;
254
- WithdrawBalanceContract = 13;
255
- UnfreezeAssetContract = 14;
256
- UpdateAssetContract = 15;
257
- ProposalCreateContract = 16;
258
- ProposalApproveContract = 17;
259
- ProposalDeleteContract = 18;
260
- SetAccountIdContract = 19;
261
- CustomContract = 20;
262
- // BuyStorageContract = 21;
263
- // BuyStorageBytesContract = 22;
264
- // SellStorageContract = 23;
265
- CreateSmartContract = 30;
266
- TriggerSmartContract = 31;
267
- GetContract = 32;
268
- UpdateSettingContract = 33;
269
- ExchangeCreateContract = 41;
270
- ExchangeInjectContract = 42;
271
- ExchangeWithdrawContract = 43;
272
- ExchangeTransactionContract = 44;
273
- UpdateEnergyLimitContract = 45;
274
- AccountPermissionUpdateContract = 46;
275
- ClearABIContract = 48;
276
- }
277
- ContractType type = 1;
278
- google.protobuf.Any parameter = 2;
279
- bytes provider = 3;
280
- bytes ContractName = 4;
281
- int32 Permission_id = 5;
282
- }
283
-
284
- message Result {
285
- enum code {
286
- SUCESS = 0;
287
- FAILED = 1;
288
- }
289
- enum contractResult {
290
- DEFAULT = 0;
291
- SUCCESS = 1;
292
- REVERT = 2;
293
- BAD_JUMP_DESTINATION = 3;
294
- OUT_OF_MEMORY = 4;
295
- PRECOMPILED_CONTRACT = 5;
296
- STACK_TOO_SMALL = 6;
297
- STACK_TOO_LARGE = 7;
298
- ILLEGAL_OPERATION = 8;
299
- STACK_OVERFLOW = 9;
300
- OUT_OF_ENERGY = 10;
301
- OUT_OF_TIME = 11;
302
- JVM_STACK_OVER_FLOW = 12;
303
- UNKNOWN = 13;
304
- TRANSFER_FAILED = 14;
305
- }
306
- int64 fee = 1;
307
- code ret = 2;
308
- contractResult contractRet = 3;
309
-
310
- string assetIssueID = 14;
311
- int64 withdraw_amount = 15;
312
- int64 unfreeze_amount = 16;
313
- int64 exchange_received_amount = 18;
314
- int64 exchange_inject_another_amount = 19;
315
- int64 exchange_withdraw_another_amount = 20;
316
- int64 exchange_id = 21;
317
- }
318
-
319
- message raw {
320
- bytes ref_block_bytes = 1;
321
- int64 ref_block_num = 3;
322
- bytes ref_block_hash = 4;
323
- int64 expiration = 8;
324
- repeated authority auths = 9;
325
- // data not used
326
- bytes data = 10;
327
- //only support size = 1, repeated list here for extension
328
- repeated Contract contract = 11;
329
- // scripts not used
330
- bytes scripts = 12;
331
- int64 timestamp = 14;
332
- int64 fee_limit = 18;
333
- }
334
-
335
- raw raw_data = 1;
336
- // only support size = 1, repeated list here for muti-sig extension
337
- repeated bytes signature = 2;
338
- repeated Result ret = 5;
339
- }
340
-
341
- message TransactionInfo {
342
- enum code {
343
- SUCESS = 0;
344
- FAILED = 1;
345
- }
346
- message Log {
347
- bytes address = 1;
348
- repeated bytes topics = 2;
349
- bytes data = 3;
350
- }
351
- bytes id = 1;
352
- int64 fee = 2;
353
- int64 blockNumber = 3;
354
- int64 blockTimeStamp = 4;
355
- repeated bytes contractResult = 5;
356
- bytes contract_address = 6;
357
- ResourceReceipt receipt = 7;
358
- repeated Log log = 8;
359
- code result = 9;
360
- bytes resMessage = 10;
361
-
362
- string assetIssueID = 14;
363
- int64 withdraw_amount = 15;
364
- int64 unfreeze_amount = 16;
365
- repeated InternalTransaction internal_transactions = 17;
366
- int64 exchange_received_amount = 18;
367
- int64 exchange_inject_another_amount = 19;
368
- int64 exchange_withdraw_another_amount = 20;
369
- int64 exchange_id = 21;
370
- }
371
-
372
- message TransactionRet {
373
- int64 blockNumber = 1;
374
- int64 blockTimeStamp = 2;
375
- repeated TransactionInfo transactioninfo = 3;
376
- }
377
-
378
- message Transactions {
379
- repeated Transaction transactions = 1;
380
- }
381
-
382
- message TransactionSign {
383
- Transaction transaction = 1;
384
- bytes privateKey = 2;
385
- }
386
-
387
- message BlockHeader {
388
- message raw {
389
- int64 timestamp = 1;
390
- bytes txTrieRoot = 2;
391
- bytes parentHash = 3;
392
- //bytes nonce = 5;
393
- //bytes difficulty = 6;
394
- int64 number = 7;
395
- int64 witness_id = 8;
396
- bytes witness_address = 9;
397
- int32 version = 10;
398
- bytes accountStateRoot = 11;
399
- }
400
- raw raw_data = 1;
401
- bytes witness_signature = 2;
402
- }
403
-
404
- // block
405
- message Block {
406
- repeated Transaction transactions = 1;
407
- BlockHeader block_header = 2;
408
- }
409
-
410
- message ChainInventory {
411
- message BlockId {
412
- bytes hash = 1;
413
- int64 number = 2;
414
- }
415
- repeated BlockId ids = 1;
416
- int64 remain_num = 2;
417
- }
418
-
419
- // Inventory
420
- message BlockInventory {
421
- enum Type {
422
- SYNC = 0;
423
- ADVTISE = 1;
424
- FETCH = 2;
425
- }
426
-
427
- message BlockId {
428
- bytes hash = 1;
429
- int64 number = 2;
430
- }
431
- repeated BlockId ids = 1;
432
- Type type = 2;
433
- }
434
-
435
- message Inventory {
436
- enum InventoryType {
437
- TRX = 0;
438
- BLOCK = 1;
439
- }
440
- InventoryType type = 1;
441
- repeated bytes ids = 2;
442
- }
443
-
444
- message Items {
445
- enum ItemType {
446
- ERR = 0;
447
- TRX = 1;
448
- BLOCK = 2;
449
- BLOCKHEADER = 3;
450
- }
451
-
452
- ItemType type = 1;
453
- repeated Block blocks = 2;
454
- repeated BlockHeader block_headers = 3;
455
- repeated Transaction transactions = 4;
456
- }
457
-
458
- // DynamicProperties
459
- message DynamicProperties {
460
- int64 last_solidity_block_num = 1;
461
- }
462
-
463
- enum ReasonCode {
464
- REQUESTED = 0x00;
465
- BAD_PROTOCOL = 0x02;
466
- TOO_MANY_PEERS = 0x04;
467
- DUPLICATE_PEER = 0x05;
468
- INCOMPATIBLE_PROTOCOL = 0x06;
469
- NULL_IDENTITY = 0x07;
470
- PEER_QUITING = 0x08;
471
- UNEXPECTED_IDENTITY = 0x09;
472
- LOCAL_IDENTITY = 0x0A;
473
- PING_TIMEOUT = 0x0B;
474
- USER_REASON = 0x10;
475
- RESET = 0x11;
476
- SYNC_FAIL = 0x12;
477
- FETCH_FAIL = 0x13;
478
- BAD_TX = 0x14;
479
- BAD_BLOCK = 0x15;
480
- FORKED = 0x16;
481
- UNLINKABLE = 0x17;
482
- INCOMPATIBLE_VERSION = 0x18;
483
- INCOMPATIBLE_CHAIN = 0x19;
484
- TIME_OUT = 0x20;
485
- CONNECT_FAIL = 0x21;
486
- TOO_MANY_PEERS_WITH_SAME_IP = 0x22;
487
- UNKNOWN = 0xFF;
488
- }
489
-
490
- message DisconnectMessage {
491
- ReasonCode reason = 1;
492
- }
493
-
494
- message HelloMessage {
495
- message BlockId {
496
- bytes hash = 1;
497
- int64 number = 2;
498
- }
499
-
500
- Endpoint from = 1;
501
- int32 version = 2;
502
- int64 timestamp = 3;
503
- BlockId genesisBlockId = 4;
504
- BlockId solidBlockId = 5;
505
- BlockId headBlockId = 6;
506
- }
507
-
508
- message SmartContract {
509
- message ABI {
510
- message Entry {
511
- enum EntryType {
512
- UnknownEntryType = 0;
513
- Constructor = 1;
514
- Function = 2;
515
- Event = 3;
516
- Fallback = 4;
517
- }
518
- message Param {
519
- bool indexed = 1;
520
- string name = 2;
521
- string type = 3;
522
- // SolidityType type = 3;
523
- }
524
- enum StateMutabilityType {
525
- UnknownMutabilityType = 0;
526
- Pure = 1;
527
- View = 2;
528
- Nonpayable = 3;
529
- Payable = 4;
530
- }
531
-
532
- bool anonymous = 1;
533
- bool constant = 2;
534
- string name = 3;
535
- repeated Param inputs = 4;
536
- repeated Param outputs = 5;
537
- EntryType type = 6;
538
- bool payable = 7;
539
- StateMutabilityType stateMutability = 8;
540
- }
541
- repeated Entry entrys = 1;
542
- }
543
- bytes origin_address = 1;
544
- bytes contract_address = 2;
545
- ABI abi = 3;
546
- bytes bytecode = 4;
547
- int64 call_value = 5;
548
- int64 consume_user_resource_percent = 6;
549
- string name = 7;
550
- int64 origin_energy_limit = 8;
551
- bytes code_hash = 9;
552
- bytes trx_hash = 10;
553
- }
554
-
555
- message InternalTransaction {
556
- // internalTransaction identity, the root InternalTransaction hash
557
- // should equals to root transaction id.
558
- bytes hash = 1;
559
- // the one send trx (TBD: or token) via function
560
- bytes caller_address = 2;
561
- // the one recieve trx (TBD: or token) via function
562
- bytes transferTo_address = 3;
563
- message CallValueInfo {
564
- // trx (TBD: or token) value
565
- int64 callValue = 1;
566
- // TBD: tokenName, trx should be empty
567
- string tokenId = 2;
568
- }
569
- repeated CallValueInfo callValueInfo = 4;
570
- bytes note = 5;
571
- bool rejected = 6;
572
- }
573
-
574
- message DelegatedResourceAccountIndex {
575
- bytes account = 1;
576
- repeated bytes fromAccounts = 2;
577
- repeated bytes toAccounts = 3;
578
- }
579
-
580
- message NodeInfo {
581
- int64 beginSyncNum = 1;
582
- string block = 2;
583
- string solidityBlock = 3;
584
- //connect information
585
- int32 currentConnectCount = 4;
586
- int32 activeConnectCount = 5;
587
- int32 passiveConnectCount = 6;
588
- int64 totalFlow = 7;
589
- repeated PeerInfo peerInfoList = 8;
590
- ConfigNodeInfo configNodeInfo = 9;
591
- MachineInfo machineInfo = 10;
592
- map<string, string> cheatWitnessInfoMap = 11;
593
-
594
- message PeerInfo {
595
- string lastSyncBlock = 1;
596
- int64 remainNum = 2;
597
- int64 lastBlockUpdateTime = 3;
598
- bool syncFlag = 4;
599
- int64 headBlockTimeWeBothHave = 5;
600
- bool needSyncFromPeer = 6;
601
- bool needSyncFromUs = 7;
602
- string host = 8;
603
- int32 port = 9;
604
- string nodeId = 10;
605
- int64 connectTime = 11;
606
- double avgLatency = 12;
607
- int32 syncToFetchSize = 13;
608
- int64 syncToFetchSizePeekNum = 14;
609
- int32 syncBlockRequestedSize = 15;
610
- int64 unFetchSynNum = 16;
611
- int32 blockInPorcSize = 17;
612
- string headBlockWeBothHave = 18;
613
- bool isActive = 19;
614
- int32 score = 20;
615
- int32 nodeCount = 21;
616
- int64 inFlow = 22;
617
- int32 disconnectTimes = 23;
618
- string localDisconnectReason = 24;
619
- string remoteDisconnectReason = 25;
620
- }
621
-
622
- message ConfigNodeInfo {
623
- string codeVersion = 1;
624
- string p2pVersion = 2;
625
- int32 listenPort = 3;
626
- bool discoverEnable = 4;
627
- int32 activeNodeSize = 5;
628
- int32 passiveNodeSize = 6;
629
- int32 sendNodeSize = 7;
630
- int32 maxConnectCount = 8;
631
- int32 sameIpMaxConnectCount = 9;
632
- int32 backupListenPort = 10;
633
- int32 backupMemberSize = 11;
634
- int32 backupPriority = 12;
635
- int32 dbVersion = 13;
636
- int32 minParticipationRate = 14;
637
- bool supportConstant = 15;
638
- double minTimeRatio = 16;
639
- double maxTimeRatio = 17;
640
- int64 allowCreationOfContracts = 18;
641
- int64 allowAdaptiveEnergy = 19;
642
- }
643
-
644
- message MachineInfo {
645
- int32 threadCount = 1;
646
- int32 deadLockThreadCount = 2;
647
- int32 cpuCount = 3;
648
- int64 totalMemory = 4;
649
- int64 freeMemory = 5;
650
- double cpuRate = 6;
651
- string javaVersion = 7;
652
- string osName = 8;
653
- int64 jvmTotalMemoery = 9;
654
- int64 jvmFreeMemory = 10;
655
- double processCpuRate = 11;
656
- repeated MemoryDescInfo memoryDescInfoList = 12;
657
- repeated DeadLockThreadInfo deadLockThreadInfoList = 13;
658
-
659
- message MemoryDescInfo {
660
- string name = 1;
661
- int64 initSize = 2;
662
- int64 useSize = 3;
663
- int64 maxSize = 4;
664
- double useRate = 5;
665
- }
666
-
667
- message DeadLockThreadInfo {
668
- string name = 1;
669
- string lockName = 2;
670
- string lockOwner = 3;
671
- string state = 4;
672
- int64 blockTime = 5;
673
- int64 waitTime = 6;
674
- string stackTrace = 7;
675
- }
676
- }
677
- }