Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bitcoin-connect instead of webln #598

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
243 changes: 240 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"dependencies": {
"@bitcoinerlab/secp256k1": "^1.1.1",
"@fontsource/noto-sans": "^5.0.21",
"@getalby/bitcoin-connect": "^3.5.1",
"@scure/base": "^1.1.6",
"@solid-primitives/i18n": "^2.1.1",
"@solid-primitives/storage": "^2.1.4",
Expand Down
13 changes: 6 additions & 7 deletions src/components/WeblnButton.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { requestProvider } from "@getalby/bitcoin-connect";
import log from "loglevel";

import { useCreateContext } from "../context/Create";
import { useGlobalContext } from "../context/Global";
import { enableWebln } from "../utils/webln";

const WeblnButton = () => {
const { t } = useGlobalContext();
const { receiveAmount, amountValid, setInvoice } = useCreateContext();

const createWeblnInvoice = async () => {
await enableWebln(async () => {
const amount = Number(receiveAmount());
const invoice = await window.webln.makeInvoice({ amount: amount });
log.debug("created webln invoice", invoice);
setInvoice(invoice.paymentRequest);
});
const weblnProvider = await requestProvider();
const amount = Number(receiveAmount());
const invoice = await weblnProvider.makeInvoice({ amount: amount });
log.debug("created webln invoice", invoice);
setInvoice(invoice.paymentRequest);
};
return (
<button
Expand Down
Loading
Loading