Skip to content

Conversation

@Klakurka
Copy link
Member

@Klakurka Klakurka commented Aug 3, 2025

Related to #516

Description

This change standardizes how we interact with both the Cashtab extension and (fallback) website.

Test plan

Initiate payments with the Cashtab extension installed and not installed.

@Klakurka Klakurka requested a review from lissavxo August 3, 2025 05:05
@Klakurka Klakurka self-assigned this Aug 3, 2025
@Klakurka Klakurka added the enhancement (behind the scenes) Stuff that users won't see label Aug 3, 2025
@Klakurka Klakurka linked an issue Aug 3, 2025 that may be closed by this pull request
*/
export const openCashtabPayment = async (bip21Url: string, fallbackUrl?: string): Promise<void> => {
try {
const isAvailable = await getCashtabProviderStatus();

Choose a reason for hiding this comment

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

this approach -- checking status on button click -- is probably effective in most current contexts. However it would be wasteful for any application where multiple clicks are expected.

The cashtab provider status is not expected to change during a user's visit (and, even if it did --- e.g. if the user installs the cashtab extension --- a refresh is required for this to be detected).

Would be more robust and payments would be faster if this check were performed on page load. This would also allow you to conditionally render the button, i.e. show the user that it will open Cashtab or the mobile app or Electrum before a click.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good idea - now we can make this nice little text change on widget load:

image

@Klakurka
Copy link
Member Author

Klakurka commented Aug 3, 2025

Changes:

  • Cashtab extension check only happens once (regradless of how many buttons/widgets are on the page) and at page load.
  • "Send with XEC wallet" text now shows "Send with Cashtab" if extension is detected.

Copy link
Collaborator

@chedieck chedieck left a comment

Choose a reason for hiding this comment

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

Works well, just the same thing about too many redundant comments pollution

Copy link
Member Author

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

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

Some of the comments I do find useful but I removed the rest.

@Klakurka Klakurka requested review from chedieck and removed request for lissavxo August 9, 2025 02:18
@Klakurka Klakurka merged commit 1c1d677 into master Aug 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement (behind the scenes) Stuff that users won't see

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch to cashtab-connect (lib) for interfacing w/ cashtab

4 participants