aboutsummaryrefslogtreecommitdiffstats
path: root/lib/upload.js.map
Commit message (Collapse)AuthorAgeFilesLines
* typescriptAdam Soltys2024-08-261-0/+1
f='#n15'>15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
import { auth, get, post } from "$lib/utils";
import { env } from "$env/dynamic/private";
import tickets from "$lib/tickets";

export const createTicket = async (cookies, username) => {
	const { ticket } = await get("/ticket");

	const { address } = await post(
		`/${username}/invoice`,
		{ invoice: { network: "liquid" }, user: { username } },
		auth(cookies),
	);

	const { asset } = await post(
		"/assets",
		{
			address,
			name: `Launch Party Ticket ${ticket}`,
			ticker: "LPT",
			precision: 0,
			asset_amount: "1",
			token_amount: 0,
			domain: "coinos.io",
			filename: tickets[ticket],
		},
		{ authorization: `Bearer ${env.LAUNCH}` },
	);

	await post("/ticket", { asset }, { authorization: `Bearer ${env.LAUNCH}` });
	return asset;
};