UNPKG

@raydium-io/raydium-sdk-v2

Version:

An SDK for building applications on top of Raydium.

335 lines (332 loc) 10.5 kB
import { PublicKey, Signer } from '@solana/web3.js'; import { bU as ComputeBudgetConfig, bV as TxTipConfig } from '../../api-aa5759c5.js'; import BN__default from 'bn.js'; import { TransferFeeConfig } from '@solana/spl-token'; import { TxVersion } from '../../common/txTool/txType.js'; import { LaunchpadPool, LaunchpadConfig, PlatformConfig } from './layout.js'; import 'axios'; import '../../solana/type.js'; import '../../api/url.js'; import '../../common/owner.js'; import '../../common/txTool/lookupTable.js'; import 'decimal.js'; import '../../module/token.js'; import '../../common/pubKey.js'; import '../../common/logger.js'; import '../../module/currency.js'; import '../../marshmallow/index.js'; import '../../marshmallow/buffer-layout.js'; interface CreateLaunchPad<T = TxVersion.LEGACY> { mintA: PublicKey; name: string; symbol: string; buyAmount: BN__default; platformId?: PublicKey; programId?: PublicKey; authProgramId?: PublicKey; decimals?: number; mintBDecimals?: number; curType?: number; configId: PublicKey; configInfo?: LaunchpadConfigInfo; minMintAAmount?: BN__default; slippage?: BN__default; uri: string; migrateType: "amm" | "cpmm"; supply?: BN__default; totalSellA?: BN__default; totalFundRaisingB?: BN__default; totalLockedAmount?: BN__default; cliffPeriod?: BN__default; unlockPeriod?: BN__default; shareFeeRate?: BN__default; shareFeeReceiver?: PublicKey; platformFeeRate?: BN__default; platformVestingScale?: BN__default; createOnly?: boolean; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; associatedOnly?: boolean; checkCreateATAOwner?: boolean; extraSigners?: Signer[]; token2022?: boolean; transferFeeExtensionParams?: { transferFeeBasePoints: number; maxinumFee: BN__default; }; creatorFeeOn?: CpmmCreatorFeeOn; platformConfigAccess?: boolean; } interface BuyToken<T = TxVersion.LEGACY> { mintA: PublicKey; mintAProgram?: PublicKey; buyAmount: BN__default; programId?: PublicKey; authProgramId?: PublicKey; mintB?: PublicKey; poolInfo?: LaunchpadPoolInfo; minMintAAmount?: BN__default; slippage?: BN__default; shareFeeRate?: BN__default; shareFeeReceiver?: PublicKey; configInfo?: LaunchpadConfigInfo; platformFeeRate?: BN__default; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; associatedOnly?: boolean; checkCreateATAOwner?: boolean; transferFeeConfigA?: TransferFeeConfig | undefined; skipCheckMintA?: boolean; fromCreate?: boolean; } interface BuyTokenExactOut<T = TxVersion.LEGACY> extends Omit<BuyToken, "buyAmount" | "minMintAAmount" | "txVersion"> { maxBuyAmount?: BN__default; outAmount: BN__default; txVersion?: T; } interface SellToken<T = TxVersion.LEGACY> { mintA: PublicKey; mintAProgram?: PublicKey; sellAmount: BN__default; slippage?: BN__default; programId?: PublicKey; authProgramId?: PublicKey; poolInfo?: LaunchpadPoolInfo; mintB?: PublicKey; minAmountB?: BN__default; shareFeeRate?: BN__default; shareFeeReceiver?: PublicKey; configInfo?: LaunchpadConfigInfo; platformFeeRate?: BN__default; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; associatedOnly?: boolean; checkCreateATAOwner?: boolean; skipCheckMintA?: boolean; } interface SellTokenExactOut<T = TxVersion.LEGACY> extends Omit<SellToken, "sellAmount" | "txVersion"> { maxSellAmount?: BN__default; inAmount: BN__default; txVersion?: T; } interface CreatePlatform<T = TxVersion.LEGACY> { programId?: PublicKey; platformAdmin: PublicKey; platformClaimFeeWallet: PublicKey; platformLockNftWallet: PublicKey; platformVestingWallet: PublicKey; cpConfigId: PublicKey; migrateCpLockNftScale: { platformScale: BN__default; creatorScale: BN__default; burnScale: BN__default; }; transferFeeExtensionAuth: PublicKey; creatorFeeRate: BN__default; feeRate: BN__default; name: string; web: string; img: string; platformVestingScale?: BN__default; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface UpdatePlatform<T = TxVersion.LEGACY> { programId?: PublicKey; platformAdmin: PublicKey; platformId?: PublicKey; updateInfo: { type: "updateClaimFeeWallet" | "updateLockNftWallet"; value: PublicKey; } | { type: "updateFeeRate"; value: BN__default; } | { type: "updateName" | "updateImg" | "updateWeb"; value: string; } | { type: "migrateCpLockNftScale"; value: { platformScale: BN__default; creatorScale: BN__default; burnScale: BN__default; }; } | { type: "updateCpConfigId"; value: PublicKey; } | { type: "updateVestingWallet"; value: PublicKey; } | { type: "updatePlatformVestingScale"; value: BN__default; } | { type: "updatePlatformCpCreator"; value: PublicKey; } | { type: "updateAll"; value: { platformClaimFeeWallet: PublicKey; platformLockNftWallet: PublicKey; platformVestingWallet: PublicKey; cpConfigId: PublicKey; migrateCpLockNftScale: { platformScale: BN__default; creatorScale: BN__default; burnScale: BN__default; }; feeRate: BN__default; name: string; web: string; img: string; transferFeeExtensionAuth: PublicKey; creatorFeeRate: BN__default; platformVestingScale: BN__default; }; }; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface CreatePlatformVestingAccount<T = TxVersion.LEGACY> { programId?: PublicKey; platformVestingWallet: PublicKey; beneficiary: PublicKey; platformId: PublicKey; poolId: PublicKey; vestingRecord?: PublicKey; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimPlatformFee<T = TxVersion.LEGACY> { programId?: PublicKey; authProgramId?: PublicKey; platformId: PublicKey; platformClaimFeeWallet: PublicKey; poolId: PublicKey; mintB?: PublicKey; vaultB?: PublicKey; mintBProgram?: PublicKey; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimAllPlatformFee<T = TxVersion.LEGACY> { programId?: PublicKey; authProgramId?: PublicKey; platformId: PublicKey; platformClaimFeeWallet: PublicKey; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface CreateVesting<T = TxVersion.LEGACY> { programId?: PublicKey; poolId: PublicKey; beneficiary: PublicKey; shareAmount: BN__default; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface CreateMultipleVesting<T = TxVersion.LEGACY> { programId?: PublicKey; poolId: PublicKey; beneficiaryList: { wallet: PublicKey; shareAmount: BN__default; }[]; computeBudgetConfig?: ComputeBudgetConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimVesting<T = TxVersion.LEGACY> { programId?: PublicKey; poolId: PublicKey; vestingRecord?: PublicKey; poolInfo?: LaunchpadPoolInfo; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimMultiVesting<T = TxVersion.LEGACY> { programId?: PublicKey; poolIdList: PublicKey[]; vestingRecords?: Record<string, PublicKey>; poolsInfo?: Record<string, { mintA: PublicKey; vaultA: PublicKey; }>; computeBudgetConfig?: ComputeBudgetConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimVaultPlatformFee<T = TxVersion.LEGACY> { programId?: PublicKey; platformId: PublicKey; mintB: PublicKey; mintBProgram?: PublicKey; claimFeeWallet?: PublicKey; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimMultipleVaultPlatformFee<T = TxVersion.LEGACY> { programId?: PublicKey; platformList: { id: PublicKey; mintB: PublicKey; mintBProgram?: PublicKey; claimFeeWallet?: PublicKey; }[]; unwrapSol?: boolean; computeBudgetConfig?: ComputeBudgetConfig; txVersion?: T; feePayer?: PublicKey; associatedOnly?: boolean; checkCreateATAOwner?: boolean; } interface ClaimCreatorFee<T = TxVersion.LEGACY> { programId?: PublicKey; mintB: PublicKey; mintBProgram?: PublicKey; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } interface ClaimMultiCreatorFee<T = TxVersion.LEGACY> { programId?: PublicKey; mintBList: { pubKey: PublicKey; programId?: PublicKey; }[]; computeBudgetConfig?: ComputeBudgetConfig; txTipConfig?: TxTipConfig; txVersion?: T; feePayer?: PublicKey; } declare type LaunchpadPoolInfo = ReturnType<typeof LaunchpadPool.decode>; declare type LaunchpadConfigInfo = ReturnType<typeof LaunchpadConfig.decode>; declare type LaunchpadPlatformInfo = ReturnType<typeof PlatformConfig.decode>; declare enum CpmmCreatorFeeOn { OnlyTokenB = 0, BothToken = 1 } export { BuyToken, BuyTokenExactOut, ClaimAllPlatformFee, ClaimCreatorFee, ClaimMultiCreatorFee, ClaimMultiVesting, ClaimMultipleVaultPlatformFee, ClaimPlatformFee, ClaimVaultPlatformFee, ClaimVesting, CpmmCreatorFeeOn, CreateLaunchPad, CreateMultipleVesting, CreatePlatform, CreatePlatformVestingAccount, CreateVesting, LaunchpadConfigInfo, LaunchpadPlatformInfo, LaunchpadPoolInfo, SellToken, SellTokenExactOut, UpdatePlatform };