package
1.8.0-rc1
Repository: https://github.com/hermeznetwork/hermez-node.git
Documentation: pkg.go.dev

# README

Hermez API

Easy to deploy and scale API for Hermez operators. You will need to have docker and docker-compose installed on your machine in order to use this repo.

Documentation

As of now the documentation is not hosted anywhere, but you can easily do it yourself by running ./run.sh doc and then opening the documentation in your browser

Mock Up

To use a mock up of the endpoints in the API run ./run.sh doc (UI + mock up server) or ./run.sh mock (only mock up server). You can play with the mocked up endpoints using the web UI, importing swagger.yml into Postman or using your preferred language and using http://localhost:4010 as base URL.

Editor

It is recommended to edit swagger.yml using a dedicated editor as they provide spec validation and real time visualization. Of course you can use your prefered editor. To use the editor run ./run.sh editor and then opening the editor in your browser. Keep in mind that you will need to manually save the file otherwise you will lose the changes you made once you close your browser seshion or stop the server.

Note: Your browser may cache the swagger definition, so in order to see updated changes it may be needed to refresh the page without cache (Ctrl + Shift + R).

# Packages

Package coordinatornetwork implements a comunication layer among coordinators in order to share information such as transactions in the pool and create account authorizations.
No description provided by the author
Package stateapiupdater is responsible for generating and storing the object response of the GET /state endpoint exposed through the api package.

# Functions

NewAPI sets the endpoints and the appropriate handlers, but doesn't start the server.
RequestOffset2RelativePosition translates from 0 to 7 to protocol position.

# Constants

ErrAccountTokenNotEqualTxTokenCode code for account token not equal tx token error.
ErrAccountTokenNotEqualTxTokenType type for account token not equal tx token type.
ErrCantSendToEthAddrCode code when can't send to eth addr code error appeared.
ErrCantSendToEthAddrType type when can't send to eth addr code error appeared.
ErrDuplicatedKey error message returned when trying to insert an item with duplicated key.
ErrDuplicatedKeyCode code for duplicated key error.
ErrDuplicatedKeyType type for duplicated key error.
ErrExitAmount0 error message returned when receiving (and rejecting) a tx of type exit with amount 0.
ErrExitAmount0Code code for 0 exit amount error.
ErrExitAmount0Type type for 0 exit amount error.
ErrFailedToAddEmptySlotCode code when can't add empty slot in /slots request.
ErrFailedToAddEmptySlotType type when can't add empty slot in /slots request.
ErrFailedToFindOffsetToRelativePositionCode error code when can't find offset to relative position.
ErrFailedToFindOffsetToRelativePositionType error type.
ErrFailedToGetAuctionVarsCode code when can't get auction vars in /slots request.
ErrFailedToGetAuctionVarsType type when can't get auction vars in /slots request.
ErrFailedToGetCurrentBlockCode code when can't get current block in /slots request.
ErrFailedToGetCurrentBlockType type when can't get current block in /slots request.
ErrFeeOverflowCode code for fee overflow code error.
ErrFeeOverflowType type for fee overflow code type.
ErrFeeTooBigCode code for fee too big error.
ErrFeeTooBigType type for fee too big error.
ErrFeeTooLowCode code for fee too low error.
ErrFeeTooLowType type for fee too low error.
ErrGettingReceiverAccountCode code for getting receiver account error.
ErrGettingReceiverAccountType type for getting receiver account error.
ErrGettingSenderAccountCode code for getting sender account error.
ErrGettingSenderAccountType type for getting sender account error.
ErrInvalidAtomicGroupID error message returned when received an invalid AtomicGroupID.
ErrInvalidAtomicGroupIDCode error code.
ErrInvalidAtomicGroupIDType error type.
ErrInvalidNonceCode code for invalid nonce error.
ErrInvalidNonceType type for invalid nonce error.
ErrInvalidRqOffset error message returned when received an invalid request offset.
ErrInvalidSignatureCode code for invalid signature error.
ErrInvalidSignatureType type for invalid signature error.
ErrInvalidTxTypeOrTxIDCode code for invalid tx type or txID error.
ErrInvalidTxTypeOrTxIDType type for invalid tx type or txID error.
ErrNotAtomicTxsInPostPoolTx error message returned when received an non-atomic transaction inside atomic pool.
ErrNotAtomicTxsInPostPoolTxCode code filter atomic transactions on POST /transactions-pool.
ErrNotAtomicTxsInPostPoolTxType type filter atomic transactions on POST /transactions-pool.
ErrNothingToUpdateCode code for nothing to update error.
ErrNothingToUpdateType type for nothing to update type.
ErrParamValidationFailedCode code for param validation failed error.
ErrParamValidationFailedType type for param validation failed error.
ErrRqOffsetOutOfBounds error message returned when transaction tries to access another out the bounds of the array.
ErrRqOffsetOutOfBoundsCode error code.
ErrRqOffsetOutOfBoundsType error type.
ErrSingleTxInAtomicEndpoint only one tx sent to the atomic-pool endpoint.
ErrSingleTxInAtomicEndpointCode error code.
ErrSingleTxInAtomicEndpointType error type.
ErrSQLNoRows error message returned when there is no such records.
ErrSQLNoRowsCode code for no rows error.
ErrSQLNoRowsType type for now rows error.
ErrSQLTimeout error message returned when timeout due to SQL connection.
ErrSQLTimeoutCode code for sql timeout error.
ErrSQLTimeoutType type for sql timeout type.
ErrTxsNotAtomic error message returned when receiving (and rejecting) txs in the atomic endpoint with not all txs being atomic.
ErrTxsNotAtomicCode error code.
ErrTxsNotAtomicType error type.
ErrUnsupportedMaxNumBatch error message returned when tx.MaxNumBatch != 0 until the feature is fully implemented.

# Structs

API serves HTTP requests to allow external interaction with the Hermez node.
Config wraps the parameters needed to start the API.
CoordinatorNetworkConfig wraps the parameters needed to start the coordinator network.
CurrenciesResponse is the response object for multiple fiat prices.
NetworkConfig of the API.
SlotAPI is a representation of a slot information.