-
Notifications
You must be signed in to change notification settings - Fork 0
DEXInfo Fees Endpoint
Alex Megalokonomos edited this page Feb 17, 2022
·
1 revision
The fee estimation endpoint lives under the /fees
route and accepts a POSTed JSON in the following format:
{ tx: AbstractTransactionMappingRequest }
Where the AbstractTransactionMappingRequest model is defined here: https://github.com/allinbits/emeris-libraries/blob/feat/mapper-updates/packages/types/src/EmerisTransactions.ts#L153-L157
Essentially we provide the chain name this Tx is for, the signing address and an array of abstract transactions/messages to be included.
Abstract transactions are defined here: https://github.com/allinbits/emeris-libraries/blob/feat/mapper-updates/packages/types/src/EmerisTransactions.ts#L151
The fees route handler then proceeds to:
- fetch chain information for the provided chain name
- instantiate an emeris signer object (provided by
@emeris/signer
: https://github.com/allinbits/emeris-libraries/tree/feat/mapper-updates/packages/signer/src) with a dummy account/mnemonic. - map the abstract transactions to chain and library specific messages using the map() function provided by
@emeris/mapper
(https://github.com/allinbits/emeris-libraries/tree/feat/mapper-updates/packages/mapper/src) - use the getFees() method provided by the emeris signer object with the chain name and mapped chain-specific messages to get the estimated fee and return it