on-chain donation option
This commit is contained in:
parent
87f279bd77
commit
cd8fce15a9
@ -25,10 +25,10 @@ const ZapButton = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="zap-button flex" onClick={() => setZap(true)}>
|
||||
<Icon name="zap" className={children ? "mr5" : ""} size={15} />
|
||||
<button type="button" className="flex g8" onClick={() => setZap(true)}>
|
||||
<Icon name="zap-solid" />
|
||||
{children}
|
||||
</div>
|
||||
</button>
|
||||
<SendSats
|
||||
targets={[
|
||||
{
|
||||
|
@ -7,6 +7,10 @@ import ProfilePreview from "Element/ProfilePreview";
|
||||
import ZapButton from "Element/ZapButton";
|
||||
import { bech32ToHex } from "SnortUtils";
|
||||
import SnortApi, { RevenueSplit, RevenueToday } from "SnortApi";
|
||||
import Modal from "Element/Modal";
|
||||
import AsyncButton from "Element/AsyncButton";
|
||||
import QrCode from "Element/QrCode";
|
||||
import Copy from "Element/Copy";
|
||||
|
||||
const Developers = [
|
||||
bech32ToHex(KieranPubKey), // kieran
|
||||
@ -56,8 +60,14 @@ export const DonateLNURL = "donate@snort.social";
|
||||
const DonatePage = () => {
|
||||
const [splits, setSplits] = useState<RevenueSplit[]>([]);
|
||||
const [today, setSumToday] = useState<RevenueToday>();
|
||||
const [onChain, setOnChain] = useState("");
|
||||
const api = new SnortApi(ApiHost);
|
||||
|
||||
async function getOnChainAddress() {
|
||||
const { address } = await api.onChainDonation();
|
||||
setOnChain(address);
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
const rsp = await api.revenueSplits();
|
||||
setSplits(rsp);
|
||||
@ -103,24 +113,43 @@ const DonatePage = () => {
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="Each contributor will get paid a percentage of all donations and NIP-05 orders, you can see the split amounts below" />
|
||||
</p>
|
||||
<div className="card">
|
||||
<div className="flex">
|
||||
<div className="mr10">
|
||||
<FormattedMessage defaultMessage="Lightning Donation: " />
|
||||
<div className="flex-column g12">
|
||||
<div className="b br p">
|
||||
<div className="flex f-space">
|
||||
<FormattedMessage defaultMessage="Lightning Donation" />
|
||||
<ZapButton pubkey={bech32ToHex(SnortPubKey)} lnurl={DonateLNURL}>
|
||||
<FormattedMessage defaultMessage="Donate" />
|
||||
</ZapButton>
|
||||
</div>
|
||||
{today && (
|
||||
<small>
|
||||
<FormattedMessage
|
||||
defaultMessage="Total today (UTC): {amount} sats"
|
||||
values={{ amount: today.donations.toLocaleString() }}
|
||||
/>
|
||||
</small>
|
||||
)}
|
||||
</div>
|
||||
<div className="b br p">
|
||||
<div className="flex f-space">
|
||||
<FormattedMessage defaultMessage="On-chain Donation" />
|
||||
<AsyncButton type="button" onClick={getOnChainAddress}>
|
||||
<FormattedMessage defaultMessage="Get Address" />
|
||||
</AsyncButton>
|
||||
</div>
|
||||
<ZapButton pubkey={bech32ToHex(SnortPubKey)} lnurl={DonateLNURL}>
|
||||
<FormattedMessage defaultMessage="Donate" />
|
||||
</ZapButton>
|
||||
</div>
|
||||
{today && (
|
||||
<small>
|
||||
<FormattedMessage
|
||||
defaultMessage="Total today (UTC): {amount} sats"
|
||||
values={{ amount: today.donations.toLocaleString() }}
|
||||
/>
|
||||
</small>
|
||||
)}
|
||||
</div>
|
||||
{onChain && (
|
||||
<Modal onClose={() => setOnChain("")} id="donate-on-chain">
|
||||
<div className="flex-column f-center g12">
|
||||
<h2>
|
||||
<FormattedMessage defaultMessage="On-chain Donation Address" />
|
||||
</h2>
|
||||
<QrCode data={onChain} link={`bitcoin:${onChain}`} />
|
||||
<Copy text={onChain} />
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
<h3>
|
||||
<FormattedMessage defaultMessage="Primary Developers" />
|
||||
</h3>
|
||||
|
@ -84,6 +84,10 @@ export default class SnortApi {
|
||||
return this.#getJson<LinkPreviewData>(`api/v1/preview?url=${encodeURIComponent(url)}`);
|
||||
}
|
||||
|
||||
onChainDonation() {
|
||||
return this.#getJson<{ address: string }>("p/on-chain");
|
||||
}
|
||||
|
||||
async #getJsonAuthd<T>(
|
||||
path: string,
|
||||
method?: "GET" | string,
|
||||
|
@ -329,6 +329,9 @@
|
||||
"BcGMo+": {
|
||||
"defaultMessage": "Notes hold text content, the most popular usage of these notes is to store \"tweet like\" messages."
|
||||
},
|
||||
"C1LjMx": {
|
||||
"defaultMessage": "Lightning Donation"
|
||||
},
|
||||
"C5xzTC": {
|
||||
"defaultMessage": "Premium"
|
||||
},
|
||||
@ -401,6 +404,9 @@
|
||||
"EcglP9": {
|
||||
"defaultMessage": "Key"
|
||||
},
|
||||
"EjFyoR": {
|
||||
"defaultMessage": "On-chain Donation Address"
|
||||
},
|
||||
"EnCOBJ": {
|
||||
"defaultMessage": "Buy"
|
||||
},
|
||||
@ -871,9 +877,6 @@
|
||||
"ZS+jRE": {
|
||||
"defaultMessage": "Send zap splits to"
|
||||
},
|
||||
"ZUZedV": {
|
||||
"defaultMessage": "Lightning Donation:"
|
||||
},
|
||||
"Zr5TMx": {
|
||||
"defaultMessage": "Setup profile"
|
||||
},
|
||||
@ -892,6 +895,9 @@
|
||||
"b5vAk0": {
|
||||
"defaultMessage": "Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address"
|
||||
},
|
||||
"bLZL5a": {
|
||||
"defaultMessage": "Get Address"
|
||||
},
|
||||
"bQdA2k": {
|
||||
"defaultMessage": "Sensitive Content"
|
||||
},
|
||||
@ -991,6 +997,9 @@
|
||||
"flnGvv": {
|
||||
"defaultMessage": "What's on your mind?"
|
||||
},
|
||||
"fqwcJ1": {
|
||||
"defaultMessage": "On-chain Donation"
|
||||
},
|
||||
"fsB/4p": {
|
||||
"defaultMessage": "Saved"
|
||||
},
|
||||
|
@ -107,6 +107,7 @@
|
||||
"BOr9z/": "Snort is an open source project built by passionate people in their free time",
|
||||
"BWpuKl": "Update",
|
||||
"BcGMo+": "Notes hold text content, the most popular usage of these notes is to store \"tweet like\" messages.",
|
||||
"C1LjMx": "Lightning Donation",
|
||||
"C5xzTC": "Premium",
|
||||
"C81/uG": "Logout",
|
||||
"C8HhVE": "Suggested Follows",
|
||||
@ -131,6 +132,7 @@
|
||||
"Ebl/B2": "Translate to {lang}",
|
||||
"EcZF24": "Custom Relays",
|
||||
"EcglP9": "Key",
|
||||
"EjFyoR": "On-chain Donation Address",
|
||||
"EnCOBJ": "Buy",
|
||||
"Eqjl5K": "Only Snort and our integration partner identifier gives you a colorful domain name, but you are welcome to use other services too.",
|
||||
"F+B3x1": "We have also partnered with nostrplebs.com to give you more options",
|
||||
@ -285,13 +287,13 @@
|
||||
"ZKORll": "Activate Now",
|
||||
"ZLmyG9": "Contributors",
|
||||
"ZS+jRE": "Send zap splits to",
|
||||
"ZUZedV": "Lightning Donation:",
|
||||
"Zr5TMx": "Setup profile",
|
||||
"a5UPxh": "Fund developers and platforms providing NIP-05 verification services",
|
||||
"a7TDNm": "Notes will stream in real time into global and notes tab",
|
||||
"aWpBzj": "Show more",
|
||||
"b12Goz": "Mnemonic",
|
||||
"b5vAk0": "Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address",
|
||||
"bLZL5a": "Get Address",
|
||||
"bQdA2k": "Sensitive Content",
|
||||
"bep9C3": "Public Key",
|
||||
"bfvyfs": "Anon",
|
||||
@ -324,6 +326,7 @@
|
||||
"fWZYP5": "Pinned",
|
||||
"filwqD": "Read",
|
||||
"flnGvv": "What's on your mind?",
|
||||
"fqwcJ1": "On-chain Donation",
|
||||
"fsB/4p": "Saved",
|
||||
"g5pX+a": "About",
|
||||
"g985Wp": "Failed to send vote",
|
||||
|
Loading…
x
Reference in New Issue
Block a user