trac-msb 0.2.8 → 0.2.10

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 (151) hide show
  1. package/.github/workflows/acceptance-tests.yml +7 -11
  2. package/.github/workflows/lint-pr-title.yml +26 -0
  3. package/.github/workflows/unit-tests.yml +2 -8
  4. package/CODE_OF_CONDUCT.md +128 -0
  5. package/README.md +33 -18
  6. package/docker-compose.yml +1 -0
  7. package/docs/trac_network_http_api.openapi.yaml +889 -0
  8. package/msb.mjs +5 -22
  9. package/package.json +14 -10
  10. package/proto/network.proto +74 -0
  11. package/rpc/create_server.js +2 -2
  12. package/rpc/handlers.js +165 -92
  13. package/rpc/routes/v1.js +3 -1
  14. package/rpc/rpc_server.js +4 -4
  15. package/rpc/rpc_services.js +62 -25
  16. package/rpc/utils/helpers.js +83 -52
  17. package/src/config/args.js +46 -0
  18. package/src/config/config.js +78 -5
  19. package/src/config/env.js +70 -3
  20. package/src/core/network/Network.js +34 -70
  21. package/src/core/network/identity/NetworkWalletFactory.js +2 -2
  22. package/src/core/network/protocols/LegacyProtocol.js +67 -0
  23. package/src/core/network/protocols/NetworkMessages.js +48 -0
  24. package/src/core/network/protocols/ProtocolInterface.js +31 -0
  25. package/src/core/network/protocols/ProtocolSession.js +59 -0
  26. package/src/core/network/protocols/V1Protocol.js +64 -0
  27. package/src/core/network/protocols/legacy/NetworkMessageRouter.js +84 -0
  28. package/src/core/network/protocols/legacy/handlers/GetRequestHandler.js +53 -0
  29. package/src/core/network/protocols/legacy/handlers/ResponseHandler.js +37 -0
  30. package/src/core/network/{messaging → protocols/legacy}/validators/base/BaseResponse.js +2 -3
  31. package/src/core/network/protocols/shared/handlers/RoleOperationHandler.js +88 -0
  32. package/src/core/network/protocols/shared/handlers/SubnetworkOperationHandler.js +93 -0
  33. package/src/core/network/{messaging → protocols/shared}/handlers/TransferOperationHandler.js +17 -16
  34. package/src/core/network/{messaging → protocols/shared}/handlers/base/BaseOperationHandler.js +10 -15
  35. package/src/core/network/{messaging → protocols/shared}/validators/PartialBootstrapDeployment.js +2 -2
  36. package/src/core/network/{messaging → protocols/shared}/validators/PartialRoleAccess.js +5 -5
  37. package/src/core/network/{messaging → protocols/shared}/validators/PartialTransaction.js +4 -4
  38. package/src/core/network/{messaging → protocols/shared}/validators/PartialTransfer.js +4 -4
  39. package/src/core/network/{messaging → protocols/shared}/validators/base/PartialOperation.js +14 -12
  40. package/src/core/network/protocols/v1/NetworkMessageRouter.js +15 -0
  41. package/src/core/network/services/ConnectionManager.js +5 -5
  42. package/src/core/network/services/MessageOrchestrator.js +2 -2
  43. package/src/core/network/services/TransactionPoolService.js +5 -6
  44. package/src/core/network/services/TransactionRateLimiterService.js +12 -13
  45. package/src/core/network/services/ValidatorObserverService.js +5 -6
  46. package/src/core/state/State.js +3 -5
  47. package/src/index.js +156 -181
  48. package/src/messages/network/v1/NetworkMessageBuilder.js +325 -0
  49. package/src/messages/network/v1/NetworkMessageDirector.js +137 -0
  50. package/src/messages/network/v1/networkMessageFactory.js +12 -0
  51. package/src/messages/state/ApplyStateMessageBuilder.js +661 -0
  52. package/src/messages/state/ApplyStateMessageDirector.js +516 -0
  53. package/src/messages/state/applyStateMessageFactory.js +12 -0
  54. package/src/utils/buffer.js +53 -1
  55. package/src/utils/check.js +1 -1
  56. package/src/utils/cli.js +0 -8
  57. package/src/utils/constants.js +33 -30
  58. package/src/utils/fileUtils.js +13 -0
  59. package/src/utils/normalizers.js +84 -2
  60. package/src/utils/protobuf/network.cjs +840 -0
  61. package/src/utils/protobuf/operationHelpers.js +10 -0
  62. package/src/utils/type.js +26 -0
  63. package/tests/acceptance/v1/balance/balance.test.mjs +1 -2
  64. package/tests/acceptance/v1/broadcast-transaction/broadcast-transaction.test.mjs +26 -30
  65. package/tests/acceptance/v1/health/health.test.mjs +33 -0
  66. package/tests/acceptance/v1/rpc.test.mjs +4 -3
  67. package/tests/acceptance/v1/tx/tx.test.mjs +27 -16
  68. package/tests/acceptance/v1/tx-details/tx-details.test.mjs +26 -12
  69. package/tests/fixtures/check.fixtures.js +33 -32
  70. package/tests/fixtures/networkV1.fixtures.js +85 -0
  71. package/tests/fixtures/protobuf.fixtures.js +109 -25
  72. package/tests/helpers/StateNetworkFactory.js +2 -2
  73. package/tests/helpers/address.js +6 -0
  74. package/tests/helpers/autobaseTestHelpers.js +2 -1
  75. package/tests/helpers/config.js +2 -1
  76. package/tests/helpers/setupApplyTests.js +59 -56
  77. package/tests/unit/messages/messages.test.js +12 -0
  78. package/tests/unit/messages/network/NetworkMessageBuilder.test.js +276 -0
  79. package/tests/unit/messages/network/NetworkMessageDirector.test.js +201 -0
  80. package/tests/unit/messages/state/applyStateMessageBuilder.complete.test.js +521 -0
  81. package/tests/unit/messages/state/applyStateMessageBuilder.partial.test.js +233 -0
  82. package/tests/unit/network/ConnectionManager.test.js +6 -5
  83. package/tests/unit/network/networkModule.test.js +3 -2
  84. package/tests/unit/state/apply/addAdmin/addAdminHappyPathScenario.js +10 -6
  85. package/tests/unit/state/apply/addAdmin/addAdminScenarioHelpers.js +9 -6
  86. package/tests/unit/state/apply/addAdmin/state.apply.addAdmin.test.js +10 -7
  87. package/tests/unit/state/apply/addIndexer/addIndexerScenarioHelpers.js +18 -21
  88. package/tests/unit/state/apply/addWriter/addWriterScenarioHelpers.js +53 -38
  89. package/tests/unit/state/apply/adminRecovery/adminRecoveryScenarioHelpers.js +46 -35
  90. package/tests/unit/state/apply/appendWhitelist/appendWhitelistScenarioHelpers.js +13 -16
  91. package/tests/unit/state/apply/balanceInitialization/balanceInitializationScenarioHelpers.js +17 -11
  92. package/tests/unit/state/apply/banValidator/banValidatorScenarioHelpers.js +11 -12
  93. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentScenarioHelpers.js +9 -7
  94. package/tests/unit/state/apply/common/commonScenarioHelper.js +15 -14
  95. package/tests/unit/state/apply/common/payload-structure/initializationDisabledScenario.js +9 -4
  96. package/tests/unit/state/apply/disableInitialization/disableInitializationScenarioHelpers.js +17 -11
  97. package/tests/unit/state/apply/removeWriter/removeWriterScenarioHelpers.js +19 -14
  98. package/tests/unit/state/apply/transfer/transferDoubleSpendAcrossValidatorsScenario.js +37 -29
  99. package/tests/unit/state/apply/transfer/transferScenarioHelpers.js +9 -7
  100. package/tests/unit/state/apply/txOperation/txOperationScenarioHelpers.js +11 -9
  101. package/tests/unit/unit.test.js +1 -1
  102. package/tests/unit/utils/buffer/buffer.test.js +62 -1
  103. package/tests/unit/utils/fileUtils/readAddressesFromWhitelistFile.test.js +4 -3
  104. package/tests/unit/utils/fileUtils/readBalanceMigrationFile.test.js +3 -2
  105. package/tests/unit/utils/migrationUtils/validateAddressFromIncomingFile.test.js +3 -2
  106. package/tests/unit/utils/normalizers/normalizers.test.js +469 -0
  107. package/tests/unit/utils/protobuf/operationHelpers.test.js +120 -2
  108. package/tests/unit/utils/type/type.test.js +25 -0
  109. package/tests/unit/utils/utils.test.js +1 -0
  110. package/docs/networking-dualstack-plan.md +0 -75
  111. package/docs/networking-layer-redesign.md +0 -155
  112. package/src/core/network/messaging/NetworkMessages.js +0 -64
  113. package/src/core/network/messaging/handlers/GetRequestHandler.js +0 -113
  114. package/src/core/network/messaging/handlers/ResponseHandler.js +0 -107
  115. package/src/core/network/messaging/handlers/RoleOperationHandler.js +0 -114
  116. package/src/core/network/messaging/handlers/SubnetworkOperationHandler.js +0 -149
  117. package/src/core/network/messaging/routes/NetworkMessageRouter.js +0 -98
  118. package/src/core/network/messaging/validators/AdminResponse.js +0 -58
  119. package/src/core/network/messaging/validators/CustomNodeResponse.js +0 -46
  120. package/src/messages/base/StateBuilder.js +0 -25
  121. package/src/messages/completeStateMessages/CompleteStateMessageBuilder.js +0 -425
  122. package/src/messages/completeStateMessages/CompleteStateMessageDirector.js +0 -252
  123. package/src/messages/completeStateMessages/CompleteStateMessageOperations.js +0 -296
  124. package/src/messages/partialStateMessages/PartialStateMessageBuilder.js +0 -272
  125. package/src/messages/partialStateMessages/PartialStateMessageDirector.js +0 -137
  126. package/src/messages/partialStateMessages/PartialStateMessageOperations.js +0 -138
  127. package/tests/integration/apply/addAdmin/addAdminBasic.test.js +0 -69
  128. package/tests/integration/apply/addAdmin/addAdminRecovery.test.js +0 -126
  129. package/tests/integration/apply/addIndexer.test.js +0 -239
  130. package/tests/integration/apply/addWhitelist.test.js +0 -53
  131. package/tests/integration/apply/addWriter.test.js +0 -245
  132. package/tests/integration/apply/apply.test.js +0 -19
  133. package/tests/integration/apply/banValidator.test.js +0 -116
  134. package/tests/integration/apply/postTx/invalidSubValues.test.js +0 -103
  135. package/tests/integration/apply/postTx/postTx.test.js +0 -196
  136. package/tests/integration/apply/removeIndexer.test.js +0 -132
  137. package/tests/integration/apply/removeWriter.test.js +0 -168
  138. package/tests/integration/apply/transfer.test.js +0 -83
  139. package/tests/integration/integration.test.js +0 -9
  140. package/tests/unit/messageOperations/assembleAddIndexerMessage.test.js +0 -21
  141. package/tests/unit/messageOperations/assembleAddWriterMessage.test.js +0 -17
  142. package/tests/unit/messageOperations/assembleAdminMessage.test.js +0 -68
  143. package/tests/unit/messageOperations/assembleBanWriterMessage.test.js +0 -17
  144. package/tests/unit/messageOperations/assemblePostTransaction.test.js +0 -424
  145. package/tests/unit/messageOperations/assembleRemoveIndexerMessage.test.js +0 -19
  146. package/tests/unit/messageOperations/assembleRemoveWriterMessage.test.js +0 -17
  147. package/tests/unit/messageOperations/assembleWhitelistMessages.test.js +0 -59
  148. package/tests/unit/messageOperations/commonsStateMessageOperationsTest.js +0 -278
  149. package/tests/unit/messageOperations/stateMessageOperations.test.js +0 -19
  150. /package/src/core/network/{messaging → protocols/legacy}/validators/ValidatorResponse.js +0 -0
  151. /package/src/utils/{operations.js → applyOperations.js} +0 -0
@@ -0,0 +1,889 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Trac Network RPC API
4
+ version: "1.0.2"
5
+ description: |
6
+ OpenAPI specification for Trac Network mainnet RPC endpoints (`v1`).
7
+
8
+ This file is optimized for GitBook API Reference import and reflects
9
+ current behavior of handlers in `rpc/`.
10
+ servers:
11
+ - url: https://tracapi.trac.network
12
+ description: Trac Network Mainnet
13
+ tags:
14
+ - name: Wallet
15
+ - name: Network
16
+ - name: Transactions
17
+
18
+ paths:
19
+ /v1/health:
20
+ get:
21
+ tags: [Network]
22
+ summary: Check API health status
23
+ description: Returns the connectivity status of the RPC node based on the internal MSB state.
24
+ responses:
25
+ "200":
26
+ description: Service is healthy and synchronized.
27
+ content:
28
+ application/json:
29
+ schema:
30
+ $ref: "#/components/schemas/HealthResponse"
31
+ "503":
32
+ description: Service Unavailable - RPC node is down or state is initializing.
33
+ content:
34
+ application/json:
35
+ schema:
36
+ $ref: "#/components/schemas/ErrorResponse"
37
+ example:
38
+ error: "Could not connect to RPC server"
39
+
40
+ /v1/balance/{address}:
41
+ get:
42
+ tags: [Wallet]
43
+ summary: Get wallet balance
44
+ description: |
45
+ Returns balance for the specified wallet address.
46
+
47
+ `confirmed` query behavior:
48
+ - missing: defaults to confirmed view
49
+ - `true`: confirmed view
50
+ - `false`: unconfirmed view
51
+ - any other value: falls back to unconfirmed view
52
+ parameters:
53
+ - $ref: "#/components/parameters/AddressParam"
54
+ - $ref: "#/components/parameters/ConfirmedQueryParamLenient"
55
+ responses:
56
+ "200":
57
+ description: Balance returned successfully.
58
+ content:
59
+ application/json:
60
+ schema:
61
+ $ref: "#/components/schemas/BalanceResponse"
62
+ examples:
63
+ success:
64
+ value:
65
+ address: trac1hyg3mv57fph35qev4xsa74n7rey2lkg9puq9yzq6aq84r023ldcqyk889z
66
+ balance: "782500000000000000"
67
+ unknownAddress:
68
+ value:
69
+ address: trac1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
70
+ balance: "0"
71
+ "400":
72
+ description: Missing address.
73
+ content:
74
+ application/json:
75
+ schema:
76
+ $ref: "#/components/schemas/ErrorResponse"
77
+ example:
78
+ error: Wallet address is required
79
+ "500":
80
+ $ref: "#/components/responses/InternalServerError"
81
+
82
+ /v1/account/{address}:
83
+ get:
84
+ tags: [Wallet]
85
+ summary: Get account details
86
+ description: |
87
+ Returns account details (roles, keys, balances and license).
88
+
89
+ `confirmed` must be exactly `true` or `false`.
90
+ parameters:
91
+ - $ref: "#/components/parameters/AddressParam"
92
+ - $ref: "#/components/parameters/ConfirmedQueryParamStrict"
93
+ responses:
94
+ "200":
95
+ description: Account details returned successfully.
96
+ content:
97
+ application/json:
98
+ schema:
99
+ $ref: "#/components/schemas/AccountDetailsResponse"
100
+ examples:
101
+ existing:
102
+ value:
103
+ address: trac1xljl28ugeskpcswxdxlsx7f9n7jtt5pxusf6qmq08na0j30f6n9smus3rh
104
+ writingKey: "0000000000000000000000000000000000000000000000000000000000000000"
105
+ isWhitelisted: false
106
+ isValidator: false
107
+ isIndexer: false
108
+ license: null
109
+ balance: "49630000000000000000"
110
+ stakedBalance: "0"
111
+ writerAssigned:
112
+ value:
113
+ address: trac1exampleaddressxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
114
+ writingKey: "5d9683f6f39d7a0ce7f88d7a6de7c57e6d6e1c8e9571f8d18a6d13ad2d7c48af"
115
+ isWhitelisted: true
116
+ isValidator: true
117
+ isIndexer: false
118
+ license: "2"
119
+ balance: "1000000000000000000"
120
+ stakedBalance: "300000000000000000"
121
+ notFound:
122
+ value:
123
+ address: trac1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
124
+ writingKey: "0000000000000000000000000000000000000000000000000000000000000000"
125
+ isWhitelisted: false
126
+ isValidator: false
127
+ isIndexer: false
128
+ license: null
129
+ balance: "0"
130
+ stakedBalance: "0"
131
+ "400":
132
+ description: Invalid address or invalid `confirmed` parameter.
133
+ content:
134
+ application/json:
135
+ schema:
136
+ $ref: "#/components/schemas/ErrorResponse"
137
+ examples:
138
+ missingAddress:
139
+ value:
140
+ error: Account address is required
141
+ invalidAddress:
142
+ value:
143
+ error: Invalid account address format
144
+ invalidConfirmed:
145
+ value:
146
+ error: Parameter "confirmed" must be exactly "true" or "false"
147
+ "500":
148
+ $ref: "#/components/responses/InternalServerError"
149
+
150
+ /v1/txv:
151
+ get:
152
+ tags: [Network]
153
+ summary: Get current TXV
154
+ description: Returns the current transaction validity hash (`txv`) as hex.
155
+ responses:
156
+ "200":
157
+ description: TXV returned successfully.
158
+ content:
159
+ application/json:
160
+ schema:
161
+ $ref: "#/components/schemas/TxvResponse"
162
+ example:
163
+ txv: 54f57c8d3c4fb3e653201aa9a040e3f673e80c939a95f0a477b18fe51dbfd186
164
+ "500":
165
+ $ref: "#/components/responses/InternalServerError"
166
+
167
+ /v1/fee:
168
+ get:
169
+ tags: [Network]
170
+ summary: Get current transaction fee
171
+ responses:
172
+ "200":
173
+ description: Fee returned successfully.
174
+ content:
175
+ application/json:
176
+ schema:
177
+ $ref: "#/components/schemas/FeeResponse"
178
+ example:
179
+ fee: "30000000000000000"
180
+ "500":
181
+ $ref: "#/components/responses/InternalServerError"
182
+
183
+ /v1/confirmed-length:
184
+ get:
185
+ tags: [Network]
186
+ summary: Get confirmed ledger length
187
+ responses:
188
+ "200":
189
+ description: Confirmed length returned successfully.
190
+ content:
191
+ application/json:
192
+ schema:
193
+ $ref: "#/components/schemas/ConfirmedLengthResponse"
194
+ example:
195
+ confirmed_length: 63
196
+ "500":
197
+ $ref: "#/components/responses/InternalServerError"
198
+
199
+ /v1/unconfirmed-length:
200
+ get:
201
+ tags: [Network]
202
+ summary: Get unconfirmed ledger length
203
+ responses:
204
+ "200":
205
+ description: Unconfirmed length returned successfully.
206
+ content:
207
+ application/json:
208
+ schema:
209
+ $ref: "#/components/schemas/UnconfirmedLengthResponse"
210
+ example:
211
+ unconfirmed_length: 63
212
+ "500":
213
+ $ref: "#/components/responses/InternalServerError"
214
+
215
+ /v1/broadcast-transaction:
216
+ post:
217
+ tags: [Transactions]
218
+ summary: Broadcast signed transaction
219
+ description: |
220
+ Broadcasts a signed transaction payload.
221
+
222
+ Request requirements:
223
+ - body must be valid JSON
224
+ - body must contain `payload`
225
+ - `payload` must be valid Base64 string
226
+ requestBody:
227
+ required: true
228
+ content:
229
+ application/json:
230
+ schema:
231
+ $ref: "#/components/schemas/BroadcastTransactionRequest"
232
+ example:
233
+ payload: BASE64_ENCODED_TRANSACTION
234
+ responses:
235
+ "200":
236
+ description: Transaction accepted and broadcasted.
237
+ content:
238
+ application/json:
239
+ schema:
240
+ $ref: "#/components/schemas/BroadcastTransactionResponse"
241
+ example:
242
+ result:
243
+ message: Transaction broadcasted successfully.
244
+ signedLength: 123
245
+ unsignedLength: 122
246
+ tx: 6641baabac7e4815815876f90a7529f230a3d996209561803c1e05789b06c300
247
+ "400":
248
+ description: Invalid request payload.
249
+ content:
250
+ application/json:
251
+ schema:
252
+ $ref: "#/components/schemas/ErrorResponse"
253
+ examples:
254
+ missing:
255
+ value:
256
+ error: Payload is missing.
257
+ invalidBase64:
258
+ value:
259
+ error: Payload must be a valid base64 string.
260
+ invalidJson:
261
+ value:
262
+ error: Invalid JSON payload.
263
+ "429":
264
+ description: Broadcast retry limit reached.
265
+ content:
266
+ application/json:
267
+ schema:
268
+ $ref: "#/components/schemas/ErrorResponse"
269
+ example:
270
+ error: Failed to broadcast transaction after multiple attempts.
271
+ "500":
272
+ description: Internal server error.
273
+ content:
274
+ application/json:
275
+ schema:
276
+ $ref: "#/components/schemas/ErrorResponse"
277
+ examples:
278
+ generic:
279
+ value:
280
+ error: An error occurred processing the transaction.
281
+ streamError:
282
+ value:
283
+ error: Request stream failed during body transfer.
284
+
285
+ /v1/tx-hashes/{start_confirmed_length}/{end_confirmed_length}:
286
+ get:
287
+ tags: [Transactions]
288
+ summary: Get transaction hashes by confirmed-length range
289
+ description: |
290
+ Returns transaction hashes in inclusive range.
291
+
292
+ Rules:
293
+ - both params must be integers
294
+ - both params must be non-negative
295
+ - end must be greater than or equal to start
296
+ - max difference is 1000
297
+ parameters:
298
+ - $ref: "#/components/parameters/StartConfirmedLengthParam"
299
+ - $ref: "#/components/parameters/EndConfirmedLengthParam"
300
+ responses:
301
+ "200":
302
+ description: Hashes returned successfully.
303
+ content:
304
+ application/json:
305
+ schema:
306
+ $ref: "#/components/schemas/TxHashesResponse"
307
+ example:
308
+ hashes:
309
+ - hash: 6641baabac7e4815815876f90a7529f230a3d996209561803c1e05789b06c300
310
+ confirmed_length: 11
311
+ - hash: 2acc0ca12abad63222e06193820cf1ee8599aeb7d720d57ffad0311a0cd27a4a
312
+ confirmed_length: 15
313
+ "400":
314
+ description: Invalid range parameters.
315
+ content:
316
+ application/json:
317
+ schema:
318
+ $ref: "#/components/schemas/ErrorResponse"
319
+ examples:
320
+ integer:
321
+ value:
322
+ error: Params must be integer
323
+ nonNegative:
324
+ value:
325
+ error: Params must be non-negative
326
+ order:
327
+ value:
328
+ error: endSignedLength must be greater than or equal to startSignedLength.
329
+ maxRange:
330
+ value:
331
+ error: The max range for signedLength must be 1000.
332
+ "500":
333
+ $ref: "#/components/responses/InternalServerError"
334
+
335
+ /v1/tx/{transactionHash}:
336
+ get:
337
+ tags: [Transactions]
338
+ summary: Get confirmed transaction details
339
+ description: |
340
+ Returns normalized details for confirmed transaction hash.
341
+
342
+ Current handler behavior:
343
+ - if not found, returns `404` with `{ "txDetails": null }`
344
+ - hash format is not strictly validated at handler layer
345
+ parameters:
346
+ - $ref: "#/components/parameters/TransactionHashParamLoose"
347
+ responses:
348
+ "200":
349
+ description: Transaction details returned successfully.
350
+ content:
351
+ application/json:
352
+ schema:
353
+ $ref: "#/components/schemas/TxDetailsResponse"
354
+ example:
355
+ txDetails:
356
+ type: 13
357
+ address: trac1xljl28ugeskpcswxdxlsx7f9n7jtt5pxusf6qmq08na0j30f6n9smus3rh
358
+ tro:
359
+ tx: 0b4d1c1dac48af13212f616601d7399457476a0b644850875b7f4b79df6ff89c
360
+ txv: 54f57c8d3c4fb3e653201aa9a040e3f673e80c939a95f0a477b18fe51dbfd186
361
+ to: trac1fxmkmd4p4sn7aqsya7tuuc9dzhs4zp8pnwfz8msnyfvf5n6g0lqqg6uz0a
362
+ am: "1000000000000000000"
363
+ in: 40bb3aca8b4fda5afa8bc1558843ff81727d9ccc84953050d3359c0e5733dc69
364
+ is: 2f3639d487bc502961a80240f9ab4adbc671eb93ba08286383a615a4cfa95826b57b4b339502eae3de5a6b7bfd080cd0d68ffa2c042453a308ca9afc5e8c100b
365
+ va: trac1hyg3mv57fph35qev4xsa74n7rey2lkg9puq9yzq6aq84r023ldcqyk889z
366
+ vn: b68a83b508ffa35b1984c1835905b2ba8ab230a202cf62f3d58e109f77f97804
367
+ vs: ab3b4049a552b0b1a1a455e4b1f33c367a86f0312ba5c08050fdac1446a927236b43d79f4d16c260b5dbe96b4b1355dddc9c16174b9c2ed813368e33acf8600f
368
+ "404":
369
+ description: Transaction not found.
370
+ content:
371
+ application/json:
372
+ schema:
373
+ $ref: "#/components/schemas/TxDetailsNotFoundResponse"
374
+ example:
375
+ txDetails: null
376
+ "500":
377
+ $ref: "#/components/responses/InternalServerError"
378
+
379
+ /v1/tx-payloads-bulk:
380
+ post:
381
+ tags: [Transactions]
382
+ summary: Get transaction payloads in bulk
383
+ description: |
384
+ Returns payloads for provided transaction hash list.
385
+
386
+ Limits:
387
+ - max `1500` hashes per request
388
+ - request body limit: `1_000_000` bytes
389
+ - response body limit: `2_000_000` bytes
390
+ requestBody:
391
+ required: true
392
+ content:
393
+ application/json:
394
+ schema:
395
+ $ref: "#/components/schemas/TxPayloadsBulkRequest"
396
+ example:
397
+ hashes:
398
+ - d9ecb7020563f99cc171a1fa3d57e05ed001fac5ca58789f7a21cd1afdceb05b
399
+ - test
400
+ responses:
401
+ "200":
402
+ description: Payloads returned successfully.
403
+ content:
404
+ application/json:
405
+ schema:
406
+ $ref: "#/components/schemas/TxPayloadsBulkResponse"
407
+ example:
408
+ results:
409
+ - hash: d9ecb7020563f99cc171a1fa3d57e05ed001fac5ca58789f7a21cd1afdceb05b
410
+ payload:
411
+ type: 5
412
+ address: trac1j79k35xyz2v8zzw59xdlyptj56yd47zjdtmyq3mcd073t0c5kjjqfrr05t
413
+ tro:
414
+ tx: d9ecb7020563f99cc171a1fa3d57e05ed001fac5ca58789f7a21cd1afdceb05b
415
+ txv: f8f8f5ae1a45aee14ea196e3ed97bbb2fb52708cb775de24c4b2b9af86a70624
416
+ to: trac1fxmkmd4p4sn7aqsya7tuuc9dzhs4zp8pnwfz8msnyfvf5n6g0lqqg6uz0a
417
+ am: "1000000000000000000"
418
+ in: 0936963ac9e56707b27e0d215cdb6deeb4f654f26e1516373f49c417c3b57df8
419
+ is: 4e4b056f083a49de45a4ca5d0f8ddf5b813b5ecceaaea969a191ff491f5b68a3faa5f9d5dbdf907550b1e50da1293c64b6604a77caeba7fe448ff82efb66070c
420
+ va: trac1hyg3mv57fph35qev4xsa74n7rey2lkg9puq9yzq6aq84r023ldcqyk889z
421
+ vn: 8a1eb8d0923e662bb6f2082931b3b7132a94bff3e5beb68a9c72c37cd6e82d14
422
+ vs: 9d141b9e891fc0d837db79ab36417c4dc530c80556896111ae5611af4f54c2259b1a37c1815efa2c59381db0c537c132b031253b846244c492cd8c3052b96708
423
+ missing:
424
+ - test
425
+ "400":
426
+ description: Invalid request body.
427
+ content:
428
+ application/json:
429
+ schema:
430
+ $ref: "#/components/schemas/ErrorResponse"
431
+ examples:
432
+ missingPayload:
433
+ value:
434
+ error: Missing payload.
435
+ invalidPayload:
436
+ value:
437
+ error: Invalid payload.
438
+ missingHashList:
439
+ value:
440
+ error: Missing hash list.
441
+ invalidFormat:
442
+ value:
443
+ error: Invalid request body format.
444
+ "413":
445
+ description: Request/response size limits exceeded.
446
+ content:
447
+ application/json:
448
+ schema:
449
+ $ref: "#/components/schemas/ErrorResponse"
450
+ examples:
451
+ requestTooLarge:
452
+ value:
453
+ error: Request body too large.
454
+ tooManyHashes:
455
+ value:
456
+ error: Too many hashes. Max 1500 allowed per request.
457
+ responseTooLarge:
458
+ value:
459
+ error: Response too large. Reduce number of hashes.
460
+ "500":
461
+ description: Internal server error.
462
+ content:
463
+ application/json:
464
+ schema:
465
+ $ref: "#/components/schemas/ErrorResponse"
466
+ examples:
467
+ generic:
468
+ value:
469
+ error: An internal error occurred.
470
+ streamError:
471
+ value:
472
+ error: Request stream failed during body transfer.
473
+
474
+ /v1/tx/details/{transactionHash}:
475
+ get:
476
+ tags: [Transactions]
477
+ summary: Get transaction details with confirmation metadata
478
+ description: |
479
+ Returns transaction details with `confirmed_length` and `fee`.
480
+
481
+ `confirmed` must be exactly `true` or `false`.
482
+ parameters:
483
+ - $ref: "#/components/parameters/TransactionHashParamStrict"
484
+ - $ref: "#/components/parameters/ConfirmedQueryParamStrict"
485
+ responses:
486
+ "200":
487
+ description: Transaction details returned successfully.
488
+ content:
489
+ application/json:
490
+ schema:
491
+ $ref: "#/components/schemas/TxDetailsWithMetaResponse"
492
+ example:
493
+ txDetails:
494
+ type: 13
495
+ address: trac1xljl28ugeskpcswxdxlsx7f9n7jtt5pxusf6qmq08na0j30f6n9smus3rh
496
+ tro:
497
+ tx: 0b4d1c1dac48af13212f616601d7399457476a0b644850875b7f4b79df6ff89c
498
+ txv: 54f57c8d3c4fb3e653201aa9a040e3f673e80c939a95f0a477b18fe51dbfd186
499
+ to: trac1fxmkmd4p4sn7aqsya7tuuc9dzhs4zp8pnwfz8msnyfvf5n6g0lqqg6uz0a
500
+ am: "1000000000000000000"
501
+ in: 40bb3aca8b4fda5afa8bc1558843ff81727d9ccc84953050d3359c0e5733dc69
502
+ is: 2f3639d487bc502961a80240f9ab4adbc671eb93ba08286383a615a4cfa95826b57b4b339502eae3de5a6b7bfd080cd0d68ffa2c042453a308ca9afc5e8c100b
503
+ va: trac1hyg3mv57fph35qev4xsa74n7rey2lkg9puq9yzq6aq84r023ldcqyk889z
504
+ vn: b68a83b508ffa35b1984c1835905b2ba8ab230a202cf62f3d58e109f77f97804
505
+ vs: ab3b4049a552b0b1a1a455e4b1f33c367a86f0312ba5c08050fdac1446a927236b43d79f4d16c260b5dbe96b4b1355dddc9c16174b9c2ed813368e33acf8600f
506
+ confirmed_length: 82
507
+ fee: "30000000000000000"
508
+ "400":
509
+ description: Invalid transaction hash or invalid `confirmed` parameter.
510
+ content:
511
+ application/json:
512
+ schema:
513
+ $ref: "#/components/schemas/ErrorResponse"
514
+ examples:
515
+ missingHash:
516
+ value:
517
+ error: Transaction hash is required
518
+ invalidHash:
519
+ value:
520
+ error: Invalid transaction hash format
521
+ invalidConfirmed:
522
+ value:
523
+ error: Parameter "confirmed" must be exactly "true" or "false"
524
+ "404":
525
+ description: Transaction not found.
526
+ content:
527
+ application/json:
528
+ schema:
529
+ $ref: "#/components/schemas/ErrorResponse"
530
+ example:
531
+ error: "No payload found for tx hash: {transactionHash}"
532
+ "500":
533
+ description: Internal server error.
534
+ content:
535
+ application/json:
536
+ schema:
537
+ $ref: "#/components/schemas/ErrorResponse"
538
+ example:
539
+ error: An error occurred processing the request.
540
+
541
+ components:
542
+ parameters:
543
+ AddressParam:
544
+ name: address
545
+ in: path
546
+ required: true
547
+ description: Wallet/account address.
548
+ schema:
549
+ type: string
550
+ minLength: 1
551
+
552
+ TransactionHashParamLoose:
553
+ name: transactionHash
554
+ in: path
555
+ required: true
556
+ description: Transaction hash.
557
+ schema:
558
+ type: string
559
+ minLength: 1
560
+
561
+ TransactionHashParamStrict:
562
+ name: transactionHash
563
+ in: path
564
+ required: true
565
+ description: Transaction hash (64-char hex string).
566
+ schema:
567
+ type: string
568
+ pattern: "^[A-Fa-f0-9]{64}$"
569
+
570
+ ConfirmedQueryParamLenient:
571
+ name: confirmed
572
+ in: query
573
+ required: false
574
+ description: |
575
+ Balance endpoint behavior:
576
+ - `true` for confirmed view
577
+ - `false` for unconfirmed view
578
+ - omitted => confirmed view
579
+ - any other value => treated as unconfirmed view
580
+ schema:
581
+ type: string
582
+ default: "true"
583
+
584
+ ConfirmedQueryParamStrict:
585
+ name: confirmed
586
+ in: query
587
+ required: false
588
+ description: Must be exactly `true` or `false`.
589
+ schema:
590
+ type: string
591
+ enum: ["true", "false"]
592
+ default: "true"
593
+
594
+ StartConfirmedLengthParam:
595
+ name: start_confirmed_length
596
+ in: path
597
+ required: true
598
+ description: Start of confirmed-length range (inclusive).
599
+ schema:
600
+ type: integer
601
+ minimum: 0
602
+
603
+ EndConfirmedLengthParam:
604
+ name: end_confirmed_length
605
+ in: path
606
+ required: true
607
+ description: End of confirmed-length range (inclusive).
608
+ schema:
609
+ type: integer
610
+ minimum: 0
611
+
612
+ responses:
613
+ InternalServerError:
614
+ description: Internal server error.
615
+ content:
616
+ application/json:
617
+ schema:
618
+ $ref: "#/components/schemas/ErrorResponse"
619
+ example:
620
+ error: An error occurred processing the request.
621
+
622
+ schemas:
623
+ ErrorResponse:
624
+ type: object
625
+ required: [error]
626
+ properties:
627
+ error:
628
+ type: string
629
+ description: Error message describing the failure.
630
+
631
+ HealthResponse:
632
+ type: object
633
+ required: [ok]
634
+ properties:
635
+ ok:
636
+ type: boolean
637
+ description: Status indicator of the RPC node connectivity.
638
+ enum: [true]
639
+ example: true
640
+
641
+ BalanceResponse:
642
+ type: object
643
+ required: [address, balance]
644
+ properties:
645
+ address:
646
+ type: string
647
+ balance:
648
+ type: string
649
+
650
+ AccountDetailsResponse:
651
+ type: object
652
+ required:
653
+ - address
654
+ - writingKey
655
+ - isWhitelisted
656
+ - isValidator
657
+ - isIndexer
658
+ - license
659
+ - balance
660
+ - stakedBalance
661
+ properties:
662
+ address:
663
+ type: string
664
+ writingKey:
665
+ description: |
666
+ 64-character hex writing key.
667
+ Can be all zeros when no writer key is assigned.
668
+ type: string
669
+ pattern: "^[A-Fa-f0-9]{64}$"
670
+ example: "0000000000000000000000000000000000000000000000000000000000000000"
671
+ isWhitelisted:
672
+ type: boolean
673
+ isValidator:
674
+ type: boolean
675
+ isIndexer:
676
+ type: boolean
677
+ license:
678
+ type: string
679
+ nullable: true
680
+ balance:
681
+ type: string
682
+ stakedBalance:
683
+ type: string
684
+
685
+ TxvResponse:
686
+ type: object
687
+ required: [txv]
688
+ properties:
689
+ txv:
690
+ type: string
691
+
692
+ FeeResponse:
693
+ type: object
694
+ required: [fee]
695
+ properties:
696
+ fee:
697
+ type: string
698
+
699
+ ConfirmedLengthResponse:
700
+ type: object
701
+ required: [confirmed_length]
702
+ properties:
703
+ confirmed_length:
704
+ type: integer
705
+
706
+ UnconfirmedLengthResponse:
707
+ type: object
708
+ required: [unconfirmed_length]
709
+ properties:
710
+ unconfirmed_length:
711
+ type: integer
712
+
713
+ BroadcastTransactionRequest:
714
+ type: object
715
+ required: [payload]
716
+ properties:
717
+ payload:
718
+ type: string
719
+ description: Base64-encoded signed transaction.
720
+
721
+ BroadcastResult:
722
+ type: object
723
+ required: [message, signedLength, unsignedLength, tx]
724
+ properties:
725
+ message:
726
+ type: string
727
+ signedLength:
728
+ type: integer
729
+ unsignedLength:
730
+ type: integer
731
+ tx:
732
+ type: string
733
+
734
+ BroadcastTransactionResponse:
735
+ type: object
736
+ required: [result]
737
+ properties:
738
+ result:
739
+ $ref: "#/components/schemas/BroadcastResult"
740
+
741
+ TxHashItem:
742
+ type: object
743
+ required: [hash, confirmed_length]
744
+ properties:
745
+ hash:
746
+ type: string
747
+ confirmed_length:
748
+ type: integer
749
+
750
+ TxHashesResponse:
751
+ type: object
752
+ required: [hashes]
753
+ properties:
754
+ hashes:
755
+ type: array
756
+ items:
757
+ $ref: "#/components/schemas/TxHashItem"
758
+
759
+ TxOperationPayload:
760
+ type: object
761
+ description: |
762
+ Normalized operation object (`tro` for transfer or `txo` for subnet tx).
763
+ Fields depend on operation type; unknown keys may also appear.
764
+ properties:
765
+ tx:
766
+ type: string
767
+ description: Transaction hash.
768
+ txv:
769
+ type: string
770
+ description: Transaction validity hash.
771
+ to:
772
+ type: string
773
+ description: Recipient address (transfer).
774
+ am:
775
+ type: string
776
+ description: Amount in base units.
777
+ in:
778
+ type: string
779
+ description: Nonce.
780
+ is:
781
+ type: string
782
+ description: Signature.
783
+ va:
784
+ type: string
785
+ description: Validator address or encoded validator field.
786
+ vn:
787
+ type: string
788
+ description: Validator nonce or validator-related field.
789
+ vs:
790
+ type: string
791
+ description: Validator signature or validator-related field.
792
+ iw:
793
+ type: string
794
+ description: Writer/indexer related field.
795
+ bs:
796
+ type: string
797
+ description: Bootstrap/subnetwork identifier (for subnet tx).
798
+ additionalProperties: true
799
+
800
+ TxDetailsPayload:
801
+ type: object
802
+ description: Normalized transaction payload.
803
+ required: [type, address]
804
+ properties:
805
+ type:
806
+ type: integer
807
+ address:
808
+ type: string
809
+ tro:
810
+ $ref: "#/components/schemas/TxOperationPayload"
811
+ txo:
812
+ $ref: "#/components/schemas/TxOperationPayload"
813
+ oneOf:
814
+ - required: [tro]
815
+ - required: [txo]
816
+ additionalProperties: false
817
+ example:
818
+ type: 13
819
+ address: trac1xljl28ugeskpcswxdxlsx7f9n7jtt5pxusf6qmq08na0j30f6n9smus3rh
820
+ tro:
821
+ tx: 0b4d1c1dac48af13212f616601d7399457476a0b644850875b7f4b79df6ff89c
822
+ txv: 54f57c8d3c4fb3e653201aa9a040e3f673e80c939a95f0a477b18fe51dbfd186
823
+ to: trac1fxmkmd4p4sn7aqsya7tuuc9dzhs4zp8pnwfz8msnyfvf5n6g0lqqg6uz0a
824
+ am: "1000000000000000000"
825
+ in: 40bb3aca8b4fda5afa8bc1558843ff81727d9ccc84953050d3359c0e5733dc69
826
+ is: 2f3639d487bc502961a80240f9ab4adbc671eb93ba08286383a615a4cfa95826b57b4b339502eae3de5a6b7bfd080cd0d68ffa2c042453a308ca9afc5e8c100b
827
+ va: trac1hyg3mv57fph35qev4xsa74n7rey2lkg9puq9yzq6aq84r023ldcqyk889z
828
+ vn: b68a83b508ffa35b1984c1835905b2ba8ab230a202cf62f3d58e109f77f97804
829
+ vs: ab3b4049a552b0b1a1a455e4b1f33c367a86f0312ba5c08050fdac1446a927236b43d79f4d16c260b5dbe96b4b1355dddc9c16174b9c2ed813368e33acf8600f
830
+
831
+ TxDetailsResponse:
832
+ type: object
833
+ required: [txDetails]
834
+ properties:
835
+ txDetails:
836
+ $ref: "#/components/schemas/TxDetailsPayload"
837
+
838
+ TxDetailsNotFoundResponse:
839
+ type: object
840
+ required: [txDetails]
841
+ properties:
842
+ txDetails:
843
+ type: object
844
+ nullable: true
845
+
846
+ TxPayloadsBulkRequest:
847
+ type: object
848
+ required: [hashes]
849
+ properties:
850
+ hashes:
851
+ type: array
852
+ minItems: 1
853
+ maxItems: 1500
854
+ items:
855
+ type: string
856
+
857
+ TxPayloadBulkResultItem:
858
+ type: object
859
+ required: [hash, payload]
860
+ properties:
861
+ hash:
862
+ type: string
863
+ payload:
864
+ $ref: "#/components/schemas/TxDetailsPayload"
865
+
866
+ TxPayloadsBulkResponse:
867
+ type: object
868
+ required: [results, missing]
869
+ properties:
870
+ results:
871
+ type: array
872
+ items:
873
+ $ref: "#/components/schemas/TxPayloadBulkResultItem"
874
+ missing:
875
+ type: array
876
+ items:
877
+ type: string
878
+
879
+ TxDetailsWithMetaResponse:
880
+ type: object
881
+ required: [txDetails, confirmed_length, fee]
882
+ properties:
883
+ txDetails:
884
+ $ref: "#/components/schemas/TxDetailsPayload"
885
+ confirmed_length:
886
+ type: integer
887
+ description: Confirmed ledger length (0 when transaction is not yet confirmed).
888
+ fee:
889
+ type: string