aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/Numpad.svelte1
-rw-r--r--src/lib/store.js1
-rw-r--r--src/lib/utils.js50
-rw-r--r--src/routes/(app)/+layout.svelte17
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.svelte24
-rw-r--r--src/routes/(app)/[username]/(profile)/+page.svelte41
-rw-r--r--src/routes/(app)/[username]/dashboard/+page.server.js4
-rw-r--r--src/routes/(app)/[username]/dashboard/+page.svelte163
-rw-r--r--src/routes/(app)/[username]/invoice/[hash]/+layout.server.js6
-rw-r--r--src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte8
-rw-r--r--src/routes/(app)/buy/+page.svelte21
-rw-r--r--src/routes/(app)/launch/purchase/+page.svelte1
-rw-r--r--src/routes/(app)/pot/[name]/+page.svelte2
-rw-r--r--src/routes/(app)/send/user/[username]/[...amount]/+page.svelte5
14 files changed, 77 insertions, 267 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte
index 20bfe561..82512678 100644
--- a/src/components/Numpad.svelte
+++ b/src/components/Numpad.svelte
@@ -1,6 +1,5 @@
<script>
import { Left, Icon } from '$comp';
- import { selectedRate } from '$lib/store';
import { f, s, post, warning, sat, sats } from '$lib/utils';
import { t } from '$lib/translations';
diff --git a/src/lib/store.js b/src/lib/store.js
index 6853386c..86405e39 100644
--- a/src/lib/store.js
+++ b/src/lib/store.js
@@ -50,6 +50,5 @@ export const pin = persistSession('pin', undefined);
export const rate = writable();
export const request = writable();
export const requestRedirect = writable();
-export const selectedRate = writable();
export const token = persistSession('token');
export const user = writable();
diff --git a/src/lib/utils.js b/src/lib/utils.js
index 18554bd9..5eef79fc 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -10,11 +10,11 @@ export function scroll(section) {
setTimeout(() => section.scrollIntoView({ behavior: 'smooth' }), 500);
}
-const base = browser ? '' : PUBLIC_COINOS_URL;
+let base = browser ? '' : PUBLIC_COINOS_URL;
-export const punk = (k) => Math.floor((parseInt(k.slice(-2), 16) / 256) * 64) + 1 + '.webp';
+export let punk = (k) => Math.floor((parseInt(k.slice(-2), 16) / 256) * 64) + 1 + '.webp';
-export const g = (url, fetch, headers) =>
+export let g = (url, fetch, headers) =>
fetch(base + url, { headers })
.then((r) => r.text())
.then((body) => {
@@ -25,7 +25,7 @@ export const g = (url, fetch, headers) =>
}
});
-export const get = (url, headers = {}) =>
+export let get = (url, headers = {}) =>
fetch(base + url, { headers })
.then(async (r) => {
if (r.ok) return r.text();
@@ -39,7 +39,7 @@ export const get = (url, headers = {}) =>
}
});
-export const post = (url, body, headers) => {
+export let post = (url, body, headers) => {
headers = { ...headers, 'content-type': 'application/json', accept: 'application/json' };
return fetch(base + url, { method: 'POST', body: JSON.stringify(body), headers })
.then(async (r) => {
@@ -69,7 +69,7 @@ export const post = (url, body, headers) => {
});
};
-export const copy = (text) => {
+export let copy = (text) => {
navigator.clipboard.writeText(text);
success('Copied!');
};
@@ -85,7 +85,7 @@ export function reverseFormat(val, locale) {
export let protectedRoutes = [/customers/, /settings/, /payments/];
-export const success = (m) => {
+export let success = (m) => {
toast.pop();
toast.push(m, {
theme: {
@@ -94,7 +94,7 @@ export const success = (m) => {
});
};
-export const warning = (m) => {
+export let warning = (m) => {
toast.pop();
toast.push(m, {
theme: {
@@ -102,7 +102,7 @@ export const warning = (m) => {
}
});
};
-export const fail = (m) => {
+export let fail = (m) => {
toast.pop();
toast.push(m, {
theme: {
@@ -110,7 +110,7 @@ export const fail = (m) => {
}
});
};
-export const info = (m) => {
+export let info = (m) => {
toast.pop();
toast.push(m, {
theme: {
@@ -119,7 +119,7 @@ export const info = (m) => {
});
};
-export const login = async (user, cookies) => {
+export let login = async (user, cookies) => {
let maxAge = 30 * 24 * 60 * 60;
let res = await fetch(base + '/login', {
@@ -143,17 +143,17 @@ export const login = async (user, cookies) => {
cookies.set('token', token, opts);
};
-export const auth = (cookies) => ({ authorization: `Bearer ${cookies.get('token')}` });
+export let auth = (cookies) => ({ authorization: `Bearer ${cookies.get('token')}` });
-export const fiat = (amount, rate) => (amount * rate) / sats;
-export const fd = async (req) => {
+export let fiat = (amount, rate) => (amount * rate) / sats;
+export let fd = async (req) => {
let obj = Object.fromEntries(await req.formData());
for (let k in obj)
(obj[k] === 'undefined' && (obj[k] = undefined)) || (obj[k] === 'false' && (obj[k] = false));
return obj;
};
-export const f = (s, currency) =>
+export let f = (s, currency) =>
new Intl.NumberFormat('en-US', {
style: 'currency',
currency
@@ -161,8 +161,8 @@ export const f = (s, currency) =>
.format(s)
.replace('CA', '');
-export const s = (s) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(s);
-export const sat = (s) => {
+export let s = (s) => new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format(s);
+export let sat = (s) => {
s = Math.abs(s);
let p = Math.floor(Math.log(s) / Math.LN10 + 0.000000001);
let d = Math.floor((p + 1) / 3);
@@ -177,20 +177,20 @@ export const sat = (s) => {
);
};
-export const sats = 100000000;
+export let sats = 100000000;
-export const back = () => browser && (history.length ? history.go(-1) : goto('/'));
-export const focus = (el) => browser && screen.width > 1280 && setTimeout(() => el.focus(), 1);
+export let back = () => browser && (history.length ? history.go(-1) : goto('/'));
+export let focus = (el) => browser && screen.width > 1280 && setTimeout(() => el.focus(), 1);
-export const sleep = (n) => new Promise((r) => setTimeout(r, n));
-export const wait = async (f, n = 100, s = 300) => {
+export let sleep = (n) => new Promise((r) => setTimeout(r, n));
+export let wait = async (f, n = 100, s = 300) => {
let i = 0;
while (!(await f()) && i < s) (await sleep(n)) && i++;
if (i >= s) throw new Error('timeout');
return f();
};
-export const stretch = async (password, salt) =>
+export let stretch = async (password, salt) =>
crypto.subtle.deriveKey(
{
name: 'PBKDF2',
@@ -236,10 +236,12 @@ export function ss(str1, str2) {
return 0.0;
}
-export const types = {
+export let types = {
bitcoin: 'bitcoin',
lightning: 'lightning',
internal: 'internal',
pot: 'pot',
classic: 'classic'
};
+
+export let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t);
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
index 0dcdc1b2..ae9bcc50 100644
--- a/src/routes/(app)/+layout.svelte
+++ b/src/routes/(app)/+layout.svelte
@@ -2,7 +2,7 @@
import { SvelteToast } from '@zerodevx/svelte-toast';
import { onDestroy, onMount } from 'svelte';
import { close, connect, send } from '$lib/socket';
- import { last, selectedRate, invoice, rate, user, request, passwordPrompt } from '$lib/store';
+ import { last, invoice, request, passwordPrompt } from '$lib/store';
import { page } from '$app/stores';
import { browser } from '$app/environment';
import { goto } from '$app/navigation';
@@ -15,16 +15,7 @@
export let data;
let { subject } = $page.data;
- let r, u, token, rates;
-
- $: update(data);
- let update = () => {
- ({ user: u, rate: r, token, rates } = data);
- $rate = r;
- $user = u;
- };
-
- $: $selectedRate = r * (rates[u?.currency || 'USD'] / rates.USD);
+ let { rate, user, token, rates } = data;
onMount(() => {
let localStorageLocale = localStorage.getItem(localeLocalStorageKey);
@@ -89,9 +80,9 @@
</main>
{#if $invoice}
- <Invoice user={u} />
+ <Invoice {user} />
{/if}
{#if $request}
- <Request user={u} />
+ <Request {user} />
{/if}
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte
index 006bbf72..3d814668 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.svelte
+++ b/src/routes/(app)/[username]/(profile)/+layout.svelte
@@ -1,13 +1,13 @@
<script>
import { f, s, sats } from '$lib/utils';
- import { animatedRate, selectedRate } from '$lib/store';
+ import { animatedRate } from '$lib/store';
import { Icon } from '$comp';
import { t } from '$lib/translations';
import { sign, send } from '$lib/nostr';
export let data;
- let events, user, subject, src, text;
- $: ({ events, user, subject, src, text } = data);
+ let events, user, subject, rates, src, text;
+ $: ({ events, user, rates, subject, src, text } = data);
$: ({ currency, username: n, display } = subject);
$: username = n.length > 60 ? n.substr(0, 6) : display || n;
@@ -42,24 +42,6 @@
$: following = !!user?.follows.find((t) => t.includes(subject.pubkey));
- let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t);
- let i;
-
- let o = $selectedRate;
- $: animate($selectedRate);
- let animate = (n) => {
- clearInterval(i);
-
- let t = 0;
- let d = o - n;
-
- i = setInterval(() => {
- $animatedRate = (o - d * ease(t / 100)).toFixed(2);
- if (t > 80) (o = n) && clearInterval(i);
- t++;
- }, 10);
- };
-
let hideBio = true;
let toggleBio = () => (hideBio = false);
</script>
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte
index 09335e9c..1ce09f38 100644
--- a/src/routes/(app)/[username]/(profile)/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/+page.svelte
@@ -2,24 +2,23 @@
import { onMount } from 'svelte';
import { Icon, Avatar, Balance, Feed } from '$comp';
import { t } from '$lib/translations';
- import { f, sat, sats } from '$lib/utils';
+ import { ease, f, sat, sats } from '$lib/utils';
import { sign, send, encrypt, decrypt } from '$lib/nostr';
- import { event as e, password } from '$lib/store';
+ import { event as e, password, rate, animatedRate } from '$lib/store';
import { browser } from '$app/environment';
export let data;
- let { messages, notes, invoices, sent, received, subject, user } = data;
+ let { messages, notes, invoices, sent, received, subject, user, rates } = data;
$: refresh(data);
- let refresh = (d) => ({ messages, notes, invoices, sent, received, subject, user } = d);
+ let refresh = (d) => ({ messages, notes, invoices, sent, received, subject, user, rates } = d);
let keys = new Set();
let latest = [];
- let i = 0;
let ready;
e.subscribe(async (event) => {
if (!(event && ready)) return;
- if (event.recipient.id === user?.id && !~latest.findIndex((m) => m.id === event.id)) {
+ if (event.recipient?.id === user.id && !~latest.findIndex((m) => m.id === event.id)) {
event.content = await decrypt({ event, user });
let i = latest.findIndex((m) => m.pubkey === event.pubkey);
@@ -34,22 +33,46 @@
$: initialize($password);
let initialize = async (p) => {
+ let i = 0;
ready = false;
- if (!p) return;
+ if (!p || !user) return;
while (i < messages.length) {
let event = messages[i];
- let k = event.author.id === user.id ? event.recipient.pubkey : event.author.pubkey;
+ i++;
+
+ if (!(event.author && event.recipient)) continue;
+
+ let k = event.author.id === user.id ? event.recipient?.pubkey : event.author.pubkey;
if (!keys.has(k)) {
keys.add(k);
event.content = await decrypt({ event, user });
if (event.content) latest.push(event);
}
- i++;
}
latest = latest;
ready = true;
};
+
+ let i;
+ let o;
+
+ rate.subscribe((n) => {
+ if (!user?.currency) return;
+ clearInterval(i);
+
+ let r = ((rates[user.currency] / rates['USD']) * n).toFixed(2);
+ if (!o) o = r;
+
+ let t = 0;
+ let d = o - r;
+
+ i = setInterval(() => {
+ $animatedRate = (o - d * ease(t / 100)).toFixed(2);
+ if (t > 80) (o = r) && clearInterval(i);
+ t++;
+ }, 10);
+ });
</script>
<div class="space-y-8">
diff --git a/src/routes/(app)/[username]/dashboard/+page.server.js b/src/routes/(app)/[username]/dashboard/+page.server.js
deleted file mode 100644
index ae66a20d..00000000
--- a/src/routes/(app)/[username]/dashboard/+page.server.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import { redirect } from '@sveltejs/kit';
-export async function load({ params: { username } }) {
- throw redirect(301, `/${username}`);
-}
diff --git a/src/routes/(app)/[username]/dashboard/+page.svelte b/src/routes/(app)/[username]/dashboard/+page.svelte
deleted file mode 100644
index d8761ea9..00000000
--- a/src/routes/(app)/[username]/dashboard/+page.svelte
+++ /dev/null
@@ -1,163 +0,0 @@
-<script>
- import { enhance } from '$app/forms';
- import { f, s, post, fail, sat, sats } from '$lib/utils';
- import { tick } from 'svelte';
- import { Avatar, Icon } from '$comp';
- import { rate, password, selectedRate } from '$lib/store';
- import { goto } from '$app/navigation';
- import { t } from '$lib/translations';
- import { events } from '$lib/store';
-
- export let data;
- $: ({ invoices, requests } = data);
-
- let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t);
- let interval, rateInterval;
-
- let oldRate = $selectedRate;
- let animatedRate = oldRate;
- $: animateRate($selectedRate);
- let animateRate = (newRate) => {
- if (!accountBalanceFiat) return;
- let t = 0;
- let newBalance = (user.balance * newRate) / sats;
- let oldBalance = parseFloat(accountBalanceFiat);
- let diff = oldBalance - newBalance;
- let rateDiff = oldRate - newRate;
-
- clearInterval(rateInterval);
- rateInterval = setInterval(() => {
- let delta = rateDiff * ease(t / 100);
- animatedRate = (oldRate - delta).toFixed(2);
- if (t > 80) clearInterval(interval);
- t++;
- }, 10);
-
- oldRate = newRate;
-
- clearInterval(interval);
- interval = setInterval(() => {
- let delta = diff * ease(t / 100);
- accountBalanceFiat = (oldBalance - delta).toFixed(2);
- if (t > 80) clearInterval(interval);
- t++;
- }, 10);
- };
-
- $: user = data.user;
- $: accountBalanceFiat =
- accountBalanceFiat ||
- (user && $selectedRate && ((user.balance * $selectedRate) / sats).toFixed(2));
-
- let payreq = '',
- payreqField,
- loading;
-
- $: btcPrice = f($selectedRate, user.currency);
-
- $: accountBalanceBtc = user.balance / sats;
-</script>
-
-<div class="container px-4 max-w-md mx-auto mt-20 space-y-12 mb-8">
- <div class="mt-24 space-y-2">
- <div class="text-5xl font-bold">
- {$selectedRate ? f(accountBalanceFiat, user.currency) : $t('user.dashboard.fetchingRate')}
- </div>
-
- <div class="text-secondary text-2xl">
- ⚡️{s(user.balance)}
- </div>
- </div>
-
- <div class="grid sm:grid-cols-2 gap-2 text-lg">
- <a href="/send">
- <button class="rounded-full border py-4 px-5 font-bold hover:opacity-80 w-full"
- >{$t('user.dashboard.send')}</button
- >
- </a>
- <a href={`/${user.username}/receive`}>
- <button class="rounded-full border py-4 px-5 font-bold hover:opacity-80 w-full"
- >{$t('user.dashboard.receive')}</button
- >
- </a>
- </div>
-
- <!-- <div> -->
- <!-- {#each invoices as { request_id, amount, currency, rate, user: recipient, requester, id }} -->
- <!-- {@const requested = user.username === requester?.username} -->
- <!-- <a href={`/invoice/${id}` + (requested ? '/tip' : '')}> -->
- <!-- <div class="border-b p-2 last:border-b-0 hover:bg-gray-100"> -->
- <!-- <div class="flex gap-2"> -->
- <!-- <div> -->
- <!-- {#if requested} -->
- <!-- <div class="flex"> -->
- <!-- <Avatar user={recipient} size={20} /> -->
- <!-- <div class="my-auto text-left"> -->
- <!-- <p class="text-secondary">{$t('payments.invoiceFrom')}</p> -->
- <!-- <p class="ml-1 text-lg break-words">{recipient.username}</p> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- {:else} -->
- <!-- <div class="flex"> -->
- <!-- <Avatar user={requester} size={20} /> -->
- <!-- <div class="my-auto text-left"> -->
- <!-- <p class="text-secondary">{$t('payments.awaiting')}</p> -->
- <!-- <p class="ml-1 text-lg break-words">{requester.username}</p> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- {/if} -->
- <!-- </div> -->
- <!-- <div class="whitespace-nowrap my-auto ml-auto flex gap-2"> -->
- <!-- <div class="font-bold"> -->
- <!-- {f(amount * (rate / sats), currency)} -->
- <!-- </div> -->
- <!-- -->
- <!-- <div class="text-secondary">{sat(amount)}</div> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- </a> -->
- <!-- {/each} -->
- <!-- </div> -->
-
- <!-- <div> -->
- <!-- {#each requests as { id, invoice, memo, requester: r }} -->
- <!-- <a href={`/${user.username}/receive/${id}`}> -->
- <!-- <div class="border-b p-2 last:border-b-0 hover:bg-gray-100"> -->
- <!-- <div class="flex"> -->
- <!-- <div> -->
- <!-- <div class="flex"> -->
- <!-- <Avatar user={r} size={20} /> -->
- <!-- <div class="my-auto text-left"> -->
- <!-- <p class="ml-1 text-lg break-words">{r.username}</p> -->
- <!-- <p class="ml-1 text-secondary">{memo}</p> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- <div class="whitespace-nowrap my-auto ml-auto flex gap-2"> -->
- <!-- <button class="rounded-full border py-2 px-4 font-bold hover:opacity-80 w-full" -->
- <!-- >Invoice</button -->
- <!-- > -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- </div> -->
- <!-- </a> -->
- <!-- {/each} -->
- <!-- </div> -->
-</div>
-
-<div class="flex fixed w-full px-4 bg-white py-2 bottom-0 bg-opacity-90">
- <div class="text-secondary flex mr-auto">
- <div class="flex mr-1">
- <div class="my-auto mr-1">1</div>
- <img src="/images/bitcoin.svg" class="w-5 my-auto" alt="Bitcoin" />
- </div>
- <div>= {f(animatedRate, user.currency)}</div>
- </div>
- <div class="text-secondary flex ml-auto">
- <div class="flex">
- <div class="mr-1">⚡️{s((1 * sats) / animatedRate)} =</div>
- <div>{f(1, user.currency)}</div>
- </div>
- </div>
-</div>
diff --git a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
index 7cf87e14..04d413bb 100644
--- a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
+++ b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js
@@ -12,10 +12,12 @@ export async function load({ depends, params, url, parent }) {
if (user && invoice.uid !== user.id && !url.pathname.includes('tip'))
throw redirect(307, `/send/invoice/${hash}`);
- let { amount, received } = invoice;
+ let { amount, pending, received } = invoice;
amount = parseInt(amount);
- let paid = (!amount && received) || (amount > 0 && received >= amount);
+ console.log("PENDING", pending)
+
+ let paid = (!amount && received) || (amount > 0 && (pending >= amount || received >= amount));
if (paid && !url.pathname.endsWith('paid'))
throw redirect(307, `/${params.username}/invoice/${hash}/paid`);
diff --git a/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte
index 4d7aae51..c9619cee 100644
--- a/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte
+++ b/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte
@@ -21,7 +21,7 @@
{#if received}
<h1 class="text-3xl md:text-4xl font-bold mb-6">{$t('invoice.paymentSuccessful')}</h1>
<h2 class="text-2xl md:text-3xl font-semibold">
- {f(fiat(received, rate), currency)}
+ {f(fiat(received - tip, rate), currency)}
{#if tip}
<span class="text-lg">
+ {f(fiat(tip, rate), currency)}
@@ -29,7 +29,7 @@
{/if}
</h2>
<h3 class="text-secondary md:text-lg mb-6 mt-1">
- ⚡️{s(received)}
+ ⚡️{s(received - tip)}
{#if tip}
<span class="text-lg">
@@ -42,13 +42,13 @@
{#if pending}
<h1 class="text-3xl md:text-4xl font-bold mb-6">Payment detected</h1>
<h2 class="text-2xl md:text-3xl font-semibold">
- {f(fiat(pending, rate), currency)}
+ {f(fiat(pending - tip, rate), currency)}
{#if tip}
+ {f(fiat(tip, rate), currency)}
{/if}
</h2>
<h3 class="text-secondary md:text-lg mb-6 mt-1">
- ⚡️{s(pending)}
+ ⚡️{s(pending - tip)}
{#if tip}
<span class="text-lg">
+ ⚡️{s(tip)}
diff --git a/src/routes/(app)/buy/+page.svelte b/src/routes/(app)/buy/+page.svelte
index 2f556ada..22e7e9ec 100644
--- a/src/routes/(app)/buy/+page.svelte
+++ b/src/routes/(app)/buy/+page.svelte
@@ -1,7 +1,7 @@
<script>
import { enhance } from '$app/forms';
import { Icon, Lock, Card, Calendar, Spinner } from '$comp';
- import { animatedRate, selectedRate } from '$lib/store';
+ import { animatedRate } from '$lib/store';
import { f } from '$lib/utils';
export let data, form;
@@ -10,24 +10,6 @@
let loading;
let amount, n, d, cvc;
-
- let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t);
- let i;
-
- let o = $selectedRate;
- $: animate($selectedRate);
- let animate = (n) => {
- clearInterval(i);
-
- let t = 0;
- let d = o - n;
-
- i = setInterval(() => {
- $animatedRate = (o - d * ease(t / 100)).toFixed(2);
- if (t > 80) (o = n) && clearInterval(i);
- t++;
- }, 10);
- };
</script>
<div class="container px-4 max-w-xl mx-auto mt-10 space-y-5">
@@ -141,7 +123,6 @@
<div class="my-auto mr-1">1</div>
<img src="/images/bitcoin.svg" class="w-5 my-auto" alt="Bitcoin" />
</div>
- <div>= {f($animatedRate, currency)}</div>
</div>
<p class="text-secondary">3% credit card fee applies</p>
</div>
diff --git a/src/routes/(app)/launch/purchase/+page.svelte b/src/routes/(app)/launch/purchase/+page.svelte
index 3273752a..fbaa58c0 100644
--- a/src/routes/(app)/launch/purchase/+page.svelte
+++ b/src/routes/(app)/launch/purchase/+page.svelte
@@ -1,7 +1,6 @@
<script>
import { onMount } from 'svelte';
import { enhance } from '$app/forms';
- import { selectedRate } from '$lib/store';
import { post } from '$lib/utils';
import { goto } from '$app/navigation';
diff --git a/src/routes/(app)/pot/[name]/+page.svelte b/src/routes/(app)/pot/[name]/+page.svelte
index 2d93abfc..7b3d890b 100644
--- a/src/routes/(app)/pot/[name]/+page.svelte
+++ b/src/routes/(app)/pot/[name]/+page.svelte
@@ -6,7 +6,7 @@
import { toast } from '@zerodevx/svelte-toast';
import { t } from '$lib/translations';
import { copy, f, s, sat, sats } from '$lib/utils';
- import { loginRedirect, selectedRate } from '$lib/store';
+ import { loginRedirect } from '$lib/store';
export let data;
diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte
index 2f59f492..f3a67c30 100644
--- a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte
+++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte
@@ -1,7 +1,7 @@
<script>
import { t } from '$lib/translations';
import { goto } from '$app/navigation';
- import { pin, selectedRate } from '$lib/store';
+ import { pin } from '$lib/store';
import { enhance } from '$app/forms';
import { AppHeader, Avatar, Icon, Numpad, Spinner } from '$comp';
import { page } from '$app/stores';
@@ -20,13 +20,12 @@
hash,
amountFiat = 0;
- selectedRate.subscribe((r) => rate || (amountFiat = amount * (r / sats)));
$: r = rate || rates[user.currency || subject.currency];
let setAmount = async () => {
amount = a;
amountFiat = parseFloat(af).toFixed(2);
- rate = fiat ? (sats * amountFiat) / amount : $selectedRate;
+ rate = fiat ? (sats * amountFiat) / amount : r;
({ hash } = await post(`/${subject.username}/invoice`, {
invoice: {
amount,