UNPKG

metal-presale

Version:

SDK for Metal Presales - Client and Server utilities

110 lines 3.79 kB
import { BuyPresaleParams, BuyTokensParams, CreatePresaleParams, CreateHolderOptions, SellTokensParams, TransferParams } from './server'; import { HolderResponse, PortfolioSummary, PresaleResponse } from './client'; interface ServerConfig { publicApiKey: string; secretApiKey: string; } /** * Server-side SDK for Metal Presales * This class contains all methods including those that require the secret API key. * It should only be used in server-side environments. */ export declare class MetalPresalesServer { private publicApiKey; private secretApiKey; constructor({ publicApiKey, secretApiKey }: ServerConfig); /** * Public API methods */ getHolder(userId: string): Promise<HolderResponse>; getHolderWithPortfolio(userId: string): Promise<{ holder: HolderResponse; portfolio: PortfolioSummary; }>; getPresale(presaleId: string): Promise<PresaleResponse>; /** * Server-side only methods that require secret key */ getOrCreateHolder(userId: string, options?: CreateHolderOptions): Promise<HolderResponse>; listPresales(): Promise<{ name: string; id: `0x${string}`; participants: { userAddress: `0x${string}`; usdcAmount: number; }[]; tokenInfo: { name: string; symbol: string; imageUrl: string; }; }[]>; getActivePresales(): Promise<PresaleResponse[]>; createPresale(presale: CreatePresaleParams): Promise<{ signerId: string; orgId: string; id: string; chainId: 8453; status: "completed" | "pending" | "active" | "ended"; participants: []; createdAt: string; } & CreatePresaleParams>; buyPresale(holderId: string, params: BuyPresaleParams): Promise<{ success: true; }>; transfer(holderId: string, params: TransferParams): Promise<{ success: true; transactionHash: `0x${string}`; from: `0x${string}`; to: `0x${string}`; amount: number; tokenAddress: `0x${string}`; }>; quoteBuyTokens(holderId: string, params: BuyTokensParams): Promise<{ tokenQuantity: number; dollarValue: number; }>; buyTokens(holderId: string, params: BuyTokensParams): Promise<{ success: true; status: "completed"; transactionHash: `0x${string}`; from: `0x${string}`; tokenAddress: `0x${string}`; blockNumber: number; blockHash: `0x${string}`; }>; quoteSellTokens(holderId: string, params: SellTokensParams): Promise<{ tokenQuantity: number; dollarValue: number; }>; sellTokens(holderId: string, params: SellTokensParams): Promise<{ success: true; status: "completed"; transactionHash: `0x${string}`; from: `0x${string}`; tokenAddress: `0x${string}`; blockNumber: number; blockHash: `0x${string}`; }>; getTokenWithHolders(tokenAddress: string): Promise<{ id: `0x${string}`; address: `0x${string}`; name: string; symbol: string; totalSupply: number; startingAppSupply: number; remainingAppSupply: number; merchantSupply: number; merchantAddress: `0x${string}`; price: number; holders: { id: `0x${string}`; address: `0x${string}`; balance: number; value: number; }[]; }[]>; } export type { HolderResponse, PortfolioSummary, PresaleResponse, } from './client'; export type { CreatePresaleParams, CreateHolderOptions, BuyPresaleParams, BuyTokensParams, SellTokensParams, TransferParams, } from './server'; //# sourceMappingURL=server-sdk.d.ts.map