2025-06-22 00:21:09 +03:00

36 lines
4.3 KiB
JavaScript

import { s as subscribe } from "../../../chunks/utils.js";
import { c as create_ssr_component, o as onDestroy, b as each, e as escape } from "../../../chunks/ssr.js";
import { w as walletStore } from "../../../chunks/walletStoreFix.js";
import * as StellarSdk from "@stellar/stellar-sdk";
function formatDate(date) {
return new Intl.DateTimeFormat(
"en-US",
{
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit"
}
).format(date);
}
function formatAddress(address) {
if (!address) return "";
return `${address.substring(0, 6)}...${address.substring(address.length - 4)}`;
}
const Page = create_ssr_component(($$result, $$props, $$bindings, slots) => {
let $$unsubscribe_walletStore;
$$unsubscribe_walletStore = subscribe(walletStore, (value) => value);
let incomingPayments = [];
new StellarSdk.Horizon.Server("https://horizon-testnet.stellar.org");
onDestroy(() => {
});
$$unsubscribe_walletStore();
return `<div class="container mx-auto p-4"><h1 class="text-3xl font-bold mb-6" data-svelte-h="svelte-1ra1c8">Receive Payment</h1> <div class="grid gap-6"> <div class="card bg-base-100 shadow-xl"><div class="card-body"><h2 class="card-title mb-4" data-svelte-h="svelte-10vgyon">Your Address</h2> ${`<div class="alert alert-warning" data-svelte-h="svelte-s6v1z"><span>Wallet not loaded yet. Please wait...</span></div>`}</div></div> <div class="card bg-base-100 shadow-xl"><div class="card-body"><h2 class="card-title mb-4" data-svelte-h="svelte-1ailreo">Recent Incoming Payments</h2> ${incomingPayments.length === 0 ? `<div class="text-center p-6 text-gray-500" data-svelte-h="svelte-1afpzn0"><p>No recent incoming payments</p> <p class="text-sm">Payments will appear here automatically when received</p></div>` : `<div class="space-y-3">${each(incomingPayments, (payment) => {
return `<div class="flex items-center justify-between p-4 bg-success/10 border border-success/20 rounded-lg"><div class="flex flex-col"><div class="font-medium text-success">+${escape(payment.amount.toFixed(4))} ${escape(payment.asset)}</div> <div class="text-sm text-gray-600">From: ${escape(formatAddress(payment.from))}</div> ${payment.memo ? `<div class="text-xs text-gray-500">Memo: ${escape(payment.memo)} </div>` : ``}</div> <div class="text-right"><div class="text-sm text-gray-500">${escape(formatDate(payment.timestamp))}</div> <a href="${"https://stellar.expert/explorer/testnet/tx/" + escape(payment.hash, true)}" target="_blank" rel="noopener noreferrer" class="text-xs text-blue-600 hover:underline">View Transaction
</a></div> </div>`;
})}</div>`}</div></div> <div class="card bg-base-100 shadow-xl" data-svelte-h="svelte-dkp9nn"><div class="card-body"><h2 class="card-title mb-4">How to Receive Payments</h2> <div class="space-y-4"><div class="flex items-start gap-3"><div class="badge badge-primary">1</div> <div><h3 class="font-medium">Share Your Address</h3> <p class="text-sm text-gray-600">Copy and share your Stellar address with anyone who wants to send you XLM or other Stellar assets.</p></div></div> <div class="flex items-start gap-3"><div class="badge badge-primary">2</div> <div><h3 class="font-medium">Enable Notifications</h3> <p class="text-sm text-gray-600">Turn on browser notifications to get instant alerts when payments are received.</p></div></div> <div class="flex items-start gap-3"><div class="badge badge-primary">3</div> <div><h3 class="font-medium">Monitor This Page</h3> <p class="text-sm text-gray-600">Keep this page open to see incoming payments in real-time. The app will automatically detect new payments.</p></div></div></div> <div class="divider"></div> <div class="alert alert-info"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> <div><h3 class="font-bold">Important!</h3> <div class="text-sm"><p>• Only share your public address (starts with &#39;G&#39;), never your secret key</p> <p>• Payments are automatically added to your account when received</p> <p>• This is the Stellar testnet - do not send real funds</p></div></div></div></div></div></div></div>`;
});
export {
Page as default
};