{"version":3,"sources":["../../../src/raydium/cpmm/type.ts"],"sourcesContent":["import { EpochInfo, PublicKey } from \"@solana/web3.js\";\nimport BN from \"bn.js\";\nimport Decimal from \"decimal.js\";\nimport { ApiCpmmConfigInfo, ApiV3PoolInfoStandardItemCpmm, ApiV3Token, CpmmKeys } from \"../../api/type\";\nimport { TxVersion } from \"../../common/txTool/txType\";\nimport { Percent } from \"../../module\";\nimport { ComputeBudgetConfig, GetTransferAmountFee, TxTipConfig } from \"../../raydium/type\";\nimport { SwapResult } from \"./curve/calculator\";\nimport { CpmmConfigInfoLayout, CpmmPoolInfoLayout } from \"./layout\";\n\nexport interface CreateCpmmPoolParam<T> {\n  poolId?: PublicKey;\n  programId: PublicKey;\n  poolFeeAccount: PublicKey;\n  mintA: Pick<ApiV3Token, \"address\" | \"decimals\" | \"programId\">;\n  mintB: Pick<ApiV3Token, \"address\" | \"decimals\" | \"programId\">;\n  mintAAmount: BN;\n  mintBAmount: BN;\n  startTime: BN;\n  feeConfig: ApiCpmmConfigInfo;\n\n  associatedOnly: boolean;\n  checkCreateATAOwner?: boolean;\n\n  ownerInfo: {\n    feePayer?: PublicKey;\n    useSOLBalance?: boolean; // if has WSOL mint\n  };\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txVersion?: T;\n  txTipConfig?: TxTipConfig;\n  feePayer?: PublicKey;\n}\n\nexport interface CreateCpmmPoolPermissionParam<T> {\n  poolId?: PublicKey;\n  programId: PublicKey;\n  poolFeeAccount: PublicKey;\n  mintA: Pick<ApiV3Token, \"address\" | \"decimals\" | \"programId\">;\n  mintB: Pick<ApiV3Token, \"address\" | \"decimals\" | \"programId\">;\n  mintAAmount: BN;\n  mintBAmount: BN;\n  startTime: BN;\n  feeConfig: ApiCpmmConfigInfo;\n\n  associatedOnly: boolean;\n  checkCreateATAOwner?: boolean;\n\n  ownerInfo: {\n    feePayer?: PublicKey;\n    useSOLBalance?: boolean; // if has WSOL mint\n  };\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txVersion?: T;\n  txTipConfig?: TxTipConfig;\n  feePayer?: PublicKey;\n  feeOn: FeeOn;\n}\n\nexport interface CreateCpmmPoolAddress {\n  poolId: PublicKey;\n  configId: PublicKey;\n  authority: PublicKey;\n  lpMint: PublicKey;\n  vaultA: PublicKey;\n  vaultB: PublicKey;\n  observationId: PublicKey;\n  mintA: ApiV3Token;\n  mintB: ApiV3Token;\n  programId: PublicKey;\n  poolFeeAccount: PublicKey;\n  feeConfig: ApiCpmmConfigInfo;\n}\n\nexport interface AddCpmmLiquidityParams<T = TxVersion.LEGACY> {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  poolKeys?: CpmmKeys;\n  payer?: PublicKey;\n  inputAmount: BN;\n  baseIn: boolean;\n  slippage: Percent;\n  config?: {\n    bypassAssociatedCheck?: boolean;\n    checkCreateATAOwner?: boolean;\n  };\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  computeResult?: {\n    inputAmountFee: GetTransferAmountFee;\n    anotherAmount: GetTransferAmountFee;\n    maxAnotherAmount: GetTransferAmountFee;\n    liquidity: BN;\n  };\n  feePayer?: PublicKey;\n}\n\nexport interface WithdrawCpmmLiquidityParams<T = TxVersion.LEGACY> {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  poolKeys?: CpmmKeys;\n  payer?: PublicKey;\n  lpAmount: BN;\n  slippage: Percent;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n  closeWsol?: boolean;\n}\n\nexport interface CpmmSwapParams<T = TxVersion.LEGACY> {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  poolKeys?: CpmmKeys;\n  payer?: PublicKey;\n  baseIn: boolean;\n  fixedOut?: boolean;\n  slippage?: number;\n  swapResult: Pick<SwapResult, \"inputAmount\" | \"outputAmount\">;\n  inputAmount: BN;\n\n  config?: {\n    bypassAssociatedCheck?: boolean;\n    checkCreateATAOwner?: boolean;\n    associatedOnly?: boolean;\n  };\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  feePayer?: PublicKey;\n}\n\nexport interface ComputePairAmountParams {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  baseReserve: BN;\n  quoteReserve: BN;\n  amount: string | Decimal;\n  slippage: Percent;\n  epochInfo: EpochInfo;\n  baseIn?: boolean;\n}\n\nexport type CpmmParsedRpcData = ReturnType<typeof CpmmPoolInfoLayout.decode> & {\n  baseReserve: BN;\n  quoteReserve: BN;\n  vaultAAmount: BN;\n  vaultBAmount: BN;\n  configInfo?: ReturnType<typeof CpmmConfigInfoLayout.decode>;\n  poolPrice: Decimal;\n  programId: PublicKey;\n};\n\nexport type CpmmComputeData = {\n  id: PublicKey;\n  version: 7;\n  configInfo: ReturnType<typeof CpmmConfigInfoLayout.decode>;\n  mintA: ApiV3Token;\n  mintB: ApiV3Token;\n  authority: PublicKey;\n} & Omit<CpmmParsedRpcData, \"configInfo\" | \"mintA\" | \"mintB\">;\n\nexport type CpmmLockExtInfo = {\n  nftMint: PublicKey;\n  nftAccount: PublicKey;\n  metadataAccount: PublicKey;\n  lockPda: PublicKey;\n  userLpVault: PublicKey;\n  lockLpVault: PublicKey;\n};\n\nexport interface LockCpmmLpParams<T = TxVersion.LEGACY> {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  poolKeys?: CpmmKeys;\n  lpAmount: BN;\n  programId?: PublicKey;\n  authProgram?: PublicKey;\n  feePayer?: PublicKey;\n  feeNftOwner?: PublicKey;\n  withMetadata?: boolean;\n  getEphemeralSigners?: (k: number) => any;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n}\n\nexport interface HarvestLockCpmmLpParams<T = TxVersion.LEGACY> {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  poolKeys?: CpmmKeys;\n\n  nftMint: PublicKey;\n  lpFeeAmount: BN;\n\n  programId?: PublicKey;\n  authProgram?: PublicKey;\n  clmmProgram?: PublicKey;\n\n  cpmmProgram?: {\n    programId?: PublicKey;\n    authProgram?: PublicKey;\n  };\n\n  feePayer?: PublicKey;\n\n  withMetadata?: boolean;\n  getEphemeralSigners?: (k: number) => any;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n  closeWsol?: boolean;\n}\n\nexport interface HarvestMultiLockCpmmLpParams<T = TxVersion.LEGACY> {\n  lockInfo: {\n    poolInfo: ApiV3PoolInfoStandardItemCpmm;\n    poolKeys?: CpmmKeys;\n    nftMint: PublicKey;\n    lpFeeAmount: BN;\n  }[];\n\n  programId?: PublicKey;\n  authProgram?: PublicKey;\n  clmmProgram?: PublicKey;\n\n  cpmmProgram?: {\n    programId?: PublicKey;\n    authProgram?: PublicKey;\n  };\n\n  feePayer?: PublicKey;\n  withMetadata?: boolean;\n  getEphemeralSigners?: (k: number) => any;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txVersion?: T;\n  closeWsol?: boolean;\n}\n\nexport interface CpmmLockNftBasicInfo {\n  name: string;\n  symbol: string;\n  description: string;\n  external_url: string;\n  collection: {\n    name: string;\n    family: string;\n  };\n  image: string;\n}\n\nexport interface CpmmLockNftInfo extends CpmmLockNftBasicInfo {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  positionInfo: {\n    percentage: number;\n    usdValue: number;\n    unclaimedFee: {\n      lp: number;\n      amountA: number;\n      amountB: number;\n      useValue: number;\n    };\n  };\n}\n\nexport interface CollectCreatorFees<T = TxVersion.LEGACY> {\n  poolInfo: ApiV3PoolInfoStandardItemCpmm;\n  poolKeys?: CpmmKeys;\n\n  programId?: PublicKey;\n  feePayer?: PublicKey;\n  associatedOnly?: boolean;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n}\n\nexport interface CollectMultiCreatorFees<T = TxVersion.LEGACY> {\n  poolInfoList: ApiV3PoolInfoStandardItemCpmm[];\n  poolKeyList?: CpmmKeys[];\n\n  programId?: PublicKey;\n  feePayer?: PublicKey;\n  associatedOnly?: boolean;\n  computeBudgetConfig?: ComputeBudgetConfig;\n  txTipConfig?: TxTipConfig;\n  txVersion?: T;\n}\n\nexport enum FeeOn {\n  BothToken,\n  OnlyTokenA,\n  OnlyTokenB,\n}\n"],"mappings":"AA6RO,GAAK,GAAL,CAAK,GACV,8BACA,+BACA,+BAHU","names":[]}