metal-presale
Version:
SDK for Metal Presales - Client and Server utilities
63 lines (62 loc) • 1.6 kB
JavaScript
import "server-only";
import { g as r, c as a, a as i } from "./shared/utils-Crf4vSn8.js";
import { g as n, l as o, f as c, c as l, b as y, t as u, q as p, a as h, d as A, s as K, e as P } from "./shared/server-Cizl23X8.js";
class T {
constructor({ publicApiKey: e, secretApiKey: s }) {
if (!s)
throw new Error("Secret API key is required for server-side SDK");
this.publicApiKey = e, this.secretApiKey = s;
}
/**
* Public API methods
*/
async getHolder(e) {
return r(e, this.publicApiKey);
}
async getHolderWithPortfolio(e) {
const s = await r(e, this.publicApiKey), t = a(s);
return { holder: s, portfolio: t };
}
async getPresale(e) {
return i(e, this.publicApiKey);
}
/**
* Server-side only methods that require secret key
*/
async getOrCreateHolder(e, s) {
return n(e, this.secretApiKey, s);
}
async listPresales() {
return o(this.secretApiKey);
}
async getActivePresales() {
return c(this.secretApiKey);
}
async createPresale(e) {
return l(e, this.secretApiKey);
}
async buyPresale(e, s) {
return y(e, s, this.secretApiKey);
}
async transfer(e, s) {
return u(e, s, this.secretApiKey);
}
async quoteBuyTokens(e, s) {
return p(e, s, this.secretApiKey);
}
async buyTokens(e, s) {
return h(e, s, this.secretApiKey);
}
async quoteSellTokens(e, s) {
return A(e, s, this.secretApiKey);
}
async sellTokens(e, s) {
return K(e, s, this.secretApiKey);
}
async getTokenWithHolders(e) {
return P(e, this.secretApiKey);
}
}
export {
T as MetalPresalesServer
};