metal-presale
Version:
SDK for Metal Presales - Client and Server utilities
105 lines (104 loc) • 2.18 kB
JavaScript
import { l as r, i as a } from "./utils-Crf4vSn8.js";
async function d(s, e, t) {
return r(`/holder/${s}`, {
method: "PUT",
headers: { "x-api-key": e },
body: t ? JSON.stringify(t) : void 0
});
}
async function o(s) {
return r("/merchant/presales", {
method: "GET",
headers: { "x-api-key": s }
});
}
async function l(s, e) {
return r("/merchant/presale", {
method: "POST",
headers: { "x-api-key": e },
body: JSON.stringify(s)
});
}
async function u(s, e, t) {
return r(`/holder/${s}/buy-presale`, {
method: "POST",
headers: { "x-api-key": t },
body: JSON.stringify(e)
});
}
async function y(s, e, t) {
return r(`/holder/${s}/buy`, {
method: "POST",
body: JSON.stringify(e),
headers: { "x-api-key": t }
});
}
async function c(s, e, t) {
const n = new URLSearchParams({
tokenAddress: e.tokenAddress,
usdcAmount: e.usdcAmount.toString(),
...e.swapFeeBps !== void 0 && { swapFeeBps: e.swapFeeBps.toString() }
});
return r(
`/holder/${s}/buy/quote?${n.toString()}`,
{
method: "GET",
headers: { "x-api-key": t }
}
);
}
async function h(s, e, t) {
return r(`/holder/${s}/sell`, {
method: "POST",
headers: { "x-api-key": t },
body: JSON.stringify(e)
});
}
async function p(s, e, t) {
const n = new URLSearchParams({
tokenAddress: e.tokenAddress,
tokenAmount: e.tokenAmount.toString(),
...e.swapFeeBps !== void 0 && { swapFeeBps: e.swapFeeBps.toString() }
});
return r(
`/holder/${s}/sell/quote?${n.toString()}`,
{
method: "GET",
headers: { "x-api-key": t }
}
);
}
function f(s, e, t) {
return r(`/holder/${s}/transfer`, {
method: "POST",
headers: { "x-api-key": t },
body: JSON.stringify(e)
});
}
function k(s, e) {
return r(`/token/${s}`, {
method: "GET",
headers: { "x-api-key": e }
});
}
async function S(s) {
const e = await o(s);
return (await Promise.all(
e.map(
(n) => r(`/token/presales/${n.id}?publicKey=${s}`)
)
)).filter(a);
}
export {
y as a,
u as b,
l as c,
p as d,
k as e,
S as f,
d as g,
o as l,
c as q,
h as s,
f as t
};