{"version":3,"sources":["../../../src/raydium/launchpad/type.ts"],"sourcesContent":["import { PublicKey, Signer } from \"@solana/web3.js\";\nimport { ComputeBudgetConfig, TxTipConfig } from \"../type\";\nimport { TxVersion } from \"@/common\";\nimport BN from \"bn.js\";\nimport { LaunchpadPool, LaunchpadConfig, PlatformConfig, PlatformCurveRule } from \"./layout\";\nimport { TransferFeeConfig } from \"@solana/spl-token\";\n\nexport interface CreateLaunchPad<T = TxVersion.LEGACY> {\n  mintA: PublicKey;\n  name: string;\n  symbol: string;\n  buyAmount: BN;\n  platformId?: PublicKey;\n\n  programId?: PublicKey; // default mainnet\n  authProgramId?: PublicKey; // default mainnet\n  decimals?: number; // default 6\n  mintBDecimals?: number; // default 9\n  curType?: number; // default 0\n  configId: PublicKey;\n  configInfo?: LaunchpadConfigInfo;\n\n  minMintAAmount?: BN; // default calculated by realtime rpc data\n  slippage?: BN;\n\n  uri: string;\n  migrateType: \"amm\" | \"cpmm\";\n\n  supply?: BN;\n  totalSellA?: BN;\n  totalFundRaisingB?: BN;\n  totalLockedAmount?: BN;\n  cliffPeriod?: BN;\n  unlockPeriod?: BN;\n\n  shareFeeRate?: BN;\n  shareFeeReceiver?: PublicKey;\n  platformFeeRate?: BN; // for preload usage\n  platformVestingScale?: BN; // for preload usage\n\n  createOnly?: boolean;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n  associatedOnly?: boolean;\n  checkCreateATAOwner?: boolean;\n  extraSigners?: Signer[];\n\n  token2022?: boolean;\n  transferFeeExtensionParams?: { transferFeeBasePoints: number; maxinumFee: BN };\n  creatorFeeOn?: CpmmCreatorFeeOn;\n  platformAllowConfig?: boolean;\n\n  mintBProgram?: PublicKey;\n  transferFeeConfigB?: TransferFeeConfig | undefined;\n  skipCheckMintB?: boolean;\n}\n\nexport interface BuyToken<T = TxVersion.LEGACY> {\n  mintA: PublicKey;\n  mintAProgram?: PublicKey;\n  mintBProgram?: PublicKey;\n  buyAmount: BN;\n\n  programId?: PublicKey; // default mainnet\n  authProgramId?: PublicKey; // default mainnet\n  mintB?: PublicKey; // default SOL\n  poolInfo?: LaunchpadPoolInfo; // default calculated from mint\n  minMintAAmount?: BN; // default calculated by realtime rpc data\n  slippage?: BN;\n  shareFeeRate?: BN;\n  shareFeeReceiver?: PublicKey;\n\n  configInfo?: LaunchpadConfigInfo; // for preload usage\n  platformFeeRate?: BN; // for preload usage\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n  associatedOnly?: boolean;\n  checkCreateATAOwner?: boolean;\n  transferFeeConfigA?: TransferFeeConfig | undefined;\n  transferFeeConfigB?: TransferFeeConfig | undefined;\n  skipCheckMintA?: boolean;\n  skipCheckMintB?: boolean;\n  fromCreate?: boolean;\n}\n\nexport interface BuyTokenExactOut<T = TxVersion.LEGACY>\n  extends Omit<BuyToken, \"buyAmount\" | \"minMintAAmount\" | \"txVersion\"> {\n  maxBuyAmount?: BN;\n  outAmount: BN;\n  txVersion?: T;\n}\n\nexport interface SellToken<T = TxVersion.LEGACY> {\n  mintA: PublicKey;\n  mintAProgram?: PublicKey;\n  mintBProgram?: PublicKey;\n  sellAmount: BN;\n  slippage?: BN;\n\n  programId?: PublicKey; // default mainnet\n  authProgramId?: PublicKey; // default mainnet\n  poolInfo?: LaunchpadPoolInfo; // default calculated from mint\n  mintB?: PublicKey; // default SOL\n  minAmountB?: BN; // default SOL decimals 9\n\n  shareFeeRate?: BN;\n  shareFeeReceiver?: PublicKey;\n\n  configInfo?: LaunchpadConfigInfo; // for preload usage\n  platformFeeRate?: BN; // for preload usage\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n  associatedOnly?: boolean;\n  checkCreateATAOwner?: boolean;\n  transferFeeConfigB?: TransferFeeConfig | undefined;\n  skipCheckMintA?: boolean;\n  skipCheckMintB?: boolean;\n}\n\nexport interface SellTokenExactOut<T = TxVersion.LEGACY> extends Omit<SellToken, \"sellAmount\" | \"txVersion\"> {\n  maxSellAmount?: BN;\n  inAmount: BN;\n  txVersion?: T;\n}\n\nexport interface CreatePlatform<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  platformAdmin: PublicKey;\n  platformClaimFeeWallet: PublicKey;\n  platformLockNftWallet: PublicKey;\n  platformVestingWallet: PublicKey;\n  cpConfigId: PublicKey;\n\n  migrateCpLockNftScale: {\n    platformScale: BN;\n    creatorScale: BN;\n    burnScale: BN;\n  };\n\n  transferFeeExtensionAuth: PublicKey;\n  creatorFeeRate: BN;\n  feeRate: BN;\n  name: string;\n  web: string;\n  img: string;\n  platformVestingScale?: BN;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface CreatePlatformAllowConfig<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  platformAdmin: PublicKey;\n  platformId: PublicKey;\n\n  configInfo: {\n    mintB: string | PublicKey;\n    curveType: number;\n    index: number;\n  };\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface CreatePlatformCurveRule<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  curveRuleAuthority?: PublicKey;\n  platformId: PublicKey;\n  configId: PublicKey;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface UpdatePlatformCurveRule<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  curveRuleAuthority?: PublicKey;\n  platformCurveRuleId: PublicKey;\n  groupId: number;\n  constraints: LaunchpadCurveRuleConstraint[];\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface UpdatePlatform<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  platformAdmin: PublicKey;\n  platformId?: PublicKey;\n\n  updateInfo:\n    | { type: \"updateClaimFeeWallet\" | \"updateLockNftWallet\"; value: PublicKey }\n    | { type: \"updateFeeRate\"; value: BN }\n    | { type: \"updateName\" | \"updateImg\" | \"updateWeb\"; value: string }\n    | { type: \"migrateCpLockNftScale\"; value: { platformScale: BN; creatorScale: BN; burnScale: BN } }\n    | { type: \"updateCpConfigId\"; value: PublicKey }\n    | { type: \"updateVestingWallet\"; value: PublicKey }\n    | { type: \"updatePlatformVestingScale\"; value: BN }\n    | { type: \"updatePlatformCpCreator\"; value: PublicKey }\n    | { type: \"updateRestrictGlobalConfig\"; value: BN }\n    | { type: \"updateRestrictCurveParam\"; value: BN }\n    | { type: \"updateCurveRuleManager\"; value: PublicKey }\n    | {\n        type: \"updateAll\";\n        value: {\n          platformClaimFeeWallet: PublicKey;\n          platformLockNftWallet: PublicKey;\n          platformVestingWallet: PublicKey;\n          cpConfigId: PublicKey;\n          migrateCpLockNftScale: {\n            platformScale: BN;\n            creatorScale: BN;\n            burnScale: BN;\n          };\n          feeRate: BN;\n          name: string;\n          web: string;\n          img: string;\n          transferFeeExtensionAuth: PublicKey;\n          creatorFeeRate: BN;\n          platformVestingScale: BN;\n        };\n      };\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface CreatePlatformVestingAccount<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  platformVestingWallet: PublicKey;\n  beneficiary: PublicKey;\n  platformId: PublicKey;\n  poolId: PublicKey;\n  vestingRecord?: PublicKey;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\nexport interface ClaimPlatformFee<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  authProgramId?: PublicKey;\n  platformId: PublicKey;\n  platformClaimFeeWallet: PublicKey;\n  poolId: PublicKey;\n\n  mintB?: PublicKey;\n  vaultB?: PublicKey;\n  mintBProgram?: PublicKey;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ClaimAllPlatformFee<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  authProgramId?: PublicKey;\n  platformId: PublicKey;\n  platformClaimFeeWallet: PublicKey;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface CreateVesting<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  poolId: PublicKey;\n  beneficiary: PublicKey;\n  shareAmount: BN;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface CreateMultipleVesting<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  poolId: PublicKey;\n  beneficiaryList: {\n    wallet: PublicKey;\n    shareAmount: BN;\n  }[];\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ClaimVesting<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  poolId: PublicKey;\n  vestingRecord?: PublicKey;\n  poolInfo?: LaunchpadPoolInfo;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ClaimMultiVesting<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  poolIdList: PublicKey[];\n  vestingRecords?: Record<string, PublicKey>;\n  poolsInfo?: Record<\n    string,\n    {\n      mintA: PublicKey;\n      vaultA: PublicKey;\n    }\n  >;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ClaimVaultPlatformFee<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  platformId: PublicKey;\n  mintB: PublicKey;\n  mintBProgram?: PublicKey;\n\n  claimFeeWallet?: PublicKey;\n\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ClaimMultipleVaultPlatformFee<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n\n  platformList: {\n    id: PublicKey;\n    mintB: PublicKey;\n    mintBProgram?: PublicKey;\n    claimFeeWallet?: PublicKey;\n  }[];\n\n  unwrapSol?: boolean;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n  associatedOnly?: boolean;\n  checkCreateATAOwner?: boolean;\n}\n\nexport interface ClaimCreatorFee<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  mintB: PublicKey;\n  mintBProgram?: PublicKey;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ClaimMultiCreatorFee<T = TxVersion.LEGACY> {\n  programId?: PublicKey;\n  mintBList: {\n    pubKey: PublicKey;\n    programId?: PublicKey;\n  }[];\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport type LaunchpadPoolInfo = ReturnType<typeof LaunchpadPool.decode>;\nexport type LaunchpadConfigInfo = ReturnType<typeof LaunchpadConfig.decode>;\nexport type LaunchpadPlatformInfo = ReturnType<typeof PlatformConfig.decode>;\nexport type LaunchpadCurveRuleInfo = ReturnType<typeof PlatformCurveRule.decode>;\n\nexport enum LaunchpadCurveRuleField {\n  CurveType = 0,\n  MigrateType = 1,\n  MigrateCpmmFeeOn = 2,\n  Supply = 3,\n  TotalSellA = 4,\n  TotalFundRaisingB = 5,\n  TotalLockedAmount = 6,\n  CliffPeriod = 7,\n  UnlockPeriod = 8,\n  /** 0: the base mint belongs to spl token, 1: to token2022, see LaunchpadCurveRuleBaseTokenProgram */\n  BaseTokenProgram = 9,\n  /** 1 when the base mint carries the transfer fee extension, 0 when it does not */\n  TransferFeeEnabled = 10,\n  /** the transfer fee rate of the base mint, denominator 10000, 0 without the extension */\n  TransferFeeBasisPoints = 11,\n  /** the maximum transfer fee of the base mint, 0 without the extension */\n  TransferFeeMaximumFee = 12,\n  /** derived: totalSellA / supply, denominated in 10^-6 */\n  SellRateA = 13,\n  /** derived: totalLockedAmount / supply, denominated in 10^-6 */\n  LockRate = 14,\n  /** derived: supply - totalSellA - totalLockedAmount, the base amount reaching the migrated pool */\n  MigrateAmountA = 15,\n  /** derived: migrate amount / supply, denominated in 10^-6 */\n  MigrateRateA = 16,\n  /** derived: totalFundRaisingB / supply, denominated in 10^-6, a band on the graduation valuation */\n  FundRaisingRateB = 17,\n  /** the block time the pool is created at, in seconds, it lets a group carry a validity window */\n  UnixTimestamp = 18,\n}\n\n/**\n * The fields that read totalSellA. They are only accepted on a constant product config: the\n * fixed and the linear curve derive the sell amount themselves, so the program refuses\n * these fields when the rule of such a config is written.\n */\nexport const LAUNCHPAD_CURVE_RULE_CONSTANT_PRODUCT_ONLY_FIELDS = [\n  LaunchpadCurveRuleField.TotalSellA,\n  LaunchpadCurveRuleField.SellRateA,\n  LaunchpadCurveRuleField.MigrateAmountA,\n  LaunchpadCurveRuleField.MigrateRateA,\n];\n\nexport enum LaunchpadCurveRuleOp {\n  Eq = 0,\n  /** min */\n  Gte = 1,\n  /** max */\n  Lte = 2,\n  Neq = 3,\n}\n\nexport enum LaunchpadCurveRuleBaseTokenProgram {\n  SplToken = 0,\n  Token2022 = 1,\n}\n\nexport interface LaunchpadCurveRuleConstraint {\n  field: LaunchpadCurveRuleField;\n  op: LaunchpadCurveRuleOp;\n  value: BN;\n}\n\nexport const LAUNCHPAD_MAX_CURVE_RULE_GROUPS = 10;\nexport const LAUNCHPAD_MAX_CONSTRAINTS_PER_GROUP = 25;\nexport enum CpmmCreatorFeeOn {\n  OnlyTokenB,\n  BothToken,\n}\n"],"mappings":"AA4ZO,GAAK,GAAL,CAAK,GACV,eAAY,GAAZ,YACA,gBAAc,GAAd,cACA,qBAAmB,GAAnB,mBACA,WAAS,GAAT,SACA,eAAa,GAAb,aACA,sBAAoB,GAApB,oBACA,sBAAoB,GAApB,oBACA,gBAAc,GAAd,cACA,iBAAe,GAAf,eAEA,qBAAmB,GAAnB,mBAEA,uBAAqB,IAArB,qBAEA,2BAAyB,IAAzB,yBAEA,0BAAwB,IAAxB,wBAEA,cAAY,IAAZ,YAEA,aAAW,IAAX,WAEA,mBAAiB,IAAjB,iBAEA,iBAAe,IAAf,eAEA,qBAAmB,IAAnB,mBAEA,kBAAgB,IAAhB,gBA7BU,WAqCC,EAAoD,CAC/D,EACA,GACA,GACA,EACF,EAEY,EAAL,CAAK,GACV,QAAK,GAAL,KAEA,QAAM,GAAN,MAEA,QAAM,GAAN,MACA,QAAM,GAAN,MANU,WASA,EAAL,CAAK,GACV,cAAW,GAAX,WACA,cAAY,GAAZ,YAFU,WAWC,EAAkC,GAClC,EAAsC,GACvC,EAAL,CAAK,GACV,gCACA,6BAFU","names":[]}