@gabox-labs/sdk 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
2
  import { Dt as POOL_DISCRIMINATOR, Et as getWalletActivitySize, Jt as getDrawSize, Lt as getPoolSize, Ot as decodePool, Rt as DRAW_DISCRIMINATOR, _t as decodeWalletActivity, ft as findPoolPda, ht as findActivityPda, mt as findDrawPda, pt as findIdentityPda, t as GABOX_PROGRAM_ADDRESS, zt as decodeDraw } from "./gabox-DGTCh34U.js";
3
- import { AccountRole, Endian, addEncoderSizePrefix, appendTransactionMessageInstructions, compileTransaction, compressTransactionMessageUsingAddressLookupTables, createTransactionMessage, fetchEncodedAccount, fixDecoderSize, getAddressDecoder, getAddressEncoder, getBase58Decoder, getBase64Encoder, getBooleanDecoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getTransactionEncoder, getU16Decoder, getU16Encoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, getUtf8Encoder, pipe, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash } from "@solana/kit";
3
+ import { AccountRole, Endian, addEncoderSizePrefix, appendTransactionMessageInstructions, compileTransaction, compressTransactionMessageUsingAddressLookupTables, createTransactionMessage, fetchEncodedAccount, fixDecoderSize, getAddressDecoder, getAddressEncoder, getBase58Decoder, getBase64Encoder, getBooleanDecoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getTransactionEncoder, getU128Decoder, getU16Decoder, getU16Encoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, getUtf8Encoder, pipe, setTransactionMessageFeePayerSigner, setTransactionMessageLifetimeUsingBlockhash } from "@solana/kit";
4
4
  import { getCloseAccountInstruction, getCreateAssociatedTokenIdempotentInstruction } from "@solana-program/token";
5
5
  //#region src/raydium/abi.ts
6
6
  const RAYDIUM_MAINNET_IDS = {
@@ -603,6 +603,69 @@ const LAUNCHLAB_CLAIM_CREATOR_FEE = {
603
603
  ]
604
604
  };
605
605
  /**
606
+ * `claim_platform_fee_from_vault` on `LanMV9sAd7wArD4vJFi2qDdfnVhFxYSUg6eADduJ3uj` — not in interfaces.json (the program never builds it).
607
+ */
608
+ const LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT = {
609
+ name: "claim_platform_fee_from_vault",
610
+ discriminator: new Uint8Array([
611
+ 117,
612
+ 241,
613
+ 198,
614
+ 168,
615
+ 248,
616
+ 218,
617
+ 80,
618
+ 29
619
+ ]),
620
+ accounts: [
621
+ {
622
+ name: "platform_fee_wallet",
623
+ writable: true,
624
+ signer: true
625
+ },
626
+ {
627
+ name: "fee_vault_authority",
628
+ writable: false,
629
+ signer: false
630
+ },
631
+ {
632
+ name: "platform_config",
633
+ writable: false,
634
+ signer: false
635
+ },
636
+ {
637
+ name: "platform_fee_vault",
638
+ writable: true,
639
+ signer: false
640
+ },
641
+ {
642
+ name: "recipient_token_account",
643
+ writable: true,
644
+ signer: false
645
+ },
646
+ {
647
+ name: "quote_mint",
648
+ writable: false,
649
+ signer: false
650
+ },
651
+ {
652
+ name: "token_program",
653
+ writable: false,
654
+ signer: false
655
+ },
656
+ {
657
+ name: "system_program",
658
+ writable: false,
659
+ signer: false
660
+ },
661
+ {
662
+ name: "associated_token_program",
663
+ writable: false,
664
+ signer: false
665
+ }
666
+ ]
667
+ };
668
+ /**
606
669
  * `swap_base_output` on `CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C` — cross-checked against interfaces.json.
607
670
  */
608
671
  const CPMM_SWAP_BASE_OUTPUT = {
@@ -878,6 +941,14 @@ const CPMM_COLLECT_CREATOR_FEE = {
878
941
  * `test/raydium-pdas.test.ts` derives each PDA again and compares.
879
942
  */
880
943
  const ADDRESS_ENCODER = getAddressEncoder();
944
+ const LOCK_MAINNET_IDS = {
945
+ lock: "LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE",
946
+ lockAuthority: "3f7GcQFG397GAaEnv51zR6tsTVihYRydnydDD1cXekxH"
947
+ };
948
+ const LOCK_DEVNET_IDS = {
949
+ lock: "DRay25Usp3YJAi7beckgpGUC7mGJ2cR1AVPxhYfwVCUX",
950
+ lockAuthority: "7qWVV8UY2bRJfDLP4s37YzBPKUkVB46DStYJBpYbQzu3"
951
+ };
881
952
  /**
882
953
  * The decimals every Gabox coin is launched with. `venue/launch.rs` refuses any other value, and
883
954
  * `tokens.rs` refuses a pool mint that does not have exactly this many.
@@ -891,9 +962,18 @@ const LAUNCH_DECIMALS = 6;
891
962
  * feature is what swaps them. Pass your own ids to a builder if your validator clones devnet.
892
963
  */
893
964
  const RAYDIUM_IDS = {
894
- "mainnet-beta": RAYDIUM_MAINNET_IDS,
895
- devnet: RAYDIUM_DEVNET_IDS,
896
- localnet: RAYDIUM_MAINNET_IDS
965
+ "mainnet-beta": {
966
+ ...RAYDIUM_MAINNET_IDS,
967
+ ...LOCK_MAINNET_IDS
968
+ },
969
+ devnet: {
970
+ ...RAYDIUM_DEVNET_IDS,
971
+ ...LOCK_DEVNET_IDS
972
+ },
973
+ localnet: {
974
+ ...RAYDIUM_MAINNET_IDS,
975
+ ...LOCK_MAINNET_IDS
976
+ }
897
977
  };
898
978
  /** The Raydium deployment one cluster trades on. Throws for a cluster this SDK does not know. */
899
979
  function raydiumIds(cluster) {
@@ -916,7 +996,9 @@ const LAUNCHLAB_SEEDS = {
916
996
  /** `["pool_vault", pool_state, mint]`. */
917
997
  vault: "pool_vault",
918
998
  /** `["creator_fee_vault_auth_seed"]`, the authority over every creator fee vault. */
919
- creatorFeeVaultAuthority: "creator_fee_vault_auth_seed"
999
+ creatorFeeVaultAuthority: "creator_fee_vault_auth_seed",
1000
+ /** `["platform_fee_vault_auth_seed"]`, the authority over every platform fee vault. */
1001
+ platformFeeVaultAuthority: "platform_fee_vault_auth_seed"
920
1002
  };
921
1003
  /** CPMM's PDA seeds. */
922
1004
  const CPMM_SEEDS = {
@@ -931,6 +1013,15 @@ const CPMM_SEEDS = {
931
1013
  /** `["creator_fee_share", creator, amm_config]`. */
932
1014
  creatorFeeShare: "creator_fee_share"
933
1015
  };
1016
+ /** The SPL Memo program. The lock program's `collect_cp_fees` lists it and never writes to it. */
1017
+ const MEMO_PROGRAM_ADDRESS = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
1018
+ /** The lock program's PDA seeds. */
1019
+ const LOCK_SEEDS = {
1020
+ /** `["lock_cp_authority_seed"]`. */
1021
+ authority: "lock_cp_authority_seed",
1022
+ /** `["locked_liquidity", fee_nft_mint]`. One record per locked position. */
1023
+ lockedLiquidity: "locked_liquidity"
1024
+ };
934
1025
  /** Metaplex's metadata PDA seed: `["metadata", metaplex, mint]`. */
935
1026
  const METADATA_SEED = "metadata";
936
1027
  /**
@@ -1337,6 +1428,11 @@ const platformFeeVaultAddress = async (launchlab, platformConfig, quoteMint) =>
1337
1428
  const creatorFeeVaultAddress = async (launchlab, creator, quoteMint) => await derive(launchlab, [address$1.encode(creator), address$1.encode(quoteMint)]);
1338
1429
  /** `["creator_fee_vault_auth_seed"]`. The authority `claim_creator_fee` signs the payout with. */
1339
1430
  const creatorFeeVaultAuthority = async (launchlab) => await derive(launchlab, [utf8.encode(LAUNCHLAB_SEEDS.creatorFeeVaultAuthority)]);
1431
+ /**
1432
+ * `["platform_fee_vault_auth_seed"]`. The authority `claim_platform_fee_from_vault` signs the
1433
+ * payout with.
1434
+ */
1435
+ const platformFeeVaultAuthority = async (launchlab) => await derive(launchlab, [utf8.encode(LAUNCHLAB_SEEDS.platformFeeVaultAuthority)]);
1340
1436
  /** `["metadata", metaplex, mint]` under Metaplex. LaunchLab's create instruction writes it. */
1341
1437
  const metadataAddress = async (mint) => await derive(METAPLEX_PROGRAM_ADDRESS, [
1342
1438
  utf8.encode(METADATA_SEED),
@@ -1379,6 +1475,13 @@ const cpmmCreatorFeeShare = async (cpmm, creator, ammConfig) => await derive(cpm
1379
1475
  address$1.encode(creator),
1380
1476
  address$1.encode(ammConfig)
1381
1477
  ]);
1478
+ /** `["lock_cp_authority_seed"]`. The lock program's authority, which owns every locked LP vault. */
1479
+ const lockAuthority = async (lock) => await derive(lock, [utf8.encode(LOCK_SEEDS.authority)]);
1480
+ /**
1481
+ * `["locked_liquidity", fee_nft_mint]`. The record of one locked position: which pool, how much LP,
1482
+ * and the checkpoint the next fee harvest is measured from.
1483
+ */
1484
+ const lockedLiquidityAddress = async (lock, feeNftMint) => await derive(lock, [utf8.encode(LOCK_SEEDS.lockedLiquidity), address$1.encode(feeNftMint)]);
1382
1485
  /** An associated token account. Off-curve owners are allowed: pool PDAs are all off-curve. */
1383
1486
  const ata = async (owner, mint, tokenProgram = TOKEN_PROGRAM_ADDRESS) => await derive(ASSOCIATED_TOKEN_PROGRAM_ADDRESS, [
1384
1487
  address$1.encode(owner),
@@ -1440,7 +1543,8 @@ const vaultAddress = async (mint) => await associatedTokenAddress(await poolAddr
1440
1543
  const DISCRIMINATOR$1 = 8;
1441
1544
  const u8 = getU8Decoder();
1442
1545
  const u16 = getU16Decoder();
1443
- const u64$1 = getU64Decoder();
1546
+ const u64$2 = getU64Decoder();
1547
+ const u128 = getU128Decoder();
1444
1548
  const addressAt = getAddressDecoder();
1445
1549
  const bool = getBooleanDecoder();
1446
1550
  /** Refuse an account that is too short or carries another type's discriminator. */
@@ -1462,7 +1566,7 @@ function atLeast(data, size, what) {
1462
1566
  */
1463
1567
  function tokenAccountAmount(data) {
1464
1568
  if (data.length < 72) throw new Error("not a token account: fewer than 72 bytes");
1465
- return u64$1.decode(data, 64);
1569
+ return u64$2.decode(data, 64);
1466
1570
  }
1467
1571
  /** The `mint` and `owner` of an SPL token account: bytes 0 to 32 and 32 to 64. */
1468
1572
  function tokenAccountOwnerAndMint(data) {
@@ -1542,27 +1646,27 @@ function token2022Symbol(data) {
1542
1646
  }
1543
1647
  /** Offsets follow the `PoolState` field list in `idl/raydium_launchpad.json`. */
1544
1648
  const LAUNCHLAB_POOL_HEAD = getStructDecoder([
1545
- ["epoch", u64$1],
1649
+ ["epoch", u64$2],
1546
1650
  ["authBump", u8],
1547
1651
  ["status", u8],
1548
1652
  ["baseDecimals", u8],
1549
1653
  ["quoteDecimals", u8],
1550
1654
  ["migrateType", u8],
1551
- ["supply", u64$1],
1552
- ["totalBaseSell", u64$1],
1553
- ["virtualBase", u64$1],
1554
- ["virtualQuote", u64$1],
1555
- ["realBase", u64$1],
1556
- ["realQuote", u64$1],
1557
- ["totalQuoteFundRaising", u64$1],
1558
- ["quoteProtocolFee", u64$1],
1559
- ["platformFee", u64$1],
1560
- ["migrateFee", u64$1],
1561
- ["vestingTotalLockedAmount", u64$1],
1562
- ["vestingCliffPeriod", u64$1],
1563
- ["vestingUnlockPeriod", u64$1],
1564
- ["vestingStartTime", u64$1],
1565
- ["vestingAllocatedShareAmount", u64$1],
1655
+ ["supply", u64$2],
1656
+ ["totalBaseSell", u64$2],
1657
+ ["virtualBase", u64$2],
1658
+ ["virtualQuote", u64$2],
1659
+ ["realBase", u64$2],
1660
+ ["realQuote", u64$2],
1661
+ ["totalQuoteFundRaising", u64$2],
1662
+ ["quoteProtocolFee", u64$2],
1663
+ ["platformFee", u64$2],
1664
+ ["migrateFee", u64$2],
1665
+ ["vestingTotalLockedAmount", u64$2],
1666
+ ["vestingCliffPeriod", u64$2],
1667
+ ["vestingUnlockPeriod", u64$2],
1668
+ ["vestingStartTime", u64$2],
1669
+ ["vestingAllocatedShareAmount", u64$2],
1566
1670
  ["globalConfig", addressAt],
1567
1671
  ["platformConfig", addressAt],
1568
1672
  ["baseMint", addressAt],
@@ -1603,17 +1707,17 @@ function decodeLaunchlabPool(data) {
1603
1707
  };
1604
1708
  }
1605
1709
  const LAUNCHLAB_GLOBAL_CONFIG_HEAD = getStructDecoder([
1606
- ["epoch", u64$1],
1710
+ ["epoch", u64$2],
1607
1711
  ["curveType", u8],
1608
1712
  ["index", u16],
1609
- ["migrateFee", u64$1],
1610
- ["tradeFeeRate", u64$1],
1611
- ["maxShareFeeRate", u64$1],
1612
- ["minBaseSupply", u64$1],
1613
- ["maxLockRate", u64$1],
1614
- ["minBaseSellRate", u64$1],
1615
- ["minBaseMigrateRate", u64$1],
1616
- ["minQuoteFundRaising", u64$1],
1713
+ ["migrateFee", u64$2],
1714
+ ["tradeFeeRate", u64$2],
1715
+ ["maxShareFeeRate", u64$2],
1716
+ ["minBaseSupply", u64$2],
1717
+ ["maxLockRate", u64$2],
1718
+ ["minBaseSellRate", u64$2],
1719
+ ["minBaseMigrateRate", u64$2],
1720
+ ["minQuoteFundRaising", u64$2],
1617
1721
  ["quoteMint", addressAt]
1618
1722
  ]);
1619
1723
  const LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE = 115;
@@ -1635,13 +1739,13 @@ function decodeLaunchlabGlobalConfig(data) {
1635
1739
  * are fixed byte arrays, so this is the same length for every platform.
1636
1740
  */
1637
1741
  const LAUNCHLAB_PLATFORM_CONFIG_HEAD = getStructDecoder([
1638
- ["epoch", u64$1],
1742
+ ["epoch", u64$2],
1639
1743
  ["platformFeeWallet", addressAt],
1640
1744
  ["platformNftWallet", addressAt],
1641
- ["platformScale", u64$1],
1642
- ["creatorScale", u64$1],
1643
- ["burnScale", u64$1],
1644
- ["feeRate", u64$1]
1745
+ ["platformScale", u64$2],
1746
+ ["creatorScale", u64$2],
1747
+ ["burnScale", u64$2],
1748
+ ["feeRate", u64$2]
1645
1749
  ]);
1646
1750
  const PLATFORM_CPSWAP_CONFIG_OFFSET = 688;
1647
1751
  const PLATFORM_CREATOR_FEE_RATE_OFFSET = 720;
@@ -1655,7 +1759,7 @@ function decodeLaunchlabPlatformConfig(data) {
1655
1759
  return {
1656
1760
  platformFeeWallet: head.platformFeeWallet,
1657
1761
  feeRate: head.feeRate,
1658
- creatorFeeRate: u64$1.decode(data, PLATFORM_CREATOR_FEE_RATE_OFFSET),
1762
+ creatorFeeRate: u64$2.decode(data, PLATFORM_CREATOR_FEE_RATE_OFFSET),
1659
1763
  cpswapConfig: addressAt.decode(data, PLATFORM_CPSWAP_CONFIG_OFFSET),
1660
1764
  platformCpCreator: addressAt.decode(data, PLATFORM_CP_CREATOR_OFFSET)
1661
1765
  };
@@ -1676,18 +1780,18 @@ const CPMM_POOL_HEAD = getStructDecoder([
1676
1780
  ["lpMintDecimals", u8],
1677
1781
  ["mint0Decimals", u8],
1678
1782
  ["mint1Decimals", u8],
1679
- ["lpSupply", u64$1],
1680
- ["protocolFeesToken0", u64$1],
1681
- ["protocolFeesToken1", u64$1],
1682
- ["fundFeesToken0", u64$1],
1683
- ["fundFeesToken1", u64$1],
1684
- ["openTime", u64$1],
1685
- ["recentEpoch", u64$1],
1783
+ ["lpSupply", u64$2],
1784
+ ["protocolFeesToken0", u64$2],
1785
+ ["protocolFeesToken1", u64$2],
1786
+ ["fundFeesToken0", u64$2],
1787
+ ["fundFeesToken1", u64$2],
1788
+ ["openTime", u64$2],
1789
+ ["recentEpoch", u64$2],
1686
1790
  ["creatorFeeOn", u8],
1687
1791
  ["enableCreatorFee", bool],
1688
1792
  ["padding1", fixDecoderSize(getBytesDecoder(), 6)],
1689
- ["creatorFeesToken0", u64$1],
1690
- ["creatorFeesToken1", u64$1]
1793
+ ["creatorFeesToken0", u64$2],
1794
+ ["creatorFeesToken1", u64$2]
1691
1795
  ]);
1692
1796
  const CPMM_POOL_STATE_HEAD_SIZE = 413;
1693
1797
  /**
@@ -1715,12 +1819,14 @@ function decodeCpmmPool(data) {
1715
1819
  poolCreator: head.poolCreator,
1716
1820
  token0Vault: head.token0Vault,
1717
1821
  token1Vault: head.token1Vault,
1822
+ lpMint: head.lpMint,
1718
1823
  token0Mint: head.token0Mint,
1719
1824
  token1Mint: head.token1Mint,
1720
1825
  token0Program: head.token0Program,
1721
1826
  token1Program: head.token1Program,
1722
1827
  observationKey: head.observationKey,
1723
1828
  status: head.status,
1829
+ lpSupply: head.lpSupply,
1724
1830
  mint0Decimals: head.mint0Decimals,
1725
1831
  mint1Decimals: head.mint1Decimals,
1726
1832
  protocolFeesToken0: head.protocolFeesToken0,
@@ -1738,13 +1844,13 @@ const CPMM_AMM_CONFIG_HEAD = getStructDecoder([
1738
1844
  ["bump", u8],
1739
1845
  ["disableCreatePool", bool],
1740
1846
  ["index", u16],
1741
- ["tradeFeeRate", u64$1],
1742
- ["protocolFeeRate", u64$1],
1743
- ["fundFeeRate", u64$1],
1744
- ["createPoolFee", u64$1],
1847
+ ["tradeFeeRate", u64$2],
1848
+ ["protocolFeeRate", u64$2],
1849
+ ["fundFeeRate", u64$2],
1850
+ ["createPoolFee", u64$2],
1745
1851
  ["protocolOwner", addressAt],
1746
1852
  ["fundOwner", addressAt],
1747
- ["creatorFeeRate", u64$1]
1853
+ ["creatorFeeRate", u64$2]
1748
1854
  ]);
1749
1855
  const CPMM_AMM_CONFIG_HEAD_SIZE = 116;
1750
1856
  function decodeCpmmAmmConfig(data) {
@@ -1760,6 +1866,36 @@ function decodeCpmmAmmConfig(data) {
1760
1866
  creatorFeeRate: head.creatorFeeRate
1761
1867
  };
1762
1868
  }
1869
+ /** `sha256("account:LockedCpLiquidityState")[0..8]`. */
1870
+ const LOCKED_CP_LIQUIDITY_DISCRIMINATOR = new Uint8Array([
1871
+ 25,
1872
+ 10,
1873
+ 238,
1874
+ 197,
1875
+ 207,
1876
+ 234,
1877
+ 73,
1878
+ 22
1879
+ ]);
1880
+ const LOCKED_CP_LIQUIDITY = getStructDecoder([
1881
+ ["lockedLpAmount", u64$2],
1882
+ ["claimedLpAmount", u64$2],
1883
+ ["unclaimedLpAmount", u64$2],
1884
+ ["lastLp", u64$2],
1885
+ ["lastK", u128],
1886
+ ["recentEpoch", u64$2],
1887
+ ["poolId", addressAt],
1888
+ ["feeNftMint", addressAt],
1889
+ ["lockedOwner", addressAt],
1890
+ ["lockedLpMint", addressAt]
1891
+ ]);
1892
+ /** Six numbers and four addresses after the discriminator. The account itself is 256 bytes. */
1893
+ const LOCKED_CP_LIQUIDITY_HEAD_SIZE = 192;
1894
+ function decodeLockedCpLiquidity(data) {
1895
+ checked(data, LOCKED_CP_LIQUIDITY_DISCRIMINATOR, "locked liquidity record");
1896
+ atLeast(data, 192, "locked liquidity record");
1897
+ return LOCKED_CP_LIQUIDITY.decode(data, DISCRIMINATOR$1);
1898
+ }
1763
1899
  //#endregion
1764
1900
  //#region src/accounts.ts
1765
1901
  /** Account readers and bounded discovery scans. Old pool layouts are intentionally unsupported. */
@@ -1936,6 +2072,15 @@ const REDEEM_COMPUTE_UNITS = 125e3;
1936
2072
  * on a pool quoted in another token is cheaper, `17,635`, because nothing has to be unwrapped.
1937
2073
  */
1938
2074
  const CLAIM_COMPUTE_UNITS = 55e3;
2075
+ /**
2076
+ * A harvest of one locked CPMM position: `collect_cp_fees` on the lock program, which withdraws
2077
+ * LP through CPMM and pays both sides out.
2078
+ *
2079
+ * Measured at `102,221` on devnet on 2026-09-19 (tx `5s7xvy23…`), with both token accounts
2080
+ * created in the same transaction and the WSOL one closed again. `82,697` of that is the lock
2081
+ * program itself.
2082
+ */
2083
+ const HARVEST_COMPUTE_UNITS = 15e4;
1939
2084
  /** `ComputeBudgetInstruction`'s discriminants. Positional and append-only upstream. */
1940
2085
  const SET_COMPUTE_UNIT_LIMIT = 2;
1941
2086
  const SET_COMPUTE_UNIT_PRICE = 3;
@@ -2894,7 +3039,7 @@ async function getLaunchInstruction(input, ids) {
2894
3039
  * WSOL into SOL, so it only belongs on a WSOL claim: closing a USDC account would throw the payout
2895
3040
  * away.
2896
3041
  */
2897
- async function wrapAround(creator, quote, middle) {
3042
+ async function wrapAround$1(creator, quote, middle) {
2898
3043
  const account = await ata(creator.address, quote.mint, quote.tokenProgram);
2899
3044
  const create = getCreateAssociatedTokenIdempotentInstruction({
2900
3045
  payer: creator,
@@ -2915,7 +3060,7 @@ async function wrapAround(creator, quote, middle) {
2915
3060
  ];
2916
3061
  }
2917
3062
  /** Attach a signer to the one slot the ABI marks as signing. Roles never change here. */
2918
- function withSigner(accounts, signer) {
3063
+ function withSigner$1(accounts, signer) {
2919
3064
  return accounts.map((meta) => (meta.role === AccountRole.READONLY_SIGNER || meta.role === AccountRole.WRITABLE_SIGNER) && meta.address === signer.address ? {
2920
3065
  ...meta,
2921
3066
  signer
@@ -2930,9 +3075,9 @@ function withSigner(accounts, signer) {
2930
3075
  * two quote assets claims once per asset.
2931
3076
  */
2932
3077
  async function getClaimCreatorFeeInstructions(creator, ids, quote) {
2933
- return await wrapAround(creator, quote, [{
3078
+ return await wrapAround$1(creator, quote, [{
2934
3079
  programAddress: ids.launchlab,
2935
- accounts: withSigner(order(LAUNCHLAB_CLAIM_CREATOR_FEE, {
3080
+ accounts: withSigner$1(order(LAUNCHLAB_CLAIM_CREATOR_FEE, {
2936
3081
  creator: creator.address,
2937
3082
  fee_vault_authority: await creatorFeeVaultAuthority(ids.launchlab),
2938
3083
  creator_fee_vault: await creatorFeeVaultAddress(ids.launchlab, creator.address, quote.mint),
@@ -2953,7 +3098,7 @@ async function getClaimCreatorFeeInstructions(creator, ids, quote) {
2953
3098
  */
2954
3099
  async function claimCreatorFee(client, input) {
2955
3100
  const ids = raydiumIds(client.cluster);
2956
- const quote = await quoteOf(client, input.quoteMint ?? "So11111111111111111111111111111111111111112");
3101
+ const quote = await quoteOf$1(client, input.quoteMint ?? "So11111111111111111111111111111111111111112");
2957
3102
  const instructions = await getClaimCreatorFeeInstructions(input.creator, ids, quote);
2958
3103
  return await buildMessage(client, input.creator, instructions, {
2959
3104
  addressLookupTables: input.addressLookupTables,
@@ -2965,7 +3110,7 @@ async function claimCreatorFee(client, input) {
2965
3110
  * The token program a quote mint lives under. WSOL is always classic SPL Token, so that one needs
2966
3111
  * no read at all.
2967
3112
  */
2968
- async function quoteOf(client, mint) {
3113
+ async function quoteOf$1(client, mint) {
2969
3114
  if (mint === "So11111111111111111111111111111111111111112") return {
2970
3115
  mint,
2971
3116
  tokenProgram: TOKEN_PROGRAM_ADDRESS
@@ -2996,7 +3141,7 @@ async function getCollectCreatorFeeInstructions(client, input, ids = raydiumIds(
2996
3141
  });
2997
3142
  const collect = {
2998
3143
  programAddress: ids.cpmm,
2999
- accounts: withSigner(order(CPMM_COLLECT_CREATOR_FEE, {
3144
+ accounts: withSigner$1(order(CPMM_COLLECT_CREATOR_FEE, {
3000
3145
  creator: creator.address,
3001
3146
  authority: ids.cpmmAuthority,
3002
3147
  pool_state: poolState,
@@ -3015,7 +3160,7 @@ async function getCollectCreatorFeeInstructions(client, input, ids = raydiumIds(
3015
3160
  }), creator),
3016
3161
  data: new Uint8Array(CPMM_COLLECT_CREATOR_FEE.discriminator)
3017
3162
  };
3018
- return await wrapAround(creator, {
3163
+ return await wrapAround$1(creator, {
3019
3164
  mint: quote.mint,
3020
3165
  tokenProgram: quote.tokenProgram
3021
3166
  }, [collect]);
@@ -3086,6 +3231,400 @@ async function fetchCreatorFees(client, input) {
3086
3231
  }
3087
3232
  }
3088
3233
  //#endregion
3234
+ //#region src/raydium/platform.ts
3235
+ /**
3236
+ * Collecting the platform's share of trading.
3237
+ *
3238
+ * Gabox charges no fee of its own. The platform's income is the share Raydium pays out of its own
3239
+ * revenue, and it sits in two different places depending on where a coin trades:
3240
+ *
3241
+ * - **On the curve.** LaunchLab pays 0.5% of every trade into `[platform_config, quote_mint]`
3242
+ * under LaunchLab. One vault per quote asset for the whole platform, not one per coin, so a
3243
+ * single `claim_platform_fee_from_vault` sweeps every coin on that quote. Only the wallet the
3244
+ * platform config names as `platform_fee_wallet` can sign it.
3245
+ * - **After graduation.** LaunchLab moves the whole pool into a CPMM pool and locks 100% of the
3246
+ * LP under Raydium's lock program. The lock mints one fee NFT to the platform NFT wallet. The
3247
+ * LP earns the pool's trade fee, and `collect_cp_fees` on the lock program pays the NFT holder
3248
+ * that growth. One position per graduated coin, so it takes one call per coin.
3249
+ *
3250
+ * Both flows pay into the signer's associated token account. When a side is WSOL, the builders
3251
+ * close that account afterwards, so the wallet ends up with plain SOL. Any other token is created if
3252
+ * missing and left alone, because closing it would throw away a real balance.
3253
+ *
3254
+ * **Closing unwraps everything.** If the wallet already held WSOL in that account, closing turns it
3255
+ * into SOL too. Nothing is lost, but the balance moves.
3256
+ */
3257
+ const u64$1 = getU64Encoder();
3258
+ /**
3259
+ * Create the signer's token account for one mint, if it is missing, and close it again when the
3260
+ * mint is WSOL. The close is what turns WSOL into SOL, so it only belongs on a WSOL side.
3261
+ */
3262
+ async function wrapAround(signer, sides, middle) {
3263
+ const before = [];
3264
+ const after = [];
3265
+ for (const side of sides) {
3266
+ const account = await ata(signer.address, side.mint, side.tokenProgram);
3267
+ before.push(getCreateAssociatedTokenIdempotentInstruction({
3268
+ payer: signer,
3269
+ ata: account,
3270
+ owner: signer.address,
3271
+ mint: side.mint,
3272
+ tokenProgram: side.tokenProgram
3273
+ }));
3274
+ if (side.mint === "So11111111111111111111111111111111111111112") after.push(getCloseAccountInstruction({
3275
+ account,
3276
+ destination: signer.address,
3277
+ owner: signer
3278
+ }));
3279
+ }
3280
+ return [
3281
+ ...before,
3282
+ ...middle,
3283
+ ...after
3284
+ ];
3285
+ }
3286
+ /** Attach a signer to the one slot the ABI marks as signing. Roles never change here. */
3287
+ function withSigner(accounts, signer) {
3288
+ return accounts.map((meta) => (meta.role === AccountRole.READONLY_SIGNER || meta.role === AccountRole.WRITABLE_SIGNER) && meta.address === signer.address ? {
3289
+ ...meta,
3290
+ signer
3291
+ } : meta);
3292
+ }
3293
+ /**
3294
+ * The token program a quote mint lives under. WSOL is always classic SPL Token, so that one needs
3295
+ * no read at all.
3296
+ */
3297
+ async function quoteOf(client, mint) {
3298
+ if (mint === "So11111111111111111111111111111111111111112") return {
3299
+ mint,
3300
+ tokenProgram: TOKEN_PROGRAM_ADDRESS
3301
+ };
3302
+ return {
3303
+ mint,
3304
+ tokenProgram: (await fetchQuoteDisplay(client, mint)).tokenProgram
3305
+ };
3306
+ }
3307
+ /**
3308
+ * The instructions of a platform fee claim, for one quote asset: create the quote account, claim,
3309
+ * and close it again when the quote is WSOL.
3310
+ *
3311
+ * This sweeps **every** coin launched against that quote, because LaunchLab keeps one platform
3312
+ * vault per quote asset. `feeWallet` must be the wallet the platform config names, or LaunchLab
3313
+ * refuses the claim.
3314
+ */
3315
+ async function getClaimPlatformFeeInstructions(feeWallet, ids, quote) {
3316
+ const claim = {
3317
+ programAddress: ids.launchlab,
3318
+ accounts: withSigner(order(LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT, {
3319
+ platform_fee_wallet: feeWallet.address,
3320
+ fee_vault_authority: await platformFeeVaultAuthority(ids.launchlab),
3321
+ platform_config: ids.gaboxPlatform,
3322
+ platform_fee_vault: await platformFeeVaultAddress(ids.launchlab, ids.gaboxPlatform, quote.mint),
3323
+ recipient_token_account: await ata(feeWallet.address, quote.mint, quote.tokenProgram),
3324
+ quote_mint: quote.mint,
3325
+ token_program: quote.tokenProgram,
3326
+ system_program: SYSTEM_PROGRAM_ADDRESS,
3327
+ associated_token_program: ASSOCIATED_TOKEN_PROGRAM_ADDRESS
3328
+ }), feeWallet),
3329
+ data: new Uint8Array(LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT.discriminator)
3330
+ };
3331
+ return await wrapAround(feeWallet, [quote], [claim]);
3332
+ }
3333
+ /**
3334
+ * Claim the curve platform fee for one quote asset.
3335
+ *
3336
+ * A WSOL claim arrives as SOL, because the builder closes the WSOL account. Any other quote arrives
3337
+ * as that token, in the fee wallet's own account.
3338
+ */
3339
+ async function claimPlatformFee(client, input) {
3340
+ const ids = raydiumIds(client.cluster);
3341
+ const quote = await quoteOf(client, input.quoteMint ?? "So11111111111111111111111111111111111111112");
3342
+ const instructions = await getClaimPlatformFeeInstructions(input.feeWallet, ids, quote);
3343
+ return await buildMessage(client, input.feeWallet, instructions, {
3344
+ addressLookupTables: input.addressLookupTables,
3345
+ computeUnitLimit: input.computeUnitLimit ?? 55e3,
3346
+ ...input.computeUnitPrice === void 0 ? {} : { computeUnitPrice: input.computeUnitPrice }
3347
+ });
3348
+ }
3349
+ /**
3350
+ * What the platform can claim from the curve right now, for one quote asset, in base units.
3351
+ *
3352
+ * `quoteMint` defaults to wrapped SOL. One vault per quote asset, so a platform with coins on two
3353
+ * quotes reads this twice. A vault that does not exist yet reads as zero.
3354
+ */
3355
+ async function fetchPlatformFees(client, input = {}) {
3356
+ const ids = raydiumIds(client.cluster);
3357
+ const quoteMint = input.quoteMint ?? "So11111111111111111111111111111111111111112";
3358
+ const vault = await platformFeeVaultAddress(ids.launchlab, ids.gaboxPlatform, quoteMint);
3359
+ const [account] = await readAccounts(client.rpc, [vault]);
3360
+ return {
3361
+ quoteMint,
3362
+ curveQuote: account ? tokenAccountAmount(account.data) : 0n
3363
+ };
3364
+ }
3365
+ /**
3366
+ * `collect_cp_fees` on the lock program. There is no public IDL for it. The account list and the
3367
+ * discriminator come from Raydium's own SDK and from the `pinocchio-raydium-locking-program`
3368
+ * client crate, and the devnet harvest in `test/devnet.e2e.test.ts` runs it.
3369
+ */
3370
+ const LOCK_COLLECT_CP_FEES = {
3371
+ name: "collect_cp_fees",
3372
+ discriminator: new Uint8Array([
3373
+ 8,
3374
+ 30,
3375
+ 51,
3376
+ 199,
3377
+ 209,
3378
+ 184,
3379
+ 247,
3380
+ 133
3381
+ ]),
3382
+ accounts: [
3383
+ {
3384
+ name: "authority",
3385
+ writable: false,
3386
+ signer: false
3387
+ },
3388
+ {
3389
+ name: "fee_nft_owner",
3390
+ writable: false,
3391
+ signer: true
3392
+ },
3393
+ {
3394
+ name: "fee_nft_account",
3395
+ writable: false,
3396
+ signer: false
3397
+ },
3398
+ {
3399
+ name: "locked_liquidity",
3400
+ writable: true,
3401
+ signer: false
3402
+ },
3403
+ {
3404
+ name: "cpmm_program",
3405
+ writable: false,
3406
+ signer: false
3407
+ },
3408
+ {
3409
+ name: "cp_authority",
3410
+ writable: false,
3411
+ signer: false
3412
+ },
3413
+ {
3414
+ name: "pool_state",
3415
+ writable: true,
3416
+ signer: false
3417
+ },
3418
+ {
3419
+ name: "lp_mint",
3420
+ writable: true,
3421
+ signer: false
3422
+ },
3423
+ {
3424
+ name: "recipient_token_0_account",
3425
+ writable: true,
3426
+ signer: false
3427
+ },
3428
+ {
3429
+ name: "recipient_token_1_account",
3430
+ writable: true,
3431
+ signer: false
3432
+ },
3433
+ {
3434
+ name: "token_0_vault",
3435
+ writable: true,
3436
+ signer: false
3437
+ },
3438
+ {
3439
+ name: "token_1_vault",
3440
+ writable: true,
3441
+ signer: false
3442
+ },
3443
+ {
3444
+ name: "vault_0_mint",
3445
+ writable: false,
3446
+ signer: false
3447
+ },
3448
+ {
3449
+ name: "vault_1_mint",
3450
+ writable: false,
3451
+ signer: false
3452
+ },
3453
+ {
3454
+ name: "locked_lp_vault",
3455
+ writable: true,
3456
+ signer: false
3457
+ },
3458
+ {
3459
+ name: "token_program",
3460
+ writable: false,
3461
+ signer: false
3462
+ },
3463
+ {
3464
+ name: "token_program_2022",
3465
+ writable: false,
3466
+ signer: false
3467
+ },
3468
+ {
3469
+ name: "memo_program",
3470
+ writable: false,
3471
+ signer: false
3472
+ }
3473
+ ]
3474
+ };
3475
+ /** Integer square root, rounded down. */
3476
+ function isqrt(value) {
3477
+ if (value < 0n) throw new Error("isqrt of a negative number");
3478
+ if (value < 2n) return value;
3479
+ let x = BigInt(Math.floor(Math.sqrt(Number(value))));
3480
+ for (;;) {
3481
+ const y = x + value / x >> 1n;
3482
+ if (y >= x) break;
3483
+ x = y;
3484
+ }
3485
+ while (x * x > value) x -= 1n;
3486
+ while ((x + 1n) * (x + 1n) <= value) x += 1n;
3487
+ return x;
3488
+ }
3489
+ /**
3490
+ * The LP tokens a locked position may withdraw as fees.
3491
+ *
3492
+ * Every swap leaves its fee in the vaults, so one LP token buys a little more of the pool after
3493
+ * each trade than before it. The record keeps the pool's `x * y` and LP supply from its last
3494
+ * checkpoint. The LP tokens that still hold exactly the checkpoint's liquidity are
3495
+ * `locked * sqrt(last_k) / last_lp * supply / sqrt(k)`; everything above that is fee growth.
3496
+ *
3497
+ * The division rounds the kept part up, so the answer never claims a unit the pool does not owe.
3498
+ */
3499
+ function lockedFeeLp(lock, pool) {
3500
+ if (lock.lockedLpAmount === 0n || lock.lastLp === 0n || pool.lpSupply === 0n) return 0n;
3501
+ const rootNow = isqrt(pool.vault0 * pool.vault1);
3502
+ if (rootNow === 0n) return 0n;
3503
+ const numerator = lock.lockedLpAmount * isqrt(lock.lastK) * pool.lpSupply;
3504
+ const denominator = lock.lastLp * rootNow;
3505
+ const keep = (numerator + denominator - 1n) / denominator;
3506
+ return keep >= lock.lockedLpAmount ? 0n : lock.lockedLpAmount - keep;
3507
+ }
3508
+ /**
3509
+ * Every locked CPMM position `owner` holds a fee NFT for, with what each one can harvest.
3510
+ *
3511
+ * Three reads: the wallet's token accounts, then the lock record behind every NFT-shaped one, then
3512
+ * the pool and the two vaults of every record found. A token account of one unit and zero decimals
3513
+ * is not always a lock NFT, so the record decides: no record, not a position.
3514
+ */
3515
+ async function fetchLockedPositions(client, owner, ids = raydiumIds(client.cluster)) {
3516
+ const { value: accounts } = await client.rpc.getTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ADDRESS }, {
3517
+ encoding: "jsonParsed",
3518
+ commitment: "confirmed"
3519
+ }).send();
3520
+ const nftMints = [];
3521
+ for (const { account } of accounts) {
3522
+ const info = account.data.parsed.info;
3523
+ if (info.tokenAmount.decimals === 0 && info.tokenAmount.amount === "1") nftMints.push(info.mint);
3524
+ }
3525
+ if (nftMints.length === 0) return [];
3526
+ const records = await Promise.all(nftMints.map((mint) => lockedLiquidityAddress(ids.lock, mint)));
3527
+ const found = [];
3528
+ for (const [index, account] of (await readAccounts(client.rpc, records)).entries()) {
3529
+ if (!account || account.owner !== ids.lock) continue;
3530
+ const lock = decodeLockedCpLiquidity(account.data);
3531
+ if (lock.feeNftMint !== nftMints[index]) continue;
3532
+ found.push({
3533
+ feeNftMint: nftMints[index],
3534
+ record: records[index],
3535
+ lock
3536
+ });
3537
+ }
3538
+ if (found.length === 0) return [];
3539
+ const decoded = (await readAccounts(client.rpc, found.map((entry) => entry.lock.poolId))).map((account) => account && account.owner === ids.cpmm ? decodeCpmmPool(account.data) : null);
3540
+ const vaults = await readAccounts(client.rpc, decoded.flatMap((pool) => pool ? [pool.token0Vault, pool.token1Vault] : []));
3541
+ const positions = [];
3542
+ let cursor = 0;
3543
+ for (const [index, entry] of found.entries()) {
3544
+ const pool = decoded[index];
3545
+ if (!pool) continue;
3546
+ const raw0 = vaults[cursor];
3547
+ const raw1 = vaults[cursor + 1];
3548
+ cursor += 2;
3549
+ if (!raw0 || !raw1 || pool.lpMint !== entry.lock.lockedLpMint) continue;
3550
+ const vault0 = tokenAccountAmount(raw0.data) - pool.protocolFeesToken0 - pool.fundFeesToken0 - pool.creatorFeesToken0;
3551
+ const vault1 = tokenAccountAmount(raw1.data) - pool.protocolFeesToken1 - pool.fundFeesToken1 - pool.creatorFeesToken1;
3552
+ const claimableLp = lockedFeeLp(entry.lock, {
3553
+ vault0,
3554
+ vault1,
3555
+ lpSupply: pool.lpSupply
3556
+ });
3557
+ positions.push({
3558
+ ...entry,
3559
+ poolAddress: entry.lock.poolId,
3560
+ pool,
3561
+ vault0,
3562
+ vault1,
3563
+ claimableLp,
3564
+ claimableToken0: pool.lpSupply === 0n ? 0n : claimableLp * vault0 / pool.lpSupply,
3565
+ claimableToken1: pool.lpSupply === 0n ? 0n : claimableLp * vault1 / pool.lpSupply
3566
+ });
3567
+ }
3568
+ return positions;
3569
+ }
3570
+ /**
3571
+ * The instructions of one harvest: create the two token accounts, collect, and close the WSOL one
3572
+ * when a side is WSOL.
3573
+ *
3574
+ * `feeLp` defaults to everything the position can withdraw now. The lock program refuses more than
3575
+ * that, so a caller that passes its own number keeps it at or below `position.claimableLp`.
3576
+ */
3577
+ async function getHarvestLockedFeesInstructions(owner, ids, position, feeLp = position.claimableLp) {
3578
+ if (feeLp <= 0n) throw new Error("nothing to harvest: the position has earned no fee LP yet");
3579
+ const { pool } = position;
3580
+ const collect = {
3581
+ programAddress: ids.lock,
3582
+ accounts: withSigner(order(LOCK_COLLECT_CP_FEES, {
3583
+ authority: ids.lockAuthority,
3584
+ fee_nft_owner: owner.address,
3585
+ fee_nft_account: await ata(owner.address, position.feeNftMint, TOKEN_PROGRAM_ADDRESS),
3586
+ locked_liquidity: position.record,
3587
+ cpmm_program: ids.cpmm,
3588
+ cp_authority: ids.cpmmAuthority,
3589
+ pool_state: position.poolAddress,
3590
+ lp_mint: pool.lpMint,
3591
+ recipient_token_0_account: await ata(owner.address, pool.token0Mint, pool.token0Program),
3592
+ recipient_token_1_account: await ata(owner.address, pool.token1Mint, pool.token1Program),
3593
+ token_0_vault: pool.token0Vault,
3594
+ token_1_vault: pool.token1Vault,
3595
+ vault_0_mint: pool.token0Mint,
3596
+ vault_1_mint: pool.token1Mint,
3597
+ locked_lp_vault: await ata(ids.lockAuthority, pool.lpMint, TOKEN_PROGRAM_ADDRESS),
3598
+ token_program: TOKEN_PROGRAM_ADDRESS,
3599
+ token_program_2022: TOKEN_2022_PROGRAM_ADDRESS,
3600
+ memo_program: MEMO_PROGRAM_ADDRESS
3601
+ }), owner),
3602
+ data: new Uint8Array([...LOCK_COLLECT_CP_FEES.discriminator, ...u64$1.encode(feeLp)])
3603
+ };
3604
+ return await wrapAround(owner, [{
3605
+ mint: pool.token0Mint,
3606
+ tokenProgram: pool.token0Program
3607
+ }, {
3608
+ mint: pool.token1Mint,
3609
+ tokenProgram: pool.token1Program
3610
+ }], [collect]);
3611
+ }
3612
+ /**
3613
+ * Harvest one locked position's fees.
3614
+ *
3615
+ * A pool with WSOL on one side pays that side out as SOL, because the builder closes the WSOL
3616
+ * account. The other side arrives as that token, in the owner's own account.
3617
+ */
3618
+ async function harvestLockedFees(client, input) {
3619
+ const ids = raydiumIds(client.cluster);
3620
+ const instructions = await getHarvestLockedFeesInstructions(input.owner, ids, input.position, input.feeLp);
3621
+ return await buildMessage(client, input.owner, instructions, {
3622
+ addressLookupTables: input.addressLookupTables,
3623
+ computeUnitLimit: input.computeUnitLimit ?? 15e4,
3624
+ ...input.computeUnitPrice === void 0 ? {} : { computeUnitPrice: input.computeUnitPrice }
3625
+ });
3626
+ }
3627
+ //#endregion
3089
3628
  //#region src/raydium/trade.ts
3090
3629
  /**
3091
3630
  * A venue trade a wallet sends on its own, outside any Gabox instruction.
@@ -3176,6 +3715,7 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3176
3715
  LAUNCHLAB_BUY_EXACT_IN: () => LAUNCHLAB_BUY_EXACT_IN,
3177
3716
  LAUNCHLAB_BUY_EXACT_OUT: () => LAUNCHLAB_BUY_EXACT_OUT,
3178
3717
  LAUNCHLAB_CLAIM_CREATOR_FEE: () => LAUNCHLAB_CLAIM_CREATOR_FEE,
3718
+ LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT: () => LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT,
3179
3719
  LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR: () => LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR,
3180
3720
  LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE: () => 115,
3181
3721
  LAUNCHLAB_INITIALIZE: () => LAUNCHLAB_INITIALIZE,
@@ -3191,6 +3731,11 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3191
3731
  LAUNCH_DECIMALS: () => 6,
3192
3732
  LAUNCH_SUPPLY: () => LAUNCH_SUPPLY,
3193
3733
  LAUNCH_TOTAL_BASE_SELL: () => LAUNCH_TOTAL_BASE_SELL,
3734
+ LOCKED_CP_LIQUIDITY_DISCRIMINATOR: () => LOCKED_CP_LIQUIDITY_DISCRIMINATOR,
3735
+ LOCKED_CP_LIQUIDITY_HEAD_SIZE: () => 192,
3736
+ LOCK_COLLECT_CP_FEES: () => LOCK_COLLECT_CP_FEES,
3737
+ LOCK_SEEDS: () => LOCK_SEEDS,
3738
+ MEMO_PROGRAM_ADDRESS: () => MEMO_PROGRAM_ADDRESS,
3194
3739
  METADATA_LIMITS: () => METADATA_LIMITS,
3195
3740
  METADATA_SEED: () => METADATA_SEED,
3196
3741
  METAPLEX_PROGRAM_ADDRESS: () => METAPLEX_PROGRAM_ADDRESS,
@@ -3210,6 +3755,7 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3210
3755
  ceilDiv: () => ceilDiv,
3211
3756
  ceilDivRate: () => ceilDivRate,
3212
3757
  claimCreatorFee: () => claimCreatorFee,
3758
+ claimPlatformFee: () => claimPlatformFee,
3213
3759
  collectCreatorFee: () => collectCreatorFee,
3214
3760
  compareAddresses: () => compareAddresses,
3215
3761
  cpmmAuthority: () => cpmmAuthority,
@@ -3233,17 +3779,23 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3233
3779
  decodeLaunchlabGlobalConfig: () => decodeLaunchlabGlobalConfig,
3234
3780
  decodeLaunchlabPlatformConfig: () => decodeLaunchlabPlatformConfig,
3235
3781
  decodeLaunchlabPool: () => decodeLaunchlabPool,
3782
+ decodeLockedCpLiquidity: () => decodeLockedCpLiquidity,
3236
3783
  fetchCreatorFees: () => fetchCreatorFees,
3237
3784
  fetchCurveSettings: () => fetchCurveSettings,
3785
+ fetchLockedPositions: () => fetchLockedPositions,
3786
+ fetchPlatformFees: () => fetchPlatformFees,
3238
3787
  fetchQuoteAsset: () => fetchQuoteAsset,
3239
3788
  fetchQuoteBinding: () => fetchQuoteBinding,
3240
3789
  fetchQuoteConfig: () => fetchQuoteConfig,
3241
3790
  fetchQuoteDisplay: () => fetchQuoteDisplay,
3242
3791
  findCpmmPool: () => findCpmmPool,
3243
3792
  getClaimCreatorFeeInstructions: () => getClaimCreatorFeeInstructions,
3793
+ getClaimPlatformFeeInstructions: () => getClaimPlatformFeeInstructions,
3244
3794
  getCollectCreatorFeeInstructions: () => getCollectCreatorFeeInstructions,
3245
3795
  getCurveBuyExactInInstruction: () => getCurveBuyExactInInstruction,
3796
+ getHarvestLockedFeesInstructions: () => getHarvestLockedFeesInstructions,
3246
3797
  getLaunchInstruction: () => getLaunchInstruction,
3798
+ harvestLockedFees: () => harvestLockedFees,
3247
3799
  initialCurve: () => initialCurve,
3248
3800
  isQuoteSupported: () => isQuoteSupported,
3249
3801
  launchlabAuthority: () => launchlabAuthority,
@@ -3255,6 +3807,9 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3255
3807
  launchlabPoolAddress: () => launchlabPoolAddress,
3256
3808
  launchlabSellAccounts: () => launchlabSellAccounts,
3257
3809
  launchlabVaultAddress: () => launchlabVaultAddress,
3810
+ lockAuthority: () => lockAuthority,
3811
+ lockedFeeLp: () => lockedFeeLp,
3812
+ lockedLiquidityAddress: () => lockedLiquidityAddress,
3258
3813
  metadataAddress: () => metadataAddress,
3259
3814
  metaplexSymbol: () => metaplexSymbol,
3260
3815
  mintDecimals: () => mintDecimals,
@@ -3262,6 +3817,7 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3262
3817
  newCurveReserves: () => newCurveReserves,
3263
3818
  order: () => order,
3264
3819
  platformFeeVaultAddress: () => platformFeeVaultAddress,
3820
+ platformFeeVaultAuthority: () => platformFeeVaultAuthority,
3265
3821
  preFeeAmount: () => preFeeAmount,
3266
3822
  quoteAccountFor: () => quoteAccountFor,
3267
3823
  raydiumIds: () => raydiumIds,
@@ -3277,6 +3833,6 @@ var raydium_exports = /* @__PURE__ */ __exportAll({
3277
3833
  wsolAccountFor: () => wsolAccountFor
3278
3834
  });
3279
3835
  //#endregion
3280
- export { computeBudgetInstructions as $, LAUNCHLAB_BUY_EXACT_OUT as $n, launchlabVaultAddress as $t, initialCurve as A, CPMM_SEEDS as An, metaplexSymbol as At, fetchQuoteAsset as B, RATE_DENOMINATOR as Bn, vaultAddress as Bt, ceilDiv as C, PACK_TOKENS as Cn, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE as Ct, curveBuyExactIn as D, VRF_DEFAULT_QUEUE as Dn, decodeLaunchlabGlobalConfig as Dt, cpmmSwapBaseOutput as E, TIMEOUT_SLOTS as En, decodeCpmmPool as Et, cpmmSellAccounts as F, LAUNCHLAB_STATUS_TRADE as Fn, activityAddress as Ft, readAccounts as G, sortedMints as Gn, cpmmPoolAddress as Gt, fetchQuoteDisplay as H, SHARE_FEE_RATE as Hn, ata as Ht, launchlabBuyAccounts as I, LAUNCH_DECIMALS as In, associatedTokenAddress as It, COMPUTE_BUDGET_PROGRAM_ADDRESS as J, CPMM_COLLECT_CREATOR_FEE as Jn, launchlabAuthority as Jt, BUY_PACK_COMPUTE_UNITS as K, ASSOCIATED_TOKEN_PROGRAM_ADDRESS as Kn, creatorFeeVaultAddress as Kt, launchlabBuyExactInAccounts as L, METADATA_LIMITS as Ln, drawAddress as Lt, remainingBase as M, LAUNCHLAB_SEEDS as Mn, token2022Symbol as Mt, totalCurveFeeRate as N, LAUNCHLAB_STATUS_FUND as Nn, tokenAccountAmount as Nt, curveBuyExactOut as O, VRF_PROGRAM_ADDRESS as On, decodeLaunchlabPlatformConfig as Ot, cpmmBuyAccounts as P, LAUNCHLAB_STATUS_MIGRATE as Pn, tokenAccountOwnerAndMint as Pt, REDEEM_COMPUTE_UNITS as Q, LAUNCHLAB_BUY_EXACT_IN as Qn, launchlabPoolAddress as Qt, launchlabSellAccounts as R, METADATA_SEED as Rn, poolAddress as Rt, wsolAccountFor as S, MAX_ATTEMPTS as Sn, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE as St, cpmmSwapBaseInput as T, SLOT_HASHES_SYSVAR as Tn, decodeCpmmAmmConfig as Tt, isQuoteSupported as U, compareAddresses as Un, cpmmAuthority as Ut, fetchQuoteConfig as V, RAYDIUM_IDS as Vn, vrfIdentityAddress as Vt, decodeBase64 as W, raydiumIds as Wn, cpmmCreatorFeeShare as Wt, DEFAULT_COMPUTE_UNIT_LIMIT as X, CPMM_SWAP_BASE_INPUT as Xn, launchlabGlobalConfig as Xt, CREATE_MACHINE_COMPUTE_UNITS as Y, CPMM_POOL_STATE_DISCRIMINATOR as Yn, launchlabEventAuthority as Yt, MAX_COMPUTE_UNIT_LIMIT as Z, CPMM_SWAP_BASE_OUTPUT as Zn, launchlabPlatformConfig as Zt, newCurveBuyCost as _, validatePack as _n, tiersOf as _t, fetchCreatorFees as a, MAX_MULTIPLIER_BPS as an, LAUNCHLAB_SELL_EXACT_IN as ar, POOL_MINT_OFFSET as at, resolveVenue as b, IDENTITY_SEED as bn, CPMM_POOL_STATE_HEAD_SIZE as bt, getLaunchInstruction as c, TIERS as cn, METAPLEX_PROGRAM_ADDRESS as cr, fetchPoolByMint as ct, cpmmPoolMatches as d, maxMultiplierBps as dn, RAYDIUM_MAINNET_IDS as dr, fetchWalletActivity as dt, metadataAddress as en, LAUNCHLAB_CLAIM_CREATOR_FEE as er, getSetComputeUnitLimitInstruction as et, creatorFeeOnInput as f, quote as fn, RENT_SYSVAR_ADDRESS as fr, listDraws as ft, findCpmmPool as g, uncappedMaximum as gn, WSOL_MINT as gr, quotePool as gt, fetchQuoteBinding as h, tierAmount as hn, TOKEN_PROGRAM_ADDRESS as hr, listPools as ht, collectCreatorFee as i, GaboxMathError as in, LAUNCHLAB_POOL_STATE_DISCRIMINATOR as ir, POOL_CREATOR_OFFSET as it, preFeeAmount as j, CREATOR_FEE_ON_QUOTE as jn, mintDecimals as jt, curveSellExactIn as k, CONSTANT_CURVE_TAG as kn, decodeLaunchlabPool as kt, buildMessage as l, averageMultiplierBps as ln, PLATFORM_ADMIN as lr, fetchPoolInventory as lt, fetchCurveSettings as m, seedTokens as mn, TOKEN_2022_PROGRAM_ADDRESS as mr, listDrawsByPurchaser as mt, getCurveBuyExactInInstruction as n, BPS as nn, LAUNCHLAB_INITIALIZE as nr, DRAW_POOL_OFFSET as nt, getClaimCreatorFeeInstructions as o, MIN_SEED_MULTIPLIER_BPS as on, LAUNCH_SUPPLY as or, fetchDraw as ot, curveQuote as p, resolveReservation as pn, SYSTEM_PROGRAM_ADDRESS as pr, listDrawsByPool as pt, CLAIM_COMPUTE_UNITS as q, CPMM_AMM_CONFIG_DISCRIMINATOR as qn, creatorFeeVaultAuthority as qt, claimCreatorFee as r, DEFAULT_TIERS as rn, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR as rr, DRAW_PURCHASER_OFFSET as rt, getCollectCreatorFeeInstructions as s, TICKETS as sn, LAUNCH_TOTAL_BASE_SELL as sr, fetchPoolAt as st, raydium_exports as t, platformFeeVaultAddress as tn, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR as tr, getSetComputeUnitPriceInstruction as tt, withRemainingAccounts as u, choose as un, RAYDIUM_DEVNET_IDS as ur, fetchVaultBalance as ut, newCurveReserves as v, validateTiers as vn, CPMM_AMM_CONFIG_HEAD_SIZE as vt, ceilDivRate as w, RETRY_SLOTS as wn, LAUNCHLAB_POOL_STATE_HEAD_SIZE as wt, sellQuote as x, INSTRUCTIONS_SYSVAR as xn, CPMM_POOL_STATE_SIZE as xt, quoteAccountFor as y, GABOX_PROGRAM_ID as yn, CPMM_POOL_OFFSETS as yt, order as z, MIGRATE_TO_CPMM as zn, scopedVrfIdentityAddress as zt };
3836
+ export { readAccounts as $, MEMO_PROGRAM_ADDRESS as $n, vrfIdentityAddress as $t, wsolAccountFor as A, tierAmount as An, RENT_SYSVAR_ADDRESS as Ar, CPMM_POOL_STATE_SIZE as At, remainingBase as B, SLOT_HASHES_SYSVAR as Bn, decodeLaunchlabPool as Bt, fetchQuoteBinding as C, TIERS as Cn, LAUNCHLAB_SELL_EXACT_IN as Cr, listDrawsByPurchaser as Ct, quoteAccountFor as D, quote as Dn, PLATFORM_ADMIN as Dr, CPMM_AMM_CONFIG_HEAD_SIZE as Dt, newCurveReserves as E, maxMultiplierBps as En, METAPLEX_PROGRAM_ADDRESS as Er, tiersOf as Et, curveBuyExactIn as F, IDENTITY_SEED as Fn, LOCKED_CP_LIQUIDITY_HEAD_SIZE as Ft, launchlabBuyExactInAccounts as G, CPMM_SEEDS as Gn, tokenAccountAmount as Gt, cpmmBuyAccounts as H, VRF_DEFAULT_QUEUE as Hn, metaplexSymbol as Ht, curveBuyExactOut as I, INSTRUCTIONS_SYSVAR as In, decodeCpmmAmmConfig as It, fetchQuoteAsset as J, LAUNCHLAB_STATUS_FUND as Jn, associatedTokenAddress as Jt, launchlabSellAccounts as K, CREATOR_FEE_ON_QUOTE as Kn, tokenAccountOwnerAndMint as Kt, curveSellExactIn as L, MAX_ATTEMPTS as Ln, decodeCpmmPool as Lt, ceilDivRate as M, validatePack as Mn, TOKEN_2022_PROGRAM_ADDRESS as Mr, LAUNCHLAB_PLATFORM_CONFIG_HEAD_SIZE as Mt, cpmmSwapBaseInput as N, validateTiers as Nn, TOKEN_PROGRAM_ADDRESS as Nr, LAUNCHLAB_POOL_STATE_HEAD_SIZE as Nt, resolveVenue as O, resolveReservation as On, RAYDIUM_DEVNET_IDS as Or, CPMM_POOL_OFFSETS as Ot, cpmmSwapBaseOutput as P, GABOX_PROGRAM_ID as Pn, WSOL_MINT as Pr, LOCKED_CP_LIQUIDITY_DISCRIMINATOR as Pt, decodeBase64 as Q, LOCK_SEEDS as Qn, vaultAddress as Qt, initialCurve as R, PACK_TOKENS as Rn, decodeLaunchlabGlobalConfig as Rt, fetchCurveSettings as S, TICKETS as Sn, LAUNCHLAB_POOL_STATE_DISCRIMINATOR as Sr, listDrawsByPool as St, newCurveBuyCost as T, choose as Tn, LAUNCH_TOTAL_BASE_SELL as Tr, quotePool as Tt, cpmmSellAccounts as U, VRF_PROGRAM_ADDRESS as Un, mintDecimals as Ut, totalCurveFeeRate as V, TIMEOUT_SLOTS as Vn, decodeLockedCpLiquidity as Vt, launchlabBuyAccounts as W, CONSTANT_CURVE_TAG as Wn, token2022Symbol as Wt, fetchQuoteDisplay as X, LAUNCHLAB_STATUS_TRADE as Xn, poolAddress as Xt, fetchQuoteConfig as Y, LAUNCHLAB_STATUS_MIGRATE as Yn, drawAddress as Yt, isQuoteSupported as Z, LAUNCH_DECIMALS as Zn, scopedVrfIdentityAddress as Zt, buildMessage as _, BPS as _n, LAUNCHLAB_CLAIM_CREATOR_FEE as _r, fetchPoolByMint as _t, fetchLockedPositions as a, creatorFeeVaultAuthority as an, SHARE_FEE_RATE as ar, HARVEST_COMPUTE_UNITS as at, creatorFeeOnInput as b, MAX_MULTIPLIER_BPS as bn, LAUNCHLAB_INITIALIZE as br, fetchWalletActivity as bt, getHarvestLockedFeesInstructions as c, launchlabGlobalConfig as cn, sortedMints as cr, computeBudgetInstructions as ct, claimCreatorFee as d, launchlabVaultAddress as dn, CPMM_COLLECT_CREATOR_FEE as dr, DRAW_POOL_OFFSET as dt, ata as en, METADATA_LIMITS as er, BUY_PACK_COMPUTE_UNITS as et, collectCreatorFee as f, lockAuthority as fn, CPMM_POOL_STATE_DISCRIMINATOR as fr, DRAW_PURCHASER_OFFSET as ft, getLaunchInstruction as g, platformFeeVaultAuthority as gn, LAUNCHLAB_BUY_EXACT_OUT as gr, fetchPoolAt as gt, getCollectCreatorFeeInstructions as h, platformFeeVaultAddress as hn, LAUNCHLAB_BUY_EXACT_IN as hr, fetchDraw as ht, claimPlatformFee as i, creatorFeeVaultAddress as in, RAYDIUM_IDS as ir, DEFAULT_COMPUTE_UNIT_LIMIT as it, ceilDiv as j, uncappedMaximum as jn, SYSTEM_PROGRAM_ADDRESS as jr, LAUNCHLAB_GLOBAL_CONFIG_HEAD_SIZE as jt, sellQuote as k, seedTokens as kn, RAYDIUM_MAINNET_IDS as kr, CPMM_POOL_STATE_HEAD_SIZE as kt, harvestLockedFees as l, launchlabPlatformConfig as ln, ASSOCIATED_TOKEN_PROGRAM_ADDRESS as lr, getSetComputeUnitLimitInstruction as lt, getClaimCreatorFeeInstructions as m, metadataAddress as mn, CPMM_SWAP_BASE_OUTPUT as mr, POOL_MINT_OFFSET as mt, getCurveBuyExactInInstruction as n, cpmmCreatorFeeShare as nn, MIGRATE_TO_CPMM as nr, COMPUTE_BUDGET_PROGRAM_ADDRESS as nt, fetchPlatformFees as o, launchlabAuthority as on, compareAddresses as or, MAX_COMPUTE_UNIT_LIMIT as ot, fetchCreatorFees as p, lockedLiquidityAddress as pn, CPMM_SWAP_BASE_INPUT as pr, POOL_CREATOR_OFFSET as pt, order as q, LAUNCHLAB_SEEDS as qn, activityAddress as qt, LOCK_COLLECT_CP_FEES as r, cpmmPoolAddress as rn, RATE_DENOMINATOR as rr, CREATE_MACHINE_COMPUTE_UNITS as rt, getClaimPlatformFeeInstructions as s, launchlabEventAuthority as sn, raydiumIds as sr, REDEEM_COMPUTE_UNITS as st, raydium_exports as t, cpmmAuthority as tn, METADATA_SEED as tr, CLAIM_COMPUTE_UNITS as tt, lockedFeeLp as u, launchlabPoolAddress as un, CPMM_AMM_CONFIG_DISCRIMINATOR as ur, getSetComputeUnitPriceInstruction as ut, withRemainingAccounts as v, DEFAULT_TIERS as vn, LAUNCHLAB_CLAIM_PLATFORM_FEE_FROM_VAULT as vr, fetchPoolInventory as vt, findCpmmPool as w, averageMultiplierBps as wn, LAUNCH_SUPPLY as wr, listPools as wt, curveQuote as x, MIN_SEED_MULTIPLIER_BPS as xn, LAUNCHLAB_PLATFORM_CONFIG_DISCRIMINATOR as xr, listDraws as xt, cpmmPoolMatches as y, GaboxMathError as yn, LAUNCHLAB_GLOBAL_CONFIG_DISCRIMINATOR as yr, fetchVaultBalance as yt, preFeeAmount as z, RETRY_SLOTS as zn, decodeLaunchlabPlatformConfig as zt };
3281
3837
 
3282
- //# sourceMappingURL=raydium-CU-tZzIk.js.map
3838
+ //# sourceMappingURL=raydium-DIF1WOvI.js.map