• Finds a free pool seed index for this mint pair + amm config by checking pool PDA existence on-chain (batched). Raydium reserves index 0.

    By default the scan starts at a RANDOM index. The bucket's configured poolSeedIndex is public on-chain state, so another (potentially hostile) launch of the same mint pair and fee tier can occupy it — and if the fallback were sequential, the next index would be just as predictable. An unpredictable fresh index, repointed and graduated atomically in a single transaction or bundle, leaves no moment where the new index is visible on-chain before the pool exists. Pass startIndex for a deterministic scan.

    Run this before graduation: if the configured index is no longer free, point the bucket at the returned one via updateRaydiumClmmBucketV2 (pre-finalize) or updateRaydiumClmmBucketV2PostFinalize, in the same transaction or bundle as the graduation itself.

    Parameters

    • umi: Umi
    • baseMint: PublicKey<string>
    • ammConfig: PublicKey<string>
    • options: {
          env?: "devnet" | "mainnet";
          maxAttempts?: number;
          quoteMint?: PublicKey<string>;
          startIndex?: number;
      } = {}
      • Optional env?: "devnet" | "mainnet"
      • Optional maxAttempts?: number

        How many indices to scan before giving up (defaults to 64).

      • Optional quoteMint?: PublicKey<string>
      • Optional startIndex?: number

        First index to try (defaults to a random index; 0 is reserved by Raydium).

    Returns Promise<{
        poolSeedIndex: number;
        poolState: PublicKey;
    }>

Generated using TypeDoc