1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import { auth, get, post } from '$lib/utils';
import tickets from '$lib/tickets';
export const load = async ({ parent }) => {
let p = await parent();
let t = await get('/ticket');
return { ...p, ...t };
};
export const actions = {
internal: async ({ cookies, request, parent }) => {
let { ticket } = Object.fromEntries(await request.formData());
let r = await post(
'/assets',
{
name: `Launch Party Ticket ${ticket}`,
ticker: 'LPT',
precision: 0,
asset_amount: '1',
token_amount: 0,
domain: 'coinos.io',
filename: tickets[ticket]
},
auth(cookies)
);
console.log(r);
},
lightning: async ({ cookies, request }) => {
let form = await request.formData();
let rates = await get('/rates');
let invoice = {
amount: parseInt(form.get('amount')),
tip: parseInt(form.get('tip')),
network: 'lightning',
prompt: form.get('prompt') === 'true',
rate: rates[form.get('currency')]
};
let user = { username: form.get('username') };
let { uuid } = await post('/invoice', { invoice, user }, auth(cookies));
throw redirect(307, `/invoice/${uuid}`);
},
bitcoin: () => console.log('YYEAH')
};
|