feat: crypto payment system with HD wallets, Freedom.st integration, and checkout UI

This commit is contained in:
2026-03-18 23:04:17 +04:00
parent bead49b870
commit c9130243e8
18 changed files with 943 additions and 35 deletions
+28
View File
@@ -0,0 +1,28 @@
const API = process.env.FREEDOM_API ?? "https://api-v1.freedom.st";
export async function getChainInfo(): Promise<Record<string, any>> {
const res = await fetch(`${API}/rpc/info`);
return res.json();
}
export async function getExchangeRates(): Promise<Record<string, number>> {
const res = await fetch(`${API}/invoice/rates`);
return res.json();
}
export async function getAddressInfo(address: string): Promise<any> {
const res = await fetch(`${API}/address/${address}`);
return res.json();
}
export function getQrUrl(text: string): string {
return `${API}/invoice/qr/${encodeURIComponent(text)}`;
}
/** Returns coin keys where the chain is online (no null uptime field). */
export async function getAvailableCoins(): Promise<string[]> {
const info = await getChainInfo();
return Object.entries(info)
.filter(([_, v]) => v && v.uptime != null)
.map(([k]) => k);
}