Skip to content

Initial support for nostr wallet connect#96

Merged
AtlantisPleb merged 4 commits into
OpenAgentsInc:mainfrom
reyamir:nostr-wallet-connect
May 2, 2023
Merged

Initial support for nostr wallet connect#96
AtlantisPleb merged 4 commits into
OpenAgentsInc:mainfrom
reyamir:nostr-wallet-connect

Conversation

@reyamir

@reyamir reyamir commented May 2, 2023

Copy link
Copy Markdown
Contributor

Add:

  • Initial screen for zap: (main)/zap/[address]
  • getInvoiceFromAddress function to generate invoice with user input lightning address
  • sendZap function to send zap to specific invoice

Change:

  • initAlby function, run this function will trigger open Nostr Wallet Connect verification page as new tab and return NostrWalletConnectUrl for future use

Flow:

  • User visit /alby page, app auto trigger connect to Alby, and open Nostr Wallet Connect verification page as new tab
  • User enter their lightning address and click Zap button, app auto generate invoice (fixed 21 sats), then push this invoice to sendPayment function
  • If send payment success, send message to user

@vercel

vercel Bot commented May 2, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
arcade ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2023 3:31am

@reyamir reyamir requested a review from AtlantisPleb May 2, 2023 03:29
@reyamir reyamir self-assigned this May 2, 2023
@reyamir reyamir added the enhancement New feature or request label May 2, 2023
@AtlantisPleb AtlantisPleb merged commit 4180047 into OpenAgentsInc:main May 2, 2023
@AtlantisPleb

Copy link
Copy Markdown
Collaborator

Closes #95

@AtlantisPleb

Copy link
Copy Markdown
Collaborator

AWESOME! It worked first try!

firsttry

received

Comment thread app/alby.tsx
name: 'Arcade',
returnTo: document.location.toString(),
})
await nwc.initNWC()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

whoot, super cool!

quck feedback:
you should pass the name here to the initNWC function: https://github.com/getAlby/alby-js-sdk/blob/master/README.md#initnwcname-string

nwcURL.current = nwc.getNostrWalletConnectUrl()
await nwc.initNWC({name: "Arcade" });

getNostrWalletConnectUrl returns the walletconnect secret URL. You don't need to pass any parameter there.

the returnTo is not needed with initNWC because initNWC opens the popup and listens for a response and the resolves and closes the popup, so no redirect is needed here.

(And one best practice is it to prompt the user on some interaction and not by default when the page is opened.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've updated code based on your feedback, and it's work like charm 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants