Replying to Avatar Sirius

nostr:npub1getal6ykt05fsz5nqu4uld09nfj3y3qxmv8crys4aeut53unfvlqr80nfm is it possible to use https://github.com/getAlby/bitcoin-connect without having to show this popup every time you open the app

This seems to do it

import {onConnected} from '@getalby/bitcoin-connect';

const unsub = onConnected(async (provider) => {

const {preimage} = await provider.sendPayment('lnbc...');

});

unsub();

Reply to this note

Please Login to reply.

Discussion

Yeah, requestProvider() is supposed to be called when a user e.g. clicks a connect button:

> If one is not available, the Bitcoin connect modal will be launched. This should be called on a user interaction to avoid the modal unexpectedly being shown to the user.

The onConnected event will be raised whenever a user connects for the first time (or connected before and reloads the page). If you want to e.g. display the balance that's the way to do it 👍