@flaunch/sdk
Version:
Flaunch SDK to easily interact with the Flaunch protocol
223 lines • 10.7 kB
TypeScript
import { type ReadContract, type Address, type Drift, type ReadWriteContract, type ReadWriteAdapter, type HexString } from "@delvtech/drift";
import { FlaunchZapAbi } from "../abi/FlaunchZap";
import { IPFSParams, Permissions } from "../types";
import { ReadFlaunchPositionManagerV1_1 } from "./FlaunchPositionManagerV1_1Client";
export type FlaunchZapABI = typeof FlaunchZapAbi;
export interface FlaunchParams {
name: string;
symbol: string;
tokenUri: string;
fairLaunchPercent: number;
fairLaunchDuration: number;
initialMarketCapUSD: number;
creator: Address;
creatorFeeAllocationPercent: number;
flaunchAt?: bigint;
premineAmount?: bigint;
treasuryManagerParams?: {
manager?: Address;
permissions?: Permissions;
initializeData?: HexString;
depositData?: HexString;
};
trustedSignerSettings?: {
enabled: boolean;
walletCap?: bigint;
txCap?: bigint;
trustedFeeSigner?: Address;
premineSignedMessage?: {
deadline: number;
signature: HexString;
};
};
}
export interface FlaunchIPFSParams extends Omit<FlaunchParams, "tokenUri">, IPFSParams {
}
export interface FlaunchWithRevenueManagerParams extends Omit<FlaunchParams, "treasuryManagerParams"> {
revenueManagerInstanceAddress: Address;
treasuryManagerParams?: {
permissions?: Permissions;
};
}
export interface FlaunchWithRevenueManagerIPFSParams extends Omit<FlaunchWithRevenueManagerParams, "tokenUri">, IPFSParams {
}
export interface FlaunchWithSplitManagerParams extends Omit<FlaunchParams, "treasuryManagerParams"> {
creatorSplitPercent: number;
managerOwnerSplitPercent: number;
splitReceivers: {
address: Address;
percent: number;
}[];
treasuryManagerParams?: {
permissions?: Permissions;
};
}
export interface FlaunchWithSplitManagerIPFSParams extends Omit<FlaunchWithSplitManagerParams, "tokenUri">, IPFSParams {
}
export interface DeployRevenueManagerParams {
protocolRecipient: Address;
protocolFeePercent: number;
permissions?: Permissions;
}
export interface DeployStakingManagerParams {
managerOwner: Address;
stakingToken: Address;
minEscrowDuration: bigint;
minStakeDuration: bigint;
creatorSharePercent: number;
ownerSharePercent: number;
permissions?: Permissions;
}
export interface DeployBuyBackManagerParams {
managerOwner: Address;
creatorSharePercent: number;
ownerSharePercent: number;
buyBackPoolKey: {
currency0: Address;
currency1: Address;
fee: number;
tickSpacing: number;
hooks: Address;
};
permissions?: Permissions;
}
/**
* Base client for interacting with the FlaunchZap contract in read-only mode
* Provides basic contract initialization
*/
export declare class ReadFlaunchZap {
drift: Drift;
chainId: number;
readonly contract: ReadContract<FlaunchZapABI>;
readonly TOTAL_SUPPLY: bigint;
readonly readPositionManagerV1_1: ReadFlaunchPositionManagerV1_1;
/**
* Creates a new ReadFlaunchZap instance
* @param chainId - The chain ID of the contract
* @param address - The address of the FlaunchZap contract
* @param drift - Optional drift instance for contract interactions (creates new instance if not provided)
* @throws Error if address is not provided
*/
constructor(chainId: number, address: Address, drift?: Drift);
getPremineCostInWei(params: {
initialPriceParams: HexString;
premineAmount: bigint;
slippagePercent?: number;
}): Promise<bigint>;
getFlaunchingFee(params: {
sender: Address;
initialPriceParams: HexString;
slippagePercent?: number;
}): Promise<bigint>;
/**
* Calculates the ETH required to flaunch a token, takes into account the ETH for premine and the flaunching fee
*/
ethRequiredToFlaunch(params: {
premineAmount: bigint;
initialPriceParams: HexString;
slippagePercent?: number;
}): Promise<bigint>;
}
/**
* Extended client for interacting with the FlaunchZap contract with write capabilities
*/
export declare class ReadWriteFlaunchZap extends ReadFlaunchZap {
contract: ReadWriteContract<FlaunchZapABI>;
constructor(chainId: number, address: Address, drift?: Drift<ReadWriteAdapter>);
/**
* Flaunches a new token, supports premine
* @param params - Parameters for the flaunch
* @returns Transaction response for the flaunch creation
*/
flaunch(params: FlaunchParams): Promise<`0x${string}`>;
flaunchIPFS(params: FlaunchIPFSParams): Promise<`0x${string}`>;
/**
* Flaunches a new token for a revenue manager
* @param params - Parameters for the flaunch with revenue manager
* @param params.name - The name of the token
* @param params.symbol - The symbol of the token
* @param params.tokenUri - The URI containing the token metadata
* @param params.fairLaunchPercent - Percentage of total supply to be used in fair launch (0-100)
* @param params.fairLaunchDuration - Duration of fair launch in seconds
* @param params.initialMarketCapUSD - Initial market cap in USD
* @param params.creator - Address of the token creator
* @param params.creatorFeeAllocationPercent - Percentage of fees allocated to creator (0-100)
* @param params.protocolRecipient - Address to receive protocol fees
* @param params.protocolFeePercent - Percentage of fees allocated to protocol (0-100)
* @param params.flaunchAt - Optional timestamp when the flaunch should start
* @param params.premineAmount - Optional amount of tokens to premine
* @returns Transaction response for the flaunch creation
*/
flaunchWithRevenueManager(params: FlaunchWithRevenueManagerParams): Promise<`0x${string}`>;
/**
* Flaunches a new token for a revenue manager, storing the token metadata on IPFS
* @param params - Parameters for the flaunch including all revenue manager params and IPFS metadata
* @returns Promise resolving to the transaction response for the flaunch creation
*/
flaunchIPFSWithRevenueManager(params: FlaunchWithRevenueManagerIPFSParams): Promise<`0x${string}`>;
/**
* Flaunches a new token that splits the creator fees to the creator and a list of recipients
* @param params - Parameters for the flaunch with split manager
* @param params.name - The name of the token
* @param params.symbol - The symbol of the token
* @param params.tokenUri - The URI containing the token metadata
* @param params.fairLaunchPercent - Percentage of total supply to be used in fair launch (0-100)
* @param params.fairLaunchDuration - Duration of fair launch in seconds
* @param params.initialMarketCapUSD - Initial market cap in USD
* @param params.creator - Address of the token creator
* @param params.creatorFeeAllocationPercent - Percentage of fees allocated to creator (0-100)
* @param params.creatorSplitPercent - Split percentage of the fees for the creator (0-100)
* @param params.managerOwnerSplitPercent - Split percentage of the fees for the manager owner (0-100)
* @param params.splitReceivers - List of recipients and their percentage of the fees
* @param params.flaunchAt - Optional timestamp when the flaunch should start
* @param params.premineAmount - Optional amount of tokens to premine
* @param params.treasuryManagerParams - Optional treasury manager configuration
* @returns Transaction response for the flaunch creation
*/
flaunchWithSplitManager(params: FlaunchWithSplitManagerParams): Promise<`0x${string}`>;
/**
* Flaunches a new token that splits the creator fees to the creator and a list of recipients, storing the token metadata on IPFS
* @param params - Parameters for the flaunch with split manager including all IPFS metadata
* @returns Promise resolving to the transaction response for the flaunch creation
*/
flaunchIPFSWithSplitManager(params: FlaunchWithSplitManagerIPFSParams): Promise<`0x${string}`>;
/**
* Deploys a new revenue manager
* @param params - Parameters for deploying the revenue manager
* @param params.protocolRecipient - The address of the protocol recipient
* @param params.protocolFeePercent - The percentage of the protocol fee
* @param params.permissions - The permissions for the revenue manager
* @returns Transaction response
*/
deployRevenueManager(params: DeployRevenueManagerParams): Promise<`0x${string}`>;
/**
* Deploys a new staking manager
* @param params - Parameters for deploying the staking manager
* @param params.managerOwner - The address of the manager owner
* @param params.stakingToken - The address of the token to be staked
* @param params.minEscrowDuration - The minimum duration (in seconds) that the creator's NFT is locked for
* @param params.minStakeDuration - The minimum duration (in seconds) that the user's tokens are locked for
* @param params.creatorSharePercent - The % share that a creator will earn from their token
* @param params.ownerSharePercent - The % share that the manager owner will earn from their token
* @param params.permissions - The permissions for the staking manager
* @returns Transaction response
*/
deployStakingManager(params: DeployStakingManagerParams): Promise<`0x${string}`>;
/**
* Deploys a new BuyBack manager
* @param params - Parameters for deploying the BuyBack manager
* @param params.managerOwner - The address of the manager owner
* @param params.creatorSharePercent - The % share that a creator will earn from their token (0-100)
* @param params.ownerSharePercent - The % share that the manager owner will earn from their token (0-100)
* @param params.buyBackPoolKey - The Uniswap V4 pool key configuration for the buyback pool
* @param params.buyBackPoolKey.currency0 - The lower currency of the pool (sorted numerically)
* @param params.buyBackPoolKey.currency1 - The higher currency of the pool (sorted numerically)
* @param params.buyBackPoolKey.fee - The pool LP fee, capped at 1_000_000
* @param params.buyBackPoolKey.tickSpacing - Tick spacing for the pool
* @param params.buyBackPoolKey.hooks - The hooks address of the pool
* @param params.permissions - The permissions for the BuyBack manager
* @returns Transaction response
*/
deployBuyBackManager(params: DeployBuyBackManagerParams): Promise<`0x${string}`>;
}
//# sourceMappingURL=FlaunchZapClient.d.ts.map