feat: zap-pool

This commit is contained in:
2023-05-16 22:30:52 +01:00
parent 9b3b3adef9
commit 7317bc4c35
9 changed files with 357 additions and 23 deletions

View File

@ -16,6 +16,7 @@ import { useWallet } from "Wallet";
import useLogin from "Hooks/useLogin";
import { generateRandomKey } from "Login";
import { EventPublisher } from "System/EventPublisher";
import { ZapPoolController } from "ZapPoolController";
import messages from "./messages";
@ -36,6 +37,7 @@ export interface SendSatsProps {
target?: string;
note?: HexKey;
author?: HexKey;
allocatePool?: boolean;
}
export default function SendSats(props: SendSatsProps) {
@ -194,9 +196,12 @@ export default function SendSats(props: SendSatsProps) {
async function payWithWallet(invoice: LNURLInvoice) {
try {
if (wallet?.isReady) {
if (wallet?.isReady()) {
setPaying(true);
const res = await wallet.payInvoice(invoice?.pr ?? "");
if (props.allocatePool) {
ZapPoolController.allocate(amount);
}
console.log(res);
setSuccess(invoice?.successAction ?? {});
}