aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(static)
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/(static)')
-rw-r--r--src/routes/(static)/+layout.server.js16
-rw-r--r--src/routes/(static)/+layout.svelte6
-rw-r--r--src/routes/(static)/bounties/+page.svelte38
-rw-r--r--src/routes/(static)/docs/+page.server.js4
-rw-r--r--src/routes/(static)/docs/+page.svelte92
5 files changed, 120 insertions, 36 deletions
diff --git a/src/routes/(static)/+layout.server.js b/src/routes/(static)/+layout.server.js
new file mode 100644
index 00000000..2deeebc5
--- /dev/null
+++ b/src/routes/(static)/+layout.server.js
@@ -0,0 +1,16 @@
+import { get, post, auth, protectedRoutes } from '$lib/utils';
+
+export async function load({ cookies, request, url, params }) {
+ let token = cookies.get('token');
+ let rate,
+ rates = { USD: 1 };
+
+ let user;
+ if (token) {
+ try {
+ user = await get('/me', auth(cookies));
+ } catch (e) {}
+ }
+
+ return { user };
+}
diff --git a/src/routes/(static)/+layout.svelte b/src/routes/(static)/+layout.svelte
index 6e31f17e..3d596dff 100644
--- a/src/routes/(static)/+layout.svelte
+++ b/src/routes/(static)/+layout.svelte
@@ -1,8 +1,12 @@
<script>
+ import { SvelteToast } from '@zerodevx/svelte-toast';
import { Footer, LandingHeader } from '$comp';
+ export let data;
+ $: ({ user } = data);
</script>
-<LandingHeader />
+<SvelteToast options={{ reversed: true, intro: { y: 192 } }} />
+<LandingHeader {user} />
<main class="container flex px-10 md:px-40 mx-auto min-h-[600px] pb-20">
<slot />
</main>
diff --git a/src/routes/(static)/bounties/+page.svelte b/src/routes/(static)/bounties/+page.svelte
index 140b9c16..e3670e78 100644
--- a/src/routes/(static)/bounties/+page.svelte
+++ b/src/routes/(static)/bounties/+page.svelte
@@ -1,27 +1,30 @@
<div class="space-y-5">
- <h1 class="text-3xl mb-6 pt-20">Bounties</h1>
+ <h1 class="text-3xl mb-6 pt-28 md:pt-12">Bounties</h1>
- <p class="text-secondary">
+ <p>
We're offering <b>⚡️1,000,000</b> to the first <b>10 people</b> that help us onboard businesses
in the following categories to take bitcoin payments:
</p>
- <ul class="text-xl ml-20">
- <li>Grocery or Produce Store</li>
- <li>Cafe</li>
+ <ul>
+ <li>Grocery / Produce Store</li>
+ <li>
+ Cafe &mdash; Claimed by <a href="/reverendhodl">ReverendHodl</a> for
+ <a href="https://btcmap.org/map?lat=49.2814113&long=-123.049572">Laughing Bean Coffee Co.</a>
+ </li>
<li>Bakery</li>
<li>Butcher Shop</li>
- <li>Laundromat or Dry Cleaner</li>
- <li>Dollar Store, Book Store, or Gift Shop</li>
+ <li>Laundromat / Dry Cleaner</li>
+ <li>Dollar Store / Book Store / Gift Shop</li>
<li>Sushi Restaurant</li>
- <li>Pizza by the Slice Joint</li>
- <li>Liquor Store or Gas Station</li>
- <li>Bubble Tea or Ice Cream Parlour</li>
+ <li>Pizza by the Slice</li>
+ <li>Liquor Store / Gas Station</li>
+ <li>Bubble Tea / Ice Cream Parlour</li>
</ul>
- <h2 class="text-2xl">Terms and Conditions</h2>
+ <h2 class="text-xl">Terms and Conditions</h2>
- <ul class="ml-20">
+ <ul>
<li>The business must have a physical location that takes walk-in customers</li>
<li>
They must be located within Vancouver, North Vancouver, West Vancouver, Burnaby, New
@@ -51,7 +54,7 @@
<p>
<b>⚡️750,000</b> will be awarded once the merchant has accepted bitcoin for 6 months. We'll be
sending
- <a href="https://btcmap.org/leaderboard" class="text-black hover:underline" target="_blank"
+ <a href="https://btcmap.org/leaderboard" class="text-black hover:underline" target="_blank" rel="noreferrer"
>shadowy supertaggers</a
> to check up on them periodically.
</p>
@@ -61,7 +64,7 @@
applicants without cause
</p>
- <h2 class="text-2xl">Ready to begin!?</h2>
+ <h2 class="text-xl">Ready to begin!?</h2>
<p>
To make a referral, reach out on one of our socials or email us at <a
@@ -79,10 +82,7 @@
</div>
<style>
- p {
- @apply text-secondary;
- }
- b {
- @apply text-black text-xl;
+ a {
+ @apply font-bold;
}
</style>
diff --git a/src/routes/(static)/docs/+page.server.js b/src/routes/(static)/docs/+page.server.js
new file mode 100644
index 00000000..e80365fa
--- /dev/null
+++ b/src/routes/(static)/docs/+page.server.js
@@ -0,0 +1,4 @@
+export let load = async ({ cookies }) => {
+ let token = cookies.get('token');
+ return { token };
+};
diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte
index c634cd76..cb82bd05 100644
--- a/src/routes/(static)/docs/+page.svelte
+++ b/src/routes/(static)/docs/+page.svelte
@@ -1,17 +1,77 @@
-Coming soon
-<!-- <h1>API Examples</h1> -->
-<!-- <pre><code class="whitespace-pre-wrap" -->
-<!-- >{` -->
-<!-- api="https://coinos.io/api" -->
-<!-- json="Content-Type: application/json" -->
-<!-- -->
-<!-- username=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) -->
-<!-- password="pw" -->
-<!-- -->
-<!-- echo Create user $username with password $password -->
-<!-- curl -s "$api/register" -H "$json" -d '{"user": {"username": "'$username'", "password": "'$password'", "confirm": "'$password'"}}' > /dev/null -->
-<!-- echo "" -->
-<!-- -->
+<script>
+ import { copy } from '$lib/utils';
+ import { Code, Icon } from '$comp';
+ import { PUBLIC_COINOS_URL } from '$env/static/public';
+ export let data;
+ let { token } = data;
+ let api = PUBLIC_COINOS_URL + '/api';
+
+ if (!token) token = '<login to see your token here>';
+ let tokenSample = `export token="${token}"`;
+</script>
+
+<div class="space-y-8 lg:text-xl mt-20 w-full max-w-full">
+ <h1 class="text-4xl">API Documentation</h1>
+
+ <p class="text-secondary">
+ Coinos has a simple REST API that can be used to register accounts, fetch data, and make
+ payments
+ </p>
+
+ <p class="text-secondary">* = required parameter</p>
+
+ <h2 class="text-2xl">Base URL</h2>
+ <div class="bg-black text-white rounded-lg p-4 flex gap-4">
+ <div>{api}</div>
+ <button class="ml-auto my-auto invert opacity-90" on:click={() => copy(api)}
+ ><Icon icon="copy" style="w-10 max-w-none" /></button
+ >
+ </div>
+
+ <h2 class="text-2xl">Auth Token</h2>
+ <p class="text-secondary">This JWT authorizes you to use the API</p>
+ <div class="bg-black text-white rounded-lg p-4 flex gap-4">
+ <div class="w-full break-all">{tokenSample}</div>
+ <button class="ml-auto my-auto invert opacity-90" on:click={() => copy(tokenSample)}
+ ><Icon icon="copy" style="w-10 max-w-none" /></button
+ >
+ </div>
+
+ <h2 class="text-2xl">POST /register</h2>
+ <p class="text-secondary">Register a new user account with a username and password</p>
+ <Code sample="register" />
+
+ <h2 class="text-2xl">POST /login</h2>
+ <p class="text-secondary">Login to an account to get its auth token</p>
+ <Code sample="login" />
+
+ <h2 class="text-2xl">POST /invoice</h2>
+ <p class="text-secondary">Create an invoice.</p>
+ <div>
+ <div class="text-secondary">
+ <span class="font-mono font-bold">type</span>: bitcoin or lightning
+ </div>
+ <div class="text-secondary">
+ <span class="font-mono font-bold">amount</span>: amount in satoshis
+ </div>
+ <div class="text-secondary">
+ <span class="font-mono font-bold">webhook</span>: an endpoint to hit when the invoice is paid
+ </div>
+ <div class="text-secondary">
+ <span class="font-mono font-bold">secret</span>: a secret string for the webhook to check
+ </div>
+ </div>
+
+ hey
+ <Code sample="invoice" />
+
+ <h2 class="text-2xl">GET /invoice/:hash</h2>
+ <p class="text-secondary">
+ Fetch an invoice by passing a bitcoin address or lightning payment hash
+ </p>
+ <Code sample="fetchInvoice" />
+</div>
+
<!-- echo Login and get an API token -->
<!-- token=$(curl -s "$api/taboggan" -H "$json" -d '{"username": "'$username'", "password": "'$password'"}' | jq -r .token) -->
<!-- echo $token -->
@@ -73,5 +133,5 @@ Coming soon
<!-- -->
<!-- curl -s "$api/bitcoin/send" -H "$json" -H "$auth" -d '{"address": "bc1qqc9azhdjjpdxenrndt8cw4tw9del5pyrjn0wln", "tx": { "hex": "'$hex'", "fee": "'$fee'" }}' | jq -r '{ amount, fee, balance: (.account.balance)}' -->
<!-- echo "" -->
-<!-- `}</code -->
-<!-- ></pre> -->
+
+<!-- `} -->