The format of an error message that the RPC returns:
"message": "Layer1Address deserialize error: incorrect Layer1Address format"
- code: error code
- message: error message in English
- -32602: incorrect number of parameters or unable to serialize parameters correctly
- 100-200: parameter value is not within the correct range
- 201-300: Incorrect state, such as insufficient account balance for a transfer
- 500: RPC server internal error
The table below lists most error codes and their meanings. While the error codes and meanings generally remain the same, the error messages may change with version iterations. The range from -32768 to -32000 represents the predefined errors in the JSON RPC 2.0 protocol and are less likely to occur if the API documentation is followed. The range from 100 to 500 represents custom errors defined by the zklink RPC server and should be handled by the caller.
When using some APIs that involve querying account status such as getAccount, getAccountSnapshot, etc., if the account does not exist, it will return this error message, rather than returning a default. This is because the account with '
accountId=0' is a Layer2 fee account, and the default accountId is also 0. If the account does not exist, returning the default value will cause confusion.
Transaction fees are related to Layer2 token price, which is stable over a period of time (for example, half an hour). If the price is updated just after
tx_submitmay fail. In this case, the initiator need to re-query the transaction fee and then try to submit the transaction again.