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