Skip to content

perf(bg/PaymentSession): fewer quote requests using exchange rate#1056

Merged
sidvishnoi merged 1 commit into
mainfrom
minSendAmount-use-currency-exchange
May 15, 2025
Merged

perf(bg/PaymentSession): fewer quote requests using exchange rate#1056
sidvishnoi merged 1 commit into
mainfrom
minSendAmount-use-currency-exchange

Conversation

@sidvishnoi
Copy link
Copy Markdown
Member

@sidvishnoi sidvishnoi commented May 15, 2025

Context

Part of #976

Changes proposed in this pull request

When sending cross currency payments (specially from higher to lower exchange rate, e.g. MXN to USD (0.19MXN = 0.01USD)), make use of exchange rate and use it as the starting point for probing.

When sending from MXN to USD, there's now a single (1) quote instead of 6.
This won't be needed when we get with interledger/rafiki#3411 available across wallets.

This also gives us a more accurate minSendAmount, as otherwise with current exponential probing, we may end up trying to send 1,2,4,8,16,32 units, instead of something in between (19 here).

The exchange rates are cached for 15min as we don't want to fetch them for each session.

@sidvishnoi sidvishnoi requested a review from DarianM May 15, 2025 13:44
@github-actions github-actions Bot added area: background Improvements or additions to extension background script area: shared Changes to shared libraries and utilities labels May 15, 2025
@sidvishnoi sidvishnoi changed the title perf(bg/PaymentSession): fewer probing requests using exchange rate perf(bg/PaymentSession): fewer quote requests using exchange rate May 15, 2025
Copy link
Copy Markdown
Member Author

@sidvishnoi sidvishnoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test-e2e
Edit: Unrelated tests fails only in Edge, so all good.

@github-actions
Copy link
Copy Markdown
Contributor

Extension builds preview

Name Link
Latest commit 18e85e1
Latest job logs Run #15046598548
Chrome (990.27KB)Download
Firefox (990.29KB)Download

@sidvishnoi sidvishnoi merged commit 034249e into main May 15, 2025
15 of 16 checks passed
@sidvishnoi sidvishnoi deleted the minSendAmount-use-currency-exchange branch May 15, 2025 14:40
@sidvishnoi sidvishnoi linked an issue May 27, 2025 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: background Improvements or additions to extension background script area: shared Changes to shared libraries and utilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Payment streams overhaul

2 participants