open-payments icon indicating copy to clipboard operation
open-payments copied to clipboard

Return `estimatedExchangeRate` for quotes

Open mkurapov opened this issue 1 year ago • 1 comments

Context

Originally from @raducristianpopa particularly in the WM context, there is no good way to determine what is the minimum debitAmount for a quote that will satisfy at least a minimum one unit of value for the receiving wallet address:

What would be the best way to check what is the minimum amount that can be sent in a cross-currency scenario - debitAmount? When sending from USD to EUR, in most cases $0.01 is not going to equal 0.01EUR. I thought about using receiveAmount but this will not work - the grant will need the limits in the receiver’s asset. Probe through quoting - create quotes until one is created successfully? - For WM this will lead to some delays in the flow Probe through quoting with an exponential increase for the amount? If the sender’s asset is ZAR and the receiver’s asset is USD we will probably have to make around 16-18 quote requests (depends on the exchange rate as well): 0.01 ZAR = 0.00… USD 0.19 ZAR = 0.01 USD In the example above, the extension will have to make 18 quote requests until it reaches an amount that can be represented in USD.

What we came up with in the Open Payments catch up call is to expose an estimatedExchangeRate on the quote POST & GET response.

Todos

  • [ ] Update the resource server spec to include an optional estimatedExchangeRate: number in the quote

mkurapov avatar Jul 17 '24 15:07 mkurapov

~~Should the ILP specific fields be removed as well in this PR?~~

~~Related to: https://github.com/interledger/rafiki/issues/2856.~~

Edit: I just noticed that these fields are not returned for Open Payments.

raducristianpopa avatar Aug 22 '24 06:08 raducristianpopa

Replacing in favour of #573, as we will instead provide a minSendAmount field in the error.details response

mkurapov avatar Mar 25 '25 12:03 mkurapov