aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-10-19 08:09:59 -0700
committerAdam Soltys <[email protected]>2024-10-19 08:09:59 -0700
commit1d5053feb4a5f9b2ea477676f437aef5c7fb7c5d (patch)
tree5bc8cb35f6e4104bc17cb499275ca88e32d815a0 /lib/utils.ts
parentdd52d07a513c4c98197b36eb48e213a0b2164d32 (diff)
downloadcoinos-server-1d5053feb4a5f9b2ea477676f437aef5c7fb7c5d.tar.gz
coinos-server-1d5053feb4a5f9b2ea477676f437aef5c7fb7c5d.zip
subscriptions
Diffstat (limited to 'lib/utils.ts')
-rw-r--r--lib/utils.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utils.ts b/lib/utils.ts
index b7f55ff1..fa10fb81 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -5,6 +5,8 @@ import { g, s } from "$lib/db";
import config from "$config";
import { getPublicKey } from "nostr";
+ let { URL } = process.env;
+
export let fail = (msg) => {
throw new Error(msg);
};
@@ -180,3 +182,9 @@ export let time = (() => {
console.timeLog("", ++count, s);
};
})();
+
+export let fmt = (sats) =>
+ "⚡️" +
+ new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format(sats);
+
+export let link = (id) => `${URL}/payment/${id}`;