UNPKG

metal-presale

Version:

SDK for Metal Presales - Client and Server utilities

110 lines 3.93 kB
import { HolderResponse, PortfolioSummary, PresaleResponse } from './client'; import { BuyPresaleParams, BuyTokensParams, CreatePresaleParams, SellTokensParams, TransferParams } from './server'; export type { TokenLikeItem, HolderResponse, PortfolioSummary, PresaleResponse } from './client'; export type { CreatePresaleParams, BuyPresaleParams, BuyTokensParams, SellTokensParams, TransferParams, } from './server'; export { calculatePortfolioSummary, isPresaleActive, getPresaleProgress, getPresaleTimeRemaining, formatTimeRemaining, filterTokensByType, calculateTotalValue, findToken, sortTokensByValue, getUnlockedTokens, } from './utils'; /** * @deprecated Use MetalPresalesClient for client-side or MetalPresalesServer for server-side */ export declare class MetalPresales { private publicApiKey; private secretApiKey; constructor({ publicApiKey, secretApiKey, }: { publicApiKey: string; secretApiKey?: string; }); /** * ----- Client-side methods can be used with a public API key. ----- */ getHolder(userId: string): Promise<HolderResponse>; getHolderWithPortfolio(userId: string): Promise<{ holder: HolderResponse; portfolio: PortfolioSummary; }>; getPresale(presaleId: string): Promise<PresaleResponse>; /** * ----- Server-side only methods require a secret API key. ----- */ getOrCreateHolder(userId: string): Promise<HolderResponse & { success: true; }>; listPresales(): Promise<{ name: string; id: `0x${string}`; participants: { userAddress: `0x${string}`; usdcAmount: number; }[]; tokenInfo: { name: string; symbol: string; imageUrl: string; }; }[]>; 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; }[]; }[]>; getActivePresales(): Promise<PresaleResponse[]>; } //# sourceMappingURL=index.d.ts.map