aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice.js
blob: 147da2b7270d2242d60f63562396afc950fb6cf5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import got from 'got';
import { invoiceAmount } from '$lib/store';

const username = 'bob',
	network = 'lightning';

export async function GET({ params }) {
	let text = await got
		.post('http://localhost:3119/lightning/invoice', {
			json: { amount: invoiceAmount }
		})
		.text();

	await got
		.post('http://localhost:3119/invoice', {
			json: { invoice: { text, network }, user: { username } }
		})
		.json();

	return { body: { text } };
}