metal-presale
Version:
SDK for Metal Presales - Client and Server utilities
133 lines • 3.78 kB
TypeScript
import { HolderResponse, PresaleResponse } from './client';
interface TokenInfo {
name: string;
symbol: string;
imageUrl: string;
metadata?: {
description?: string;
telegramLink?: string;
websiteLink?: string;
xLink?: string;
farcasterLink?: string;
};
}
type Hash = `0x${string}`;
type Address = `0x${string}`;
export interface CreateHolderOptions {
contextWalletAddress?: string;
authProvider?: string;
autoForwardingEnabled?: boolean;
}
export declare function getOrCreateHolder(userId: string, apiKey: string, options?: CreateHolderOptions): Promise<HolderResponse & {
success: true;
}>;
export declare function listPresales(apiKey: string): Promise<{
name: string;
id: Address;
participants: {
userAddress: Address;
usdcAmount: number;
}[];
tokenInfo: {
name: string;
symbol: string;
imageUrl: string;
};
}[]>;
export interface CreatePresaleParams {
name: string;
description: string;
startTimestamp: number;
endTimestamp: number;
targetUsdcAmount: number;
tokenInfo: TokenInfo;
deploymentConfig: {
lockupPercentage: number;
};
}
export declare function createPresale(params: CreatePresaleParams, apiKey: string): Promise<{
signerId: string;
orgId: string;
id: string;
chainId: 8453;
status: "completed" | "pending" | "active" | "ended";
participants: [];
createdAt: string;
} & CreatePresaleParams>;
export interface BuyPresaleParams {
presaleId: string;
usdcAmount: number;
}
export declare function buyPresale(holderId: string, params: BuyPresaleParams, apiKey: string): Promise<{
success: true;
}>;
export interface BuyTokensParams {
tokenAddress: string;
usdcAmount: number;
swapFeeBps?: number;
}
export declare function buyTokens(holderId: string, params: BuyTokensParams, apiKey: string): Promise<{
success: true;
status: "completed";
transactionHash: Hash;
from: Address;
tokenAddress: Address;
blockNumber: number;
blockHash: Hash;
}>;
export declare function quoteBuyTokens(holderId: string, params: BuyTokensParams, apiKey: string): Promise<{
tokenQuantity: number;
dollarValue: number;
}>;
export interface SellTokensParams {
tokenAddress: string;
tokenAmount: number;
swapFeeBps?: number;
}
export declare function sellTokens(holderId: string, params: SellTokensParams, apiKey: string): Promise<{
success: true;
status: "completed";
transactionHash: Hash;
from: Address;
tokenAddress: Address;
blockNumber: number;
blockHash: Hash;
}>;
export declare function quoteSellTokens(holderId: string, params: SellTokensParams, apiKey: string): Promise<{
tokenQuantity: number;
dollarValue: number;
}>;
export interface TransferParams {
toAddress: `0x${string}`;
tokenAddress: `0x${string}`;
amount: number;
}
export declare function transfer(holderId: string, params: TransferParams, apiKey: string): Promise<{
success: true;
transactionHash: Hash;
from: Address;
to: Address;
amount: number;
tokenAddress: Address;
}>;
export declare function getTokenWithHolders(tokenAddress: string, apiKey: string): Promise<{
id: Address;
address: Address;
name: string;
symbol: string;
totalSupply: number;
startingAppSupply: number;
remainingAppSupply: number;
merchantSupply: number;
merchantAddress: Address;
price: number;
holders: {
id: Address;
address: Address;
balance: number;
value: number;
}[];
}[]>;
export declare function getActivePresales(apiKey: string): Promise<PresaleResponse[]>;
export {};
//# sourceMappingURL=server.d.ts.map