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