@meteora-ag/dynamic-bonding-curve-sdk 1.1.4 → 1.1.5

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.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/services/pool.ts
2
2
 
3
3
 
4
+
4
5
  var _web3js = require('@solana/web3.js');
5
6
 
6
7
  // src/types.ts
@@ -20878,6 +20879,63 @@ var PoolService = class extends DynamicBondingCurveProgram {
20878
20879
  return this.initializeToken2022Pool(baseParams);
20879
20880
  }
20880
20881
  }
20882
+ /**
20883
+ * Create a new config and pool
20884
+ * @param createConfigAndPoolParam - The parameters for the config and pool
20885
+ * @returns A new config and pool
20886
+ */
20887
+ async createConfigAndPool(createConfigAndPoolParam) {
20888
+ const {
20889
+ config,
20890
+ feeClaimer,
20891
+ leftoverReceiver,
20892
+ quoteMint,
20893
+ payer,
20894
+ ...configParam
20895
+ } = createConfigAndPoolParam;
20896
+ const { baseMint, name, symbol, uri, poolCreator } = createConfigAndPoolParam.createPoolParam;
20897
+ validateConfigParameters({ ...configParam, leftoverReceiver });
20898
+ const configKey = new (0, _web3js.PublicKey)(config);
20899
+ const quoteMintToken = new (0, _web3js.PublicKey)(quoteMint);
20900
+ const payerAddress = new (0, _web3js.PublicKey)(payer);
20901
+ const tx = new (0, _web3js.Transaction)();
20902
+ const configTx = await this.program.methods.createConfig(configParam).accountsPartial({
20903
+ config,
20904
+ feeClaimer,
20905
+ leftoverReceiver,
20906
+ quoteMint,
20907
+ payer
20908
+ }).transaction();
20909
+ tx.add(configTx);
20910
+ const pool = deriveDbcPoolAddress(quoteMintToken, baseMint, configKey);
20911
+ const baseVault = deriveDbcTokenVaultAddress(pool, baseMint);
20912
+ const quoteVault = deriveDbcTokenVaultAddress(pool, quoteMintToken);
20913
+ const baseParams = {
20914
+ name,
20915
+ symbol,
20916
+ uri,
20917
+ pool,
20918
+ config: configKey,
20919
+ payer: payerAddress,
20920
+ poolCreator,
20921
+ baseMint,
20922
+ baseVault,
20923
+ quoteVault,
20924
+ quoteMint: quoteMintToken
20925
+ };
20926
+ if (createConfigAndPoolParam.tokenType === 0 /* SPL */) {
20927
+ const mintMetadata = deriveMintMetadata(baseMint);
20928
+ const poolTx = await this.initializeSplPool({
20929
+ ...baseParams,
20930
+ mintMetadata
20931
+ });
20932
+ tx.add(poolTx);
20933
+ } else {
20934
+ const poolTx = await this.initializeToken2022Pool(baseParams);
20935
+ tx.add(poolTx);
20936
+ }
20937
+ return tx;
20938
+ }
20881
20939
  /**
20882
20940
  * Create a new pool and buy tokens
20883
20941
  * @param createPoolBuyParam - The parameters for the pool and buy