This commit is contained in:
parent
7bc00b4624
commit
47d92fe171
@ -20,12 +20,15 @@ const ConnectCashu = () => {
|
||||
}
|
||||
|
||||
const { CashuWallet } = await import("@/Wallet/Cashu");
|
||||
const connection = new CashuWallet({
|
||||
const connection = new CashuWallet(
|
||||
{
|
||||
url: config,
|
||||
keys: {},
|
||||
proofs: [],
|
||||
keysets: []
|
||||
}, () => { });
|
||||
keysets: [],
|
||||
},
|
||||
() => {},
|
||||
);
|
||||
await connection.login();
|
||||
const info = await connection.getInfo();
|
||||
const newWallet = {
|
||||
|
@ -89,7 +89,8 @@ export default function WalletPage(props: { showHistory: boolean }) {
|
||||
|
||||
function walletList() {
|
||||
if (walletState.configs.length === 0) {
|
||||
return (<div className="flex flex-col gap-4">
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div>
|
||||
<button onClick={() => navigate("/settings/wallet")}>
|
||||
<FormattedMessage defaultMessage="Connect Wallet" id="cg1VJ2" />
|
||||
@ -129,9 +130,11 @@ export default function WalletPage(props: { showHistory: boolean }) {
|
||||
<h3>
|
||||
<FormattedMessage defaultMessage="Payments" id="pukxg/" description="Wallet transation history" />
|
||||
</h3>
|
||||
{history === undefined && <small>
|
||||
{history === undefined && (
|
||||
<small>
|
||||
<FormattedMessage defaultMessage="Your sent and received payments will show up here." id="i5gBFz" />
|
||||
</small>}
|
||||
</small>
|
||||
)}
|
||||
{history?.map(a => {
|
||||
const dirClassname = {
|
||||
"text-[--success]": a.direction === "in",
|
||||
@ -231,14 +234,18 @@ export default function WalletPage(props: { showHistory: boolean }) {
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{wallet?.canCreateInvoice() && <AsyncButton className="secondary" onClick={() => navigate("/wallet/receive")}>
|
||||
{wallet?.canCreateInvoice() && (
|
||||
<AsyncButton className="secondary" onClick={() => navigate("/wallet/receive")}>
|
||||
<FormattedMessage defaultMessage="Receive" id="ULXFfP" />
|
||||
<Icon name="arrow-up-right" className="rotate-180" />
|
||||
</AsyncButton>}
|
||||
{wallet?.canPayInvoice() && <AsyncButton onClick={() => navigate("/wallet/send")}>
|
||||
</AsyncButton>
|
||||
)}
|
||||
{wallet?.canPayInvoice() && (
|
||||
<AsyncButton onClick={() => navigate("/wallet/send")}>
|
||||
<FormattedMessage defaultMessage="Send" id="9WRlF4" />
|
||||
<Icon name="arrow-up-right" />
|
||||
</AsyncButton>}
|
||||
</AsyncButton>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{walletHistory()}
|
||||
|
@ -13,30 +13,41 @@ export function WalletReceivePage() {
|
||||
const [amount, setAmount] = useState(0);
|
||||
const [comment, setComment] = useState("");
|
||||
|
||||
return <div className="p flex flex-col gap-4">
|
||||
return (
|
||||
<div className="p flex flex-col gap-4">
|
||||
<div className="text-2xl font-bold">
|
||||
<FormattedMessage defaultMessage="Receive" id="ULXFfP" />
|
||||
</div>
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="Receiving to <b>{wallet}</b>" id="PXQ0z0" values={{
|
||||
<FormattedMessage
|
||||
defaultMessage="Receiving to <b>{wallet}</b>"
|
||||
id="PXQ0z0"
|
||||
values={{
|
||||
b: b => <b>"{b}"</b>,
|
||||
wallet: wallets.config?.info.alias
|
||||
}} />
|
||||
wallet: wallets.config?.info.alias,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
<input type="text" placeholder={formatMessage({ defaultMessage: "Comment", id: 'LgbKvU' })} value={comment} onChange={e => setComment(e.target.value)} />
|
||||
<input
|
||||
type="text"
|
||||
placeholder={formatMessage({ defaultMessage: "Comment", id: "LgbKvU" })}
|
||||
value={comment}
|
||||
onChange={e => setComment(e.target.value)}
|
||||
/>
|
||||
<div className="flex flex-col">
|
||||
<small>
|
||||
<FormattedMessage defaultMessage="Amount in sats" id="djLctd" />
|
||||
</small>
|
||||
<input type="number" value={amount} onChange={e => setAmount(Number(e.target.value))} />
|
||||
</div>
|
||||
<AsyncButton onClick={async () => {
|
||||
<AsyncButton
|
||||
onClick={async () => {
|
||||
try {
|
||||
if (wallets.wallet) {
|
||||
const inv = await wallets.wallet.createInvoice({
|
||||
amount: amount,
|
||||
memo: comment,
|
||||
expiry: 600
|
||||
expiry: 600,
|
||||
});
|
||||
setInvoice(inv.pr);
|
||||
}
|
||||
@ -47,9 +58,12 @@ export function WalletReceivePage() {
|
||||
<FormattedMessage defaultMessage="Generate Invoice" id="ipHVx5" />
|
||||
</AsyncButton>
|
||||
{error && <b className="warning">{error}</b>}
|
||||
{invoice && <div className="flex flex-col gap-2 items-center">
|
||||
{invoice && (
|
||||
<div className="flex flex-col gap-2 items-center">
|
||||
<QrCode data={invoice} link={`lightning:${invoice}`} />
|
||||
<Copy text={invoice} />
|
||||
</div>}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import AsyncButton from "@/Components/Button/AsyncButton";
|
||||
import Icon from "@/Components/Icons/Icon";
|
||||
import { formatShort } from "@/Utils/Number";
|
||||
import { WalletInvoice, useWallet } from "@/Wallet"
|
||||
import { WalletInvoice, useWallet } from "@/Wallet";
|
||||
import { LNURL } from "@snort/shared";
|
||||
import { useEffect, useState } from "react";
|
||||
import { FormattedMessage, FormattedNumber, useIntl } from "react-intl";
|
||||
@ -18,30 +18,48 @@ export function WalletSendPage() {
|
||||
const [result, setResult] = useState<WalletInvoice>();
|
||||
|
||||
useEffect(() => {
|
||||
isLnurl(!invoice.startsWith("lnbc"))
|
||||
isLnurl(!invoice.startsWith("lnbc"));
|
||||
}, [invoice]);
|
||||
|
||||
return <div className="p flex flex-col gap-4">
|
||||
return (
|
||||
<div className="p flex flex-col gap-4">
|
||||
<div className="text-2xl font-bold">
|
||||
<FormattedMessage defaultMessage="Send" id="9WRlF4" />
|
||||
</div>
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="Sending from <b>{wallet}</b>" id="Xnimz0" values={{
|
||||
<FormattedMessage
|
||||
defaultMessage="Sending from <b>{wallet}</b>"
|
||||
id="Xnimz0"
|
||||
values={{
|
||||
b: b => <b>"{b}"</b>,
|
||||
wallet: wallets.config?.info.alias
|
||||
}} />
|
||||
wallet: wallets.config?.info.alias,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
<input type="text" placeholder={formatMessage({ defaultMessage: "Invoice / Lightning Address", id: 'EHqHsu' })} value={invoice} onChange={e => setInvoice(e.target.value)} />
|
||||
{lnurl && <>
|
||||
<input type="text" placeholder={formatMessage({ defaultMessage: "Comment", id: 'LgbKvU' })} value={comment} onChange={e => setComment(e.target.value)} />
|
||||
<input
|
||||
type="text"
|
||||
placeholder={formatMessage({ defaultMessage: "Invoice / Lightning Address", id: "EHqHsu" })}
|
||||
value={invoice}
|
||||
onChange={e => setInvoice(e.target.value)}
|
||||
/>
|
||||
{lnurl && (
|
||||
<>
|
||||
<input
|
||||
type="text"
|
||||
placeholder={formatMessage({ defaultMessage: "Comment", id: "LgbKvU" })}
|
||||
value={comment}
|
||||
onChange={e => setComment(e.target.value)}
|
||||
/>
|
||||
<div className="flex flex-col">
|
||||
<small>
|
||||
<FormattedMessage defaultMessage="Amount in sats" id="djLctd" />
|
||||
</small>
|
||||
<input type="number" value={amount} onChange={e => setAmount(Number(e.target.value))} />
|
||||
</div>
|
||||
</>}
|
||||
<AsyncButton onClick={async () => {
|
||||
</>
|
||||
)}
|
||||
<AsyncButton
|
||||
onClick={async () => {
|
||||
try {
|
||||
if (wallets.wallet) {
|
||||
if (!isLnurl) {
|
||||
@ -64,12 +82,19 @@ export function WalletSendPage() {
|
||||
<FormattedMessage defaultMessage="Pay" id="lD3+8a" />
|
||||
</AsyncButton>
|
||||
{error && <b className="warning">{error}</b>}
|
||||
{result && <div className="flex gap-2">
|
||||
{result && (
|
||||
<div className="flex gap-2">
|
||||
<Icon name="check" className="success" />
|
||||
<FormattedMessage defaultMessage="Paid {amount} sats, fee {fee} sats" id="aRex7h" values={{
|
||||
<FormattedMessage
|
||||
defaultMessage="Paid {amount} sats, fee {fee} sats"
|
||||
id="aRex7h"
|
||||
values={{
|
||||
amount: <FormattedNumber value={result.amount / 1000} />,
|
||||
fee: <FormattedNumber value={result.fees / 1000} />
|
||||
}} />
|
||||
</div>}
|
||||
fee: <FormattedNumber value={result.fees / 1000} />,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
@ -150,11 +150,11 @@ const mainRoutes = [
|
||||
},
|
||||
{
|
||||
path: "/wallet/send",
|
||||
element: <WalletSendPage />
|
||||
element: <WalletSendPage />,
|
||||
},
|
||||
{
|
||||
path: "/wallet/receive",
|
||||
element: <WalletReceivePage />
|
||||
element: <WalletReceivePage />,
|
||||
},
|
||||
...OnboardingRoutes,
|
||||
...SettingsRoutes,
|
||||
|
@ -467,6 +467,9 @@
|
||||
"E5ZIPD": {
|
||||
"defaultMessage": "<big>{amount}</big> <small>sats</small>"
|
||||
},
|
||||
"EHqHsu": {
|
||||
"defaultMessage": "Invoice / Lightning Address"
|
||||
},
|
||||
"EJbFi7": {
|
||||
"defaultMessage": "Search notes"
|
||||
},
|
||||
@ -810,6 +813,9 @@
|
||||
"defaultMessage": "Summary",
|
||||
"description": "Notifications summary"
|
||||
},
|
||||
"PXQ0z0": {
|
||||
"defaultMessage": "Receiving to <b>{wallet}</b>"
|
||||
},
|
||||
"PamNxw": {
|
||||
"defaultMessage": "Unknown file header: {name}"
|
||||
},
|
||||
@ -930,6 +936,9 @@
|
||||
"UJTWqI": {
|
||||
"defaultMessage": "Remove from my relays"
|
||||
},
|
||||
"ULXFfP": {
|
||||
"defaultMessage": "Receive"
|
||||
},
|
||||
"UNjfWJ": {
|
||||
"defaultMessage": "Check all event signatures received from relays"
|
||||
},
|
||||
@ -1017,6 +1026,9 @@
|
||||
"XhpBfA": {
|
||||
"defaultMessage": "{site} is an open source project built by passionate people in their free time, your donations are greatly appreciated"
|
||||
},
|
||||
"Xnimz0": {
|
||||
"defaultMessage": "Sending from <b>{wallet}</b>"
|
||||
},
|
||||
"Xopqkl": {
|
||||
"defaultMessage": "Your default zap amount is {number} sats, example values are calculated from this."
|
||||
},
|
||||
@ -1033,6 +1045,9 @@
|
||||
"YXA3AH": {
|
||||
"defaultMessage": "Enable reactions"
|
||||
},
|
||||
"Yf3DwC": {
|
||||
"defaultMessage": "Connect a wallet to send instant payments"
|
||||
},
|
||||
"Z4BMCZ": {
|
||||
"defaultMessage": "Enter pairing phrase"
|
||||
},
|
||||
@ -1063,6 +1078,9 @@
|
||||
"aMaLBK": {
|
||||
"defaultMessage": "Supported Extensions"
|
||||
},
|
||||
"aRex7h": {
|
||||
"defaultMessage": "Paid {amount} sats, fee {fee} sats"
|
||||
},
|
||||
"aSGz4J": {
|
||||
"defaultMessage": "Connect to your own LND node with Lightning Node Connect"
|
||||
},
|
||||
@ -1163,6 +1181,9 @@
|
||||
"deEeEI": {
|
||||
"defaultMessage": "Register"
|
||||
},
|
||||
"djLctd": {
|
||||
"defaultMessage": "Amount in sats"
|
||||
},
|
||||
"djNL6D": {
|
||||
"defaultMessage": "Read-only"
|
||||
},
|
||||
@ -1295,6 +1316,9 @@
|
||||
"i/dBAR": {
|
||||
"defaultMessage": "Zap Pool"
|
||||
},
|
||||
"i5gBFz": {
|
||||
"defaultMessage": "Your sent and received payments will show up here."
|
||||
},
|
||||
"iCqGww": {
|
||||
"defaultMessage": "Reactions ({n})"
|
||||
},
|
||||
@ -1319,6 +1343,9 @@
|
||||
"ieGrWo": {
|
||||
"defaultMessage": "Follow"
|
||||
},
|
||||
"ipHVx5": {
|
||||
"defaultMessage": "Generate Invoice"
|
||||
},
|
||||
"itPgxd": {
|
||||
"defaultMessage": "Profile"
|
||||
},
|
||||
|
@ -154,6 +154,7 @@
|
||||
"DtYelJ": "Transfer",
|
||||
"Dx4ey3": "Toggle all",
|
||||
"E5ZIPD": "<big>{amount}</big> <small>sats</small>",
|
||||
"EHqHsu": "Invoice / Lightning Address",
|
||||
"EJbFi7": "Search notes",
|
||||
"ELbg9p": "Data Providers",
|
||||
"EQKRE4": "Show badges on profile pages",
|
||||
@ -267,6 +268,7 @@
|
||||
"P7nJT9": "Total today (UTC): {amount} sats",
|
||||
"PCSt5T": "Preferences",
|
||||
"PJeJFc": "Summary",
|
||||
"PXQ0z0": "Receiving to <b>{wallet}</b>",
|
||||
"PamNxw": "Unknown file header: {name}",
|
||||
"Pe0ogR": "Theme",
|
||||
"PrsIg7": "Reactions will be shown on every page, if disabled no reactions will be shown",
|
||||
@ -306,6 +308,7 @@
|
||||
"U1aPPi": "Stop listening",
|
||||
"UDYlxu": "Pending Subscriptions",
|
||||
"UJTWqI": "Remove from my relays",
|
||||
"ULXFfP": "Receive",
|
||||
"UNjfWJ": "Check all event signatures received from relays",
|
||||
"UT7Nkj": "New Chat",
|
||||
"UUPFlt": "Users must accept the content warning to show the content of your note.",
|
||||
@ -335,11 +338,13 @@
|
||||
"XXm7jJ": "Trending Hashtags",
|
||||
"XgWvGA": "Reactions",
|
||||
"XhpBfA": "{site} is an open source project built by passionate people in their free time, your donations are greatly appreciated",
|
||||
"Xnimz0": "Sending from <b>{wallet}</b>",
|
||||
"Xopqkl": "Your default zap amount is {number} sats, example values are calculated from this.",
|
||||
"XrSk2j": "Redeem",
|
||||
"YDURw6": "Service URL",
|
||||
"YR2I9M": "No keys, no {app}, There is no way to reset it if you don't back up. It only takes a minute.",
|
||||
"YXA3AH": "Enable reactions",
|
||||
"Yf3DwC": "Connect a wallet to send instant payments",
|
||||
"Z4BMCZ": "Enter pairing phrase",
|
||||
"ZKORll": "Activate Now",
|
||||
"ZLmyG9": "Contributors",
|
||||
@ -350,6 +355,7 @@
|
||||
"a7TDNm": "Notes will stream in real time into global and notes tab",
|
||||
"aHje0o": "Name or nym",
|
||||
"aMaLBK": "Supported Extensions",
|
||||
"aRex7h": "Paid {amount} sats, fee {fee} sats",
|
||||
"aSGz4J": "Connect to your own LND node with Lightning Node Connect",
|
||||
"aWpBzj": "Show more",
|
||||
"b12Goz": "Mnemonic",
|
||||
@ -383,6 +389,7 @@
|
||||
"dOQCL8": "Display name",
|
||||
"ddd3JX": "Popular Hashtags",
|
||||
"deEeEI": "Register",
|
||||
"djLctd": "Amount in sats",
|
||||
"djNL6D": "Read-only",
|
||||
"dmsiLv": "A default Zap Pool split of {n} has been configured for {site} developers, you can disable it at any time in {link}",
|
||||
"e61Jf3": "Coming soon",
|
||||
@ -427,6 +434,7 @@
|
||||
"hniz8Z": "here",
|
||||
"hvFRBo": "Interaction",
|
||||
"i/dBAR": "Zap Pool",
|
||||
"i5gBFz": "Your sent and received payments will show up here.",
|
||||
"iCqGww": "Reactions ({n})",
|
||||
"iEoXYx": "DeepL translations",
|
||||
"iGT1eE": "Prevent fake accounts from imitating you",
|
||||
@ -435,6 +443,7 @@
|
||||
"iXPL0Z": "Can't login with private key on an insecure connection, please use a Nostr key manager extension instead",
|
||||
"iYc3Ld": "Payments",
|
||||
"ieGrWo": "Follow",
|
||||
"ipHVx5": "Generate Invoice",
|
||||
"itPgxd": "Profile",
|
||||
"izWS4J": "Unfollow",
|
||||
"j9xbzF": "Already backed up",
|
||||
|
Loading…
Reference in New Issue
Block a user