fix: update payment apis
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
const API = process.env.FREEDOM_API ?? "https://api-v1.freedom.st";
|
||||
const API = process.env.FREEDOM_API ?? "https://api.freedom.st";
|
||||
|
||||
export async function getChainInfo(): Promise<Record<string, any>> {
|
||||
const res = await fetch(`${API}/rpc/info`);
|
||||
const res = await fetch(`${API}/info`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function getExchangeRates(): Promise<Record<string, number>> {
|
||||
const res = await fetch(`${API}/invoice/rates`);
|
||||
const res = await fetch(`${API}/rates`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
@@ -20,13 +20,13 @@ export async function getAddressInfoBulk(addresses: string[]): Promise<Record<st
|
||||
const res = await fetch(`${API}/address`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ terms: addresses }),
|
||||
body: JSON.stringify({ addresses }),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function fetchQrBase64(text: string): Promise<string> {
|
||||
const url = `${API}/invoice/qr/${encodeURIComponent(text)}`;
|
||||
const url = `${API}/qr/${encodeURIComponent(text)}`;
|
||||
try {
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) return url;
|
||||
@@ -42,6 +42,6 @@ export async function fetchQrBase64(text: string): Promise<string> {
|
||||
export async function getAvailableCoins(): Promise<string[]> {
|
||||
const info = await getChainInfo();
|
||||
return Object.entries(info)
|
||||
.filter(([_, v]) => v && v.uptime != null)
|
||||
.filter(([_, v]) => v?.node?.uptime != null)
|
||||
.map(([k]) => k);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user