Skip to content

Return estimatedExchangeRate for quotes #491

Closed
@mkurapov

Description

@mkurapov

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

Metadata

Metadata

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions