espresso-sequencer
espresso-sequencer copied to clipboard
Adding API endpoint to get fee balance per account
Closes #2105
This PR:
Adds get_fee_balance endpoint to the sequencer API to retrieve the current balance of an account. This allows to detect whenever the Builder is low on funds and issue the corresponding alert
This PR does not:
Key places to review:
sequencer/api/merklized_state.toml: defines new endpoint. sequencer/src/api/endpoints.rs: extends merklized state API with the new endpoint and define its behaviour. In particular, given address as an input it retrieves current height from state, and uses height and address to retrieve merkle path from merklized state. Balance is extracted from leaf of this path.
Manual test is to run the native demo locally, retrieve the builder address from http://localhost:31003/v0/block_info/builderaddress, then use the address to call the new endpoint http://localhost:24001/v0/fee-state/fee_balance/<ADDRESS>