@meteora-ag/dlmm 1.0.35-rc.7 → 1.0.35

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.
package/dist/index.d.ts CHANGED
@@ -5131,7 +5131,7 @@ declare class DLMM {
5131
5131
  * `LbPairAccount` objects.
5132
5132
  */
5133
5133
  static getLbPairs(connection: Connection, opt?: Opt): Promise<LbPairAccount[]>;
5134
- static isPoolExisted(connection: Connection, tokenX: PublicKey, tokenY: PublicKey, binStep: BN, baseFactor: BN, opt?: Opt): Promise<PublicKey>;
5134
+ static checkPoolExists(connection: Connection, tokenX: PublicKey, tokenY: PublicKey, binStep: BN, baseFactor: BN, opt?: Opt): Promise<boolean>;
5135
5135
  /**
5136
5136
  * The `create` function is a static method that creates a new instance of the `DLMM` class
5137
5137
  * @param {Connection} connection - The `connection` parameter is an instance of the `Connection`
package/dist/index.js CHANGED
@@ -6922,7 +6922,7 @@ var DLMM = class {
6922
6922
  );
6923
6923
  return program.account.lbPair.all();
6924
6924
  }
6925
- static async isPoolExisted(connection, tokenX, tokenY, binStep, baseFactor, opt) {
6925
+ static async checkPoolExists(connection, tokenX, tokenY, binStep, baseFactor, opt) {
6926
6926
  const cluster = _optionalChain([opt, 'optionalAccess', _21 => _21.cluster]) || "mainnet-beta";
6927
6927
  const provider = new (0, _anchor.AnchorProvider)(
6928
6928
  connection,
@@ -6931,30 +6931,17 @@ var DLMM = class {
6931
6931
  );
6932
6932
  const program = new (0, _anchor.Program)(IDL, LBCLMM_PROGRAM_IDS[cluster], provider);
6933
6933
  try {
6934
- const [lbPair2Key] = deriveLbPair2(
6934
+ const [lbPairKey] = deriveLbPair2(
6935
6935
  tokenX,
6936
6936
  tokenY,
6937
6937
  binStep,
6938
6938
  baseFactor,
6939
6939
  program.programId
6940
6940
  );
6941
- const account2 = await program.account.lbPair.fetchNullable(lbPair2Key);
6942
- if (account2)
6943
- return lbPair2Key;
6944
- const [lbPairKey] = deriveLbPair(
6945
- tokenX,
6946
- tokenY,
6947
- binStep,
6948
- program.programId
6949
- );
6950
- const account = await program.account.lbPair.fetchNullable(lbPairKey);
6951
- if (account && account.parameters.baseFactor === baseFactor.toNumber()) {
6952
- return lbPairKey;
6953
- }
6954
- return null;
6955
- } catch (error) {
6956
- console.log("\u{1F680} ~ DLMM ~ error:", error);
6957
- return null;
6941
+ await program.account.lbPair.fetch(lbPairKey);
6942
+ return true;
6943
+ } catch (e2) {
6944
+ return false;
6958
6945
  }
6959
6946
  }
6960
6947
  /**
@@ -7642,16 +7629,6 @@ var DLMM = class {
7642
7629
  _anchor.AnchorProvider.defaultOptions()
7643
7630
  );
7644
7631
  const program = new (0, _anchor.Program)(IDL, LBCLMM_PROGRAM_IDS[opt.cluster], provider);
7645
- const existsPool = await this.isPoolExisted(
7646
- connection,
7647
- tokenX,
7648
- tokenY,
7649
- binStep,
7650
- baseFactor
7651
- );
7652
- if (existsPool) {
7653
- throw new Error("Pool already exists");
7654
- }
7655
7632
  const [lbPair] = deriveLbPair2(
7656
7633
  tokenX,
7657
7634
  tokenY,