You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2776 lines
96 KiB

3 years ago
3 years ago
3 years ago
  1. openapi: 3.0.0
  2. info:
  3. description: |
  4. This API server is the layer that allows 3rd party apps and services interfacing with the coordinator to explore, monitor and use the Hermez rollup.
  5. Example of these apps are:
  6. * Wallet: send L2 transactions, check balance, ...
  7. * Explorer: List transactions, slots, batches, ...
  8. * Exchange integrations
  9. ### Pagination
  10. #### Usage
  11. All the endpoints that return a list of undefined size use pagination. Unless the opposite is explicitly said.
  12. In order to use pagination, three query parameters are used:
  13. * `fromItem`: indicates the first item to be returned. In general, this parameter shouldn't be provided in the first call to the endpoint, and use the `itemId` of the last returned item (+/-) 1, if the order is (ascending/descending).
  14. * `order`: all paginated items are ordered chronologicaly. However the specific fields to guarantee this order depend on each endpoint. For this purpose, `itemId` is used (itemId follows ascending chronological order except for unforged L1 user transactions). If the parameter is not provided, ascending order will be used by default.
  15. * `limit`: maximum amount of items to include in each response. Default is 20, maximum is 2049.
  16. Responses for those endpoints will always include a `pendingItems` property. This property includes the amount of items that are not fetched yet. This can be used to:
  17. * Calculate the amount of items that match the filters: `totalItems = length(alreadyFetchedItems) + pendingItems`
  18. * Know when all items have been fetched: `if pendingItems == 0 {/* all items have been fetched */}`
  19. #### Reorgs and safetyness
  20. Since all the items are ordered chronologicaly, there are no safety problems when fetching items in ascending order, except for reorgs (more on this later).
  21. On the other hand, when iterating in descending order, new items will be added at the beginning. This doesn't cause any safety problem, but to get those new items, it's necessary to start queryng without the `fromItem` set to `pagination.lastItem`.
  22. To handle reorgs, the `itemId` can be used since it will change. This is important since other identifiers may be the same but with different content. As an example, if the batch 424 get's reorged, it will be deleted, but eventualy, a new batch 424 will appear with potentialy different content.
  23. ### Signatures
  24. The POST endpoint requires to be signed using BabyJubJub or Ethereum keys. TODO: add references to libraries / examples / ...
  25. version: "0.0.1"
  26. title: Hermez Network API
  27. # termsOfService: 'http://swagger.io/terms/'
  28. # contact:
  29. # email: apiteam@swagger.io
  30. # license:
  31. # name: Apache 2.0
  32. # url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
  33. externalDocs:
  34. description: Find out more about Hermez.
  35. url: 'https://hermez.io'
  36. servers:
  37. - description: Hosted mock up
  38. url: http://167.71.59.190:4010
  39. - description: Localhost mock Up
  40. url: http://localhost:4010
  41. tags:
  42. - name: Account
  43. description: Hermez account and the tokens it holds.
  44. externalDocs:
  45. description: Find out more.
  46. url: 'https://idocs.hermez.io/#/spec/zkrollup/README?id=account-types'
  47. - name: Transaction
  48. description: Send tokens off chain and track transactions.
  49. externalDocs:
  50. description: Find out more
  51. url: 'https://idocs.hermez.io/#/spec/zkrollup/README?id=transaction-types'
  52. - name: Hermez status
  53. description: Info about operators, tokens, auctions and more.
  54. externalDocs:
  55. description: Find out more.
  56. url: 'https://idocs.hermez.io/#/spec/zkrollup/README'
  57. paths:
  58. '/account-creation-authorization':
  59. post:
  60. tags:
  61. - Account
  62. summary: Send an authorization that will allow the coordinator to register accounts associated to an Ethereum address on behalf of the user.
  63. description: >-
  64. Send an authorization to create rollup accounts associated to an Ethereum address. Each account creation (an account can only hold a specific token) is effective once the coordinator forges the corresponding L1CoordinatorTx (which is always of type *account creation*).
  65. operationId: postRegister
  66. requestBody:
  67. description: Account creation authorization.
  68. required: true
  69. content:
  70. application/json:
  71. schema:
  72. $ref: '#/components/schemas/AccountCreationAuthorizationPost'
  73. responses:
  74. '200':
  75. description: Successful operation.
  76. '400':
  77. description: Bad request.
  78. content:
  79. application/json:
  80. schema:
  81. $ref: '#/components/schemas/Error400'
  82. '500':
  83. description: Internal server error.
  84. content:
  85. application/json:
  86. schema:
  87. $ref: '#/components/schemas/Error500'
  88. '/account-creation-authorization/{hezEthereumAddress}':
  89. get:
  90. tags:
  91. - Account
  92. summary: Get to know if the coordinator has the ability to create accounts associated to an Ethereum address.
  93. description: >-
  94. True if the coordinator has the required authorization to perform an account creation with the given Ethereum address on behalf of the Ethereum address holder.
  95. operationId: getAccountCreationAuthorization
  96. parameters:
  97. - name: hezEthereumAddress
  98. in: path
  99. description: Ethereum address.
  100. required: true
  101. schema:
  102. $ref: '#/components/schemas/HezEthereumAddress'
  103. responses:
  104. '200':
  105. description: Successful operation.
  106. content:
  107. application/json:
  108. schema:
  109. $ref: '#/components/schemas/AccountCreationAuthorization'
  110. '400':
  111. description: Bad request.
  112. content:
  113. application/json:
  114. schema:
  115. $ref: '#/components/schemas/Error400'
  116. '404':
  117. description: Not found.
  118. content:
  119. application/json:
  120. schema:
  121. $ref: '#/components/schemas/Error404'
  122. '500':
  123. description: Internal server error.
  124. content:
  125. application/json:
  126. schema:
  127. $ref: '#/components/schemas/Error500'
  128. '/accounts':
  129. get:
  130. tags:
  131. - Account
  132. summary: Get accounts balances and other associated information.
  133. description: Get accounts balances and other associated information.
  134. operationId: getAccounts
  135. parameters:
  136. - name: hezEthereumAddress
  137. in: query
  138. description: Only get accounts associated to an Ethereum address. Incompatible with the query `BJJ`.
  139. required: false
  140. schema:
  141. $ref: '#/components/schemas/HezEthereumAddress'
  142. - name: BJJ
  143. in: query
  144. description: Only get accounts associated to a BabyJubJub public key. Incompatible with the query `hezEthereumAddress`.
  145. required: false
  146. schema:
  147. $ref: '#/components/schemas/BJJ'
  148. - name: tokenIds
  149. in: query
  150. required: false
  151. description: Only get accounts of specific tokens.
  152. schema:
  153. type: string
  154. description: Comma separated list of token identifiers.
  155. example: "3,87,91"
  156. - name: fromItem
  157. in: query
  158. required: false
  159. description: Indicates the desired first item (using the itemId property) to be included in the response.
  160. schema:
  161. type: number
  162. - name: order
  163. in: query
  164. required: false
  165. description: Order of the returned items. Accounts will be ordered by increasing account index.
  166. schema:
  167. type: string
  168. default: ASC
  169. enum:
  170. - ASC
  171. - DESC
  172. - name: limit
  173. in: query
  174. required: false
  175. description: Maximum number of items to be returned.
  176. schema:
  177. type: integer
  178. minimum: 1
  179. maximum: 2049
  180. responses:
  181. '200':
  182. description: Successful operation.
  183. content:
  184. application/json:
  185. schema:
  186. $ref: '#/components/schemas/Accounts'
  187. '400':
  188. description: Bad request.
  189. content:
  190. application/json:
  191. schema:
  192. $ref: '#/components/schemas/Error400'
  193. '404':
  194. description: Not found.
  195. content:
  196. application/json:
  197. schema:
  198. $ref: '#/components/schemas/Error404'
  199. '500':
  200. description: Internal server error.
  201. content:
  202. application/json:
  203. schema:
  204. $ref: '#/components/schemas/Error500'
  205. '/accounts/{accountIndex}':
  206. get:
  207. tags:
  208. - Account
  209. summary: Get an account by its index.
  210. description: Get an account by its index.
  211. operationId: getAccount
  212. parameters:
  213. - name: accountIndex
  214. in: path
  215. description: Identifier of an account.
  216. required: true
  217. schema:
  218. $ref: '#/components/schemas/AccountIndex'
  219. responses:
  220. '200':
  221. description: Successful operation.
  222. content:
  223. application/json:
  224. schema:
  225. $ref: '#/components/schemas/Account'
  226. '400':
  227. description: Bad request.
  228. content:
  229. application/json:
  230. schema:
  231. $ref: '#/components/schemas/Error400'
  232. '404':
  233. description: Not found.
  234. content:
  235. application/json:
  236. schema:
  237. $ref: '#/components/schemas/Error404'
  238. '500':
  239. description: Internal server error.
  240. content:
  241. application/json:
  242. schema:
  243. $ref: '#/components/schemas/Error500'
  244. '/exits':
  245. get:
  246. tags:
  247. - Account
  248. summary: Get exit information. This information is required to perform a withdraw.
  249. description: Get exit information. This information is required to perform a withdraw.
  250. operationId: getExits
  251. parameters:
  252. - name: tokenId
  253. in: query
  254. required: false
  255. description: Only get exits of specific token
  256. schema:
  257. $ref: '#/components/schemas/TokenId'
  258. - name: hezEthereumAddress
  259. in: query
  260. description: Get exits associated to a Ethereum address. Incompatible with query `BJJ` and `accountIndex`.
  261. required: false
  262. schema:
  263. $ref: '#/components/schemas/HezEthereumAddress'
  264. - name: BJJ
  265. in: query
  266. description: Get exits associated to a BabyJubJub public key. Incompatible with query `hezEthereumAddress` and `accountIndex`.
  267. required: false
  268. schema:
  269. $ref: '#/components/schemas/BJJ'
  270. - name: accountIndex
  271. in: query
  272. description: Get exits associated to a specific account. Incompatible with queries `tokenId`, `hezEthereumAddress` and `BJJ`.
  273. required: false
  274. schema:
  275. $ref: '#/components/schemas/AccountIndex'
  276. - name: batchNum
  277. in: query
  278. description: Get exits from the exit tree of a specific batch.
  279. required: false
  280. schema:
  281. $ref: '#/components/schemas/BatchNum'
  282. - name: onlyPendingWithdraws
  283. in: query
  284. description: Get exits with pending withdrawals.
  285. required: false
  286. schema:
  287. type: boolean
  288. - name: fromItem
  289. in: query
  290. required: false
  291. description: Indicates the desired first item (using the itemId property) to be included in the response.
  292. schema:
  293. type: number
  294. - name: order
  295. in: query
  296. required: false
  297. description: Order of the returned items. Exits will be ordered by increasing (batchNum, accountIndex).
  298. schema:
  299. type: string
  300. default: ASC
  301. enum:
  302. - ASC
  303. - DESC
  304. - name: limit
  305. in: query
  306. required: false
  307. description: Maximum number of items to be returned.
  308. schema:
  309. type: integer
  310. minimum: 1
  311. maximum: 2049
  312. responses:
  313. '200':
  314. description: Successful operation.
  315. content:
  316. application/json:
  317. schema:
  318. $ref: '#/components/schemas/Exits'
  319. '400':
  320. description: Bad request.
  321. content:
  322. application/json:
  323. schema:
  324. $ref: '#/components/schemas/Error400'
  325. '404':
  326. description: Not found.
  327. content:
  328. application/json:
  329. schema:
  330. $ref: '#/components/schemas/Error404'
  331. '500':
  332. description: Internal server error.
  333. content:
  334. application/json:
  335. schema:
  336. $ref: '#/components/schemas/Error500'
  337. '/exits/{batchNum}/{accountIndex}':
  338. get:
  339. tags:
  340. - Account
  341. summary: Get specific exit information.
  342. description: Get exit information form a specific exit tree and account. This information is required to perform a withdraw. Exits are identified with accounIndex and batchNum since every batch that has exits has a different exit tree.
  343. operationId: getExit
  344. parameters:
  345. - name: batchNum
  346. in: path
  347. description: Batch of the exit tree.
  348. required: true
  349. schema:
  350. $ref: '#/components/schemas/BatchNum'
  351. - name: accountIndex
  352. in: path
  353. description: Account identifier.
  354. required: true
  355. schema:
  356. $ref: '#/components/schemas/AccountIndex'
  357. responses:
  358. '200':
  359. description: Successful operation.
  360. content:
  361. application/json:
  362. schema:
  363. $ref: '#/components/schemas/Exit'
  364. '400':
  365. description: Bad request.
  366. content:
  367. application/json:
  368. schema:
  369. $ref: '#/components/schemas/Error400'
  370. '404':
  371. description: Not found.
  372. content:
  373. application/json:
  374. schema:
  375. $ref: '#/components/schemas/Error404'
  376. '500':
  377. description: Internal server error.
  378. content:
  379. application/json:
  380. schema:
  381. $ref: '#/components/schemas/Error500'
  382. '/transactions-pool':
  383. post:
  384. tags:
  385. - Transaction
  386. summary: Add an L2 transaction to the coordinator's pool.
  387. description: >-
  388. Send L2 transaction. The transaction will be stored in the transaction pool of the coordinator and eventually forged.
  389. operationId: postTx
  390. requestBody:
  391. description: Signed transaction.
  392. required: true
  393. content:
  394. application/json:
  395. schema:
  396. $ref: '#/components/schemas/PostPoolL2Transaction'
  397. responses:
  398. '200':
  399. description: Successful operation.
  400. content:
  401. application/json:
  402. schema:
  403. $ref: '#/components/schemas/TransactionId'
  404. '400':
  405. description: Bad request.
  406. content:
  407. application/json:
  408. schema:
  409. $ref: '#/components/schemas/Error400'
  410. '500':
  411. description: Internal server error.
  412. content:
  413. application/json:
  414. schema:
  415. $ref: '#/components/schemas/Error500'
  416. '/transactions-pool/{id}':
  417. get:
  418. tags:
  419. - Transaction
  420. summary: Get details and status of a transaction that is in the pool.
  421. description: >-
  422. Get transaction from the pool by its id. This endpoint is specially useful for tracking the status of a transaction that may not be forged yet.
  423. Only transactions from the pool will be returned.
  424. Note that the transaction pool is different for each coordinator and therefore only a coordinator that has received a specific transaction
  425. will be able to provide information about that transaction.
  426. operationId: getPoolTx
  427. parameters:
  428. - name: id
  429. in: path
  430. description: Transaction identifier.
  431. required: true
  432. schema:
  433. $ref: '#/components/schemas/TransactionId'
  434. responses:
  435. '200':
  436. description: Successful operation.
  437. content:
  438. application/json:
  439. schema:
  440. $ref: '#/components/schemas/PoolL2Transaction'
  441. '400':
  442. description: Bad request.
  443. content:
  444. application/json:
  445. schema:
  446. $ref: '#/components/schemas/Error400'
  447. '404':
  448. description: Not found.
  449. content:
  450. application/json:
  451. schema:
  452. $ref: '#/components/schemas/Error404'
  453. '500':
  454. description: Internal server error.
  455. content:
  456. application/json:
  457. schema:
  458. $ref: '#/components/schemas/Error500'
  459. '/transactions-history':
  460. get:
  461. tags:
  462. - Transaction
  463. summary: Get details and status of transactions that have been forged.
  464. description: >-
  465. Get historical transactions. This endpoint will return all the different types of transactions except for:
  466. - Transactions that are still in the transaction pool of any coordinator. These transactions can be fetched using `GET /transactions-pool/{id}`.
  467. - L1 transactions sent by users that have not been forged yet. These transactions can be fetched using `GET /transactions-history/{id}`.
  468. operationId: getHistoryTxs
  469. parameters:
  470. - name: tokenId
  471. in: query
  472. required: false
  473. description: Only get transactions of specific token
  474. schema:
  475. $ref: '#/components/schemas/TokenId'
  476. - name: hezEthereumAddress
  477. in: query
  478. required: false
  479. description: Only get transactions sent from or to an account associated to an Ethereum address Incompatible with the queries `BJJ` and `accountIndex`.
  480. schema:
  481. $ref: '#/components/schemas/HezEthereumAddress'
  482. - name: BJJ
  483. in: query
  484. description: Only get transactions associated to a BabyJubJub public key. Incompatible with the queries `hezEthereumAddress` and `accountIndex`.
  485. required: false
  486. schema:
  487. $ref: '#/components/schemas/BJJ'
  488. - name: accountIndex
  489. in: query
  490. required: false
  491. description: Only get transactions sent from or to a specific account. Incompatible with the queries `tokenId`, `hezEthereumAddress` and `BJJ`.
  492. schema:
  493. $ref: '#/components/schemas/AccountIndex'
  494. - name: batchNum
  495. in: query
  496. required: false
  497. description: Only get transactions forged in a specific batch.
  498. schema:
  499. $ref: '#/components/schemas/BatchNum'
  500. - name: type
  501. in: query
  502. required: false
  503. description: Only get transactions of a specific type.
  504. schema:
  505. $ref: '#/components/schemas/TransactionType'
  506. - name: fromItem
  507. in: query
  508. required: false
  509. description: Indicates the desired first item (using the itemId property) to be included in the response.
  510. schema:
  511. type: number
  512. - name: order
  513. in: query
  514. required: false
  515. description: Order of the returned items. History transactions will be ordered by (batchNum, position).
  516. schema:
  517. type: string
  518. default: ASC
  519. enum:
  520. - ASC
  521. - DESC
  522. - name: limit
  523. in: query
  524. required: false
  525. description: Maximum number of items to be returned.
  526. schema:
  527. type: integer
  528. minimum: 1
  529. maximum: 2049
  530. responses:
  531. '200':
  532. description: Successful operation.
  533. content:
  534. application/json:
  535. schema:
  536. $ref: '#/components/schemas/HistoryTransactions'
  537. '400':
  538. description: Bad request.
  539. content:
  540. application/json:
  541. schema:
  542. $ref: '#/components/schemas/Error400'
  543. '404':
  544. description: Not found.
  545. content:
  546. application/json:
  547. schema:
  548. $ref: '#/components/schemas/Error404'
  549. '500':
  550. description: Internal server error.
  551. content:
  552. application/json:
  553. schema:
  554. $ref: '#/components/schemas/Error500'
  555. '/transactions-history/{id}':
  556. get:
  557. tags:
  558. - Transaction
  559. summary: Get details and status of a historical transaction.
  560. description: >-
  561. Get transaction from the history by its id. This endpoint will return all the different types of transactions except those that are still in the pool of any coordinator.
  562. operationId: getHistoryTx
  563. parameters:
  564. - name: id
  565. in: path
  566. description: Transaction identifier.
  567. required: true
  568. schema:
  569. $ref: '#/components/schemas/TransactionId'
  570. responses:
  571. '200':
  572. description: Successful operation.
  573. content:
  574. application/json:
  575. schema:
  576. $ref: '#/components/schemas/HistoryTransaction'
  577. '400':
  578. description: Bad request.
  579. content:
  580. application/json:
  581. schema:
  582. $ref: '#/components/schemas/Error400'
  583. '404':
  584. description: Not found.
  585. content:
  586. application/json:
  587. schema:
  588. $ref: '#/components/schemas/Error404'
  589. '500':
  590. description: Internal server error.
  591. content:
  592. application/json:
  593. schema:
  594. $ref: '#/components/schemas/Error500'
  595. '/batches':
  596. get:
  597. tags:
  598. - Hermez status
  599. summary: Get information about forged batches.
  600. description: >-
  601. Get information about forged batches.
  602. operationId: getBatches
  603. parameters:
  604. - name: minBatchNum
  605. in: query
  606. required: false
  607. description: Include only `batchNum > minBatchNum` batches.
  608. schema:
  609. $ref: '#/components/schemas/BatchNum'
  610. - name: maxBatchNum
  611. in: query
  612. required: false
  613. description: Include only `batchNum < maxBatchNum` batches.
  614. schema:
  615. type: number
  616. - name: slotNum
  617. in: query
  618. required: false
  619. description: Include only batches that were forged within the specified slot.
  620. schema:
  621. $ref: '#/components/schemas/SlotNum'
  622. - name: forgerAddr
  623. in: query
  624. required: false
  625. description: Include only batches forged by `forgerAddr`
  626. schema:
  627. $ref: '#/components/schemas/EthereumAddress'
  628. - name: fromItem
  629. in: query
  630. required: false
  631. description: Indicates the desired first item (using the itemId property) to be included in the response.
  632. schema:
  633. type: number
  634. - name: order
  635. in: query
  636. required: false
  637. description: Order of the returned items. Batches will be ordered by increasing `batchNum`.
  638. schema:
  639. type: string
  640. default: ASC
  641. enum:
  642. - ASC
  643. - DESC
  644. - name: limit
  645. in: query
  646. required: false
  647. description: Maximum number of items to be returned.
  648. schema:
  649. type: integer
  650. minimum: 1
  651. maximum: 2049
  652. responses:
  653. '200':
  654. description: Successful operation.
  655. content:
  656. application/json:
  657. schema:
  658. $ref: '#/components/schemas/Batches'
  659. '400':
  660. description: Bad request.
  661. content:
  662. application/json:
  663. schema:
  664. $ref: '#/components/schemas/Error400'
  665. '404':
  666. description: Not found.
  667. content:
  668. application/json:
  669. schema:
  670. $ref: '#/components/schemas/Error404'
  671. '500':
  672. description: Internal server error.
  673. content:
  674. application/json:
  675. schema:
  676. $ref: '#/components/schemas/Error500'
  677. '/batches/{batchNum}':
  678. get:
  679. tags:
  680. - Hermez status
  681. summary: Get a specific batch.
  682. description: >-
  683. Get a specific batch.
  684. operationId: getBatch
  685. parameters:
  686. - name: batchNum
  687. in: path
  688. description: Batch identifier.
  689. required: true
  690. schema:
  691. $ref: '#/components/schemas/BatchNum'
  692. responses:
  693. '200':
  694. description: Successful operation
  695. content:
  696. application/json:
  697. schema:
  698. $ref: '#/components/schemas/Batch'
  699. '400':
  700. description: Bad request.
  701. content:
  702. application/json:
  703. schema:
  704. $ref: '#/components/schemas/Error400'
  705. '404':
  706. description: Not found.
  707. content:
  708. application/json:
  709. schema:
  710. $ref: '#/components/schemas/Error404'
  711. '500':
  712. description: Internal server error.
  713. content:
  714. application/json:
  715. schema:
  716. $ref: '#/components/schemas/Error500'
  717. '/full-batches/{batchNum}':
  718. get:
  719. tags:
  720. - Hermez status
  721. summary: Get a full batch.
  722. description: >-
  723. Get a specific batch, including the associated transactions. The object returned in this method can be a bit heavy.
  724. If you're devloping a front end, you may consider using a combinaton of `GET /batches/{batchnum}` and `GET /history-transactions?batchNum={batchNum}`.
  725. operationId: getFullBatch
  726. parameters:
  727. - name: batchNum
  728. in: path
  729. description: Batch identifier
  730. required: true
  731. schema:
  732. $ref: '#/components/schemas/BatchNum'
  733. responses:
  734. '200':
  735. description: successful operation
  736. content:
  737. application/json:
  738. schema:
  739. $ref: '#/components/schemas/FullBatch'
  740. '400':
  741. description: Bad request.
  742. content:
  743. application/json:
  744. schema:
  745. $ref: '#/components/schemas/Error400'
  746. '404':
  747. description: Not found.
  748. content:
  749. application/json:
  750. schema:
  751. $ref: '#/components/schemas/Error404'
  752. '500':
  753. description: Internal server error.
  754. content:
  755. application/json:
  756. schema:
  757. $ref: '#/components/schemas/Error500'
  758. '/slots':
  759. get:
  760. tags:
  761. - Hermez status
  762. summary: Get information about slots.
  763. description: >-
  764. Get information about slots.
  765. operationId: getSlots
  766. parameters:
  767. - name: minSlotNum
  768. in: query
  769. required: false
  770. description: Only include slots with `slotNum >= minSlotNum`. By default, `minSlotNum = 0`.
  771. schema:
  772. $ref: '#/components/schemas/SlotNum'
  773. - name: maxSlothNum
  774. in: query
  775. required: false
  776. description: Only include slots with `slotNum <= maxSlotNum`.
  777. schema:
  778. $ref: '#/components/schemas/SlotNum'
  779. - name: wonByEthereumAddress
  780. in: query
  781. required: false
  782. description: Only include slots won by a coordinator whose `bidderAddr == wonByEthereumAddress`.
  783. schema:
  784. $ref: '#/components/schemas/EthereumAddress'
  785. - name: finishedAuction
  786. in: query
  787. required: false
  788. description: If set to true, only include slots whose auction has finished.
  789. schema:
  790. type: boolean
  791. - name: fromItem
  792. in: query
  793. required: false
  794. description: Indicates the desired first item (using the itemId property) to be included in the response.
  795. schema:
  796. type: number
  797. - name: order
  798. in: query
  799. required: false
  800. description: Order of the returned items. Slots will be ordered by increasing `slotNum`.
  801. schema:
  802. type: string
  803. default: ASC
  804. enum:
  805. - ASC
  806. - DESC
  807. - name: limit
  808. in: query
  809. required: false
  810. description: Maximum number of items to be returned.
  811. schema:
  812. type: integer
  813. minimum: 1
  814. maximum: 2049
  815. responses:
  816. '200':
  817. description: Successful operation.
  818. content:
  819. application/json:
  820. schema:
  821. $ref: '#/components/schemas/Slots'
  822. '400':
  823. description: Bad request.
  824. content:
  825. application/json:
  826. schema:
  827. $ref: '#/components/schemas/Error400'
  828. '404':
  829. description: Not found.
  830. content:
  831. application/json:
  832. schema:
  833. $ref: '#/components/schemas/Error404'
  834. '500':
  835. description: Internal server error.
  836. content:
  837. application/json:
  838. schema:
  839. $ref: '#/components/schemas/Error500'
  840. '/slots/{slotNum}':
  841. get:
  842. tags:
  843. - Hermez status
  844. summary: Get information about a specific slot.
  845. description: >-
  846. Get information about a specific slot.
  847. operationId: getSlot
  848. parameters:
  849. - name: slotNum
  850. in: path
  851. required: true
  852. description: Identifier of the slot.
  853. schema:
  854. $ref: '#/components/schemas/SlotNum'
  855. responses:
  856. '200':
  857. description: Successful operation.
  858. content:
  859. application/json:
  860. schema:
  861. $ref: '#/components/schemas/Slot'
  862. '400':
  863. description: Bad request.
  864. content:
  865. application/json:
  866. schema:
  867. $ref: '#/components/schemas/Error400'
  868. '404':
  869. description: Not found.
  870. content:
  871. application/json:
  872. schema:
  873. $ref: '#/components/schemas/Error404'
  874. '500':
  875. description: Internal server error.
  876. content:
  877. application/json:
  878. schema:
  879. $ref: '#/components/schemas/Error500'
  880. '/bids':
  881. get:
  882. tags:
  883. - Hermez status
  884. summary: Get a list of bids made for a specific slot auction.
  885. description: Get a list of bids made for a specific slot auction. Is necessary to add a filter (`slotNum` or `bidderAddr`).
  886. operationId: getSlotBids
  887. parameters:
  888. - name: slotNum
  889. in: query
  890. description: Slot identifier. Specify the auction where the returned bids were made.
  891. required: false
  892. schema:
  893. $ref: '#/components/schemas/SlotNum'
  894. - name: bidderAddr
  895. in: query
  896. description: Get only bids made by a coordinator identified by its bidder address. In this case, the bids will be returned in the order that the coordinator made them.
  897. required: false
  898. schema:
  899. $ref: '#/components/schemas/EthereumAddress'
  900. - name: fromItem
  901. in: query
  902. required: false
  903. description: Indicates the desired first item (using the itemId property) to be included in the response.
  904. schema:
  905. type: number
  906. - name: order
  907. in: query
  908. required: false
  909. description: Order of the returned items. Bids will be ordered by increasing (slotNum, bidValue)`.
  910. schema:
  911. type: string
  912. default: ASC
  913. enum:
  914. - ASC
  915. - DESC
  916. - name: limit
  917. in: query
  918. required: false
  919. description: Maximum number of items to be returned.
  920. schema:
  921. type: integer
  922. minimum: 1
  923. maximum: 2049
  924. responses:
  925. '200':
  926. description: Successful operation
  927. content:
  928. application/json:
  929. schema:
  930. $ref: '#/components/schemas/Bids'
  931. '400':
  932. description: Bad request.
  933. content:
  934. application/json:
  935. schema:
  936. $ref: '#/components/schemas/Error400'
  937. '404':
  938. description: Not found.
  939. content:
  940. application/json:
  941. schema:
  942. $ref: '#/components/schemas/Error404'
  943. '500':
  944. description: Internal server error.
  945. content:
  946. application/json:
  947. schema:
  948. $ref: '#/components/schemas/Error500'
  949. '/state':
  950. get:
  951. tags:
  952. - Hermez status
  953. summary: Return information that represents the current state of the network.
  954. description: Return information that represents the current state of the network. It also includes metrics and statistics.
  955. operationId: getState
  956. responses:
  957. '200':
  958. description: Successful operation.
  959. content:
  960. application/json:
  961. schema:
  962. $ref: '#/components/schemas/State'
  963. '400':
  964. description: Bad request.
  965. content:
  966. application/json:
  967. schema:
  968. $ref: '#/components/schemas/Error400'
  969. '500':
  970. description: Internal server error.
  971. content:
  972. application/json:
  973. schema:
  974. $ref: '#/components/schemas/Error500'
  975. '/config':
  976. get:
  977. tags:
  978. - Hermez status
  979. summary: Return constant configuration of the network.
  980. description: Return constant configuration of the network.
  981. operationId: getConfig
  982. responses:
  983. '200':
  984. description: Successful operation.
  985. content:
  986. application/json:
  987. schema:
  988. $ref: '#/components/schemas/Config'
  989. '500':
  990. description: Internal server error.
  991. content:
  992. application/json:
  993. schema:
  994. $ref: '#/components/schemas/Error500'
  995. '/tokens':
  996. get:
  997. tags:
  998. - Hermez status
  999. summary: Get information of the supported tokens in the Hermez network.
  1000. description: Get information of the supported tokens in the Hermez network.
  1001. operationId: getTokens
  1002. parameters:
  1003. - name: ids
  1004. in: query
  1005. required: false
  1006. description: Include only specific tokens by their Hermez identifiers.
  1007. schema:
  1008. type: string
  1009. description: Comma separated list of token identifiers
  1010. example: "2,44,689"
  1011. - name: symbols
  1012. in: query
  1013. required: false
  1014. description: Include only specific tokens by their symbols.
  1015. schema:
  1016. type: string
  1017. description: Comma separated list of token symbols.
  1018. example: "DAI,NEC,UMA"
  1019. - name: name
  1020. in: query
  1021. required: false
  1022. description: Include token(s) by their names (or a substring of the name).
  1023. schema:
  1024. type: string
  1025. - name: fromItem
  1026. in: query
  1027. required: false
  1028. description: Indicates the desired first item (using the itemId property) to be included in the response.
  1029. schema:
  1030. type: number
  1031. - name: order
  1032. in: query
  1033. required: false
  1034. description: Order of the returned items. Tokens will be ordered by increasing tokenID.
  1035. schema:
  1036. type: string
  1037. default: ASC
  1038. enum:
  1039. - ASC
  1040. - DESC
  1041. - name: limit
  1042. in: query
  1043. required: false
  1044. description: Maximum number of items to be returned.
  1045. schema:
  1046. type: integer
  1047. minimum: 1
  1048. maximum: 2049
  1049. responses:
  1050. '200':
  1051. description: Successful operation.
  1052. content:
  1053. application/json:
  1054. schema:
  1055. $ref: '#/components/schemas/Tokens'
  1056. '400':
  1057. description: Bad request.
  1058. content:
  1059. application/json:
  1060. schema:
  1061. $ref: '#/components/schemas/Error400'
  1062. '404':
  1063. description: Not found.
  1064. content:
  1065. application/json:
  1066. schema:
  1067. $ref: '#/components/schemas/Error404'
  1068. '500':
  1069. description: Internal server error.
  1070. content:
  1071. application/json:
  1072. schema:
  1073. $ref: '#/components/schemas/Error500'
  1074. '/tokens/{id}':
  1075. get:
  1076. tags:
  1077. - Hermez status
  1078. summary: Get information of a token supported by Hermez network.
  1079. description: Get information of a token supported by Hermez network.
  1080. operationId: getToken
  1081. parameters:
  1082. - name: id
  1083. in: path
  1084. description: Token identifier
  1085. required: true
  1086. schema:
  1087. $ref: '#/components/schemas/TokenId'
  1088. responses:
  1089. '200':
  1090. description: Successful operation.
  1091. content:
  1092. application/json:
  1093. schema:
  1094. $ref: '#/components/schemas/Token'
  1095. '400':
  1096. description: Bad request.
  1097. content:
  1098. application/json:
  1099. schema:
  1100. $ref: '#/components/schemas/Error400'
  1101. '404':
  1102. description: Not found.
  1103. content:
  1104. application/json:
  1105. schema:
  1106. $ref: '#/components/schemas/Error404'
  1107. '500':
  1108. description: Internal server error.
  1109. content:
  1110. application/json:
  1111. schema:
  1112. $ref: '#/components/schemas/Error500'
  1113. '/coordinators':
  1114. get:
  1115. tags:
  1116. - Hermez status
  1117. summary: Get information about coordinators.
  1118. description: Get information about coordinators.
  1119. operationId: getCoordinators
  1120. parameters:
  1121. - name: fromItem
  1122. in: query
  1123. required: false
  1124. description: Indicates the desired first item (using the itemId property) to be included in the response.
  1125. schema:
  1126. type: number
  1127. - name: order
  1128. in: query
  1129. required: false
  1130. description: Order of the returned items. Coordinators will be ordered by increasing (ethereumBlock, forgerAddr).
  1131. schema:
  1132. type: string
  1133. default: ASC
  1134. enum:
  1135. - ASC
  1136. - DESC
  1137. - name: limit
  1138. in: query
  1139. required: false
  1140. description: Maximum number of items to be returned.
  1141. schema:
  1142. type: integer
  1143. minimum: 1
  1144. maximum: 2049
  1145. responses:
  1146. '200':
  1147. description: Successful operation.
  1148. content:
  1149. application/json:
  1150. schema:
  1151. $ref: '#/components/schemas/Coordinators'
  1152. '400':
  1153. description: Bad request.
  1154. content:
  1155. application/json:
  1156. schema:
  1157. $ref: '#/components/schemas/Error400'
  1158. '500':
  1159. description: Internal server error.
  1160. content:
  1161. application/json:
  1162. schema:
  1163. $ref: '#/components/schemas/Error500'
  1164. '/coordinators/{bidderAddr}':
  1165. get:
  1166. tags:
  1167. - Hermez status
  1168. summary: Get the information of a coordinator.
  1169. description: Get the information of a coordinator.
  1170. operationId: getCoordinator
  1171. parameters:
  1172. - name: bidderAddr
  1173. in: path
  1174. description: Coordinator identifier
  1175. required: true
  1176. schema:
  1177. $ref: '#/components/schemas/EthereumAddress'
  1178. responses:
  1179. '200':
  1180. description: Successful operation.
  1181. content:
  1182. application/json:
  1183. schema:
  1184. $ref: '#/components/schemas/Coordinator'
  1185. '400':
  1186. description: Bad request.
  1187. content:
  1188. application/json:
  1189. schema:
  1190. $ref: '#/components/schemas/Error400'
  1191. '404':
  1192. description: Not found.
  1193. content:
  1194. application/json:
  1195. schema:
  1196. $ref: '#/components/schemas/Error404'
  1197. '500':
  1198. description: Internal server error.
  1199. content:
  1200. application/json:
  1201. schema:
  1202. $ref: '#/components/schemas/Error500'
  1203. components:
  1204. schemas:
  1205. ItemId:
  1206. type: integer
  1207. description: Position of the item in the DB. This is useful for pagination, but has nothing to do with the protocol.
  1208. PostPoolL2Transaction:
  1209. type: object
  1210. description: L2 transaction to be posted.
  1211. properties:
  1212. id:
  1213. $ref: '#/components/schemas/TransactionId'
  1214. type:
  1215. $ref: '#/components/schemas/TransactionTypeL2'
  1216. tokenId:
  1217. $ref: '#/components/schemas/TokenId'
  1218. fromAccountIndex:
  1219. $ref: '#/components/schemas/AccountIndex'
  1220. toAccountIndex:
  1221. type: string
  1222. description: >-
  1223. Identifier of the destination account. It references the position where the account is inside the state Merkle tree.
  1224. The identifier is built using: `hez:` + `token symbol:` + `index`. If this is provided, toHezEthereumAddress and toBjj
  1225. must be null. To perform an exit the value hez:EXIT:1 must be used.
  1226. example: null
  1227. nullable: true
  1228. toHezEthereumAddress:
  1229. type: string
  1230. description: "Address of an Etherum account linked to the Hermez network. If this is provided, toAccountIndex and toBjj must be null."
  1231. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1232. example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1233. nullable: true
  1234. toBjj:
  1235. type: string
  1236. description: >-
  1237. BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes.
  1238. If this is prvided, toAccountIndex must be null and toHezEthereumAddress must be hez:0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.
  1239. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1240. example: null
  1241. nullable: true
  1242. amount:
  1243. allOf:
  1244. - $ref: '#/components/schemas/BigInt'
  1245. - description: Amount of tokens to be sent.
  1246. example: "6300000000000000000"
  1247. fee:
  1248. $ref: '#/components/schemas/FeeSelector'
  1249. nonce:
  1250. $ref: '#/components/schemas/Nonce'
  1251. signature:
  1252. allOf:
  1253. - $ref: '#/components/schemas/BJJSignature'
  1254. - description: Signature of the transaction. More info [here](https://idocs.hermez.io/#/spec/zkrollup/README?id=l2a-idl2).
  1255. - example: "72024a43f546b0e1d9d5d7c4c30c259102a9726363adcc4ec7b6aea686bcb5116f485c5542d27c4092ae0ceaf38e3bb44417639bd2070a58ba1aa1aab9d92c03"
  1256. requestFromAccountIndex:
  1257. type: string
  1258. description: References the `fromAccountIndex` of the requested transaction.
  1259. example: null
  1260. nullable: true
  1261. requestToAccountIndex:
  1262. type: string
  1263. description: References the `toAccountIndex` of the requested transaction.
  1264. example: null
  1265. nullable: true
  1266. requestToHezEthereumAddress:
  1267. type: string
  1268. description: References the `toHezEthereumAddress` of the requested transaction.
  1269. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1270. example: null
  1271. nullable: true
  1272. requestToBjj:
  1273. type: string
  1274. description: References the `toBjj` of the requested transaction.
  1275. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1276. example: null
  1277. nullable: true
  1278. requestTokenId:
  1279. type: integer
  1280. description: References the `tokenId` of the requested transaction.
  1281. example: null
  1282. nullable: true
  1283. requestAmount:
  1284. type: string
  1285. description: References the `amount` of the requested transaction.
  1286. example: null
  1287. nullable: true
  1288. requestFee:
  1289. type: integer
  1290. description: References the `fee` of the requested transaction.
  1291. example: null
  1292. nullable: true
  1293. requestNonce:
  1294. type: integer
  1295. description: References the `nonce` of the requested transaction.
  1296. example: null
  1297. nullable: true
  1298. required:
  1299. - id
  1300. - type
  1301. - tokenId
  1302. - fromAccountIndex
  1303. - amount
  1304. - fee
  1305. - nonce
  1306. - signature
  1307. PoolL2Transaction:
  1308. type: object
  1309. properties:
  1310. id:
  1311. $ref: '#/components/schemas/TransactionId'
  1312. type:
  1313. $ref: '#/components/schemas/TransactionTypeL2'
  1314. fromAccountIndex:
  1315. $ref: '#/components/schemas/AccountIndex'
  1316. fromHezEthereumAddress:
  1317. type: string
  1318. description: "Address of an Etherum account linked to the Hermez network."
  1319. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1320. example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1321. nullable: true
  1322. fromBJJ:
  1323. type: string
  1324. description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
  1325. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1326. example: "hez:9CK9fjQdMUTGm8KDvGLy3MB-vnP0NCcGX7Uh7OO6KRJm"
  1327. nullable: true
  1328. toAccountIndex:
  1329. type: string
  1330. description: >-
  1331. Identifier of the destination account. It references the position where the account is inside the state Merkle tree.
  1332. The identifier is built using: `hez:` + `token symbol:` + `index`
  1333. example: "hez:DAI:309"
  1334. nullable: true
  1335. toHezEthereumAddress:
  1336. type: string
  1337. description: "Address of an Etherum account linked to the Hermez network."
  1338. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1339. example: null
  1340. nullable: true
  1341. toBjj:
  1342. type: string
  1343. description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
  1344. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1345. example: null
  1346. nullable: true
  1347. amount:
  1348. allOf:
  1349. - $ref: '#/components/schemas/BigInt'
  1350. - description: Amount of tokens to be sent.
  1351. example: "6303020000000000000"
  1352. fee:
  1353. $ref: '#/components/schemas/FeeSelector'
  1354. nonce:
  1355. $ref: '#/components/schemas/Nonce'
  1356. state:
  1357. $ref: '#/components/schemas/PoolL2TransactionState'
  1358. signature:
  1359. allOf:
  1360. - $ref: '#/components/schemas/BJJSignature'
  1361. - description: Signature of the transaction. More info [here](https://idocs.hermez.io/#/spec/zkrollup/README?id=l2a-idl2).
  1362. - example: "72024a43f546b0e1d9d5d7c4c30c259102a9726363adcc4ec7b6aea686bcb5116f485c5542d27c4092ae0ceaf38e3bb44417639bd2070a58ba1aa1aab9d92c03"
  1363. timestamp:
  1364. type: string
  1365. description: Moment in which the transaction was added to the pool.
  1366. format: date-time
  1367. batchNum:
  1368. type: integer
  1369. description: Identifier of a batch. Every new forged batch increments by one the batchNum, starting at 0.
  1370. minimum: 0
  1371. maximum: 4294967295
  1372. nullable: true
  1373. example: null
  1374. requestFromAccountIndex:
  1375. type: string
  1376. description: >-
  1377. Identifier of an account. It references the position where the account is inside the state Merkle tree.
  1378. The identifier is built using: `hez:` + `token symbol:` + `index`
  1379. nullable: true
  1380. example: null
  1381. requestToAccountIndex:
  1382. type: string
  1383. description: >-
  1384. Identifier of an account. It references the position where the account is inside the state Merkle tree.
  1385. The identifier is built using: `hez:` + `token symbol:` + `index`
  1386. nullable: true
  1387. example: null
  1388. requestToHezEthereumAddress:
  1389. type: string
  1390. description: "Address of an Etherum account linked to the Hermez network."
  1391. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1392. nullable: true
  1393. example: null
  1394. requestToBJJ:
  1395. type: string
  1396. description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
  1397. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1398. nullable: true
  1399. example: null
  1400. requestTokenId:
  1401. type: integer
  1402. description: References the `tokenId` of the requested transaction.
  1403. example: null
  1404. nullable: true
  1405. requestAmount:
  1406. type: string
  1407. description: BigInt is an integer encoded as a string for numbers that are very large.
  1408. nullable: true
  1409. example: null
  1410. requestFee:
  1411. type: integer
  1412. description: Index of the fee type to select, more info [here](https://idocs.hermez.io/#/spec/zkrollup/fee-table?id=transaction-fee-table).
  1413. minimum: 0
  1414. maximum: 256
  1415. nullable: true
  1416. example: null
  1417. requestNonce:
  1418. type: integer
  1419. description: Number that can only be used once per account. Increments by one with each transaction.
  1420. minimum: 0
  1421. maximum: 1.84467440737096e+19
  1422. nullable: true
  1423. example: null
  1424. token:
  1425. $ref: '#/components/schemas/Token'
  1426. required:
  1427. - id
  1428. - type
  1429. - fromAccountIndex
  1430. - fromHezEthereumAddress
  1431. - fromBJJ
  1432. - toAccountIndex
  1433. - toHezEthereumAddress
  1434. - toBjj
  1435. - amount
  1436. - fee
  1437. - nonce
  1438. - state
  1439. - signature
  1440. - timestamp
  1441. - batchNum
  1442. - requestFromAccountIndex
  1443. - requestToAccountIndex
  1444. - requestToHezEthereumAddress
  1445. - requestToBJJ
  1446. - requestTokenId
  1447. - requestAmount
  1448. - requestFee
  1449. - requestNonce
  1450. - token
  1451. TransactionId:
  1452. type: string
  1453. description: Identifier for transactions. Used for any kind of transaction (both L1 and L2). More info on how the identifiers are built [here](https://idocs.hermez.io/#/spec/architecture/db/README?id=txid)
  1454. example: "0x00000000000001e240004700"
  1455. EthereumAddress:
  1456. type: string
  1457. description: "Address of an Etherum account."
  1458. pattern: "^0x[a-fA-F0-9]{40}$"
  1459. example: "0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1460. HezEthereumAddress:
  1461. type: string
  1462. description: "Address of an Etherum account linked to the Hermez network."
  1463. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1464. example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1465. BJJ:
  1466. type: string
  1467. description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
  1468. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1469. example: "hez:rR7LXKal-av7I56Y0dEBCVmwc9zpoLY5ERhy5w7G-xwe"
  1470. AccountIndex:
  1471. type: string
  1472. description: >-
  1473. Identifier of an account. It references the position where the account is inside the state Merkle tree.
  1474. The identifier is built using: `hez:` + `token symbol:` + `index`
  1475. example: "hez:DAI:4444"
  1476. TransactionType:
  1477. type: string
  1478. description: Type of transaction.
  1479. enum:
  1480. - Exit
  1481. - Transfer
  1482. - Deposit
  1483. - CreateAccountDeposit
  1484. - CreateAccountDepositTransfer
  1485. - DepositTransfer
  1486. - ForceTransfer
  1487. - ForceExit
  1488. - TransferToEthAddr
  1489. - TransferToBJJ
  1490. TransactionTypeL2:
  1491. type: string
  1492. description: Type of transaction.
  1493. enum:
  1494. - Exit
  1495. - Transfer
  1496. - TransferToEthAddr
  1497. - TransferToBJJ
  1498. TokenId:
  1499. type: integer
  1500. description: Identifier of a token registered in the network.
  1501. minimum: 0
  1502. maximum: 4294967295
  1503. example: 98765
  1504. BigInt:
  1505. type: string
  1506. description: BigInt is an integer encoded as a string for numbers that are very large.
  1507. example: "8708856933496328593"
  1508. pattern: "^\\d+$"
  1509. FeeSelector:
  1510. type: integer
  1511. description: Index of the fee type to select, more info [here](https://idocs.hermez.io/#/spec/zkrollup/fee-table?id=transaction-fee-table).
  1512. minimum: 0
  1513. maximum: 256
  1514. example: 36
  1515. Nonce:
  1516. type: integer
  1517. description: Number that can only be used once per account, increments by one at each transaction.
  1518. minimum: 0
  1519. maximum: 1.84467440737096e+19
  1520. example: 121
  1521. PoolL2TransactionState:
  1522. type: string
  1523. description: >
  1524. State of a L2 transaction from the coordinator pool.
  1525. * pend: Pending
  1526. * fing: Forging
  1527. * fged: Forged
  1528. * invl: Invalid
  1529. enum:
  1530. - pend
  1531. - fing
  1532. - fged
  1533. - invl
  1534. ETHSignature:
  1535. type: string
  1536. description: Ethereum signature.
  1537. pattern: "^0x[a-fA-F0-9]{130}$"
  1538. example: "0xf9161cd688394772d93aa3e7b3f8f9553ca4f94f65b7cece93ed4a239d5c0b4677dca6d1d459e3a5c271a34de735d4664a43e5a8960a9a6e027d12c562dd448e1c"
  1539. BJJSignature:
  1540. type: string
  1541. description: BabyJubJub compressed signature.
  1542. pattern: "^[a-fA-F0-9]{128}$"
  1543. example: "72024a43f546b0e1d9d5d7c4c30c259102a9726363adcc4ec7b6aea686bcb5116f485c5542d27c4092ae0ceaf38e3bb44417639bd2070a58ba1aa1aab9d92c03"
  1544. BatchNum:
  1545. type: integer
  1546. description: Identifier of a batch. Every new forged batch increments by one the batchNum, starting at 0.
  1547. minimum: 0
  1548. maximum: 4294967295
  1549. example: 5432
  1550. AccountCreationAuthorizationPost:
  1551. type: object
  1552. properties:
  1553. hezEthereumAddress:
  1554. $ref: '#/components/schemas/HezEthereumAddress'
  1555. bjj:
  1556. $ref: '#/components/schemas/BJJ'
  1557. signature:
  1558. $ref: '#/components/schemas/ETHSignature'
  1559. required:
  1560. - hezEthereumAddress
  1561. - bjj
  1562. - signature
  1563. AccountCreationAuthorization:
  1564. type: object
  1565. properties:
  1566. timestamp:
  1567. type: string
  1568. format: date-time
  1569. hezEthereumAddress:
  1570. $ref: '#/components/schemas/HezEthereumAddress'
  1571. bjj:
  1572. $ref: '#/components/schemas/BJJ'
  1573. signature:
  1574. $ref: '#/components/schemas/ETHSignature'
  1575. required:
  1576. - timestamp
  1577. - hezEthereumAddress
  1578. - bjj
  1579. - signature
  1580. HistoryTransaction:
  1581. type: object
  1582. description: Transaction of the Hermez network
  1583. properties:
  1584. L1orL2:
  1585. type: string
  1586. enum:
  1587. - L1
  1588. - L2
  1589. id:
  1590. $ref: '#/components/schemas/TransactionId'
  1591. itemId:
  1592. $ref: '#/components/schemas/ItemId'
  1593. type:
  1594. $ref: '#/components/schemas/TransactionType'
  1595. position:
  1596. $ref: '#/components/schemas/TransactionPosition'
  1597. fromAccountIndex:
  1598. type: string
  1599. description: >-
  1600. Identifier of an account. It references the position where the account is inside the state Merkle tree.
  1601. The identifier is built using: `hez:` + `token symbol:` + `index`
  1602. example: "hez:DAI:4444"
  1603. nullable: true
  1604. fromHezEthereumAddress:
  1605. type: string
  1606. description: "Address of an Etherum account linked to the Hermez network."
  1607. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1608. example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1609. nullable: true
  1610. fromBJJ:
  1611. type: string
  1612. description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
  1613. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1614. example: "hez:9CK9fjQdMUTGm8KDvGLy3MB-vnP0NCcGX7Uh7OO6KRJm"
  1615. nullable: true
  1616. toAccountIndex:
  1617. allOf:
  1618. - $ref: '#/components/schemas/AccountIndex'
  1619. - example: "hez:DAI:672"
  1620. toHezEthereumAddress:
  1621. type: string
  1622. description: "Address of an Etherum account linked to the Hermez network."
  1623. pattern: "^hez:0x[a-fA-F0-9]{40}$"
  1624. example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1625. nullable: true
  1626. toBJJ:
  1627. type: string
  1628. description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
  1629. pattern: "^hez:[A-Za-z0-9_-]{44}$"
  1630. example: "hez:f1J78_6uqTyjX6jrVCqN4RFeRBnWQAGl477ZFtOnH6Sm"
  1631. nullable: true
  1632. amount:
  1633. allOf:
  1634. - $ref: '#/components/schemas/BigInt'
  1635. - description: Amount of tokens to be sent.
  1636. - example: "4903020000000000000"
  1637. batchNum:
  1638. type: integer
  1639. description: Batch in which the transaction was forged. Null indicates not forged yet.
  1640. minimum: 0
  1641. maximum: 4294967295
  1642. example: 5432
  1643. nullable: true
  1644. historicUSD:
  1645. type: number
  1646. description: Value in USD at the moment the transaction was forged.
  1647. example: 49.7
  1648. nullable: true
  1649. timestamp:
  1650. type: string
  1651. format: date-time
  1652. description: In the case of L1 indicates the moment where the transaction was added in the smart contract. For L2 indicates when the transaction was forged.
  1653. token:
  1654. $ref: '#/components/schemas/Token'
  1655. L1Info:
  1656. type: object
  1657. description: Additional information that only applies to L1 transactions.
  1658. nullable: true
  1659. properties:
  1660. toForgeL1TransactionsNum:
  1661. $ref: '#/components/schemas/ToForgeL1TransactionsNum'
  1662. userOrigin:
  1663. type: boolean
  1664. description: True if the transaction was sent by a user. False if it was sent by a coordinator.
  1665. loadAmount:
  1666. allOf:
  1667. - $ref: '#/components/schemas/BigInt'
  1668. - description: Tokens transfered from L1 to L2.
  1669. - example: "4900000000000000000"
  1670. historicLoadAmountUSD:
  1671. type: number
  1672. description: Load amount in USD, at the moment the transaction was made.
  1673. example: 3.897
  1674. nullable: true
  1675. ethereumBlockNum:
  1676. allOf:
  1677. - $ref: '#/components/schemas/EthBlockNum'
  1678. - description: Ethereum block in which the transaction was added to the smart contract forge queue.
  1679. - example: 258723049
  1680. required:
  1681. - toForgeL1TransactionsNum
  1682. - userOrigin
  1683. - loadAmount
  1684. - historicLoadAmountUSD
  1685. - ethereumBlockNum
  1686. additionalProperties: false
  1687. L2Info:
  1688. type: object
  1689. description: Additional information that only applies to L2 transactions.
  1690. nullable: true
  1691. properties:
  1692. fee:
  1693. $ref: '#/components/schemas/FeeSelector'
  1694. historicFeeUSD:
  1695. type: number
  1696. description: Fee in USD, at the moment the transaction was forged.
  1697. example: 263.89
  1698. nullable: true
  1699. nonce:
  1700. $ref: '#/components/schemas/Nonce'
  1701. example: null
  1702. required:
  1703. - fee
  1704. - historicFeeUSD
  1705. - nonce
  1706. additionalProperties: false
  1707. required:
  1708. - L1orL2
  1709. - id
  1710. - itemId
  1711. - type
  1712. - position
  1713. - fromAccountIndex
  1714. - fromHezEthereumAddress
  1715. - fromBJJ
  1716. - toAccountIndex
  1717. - toHezEthereumAddress
  1718. - toBJJ
  1719. - amount
  1720. - batchNum
  1721. - historicUSD
  1722. - timestamp
  1723. - token
  1724. - L1Info
  1725. - L2Info
  1726. additionalProperties: false
  1727. HistoryTransactions:
  1728. type: object
  1729. properties:
  1730. transactions:
  1731. type: array
  1732. description: List of history transactions.
  1733. items:
  1734. $ref: '#/components/schemas/HistoryTransaction'
  1735. pendingItems:
  1736. $ref: '#/components/schemas/PendingItems'
  1737. required:
  1738. - transactions
  1739. - pendingItems
  1740. additionalProperties: false
  1741. EthBlockNum:
  1742. type: integer
  1743. description: Ethereum block number
  1744. minimum: 0
  1745. maximum: 1.84467440737096e+19
  1746. example: 762375478
  1747. ToForgeL1TransactionsNum:
  1748. type: integer
  1749. description: Reference to know in which batch a L1 transaction was forged / will be forged.
  1750. minimum: 0
  1751. maximum: 4294967295
  1752. example: 784
  1753. nullable: true
  1754. TransactionPosition:
  1755. type: integer
  1756. description: Position that a transaction occupies in a batch.
  1757. minimum: 0
  1758. example: 5
  1759. URL:
  1760. type: string
  1761. description: HTTP URL
  1762. example: "https://hermez.io"
  1763. TokenSymbol:
  1764. type: string
  1765. description: Abreviation of the token name.
  1766. example: "DAI"
  1767. TokenName:
  1768. type: string
  1769. description: Token name.
  1770. example: "Dai"
  1771. CollectedFees:
  1772. type: object
  1773. description: Collected fees by the forger of the batch, represented by a map of tokenId => amount. A maximum of 64 different tokens can be used.
  1774. additionalProperties:
  1775. type: string
  1776. example:
  1777. 1234: "425632785672345647"
  1778. 4321: "86538967235465432654352"
  1779. Batch:
  1780. type: object
  1781. description: Group of transactions forged in a coordinator and sent and validated in Ethereum.
  1782. properties:
  1783. itemId:
  1784. $ref: '#/components/schemas/ItemId'
  1785. batchNum:
  1786. $ref: '#/components/schemas/BatchNum'
  1787. ethereumBlockNum:
  1788. $ref: '#/components/schemas/EthBlockNum'
  1789. ethereumBlockHash:
  1790. type: string
  1791. description: hash of the Ethereum block in which the batch was forged
  1792. example: "0xfe88c94d860f01a17f961bf4bdfb6e0c6cd10d3fda5cc861e805ca1240c58553"
  1793. timestamp:
  1794. type: string
  1795. format: date-time
  1796. description: Time in which the batch was forged.
  1797. forgerAddr:
  1798. $ref: '#/components/schemas/EthereumAddress'
  1799. collectedFees:
  1800. $ref: '#/components/schemas/CollectedFees'
  1801. historicTotalCollectedFeesUSD:
  1802. type: number
  1803. description: Sum of the all the fees collected, in USD, at the moment the batch was forged.
  1804. example: 23.3
  1805. stateRoot:
  1806. allOf:
  1807. - $ref: '#/components/schemas/Hash'
  1808. - description: Root of the accounts Merkle Tree.
  1809. - example: "2734657026572a8708d883"
  1810. numAccounts:
  1811. type: integer
  1812. description: Number of registered accounts in this batch.
  1813. exitRoot:
  1814. allOf:
  1815. - $ref: '#/components/schemas/Hash'
  1816. - description: Root of the exit Merkle Tree associated to this batch.
  1817. - example: "2734657026572a8708d883"
  1818. forgeL1TransactionsNum:
  1819. type: integer
  1820. description: Identifier that corresponds to the group of L1 transactions forged in the current batch.
  1821. example: 5
  1822. nullable: true
  1823. slotNum:
  1824. $ref: '#/components/schemas/SlotNum'
  1825. additionalProperties: false
  1826. required:
  1827. - itemId
  1828. - batchNum
  1829. - ethereumBlockNum
  1830. - ethereumBlockHash
  1831. - timestamp
  1832. - forgerAddr
  1833. - collectedFees
  1834. - historicTotalCollectedFeesUSD
  1835. - stateRoot
  1836. - numAccounts
  1837. - exitRoot
  1838. - forgeL1TransactionsNum
  1839. - slotNum
  1840. FullBatch:
  1841. type: object
  1842. description: Group of transactions forged in a coordinator and sent and validated in Ethereum.
  1843. properties:
  1844. batch:
  1845. $ref: '#/components/schemas/Batch'
  1846. transactions:
  1847. type: array
  1848. description: List of forged transactions in the batch
  1849. items:
  1850. $ref: '#/components/schemas/HistoryTransaction'
  1851. nullable: true
  1852. additionalProperties: false
  1853. required:
  1854. - batch
  1855. - transactions
  1856. Hash:
  1857. type: string
  1858. description: hashed data
  1859. example: "2734657026572a8708d883"
  1860. SlotNum:
  1861. type: integer
  1862. description: Identifier of a slot.
  1863. minimum: 0
  1864. maximum: 4294967295
  1865. example: 784
  1866. Batches:
  1867. type: object
  1868. properties:
  1869. batches:
  1870. type: array
  1871. description: List of batches.
  1872. items:
  1873. $ref: '#/components/schemas/Batch'
  1874. pendingItems:
  1875. $ref: '#/components/schemas/PendingItems'
  1876. additionalProperties: false
  1877. required:
  1878. - batches
  1879. - pendingItems
  1880. Coordinator:
  1881. type: object
  1882. properties:
  1883. itemId:
  1884. $ref: '#/components/schemas/ItemId'
  1885. forgerAddr:
  1886. $ref: '#/components/schemas/EthereumAddress'
  1887. bidderAddr:
  1888. $ref: '#/components/schemas/EthereumAddress'
  1889. URL:
  1890. $ref: '#/components/schemas/URL'
  1891. ethereumBlock:
  1892. allOf:
  1893. - $ref: '#/components/schemas/EthBlockNum'
  1894. - description: Ethereum block in which the coordinator registered into the network.
  1895. - example: 5735943738
  1896. additionalProperties: false
  1897. required:
  1898. - itemId
  1899. - forgerAddr
  1900. - bidderAddr
  1901. - URL
  1902. - ethereumBlock
  1903. Coordinators:
  1904. type: object
  1905. properties:
  1906. coordinators:
  1907. type: array
  1908. description: List of coordinators.
  1909. items:
  1910. $ref: '#/components/schemas/Coordinator'
  1911. pendingItems:
  1912. $ref: '#/components/schemas/PendingItems'
  1913. additionalProperties: false
  1914. required:
  1915. - coordinators
  1916. - pendingItems
  1917. Bid:
  1918. type: object
  1919. description: Tokens placed in an auction by a coordinator to gain the right to forge batches during a specific slot.
  1920. properties:
  1921. itemId:
  1922. $ref: '#/components/schemas/ItemId'
  1923. bidderAddr:
  1924. $ref: '#/components/schemas/EthereumAddress'
  1925. forgerAddr:
  1926. $ref: '#/components/schemas/EthereumAddress'
  1927. slotNum:
  1928. $ref: '#/components/schemas/SlotNum'
  1929. URL:
  1930. $ref: '#/components/schemas/URL'
  1931. bidValue:
  1932. $ref: '#/components/schemas/BigInt'
  1933. ethereumBlockNum:
  1934. $ref: '#/components/schemas/EthBlockNum'
  1935. timestamp:
  1936. type: string
  1937. format: date-time
  1938. additionalProperties: false
  1939. required:
  1940. - bidderAddr
  1941. - forgerAddr
  1942. - slotNum
  1943. - URL
  1944. - bidValue
  1945. - ethereumBlockNum
  1946. - timestamp
  1947. Bids:
  1948. type: object
  1949. properties:
  1950. bids:
  1951. type: array
  1952. description: List of bids.
  1953. items:
  1954. $ref: '#/components/schemas/Bid'
  1955. pendingItems:
  1956. $ref: '#/components/schemas/PendingItems'
  1957. additionalProperties: false
  1958. required:
  1959. - bids
  1960. - pendingItems
  1961. RecommendedFee:
  1962. type: object
  1963. description: Fee that the coordinator recommends per transaction in USD.
  1964. properties:
  1965. existingAccount:
  1966. type: number
  1967. description: Recommended fee if the destination account of the transaction already exists.
  1968. minimum: 0
  1969. example: 0.1
  1970. createAccount:
  1971. type: number
  1972. description: Recommended fee if the destination account of the transaction doesn't exist, but the coordinator has an authorization to create a valid account associated to an Ethereum address and a BJJ public key controlled by the receiver.
  1973. minimum: 0
  1974. example: 1.3
  1975. createAccountInternal:
  1976. type: number
  1977. description: Recommended fee if the destination account of the transaction doesn't exist, but the coordinator has the ability to create a valid account associated to a BJJ public key controlled by the receiver. Note that these kind of accounts are not associated to an Ethereum address and therefore can only operate in L2.
  1978. minimum: 0
  1979. example: 0.5
  1980. Token:
  1981. type: object
  1982. description: Hermez network compatible and registered token.
  1983. properties:
  1984. id:
  1985. $ref: '#/components/schemas/TokenId'
  1986. ethereumAddress:
  1987. allOf:
  1988. - $ref: '#/components/schemas/EthereumAddress'
  1989. - description: Ethereum address in which the token is deployed.
  1990. - example: "0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
  1991. itemId:
  1992. $ref: '#/components/schemas/ItemId'
  1993. name:
  1994. type: string
  1995. description: full name of the token
  1996. example: Maker Dai
  1997. symbol:
  1998. allOf:
  1999. - $ref: '#/components/schemas/TokenSymbol'
  2000. - example: DAI
  2001. decimals:
  2002. type: integer
  2003. description: Number of decimals of the token.
  2004. example: 18
  2005. ethereumBlockNum:
  2006. allOf:
  2007. - $ref: '#/components/schemas/EthBlockNum'
  2008. - description: Ethereum block number in which the token was added to the Hermez network.
  2009. - example: 539847538
  2010. USD:
  2011. type: number
  2012. description: Value of the token in USD.
  2013. example: 1.01
  2014. nullable: true
  2015. fiatUpdate:
  2016. type: string
  2017. format: date-time
  2018. description: Timestamp of the moment the `USD` value was updated.
  2019. nullable: true
  2020. required:
  2021. - id
  2022. - ethereumAddress
  2023. - itemId
  2024. - name
  2025. - symbol
  2026. - decimals
  2027. - ethereumBlockNum
  2028. - USD
  2029. - fiatUpdate
  2030. additionalProperties: false
  2031. Tokens:
  2032. type: object
  2033. properties:
  2034. tokens:
  2035. type: array
  2036. description: List of tokens.
  2037. items:
  2038. $ref: '#/components/schemas/Token'
  2039. pendingItems:
  2040. $ref: '#/components/schemas/PendingItems'
  2041. Exit:
  2042. type: object
  2043. description: Exit tree leaf. It Contains the necessary information to perform a withdrawal.
  2044. properties:
  2045. batchNum:
  2046. allOf:
  2047. - $ref: '#/components/schemas/BatchNum'
  2048. - description: Batch in which the exit was forged.
  2049. - example: 7394
  2050. accountIndex:
  2051. $ref: '#/components/schemas/AccountIndex'
  2052. itemId:
  2053. $ref: '#/components/schemas/ItemId'
  2054. merkleProof:
  2055. type: object
  2056. description: Existence proof of a leaf in a given Merkle Root. Encoded as hexadecimal string.
  2057. properties:
  2058. Root:
  2059. $ref: '#/components/schemas/BigInt'
  2060. Siblings:
  2061. type: array
  2062. items:
  2063. $ref: '#/components/schemas/BigInt'
  2064. OldKey:
  2065. $ref: '#/components/schemas/BigInt'
  2066. OldValue:
  2067. $ref: '#/components/schemas/BigInt'
  2068. IsOld0:
  2069. type: boolean
  2070. Key:
  2071. $ref: '#/components/schemas/BigInt'
  2072. Value:
  2073. $ref: '#/components/schemas/BigInt'
  2074. Fnc:
  2075. type: integer
  2076. maximum: 3
  2077. minimum: 0
  2078. required:
  2079. - Root
  2080. - Siblings
  2081. - OldKey
  2082. - OldValue
  2083. - IsOld0
  2084. - Key
  2085. - Value
  2086. - Fnc
  2087. additionalProperties: false
  2088. balance:
  2089. $ref: '#/components/schemas/BigInt'
  2090. instantWithdrawn:
  2091. type: integer
  2092. description: Block in which the exit balance was instantly withdrawn. Null indicates that an instant withdrawn hasn't been performed.
  2093. minimum: 0
  2094. maximum: 1.84467440737096e+19
  2095. example: 74747363
  2096. nullable: true
  2097. delayedWithdrawRequest:
  2098. type: integer
  2099. description: Block in which the exit balance was requested to delay withdraw. Null indicates that a delay withdraw hasn't been performed.
  2100. minimum: 0
  2101. maximum: 1.84467440737096e+19
  2102. example: null
  2103. nullable: true
  2104. delayedWithdrawn:
  2105. type: integer
  2106. description: Block in which the exit balance was delayed withdrawn after a delay withdraw request. Null indicates that a delay withdraw hasn't been performed.
  2107. minimum: 0
  2108. maximum: 1.84467440737096e+19
  2109. example: null
  2110. nullable: true
  2111. token:
  2112. $ref: '#/components/schemas/Token'
  2113. required:
  2114. - batchNum
  2115. - accountIndex
  2116. - itemId
  2117. - merkleProof
  2118. - balance
  2119. - instantWithdrawn
  2120. - delayedWithdrawRequest
  2121. - delayedWithdrawn
  2122. - token
  2123. additionalProperties: false
  2124. Exits:
  2125. type: object
  2126. properties:
  2127. exits:
  2128. type: array
  2129. description: List of exits.
  2130. items:
  2131. $ref: '#/components/schemas/Exit'
  2132. pendingItems:
  2133. $ref: '#/components/schemas/PendingItems'
  2134. required:
  2135. - exits
  2136. - pendingItems
  2137. additionalProperties: false
  2138. Account:
  2139. type: object
  2140. description: State tree leaf. It contains balance and nonce of an account.
  2141. properties:
  2142. itemId:
  2143. $ref: '#/components/schemas/ItemId'
  2144. accountIndex:
  2145. $ref: '#/components/schemas/AccountIndex'
  2146. nonce:
  2147. $ref: '#/components/schemas/Nonce'
  2148. balance:
  2149. $ref: '#/components/schemas/BigInt'
  2150. bjj:
  2151. $ref: '#/components/schemas/BJJ'
  2152. hezEthereumAddress:
  2153. $ref: '#/components/schemas/HezEthereumAddress'
  2154. token:
  2155. $ref: '#/components/schemas/Token'
  2156. additionalProperties: false
  2157. required:
  2158. - itemId
  2159. - accountIndex
  2160. - nonce
  2161. - balance
  2162. - bjj
  2163. - hezEthereumAddress
  2164. - token
  2165. Accounts:
  2166. type: object
  2167. properties:
  2168. accounts:
  2169. type: array
  2170. description: List of accounts.
  2171. items:
  2172. $ref: '#/components/schemas/Account'
  2173. pendingItems:
  2174. $ref: '#/components/schemas/PendingItems'
  2175. additionalProperties: false
  2176. required:
  2177. - accounts
  2178. - pendingItems
  2179. Slot:
  2180. type: object
  2181. description: Slot information.
  2182. properties:
  2183. itemId:
  2184. $ref: '#/components/schemas/ItemId'
  2185. slotNum:
  2186. $ref: '#/components/schemas/SlotNum'
  2187. firstBlock:
  2188. allOf:
  2189. - $ref: '#/components/schemas/EthBlockNum'
  2190. - description: Block in which the slot began or will begin
  2191. - example: 76238647846
  2192. lastBlock:
  2193. allOf:
  2194. - $ref: '#/components/schemas/EthBlockNum'
  2195. - description: Block in which the slot ended or will end
  2196. - example: 4475934
  2197. openAuction:
  2198. type: boolean
  2199. description: Whether the auction of the slot is open or not.
  2200. bestBid:
  2201. type: object
  2202. description: The best bid of the auction. If the bestBid is null, it is because no coordinator has bid for that slot.
  2203. nullable: true
  2204. properties:
  2205. itemId:
  2206. $ref: '#/components/schemas/ItemId'
  2207. bidderAddr:
  2208. $ref: '#/components/schemas/EthereumAddress'
  2209. forgerAddr:
  2210. $ref: '#/components/schemas/EthereumAddress'
  2211. slotNum:
  2212. $ref: '#/components/schemas/SlotNum'
  2213. URL:
  2214. $ref: '#/components/schemas/URL'
  2215. bidValue:
  2216. type: string
  2217. description: BigInt is an integer encoded as a string for numbers that are very large.
  2218. example: "8708856933496328593"
  2219. pattern: "^\\d+$"
  2220. ethereumBlockNum:
  2221. $ref: '#/components/schemas/EthBlockNum'
  2222. timestamp:
  2223. type: string
  2224. format: date-time
  2225. additionalProperties: false
  2226. required:
  2227. - bidderAddr
  2228. - forgerAddr
  2229. - slotNum
  2230. - URL
  2231. - bidValue
  2232. - ethereumBlockNum
  2233. - timestamp
  2234. additionalProperties: false
  2235. required:
  2236. - slotNum
  2237. - firstBlock
  2238. - lastBlock
  2239. - openAuction
  2240. - bestBid
  2241. Slots:
  2242. type: object
  2243. properties:
  2244. slots:
  2245. type: array
  2246. description: List of slots.
  2247. items:
  2248. allOf:
  2249. - $ref: '#/components/schemas/Slot'
  2250. - description: Last synchronized Etherum block.
  2251. pendingItems:
  2252. $ref: '#/components/schemas/PendingItems'
  2253. additionalProperties: false
  2254. required:
  2255. - slots
  2256. - pendingItems
  2257. NextForger:
  2258. type: object
  2259. description: Coordinator information along with the scheduled forging period
  2260. properties:
  2261. coordinator:
  2262. $ref: '#/components/schemas/Coordinator'
  2263. period:
  2264. type: object
  2265. description: Time period in which the coordinator will have the ability to forge. Specified both in Ethereum blocks and timestamp
  2266. properties:
  2267. slotNum:
  2268. $ref: '#/components/schemas/SlotNum'
  2269. fromBlock:
  2270. $ref: '#/components/schemas/EthBlockNum'
  2271. toBlock:
  2272. $ref: '#/components/schemas/EthBlockNum'
  2273. fromTimestamp:
  2274. type: string
  2275. format: date-time
  2276. toTimestamp:
  2277. type: string
  2278. format: date-time
  2279. required:
  2280. - slotNum
  2281. - fromBlock
  2282. - toBlock
  2283. - fromTimestamp
  2284. - toTimestamp
  2285. additionalProperties: false
  2286. required:
  2287. - coordinator
  2288. - period
  2289. additionalProperties: false
  2290. NextForgers:
  2291. type: array
  2292. description: List of next coordinators to forge.
  2293. items:
  2294. $ref: '#/components/schemas/NextForger'
  2295. State:
  2296. type: object
  2297. description: Gobal variables of the network
  2298. properties:
  2299. network:
  2300. $ref: '#/components/schemas/StateNetwork'
  2301. metrics:
  2302. $ref: '#/components/schemas/StateMetrics'
  2303. rollup:
  2304. $ref: '#/components/schemas/StateRollup'
  2305. auction:
  2306. $ref: '#/components/schemas/StateAuction'
  2307. withdrawalDelayer:
  2308. $ref: '#/components/schemas/StateWithdrawDelayer'
  2309. recommendedFee:
  2310. $ref: '#/components/schemas/RecommendedFee'
  2311. additionalProperties: false
  2312. required:
  2313. - network
  2314. - metrics
  2315. - rollup
  2316. - auction
  2317. - withdrawalDelayer
  2318. - recommendedFee
  2319. StateNetwork:
  2320. type: object
  2321. description: Gobal statistics of the network
  2322. properties:
  2323. lastEthereumBlock:
  2324. allOf:
  2325. - $ref: '#/components/schemas/EthBlockNum'
  2326. - description: Current Etherum block. Note that this is the actual last block of Ethereum, not the last synchronized block by the node.
  2327. - example: 3457437
  2328. lastSynchedBlock:
  2329. allOf:
  2330. - $ref: '#/components/schemas/EthBlockNum'
  2331. - description: Last synchronized Etherum block. Compare with lastEthereumBlock to check the synchronization status of the node.
  2332. - example: 3457437
  2333. lastBatch:
  2334. $ref: '#/components/schemas/Batch'
  2335. currentSlot:
  2336. allOf:
  2337. - $ref: '#/components/schemas/SlotNum'
  2338. - description: Slot where batches are currently being forged.
  2339. - example: 2334
  2340. nextForgers:
  2341. $ref: '#/components/schemas/NextForgers'
  2342. additionalProperties: false
  2343. required:
  2344. - lastEthereumBlock
  2345. - lastSynchedBlock
  2346. - lastBatch
  2347. - currentSlot
  2348. - nextForgers
  2349. StateAuction:
  2350. type: object
  2351. description: Auction parameters.
  2352. properties:
  2353. ethereumBlockNum:
  2354. $ref: '#/components/schemas/EthBlockNum'
  2355. bootCoordinator:
  2356. allOf:
  2357. - $ref: '#/components/schemas/EthereumAddress'
  2358. - description: Ethereum address of the boot coordinator.
  2359. - example: "0x997dc4262BCDbf85190C01c996b4C06a461d2430"
  2360. slotDeadline:
  2361. type: integer
  2362. description: Number of blocks after the beginning of a slot after which any coordinator can forge if the winner has not forged any batch in that slot.
  2363. example: 3
  2364. closedAuctionSlots:
  2365. type: integer
  2366. description: Amount of slots between the current slot and the slot auction that is closed. Example if the value is 2, when slot 10 begins, the auction of the slot 12 gets closed.
  2367. example: 2
  2368. openAuctionSlots:
  2369. type: integer
  2370. description: How many days in advance are auctions opened.
  2371. defaultSlotSetBid:
  2372. type: array
  2373. description: "Initial minimal bid for each auction. Expressed as an array of 6 values. To calculate which value corresponds to each slot: `initialMinimalBidding[slotNum%6]`."
  2374. items:
  2375. type: integer
  2376. example: [32,0,68,21,55,99]
  2377. outbidding:
  2378. type: number
  2379. description: Minimum outbid over the previous one to consider it valid.
  2380. example: 3.64
  2381. donationAddress:
  2382. allOf:
  2383. - $ref: '#/components/schemas/EthereumAddress'
  2384. - description: Ethereum address where the donations will go to.
  2385. - example: "0x887dc4262BCDbf85190C01c996b4C06a461d2430"
  2386. allocationRatio:
  2387. type: array
  2388. description: Percentage in which fees will be splitted between donations, governance and burning. The sum of the tree values should be 100.
  2389. items:
  2390. type: integer
  2391. example: [80,10,10]
  2392. additionalProperties: false
  2393. required:
  2394. - ethereumBlockNum
  2395. - bootCoordinator
  2396. - slotDeadline
  2397. - closedAuctionSlots
  2398. - openAuctionSlots
  2399. - defaultSlotSetBid
  2400. - outbidding
  2401. - donationAddress
  2402. - allocationRatio
  2403. StateRollup:
  2404. type: object
  2405. description: Rollup parameters
  2406. properties:
  2407. ethereumBlockNum:
  2408. $ref: '#/components/schemas/EthBlockNum'
  2409. forgeL1L2BatchTimeout:
  2410. type: integer
  2411. description: Max ethereum blocks after the last L1-L2-batch, when exceeds the timeout only L1-L2-batch are allowed.
  2412. example: 5
  2413. feeAddToken:
  2414. type: integer
  2415. description: Fee to pay when registering tokens into the network.
  2416. example: 5698
  2417. withdrawalDelay:
  2418. type: integer
  2419. description: Withdraw delay in seconds
  2420. example: 432000
  2421. buckets:
  2422. type: array
  2423. description: List of buckets state
  2424. items:
  2425. type: object
  2426. properties:
  2427. ceilUSD:
  2428. type: integer
  2429. description: Max USD value
  2430. example: 1000
  2431. blockStamp:
  2432. type: integer
  2433. description: Last time a withdrawal was added ( or removed if the bucket was full)
  2434. example: 4475934
  2435. withdrawals:
  2436. type: integer
  2437. description: Available withdrawals of the bucket
  2438. example: 4
  2439. blockWithdrawalRate:
  2440. type: integer
  2441. description: Every `blockWithdrawalRate` blocks add 1 withdrawal
  2442. example: 8
  2443. maxWithdrawals:
  2444. type: integer
  2445. description: Max withdrawals the bucket can hold
  2446. example: 4
  2447. additionalProperties: false
  2448. required:
  2449. - ceilUSD
  2450. - blockStamp
  2451. - withdrawals
  2452. - blockWithdrawalRate
  2453. - maxWithdrawals
  2454. additionalProperties: false
  2455. required:
  2456. - ethereumBlockNum
  2457. - forgeL1L2BatchTimeout
  2458. - feeAddToken
  2459. - withdrawalDelay
  2460. - buckets
  2461. StateWithdrawDelayer:
  2462. type: object
  2463. description: Withdrawal delayer parameters
  2464. properties:
  2465. ethereumBlockNum:
  2466. $ref: '#/components/schemas/EthBlockNum'
  2467. hermezGovernanceDAOAddress:
  2468. allOf:
  2469. - $ref: '#/components/schemas/EthereumAddress'
  2470. - description: Ethereum address of the governance DAO.
  2471. - example: "0x667dc4262BCDbf85190C01c996b4C06a461d2430"
  2472. whiteHackGroupAddress:
  2473. allOf:
  2474. - $ref: '#/components/schemas/EthereumAddress'
  2475. - description: Ethereum Address that can claim the funds in an emergency when the maximum emergency mode time is exceeded.
  2476. - example: "0x557dc4262BCDbf85190C01c996b4C06a461d2430"
  2477. hermezKeeperAddress:
  2478. allOf:
  2479. - $ref: '#/components/schemas/EthereumAddress'
  2480. - description: Ethereum Address that can enable emergency mode and modify the delay to make a withdrawal.
  2481. - example: "0x557dc4262BCDbf85190C01c996b4C06a461d2430"
  2482. withdrawalDelay:
  2483. allOf:
  2484. - $ref: '#/components/schemas/EthBlockNum'
  2485. - description: The time that anyone needs to wait until a withdrawal of the funds is allowed, in seconds.
  2486. - example: 539573849
  2487. emergencyModeStartingTime:
  2488. type: integer
  2489. description: Second (since unix epoch) in which the emergency mode has been activated.
  2490. example: 10
  2491. emergencyMode:
  2492. type: boolean
  2493. description: Indicates if emergency mode has been activated.
  2494. example: false
  2495. additionalProperties: false
  2496. required:
  2497. - ethereumBlockNum
  2498. - hermezGovernanceDAOAddress
  2499. - whiteHackGroupAddress
  2500. - hermezKeeperAddress
  2501. - withdrawalDelay
  2502. - emergencyModeStartingTime
  2503. - emergencyMode
  2504. StateMetrics:
  2505. type: object
  2506. description: Metrics of the network
  2507. properties:
  2508. transactionsPerBatch:
  2509. type: number
  2510. description: Average transactions per batch in the last 24 hours.
  2511. example: 2002.7
  2512. batchFrequency:
  2513. type: number
  2514. description: Average elapsed time between batches in the last 24 hours, in seconds.
  2515. example: 8.9
  2516. transactionsPerSecond:
  2517. type: number
  2518. description: Average transactions per second in the last 24 hours.
  2519. example: 302.3
  2520. totalAccounts:
  2521. type: integer
  2522. description: Number of created accounts.
  2523. example: 90473
  2524. totalBJJs:
  2525. type: integer
  2526. description: Number of different registered BJJs.
  2527. example: 23067
  2528. avgTransactionFee:
  2529. type: number
  2530. description: Average fee percentage paid for L2 transactions in the last 24 hours.
  2531. example: 1.54
  2532. additionalProperties: false
  2533. required:
  2534. - transactionsPerBatch
  2535. - batchFrequency
  2536. - transactionsPerSecond
  2537. - totalAccounts
  2538. - totalBJJs
  2539. - avgTransactionFee
  2540. PendingItems:
  2541. type: integer
  2542. description: Amount of items that will be returned in subsequent calls to the endpoint, as long as they are done with same filters. When the value is 0 it means that all items have been sent.
  2543. example: 15
  2544. Config:
  2545. type: object
  2546. description: Configuration parameters of the different smart contracts that power the Hermez network.
  2547. properties:
  2548. hermez:
  2549. type: object
  2550. description: Constant configuration of the Hermez smart contract.
  2551. properties:
  2552. publicConstants:
  2553. type: object
  2554. description: Public Hermez smart contract constants
  2555. properties:
  2556. tokenHEZ:
  2557. allOf:
  2558. - $ref: '#/components/schemas/EthereumAddress'
  2559. - description: Ethereum address of the HEZ token.
  2560. - example: "0x444dc4262BCDbf85190C01c996b4C06a461d2430"
  2561. absoluteMaxL1L2BatchTimeout:
  2562. type: integer
  2563. description: L1L2 Batch Timeout
  2564. example: 240
  2565. verifiers:
  2566. type: array
  2567. description: List of verifiers struct
  2568. items:
  2569. type: object
  2570. properties:
  2571. maxTx:
  2572. type: integer
  2573. description: Maximum rollup transactions in a batch
  2574. example: 512
  2575. nlevels:
  2576. type: integer
  2577. description: Number of levels of the circuit
  2578. example: 32
  2579. required:
  2580. - maxTx
  2581. - nlevels
  2582. additionalProperties: false
  2583. hermezAuctionContract:
  2584. allOf:
  2585. - $ref: '#/components/schemas/EthereumAddress'
  2586. - description: Ethereum address of the auction smart contract.
  2587. - example: "0x111dc4262BCDbf85190C01c996b4C06a461d2430"
  2588. hermezGovernanceDAOAddress:
  2589. allOf:
  2590. - $ref: '#/components/schemas/EthereumAddress'
  2591. - description: Ethereum address of the governanceDAO.
  2592. - example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
  2593. safetyAddress:
  2594. allOf:
  2595. - $ref: '#/components/schemas/EthereumAddress'
  2596. - description: Ethereum address of the safety.
  2597. - example: "0x333dc4262BCDbf85190C01c996b4C06a461d2430"
  2598. withdrawDelayerContract:
  2599. allOf:
  2600. - $ref: '#/components/schemas/EthereumAddress'
  2601. - description: Ethereum address of the withdraw delayer contracts.
  2602. - example: "0x444dc4262BCDbf85190C01c996b4C06a461d2430"
  2603. required:
  2604. - tokenHEZ
  2605. - absoluteMaxL1L2BatchTimeout
  2606. - verifiers
  2607. - hermezAuctionContract
  2608. - hermezGovernanceDAOAddress
  2609. - safetyAddress
  2610. - withdrawDelayerContract
  2611. additionalProperties: false
  2612. maxFeeIdxCoordinator:
  2613. type: integer
  2614. description: is the maximum number of tokens the coordinator can use to collect fees.
  2615. example: 64
  2616. reservedIdx:
  2617. type: integer
  2618. description: First 256 indexes reserved, first user index will be the 256.
  2619. example: 255
  2620. exitIdx:
  2621. type: integer
  2622. description: Account index used to indicate that a transaction is an `exit` or `force exit`.
  2623. example: 1
  2624. limitLoadAmount:
  2625. type: integer
  2626. description: Maximum load amount (L1 to L2) allowed.
  2627. example: 321
  2628. limitL2TransferAmount:
  2629. type: integer
  2630. description: Maximum amount (L2 to L2) allowed.
  2631. example: 837
  2632. limitTokens:
  2633. type: integer
  2634. description: Maximum number of different tokens that can be registered in the network.
  2635. example: 4294967295
  2636. l1CoordinatorTotalBytes:
  2637. type: integer
  2638. description: Number of bytes that a L1 coordinator transaction has ([4 bytes] token + [32 bytes] babyjub + [65 bytes] compressedSignature).
  2639. example: 101
  2640. l1UserTotalBytes:
  2641. type: integer
  2642. description: Number of bytes that a L1 user transaction has ([20 bytes] fromEthAddr + [32 bytes] fromBjj-compressed + [6 bytes] fromIdx + [2 bytes] loadAmountFloat16 + [2 bytes] amountFloat16 + [4 bytes] tokenId + [6 bytes] toIdx).
  2643. example: 72
  2644. maxL1UserTx:
  2645. type: integer
  2646. description: Maximum L1-user transactions allowed to be queued in a batch.
  2647. example: 128
  2648. maxL1Tx:
  2649. type: integer
  2650. description: Maximum L1 transactions allowed to be queued in a batch.
  2651. example: 256
  2652. inputSHAConstantBytes:
  2653. type: integer
  2654. description: Input SHA constant bytes
  2655. example: 18542
  2656. numBuckets:
  2657. type: integer
  2658. description: Number of buckets
  2659. example: 5
  2660. maxWithdrawalDelay:
  2661. type: integer
  2662. description: Maximum delay to withdraw tokens. Time is measured in seconds.
  2663. example: 2 * 7 * 24 * 60 * 60
  2664. exchangeMultiplier:
  2665. type: integer
  2666. description: exchange multiplier
  2667. example: 1e14
  2668. required:
  2669. - publicConstants
  2670. - reservedIdx
  2671. - exitIdx
  2672. - limitLoadAmount
  2673. - limitL2TransferAmount
  2674. - limitTokens
  2675. - l1CoordinatorTotalBytes
  2676. - l1UserTotalBytes
  2677. - maxL1UserTx
  2678. - maxL1Tx
  2679. - inputSHAConstantBytes
  2680. - numBuckets
  2681. - maxWithdrawalDelay
  2682. - exchangeMultiplier
  2683. additionalProperties: false
  2684. auction:
  2685. type: object
  2686. description: Constant configuration of the auction smart contract.
  2687. properties:
  2688. blocksPerSlot:
  2689. type: integer
  2690. description: Blocks per slot.
  2691. initialMinimalBidding:
  2692. type: integer
  2693. description: Minimum bid when no one has bid yet.
  2694. genesisBlockNum:
  2695. allOf:
  2696. - $ref: '#/components/schemas/EthBlockNum'
  2697. - description: Ethereum block number in which the smart contract starts operating.
  2698. tokenHEZ:
  2699. allOf:
  2700. - $ref: '#/components/schemas/EthereumAddress'
  2701. - description: Ethereum address of the HEZ token.
  2702. - example: "0x333dc4262BCDbf85190C01c996b4C06a461d2430"
  2703. hermezRollup:
  2704. allOf:
  2705. - $ref: '#/components/schemas/EthereumAddress'
  2706. - description: Ethereum address of the rollup smart contract.
  2707. - example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
  2708. governanceAddress:
  2709. allOf:
  2710. - $ref: '#/components/schemas/EthereumAddress'
  2711. - description: Ethereum address of the governance.
  2712. - example: "0x444dc4262BCDbf85190C01c996b4C06a461d2430"
  2713. required:
  2714. - blocksPerSlot
  2715. - initialMinimalBidding
  2716. - genesisBlockNum
  2717. - tokenHEZ
  2718. - hermezRollup
  2719. - governanceAddress
  2720. additionalProperties: false
  2721. withdrawalDelayer:
  2722. type: object
  2723. description: Constant configuration of the withdrawal delayer smart contract.
  2724. properties:
  2725. maxWithdrawalDelay:
  2726. type: integer
  2727. description: Maximum time delay in which the tokens can be locked in the contract. Time is measured in seconds.
  2728. example: 200
  2729. maxEmergencyModeTime:
  2730. type: integer
  2731. description: Maximum amount of time in which the contract can be in emergency mode. Time is measured in seconds.
  2732. example: 2000
  2733. hermezRollup:
  2734. allOf:
  2735. - $ref: '#/components/schemas/EthereumAddress'
  2736. - description: Ethereum address of the rollup smart contract.
  2737. - example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
  2738. required:
  2739. - maxWithdrawalDelay
  2740. - maxEmergencyModeTime
  2741. - hermezRollup
  2742. additionalProperties: false
  2743. required:
  2744. - hermez
  2745. - auction
  2746. - withdrawalDelayer
  2747. additionalProperties: false
  2748. Error:
  2749. type: object
  2750. description: Error response.
  2751. properties:
  2752. message:
  2753. type: string
  2754. Error400:
  2755. allOf:
  2756. - $ref: '#/components/schemas/Error'
  2757. - example:
  2758. message: Invalid signature.
  2759. Error404:
  2760. allOf:
  2761. - $ref: '#/components/schemas/Error'
  2762. - example:
  2763. message: Item(s) not found.
  2764. Error500:
  2765. allOf:
  2766. - $ref: '#/components/schemas/Error'
  2767. - example:
  2768. message: Database error.