mailchain / mailchain-legacy

Using Mailchain, blockchain users can now send and receive rich-media HTML messages with attachments via a blockchain address.
https://mailchain.xyz
Apache License 2.0
143 stars 51 forks source link

Return estimated message fee via API #714

Open tboeckmann opened 3 years ago

tboeckmann commented 3 years ago

Is your feature request related to a problem? Please describe. In order to show users the estimated fee to send a message, we need an endpoint that returns the current estimated fees in the context of a protocol, network, and envelope type.

It should take into account the cost of the on-chain data and sending the transaction with medium priority.

Describe the solution you'd like GET /messages/fee?protocol=ethereum&network=ropsten&envelope_type=0x01 returns:

{
  "fee": "167248000000000",
  "unit": "wei"
}

Ethereum See tools here Etherscan may be the best place to get data from as this is already used for the tx index and is considered widely accurate.

Edgeware E.g. see substrate fees here

Other considerations Envelope has an impact? It might be handled differently than as a param- I'm open to suggestions.

sa3664 commented 3 years ago

@tboeckmann Could you please assign this issue to me .