@meteora-ag/dynamic-bonding-curve-sdk 1.4.0 → 1.4.1
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 +472 -294
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +230 -72
- package/dist/index.d.ts +230 -72
- package/dist/index.js +472 -294
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23161,8 +23161,8 @@ var StateService = class extends DynamicBondingCurveProgram {
|
|
|
23161
23161
|
* @param partnerAddress - The address of the partner
|
|
23162
23162
|
* @returns A partner metadata
|
|
23163
23163
|
*/
|
|
23164
|
-
async getPartnerMetadata(
|
|
23165
|
-
const filters = createProgramAccountFilter(
|
|
23164
|
+
async getPartnerMetadata(partnerAddress) {
|
|
23165
|
+
const filters = createProgramAccountFilter(partnerAddress, 8);
|
|
23166
23166
|
const accounts = await this.program.account.partnerMetadata.all(filters);
|
|
23167
23167
|
return accounts.map((account) => account.account);
|
|
23168
23168
|
}
|
|
@@ -23270,24 +23270,24 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23270
23270
|
}
|
|
23271
23271
|
/**
|
|
23272
23272
|
* Create Locker (if there is lockedVesting)
|
|
23273
|
-
* @param
|
|
23273
|
+
* @param payer - The payer of the transaction
|
|
23274
|
+
* @param virtualPool - The virtual pool address
|
|
23274
23275
|
* @returns A create locker transaction
|
|
23275
23276
|
*/
|
|
23276
|
-
async createLocker(
|
|
23277
|
-
const
|
|
23277
|
+
async createLocker(params) {
|
|
23278
|
+
const { virtualPool, payer } = params;
|
|
23278
23279
|
const lockerEventAuthority = deriveLockerEventAuthority();
|
|
23279
|
-
const virtualPoolState = await this.state.getPool(
|
|
23280
|
-
createLockerParam.virtualPool
|
|
23281
|
-
);
|
|
23280
|
+
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
23282
23281
|
if (!virtualPoolState) {
|
|
23283
|
-
throw new Error(
|
|
23284
|
-
`Pool not found: ${createLockerParam.virtualPool.toString()}`
|
|
23285
|
-
);
|
|
23282
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
23286
23283
|
}
|
|
23287
23284
|
const poolConfigState = await this.state.getPoolConfig(
|
|
23288
23285
|
virtualPoolState.config
|
|
23289
23286
|
);
|
|
23290
|
-
|
|
23287
|
+
if (!poolConfigState) {
|
|
23288
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
23289
|
+
}
|
|
23290
|
+
const base = deriveBaseKeyForLocker(virtualPool);
|
|
23291
23291
|
const escrow = deriveEscrow(base);
|
|
23292
23292
|
const tokenProgram = poolConfigState.tokenType === 0 ? _spltoken.TOKEN_PROGRAM_ID : _spltoken.TOKEN_2022_PROGRAM_ID;
|
|
23293
23293
|
const escrowToken = findAssociatedTokenAddress(
|
|
@@ -23297,7 +23297,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23297
23297
|
);
|
|
23298
23298
|
const preInstructions = [];
|
|
23299
23299
|
const createOwnerEscrowVaultTokenXIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
23300
|
-
|
|
23300
|
+
payer,
|
|
23301
23301
|
escrowToken,
|
|
23302
23302
|
escrow,
|
|
23303
23303
|
virtualPoolState.baseMint,
|
|
@@ -23305,16 +23305,16 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23305
23305
|
);
|
|
23306
23306
|
preInstructions.push(createOwnerEscrowVaultTokenXIx);
|
|
23307
23307
|
const accounts = {
|
|
23308
|
-
virtualPool
|
|
23308
|
+
virtualPool,
|
|
23309
23309
|
config: virtualPoolState.config,
|
|
23310
|
-
poolAuthority,
|
|
23310
|
+
poolAuthority: this.poolAuthority,
|
|
23311
23311
|
baseVault: virtualPoolState.baseVault,
|
|
23312
23312
|
baseMint: virtualPoolState.baseMint,
|
|
23313
23313
|
base,
|
|
23314
23314
|
creator: virtualPoolState.creator,
|
|
23315
23315
|
escrow,
|
|
23316
23316
|
escrowToken,
|
|
23317
|
-
payer
|
|
23317
|
+
payer,
|
|
23318
23318
|
tokenProgram,
|
|
23319
23319
|
lockerProgram: LOCKER_PROGRAM_ID,
|
|
23320
23320
|
lockerEventAuthority,
|
|
@@ -23324,26 +23324,27 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23324
23324
|
}
|
|
23325
23325
|
/**
|
|
23326
23326
|
* Withdraw leftover
|
|
23327
|
-
* @param
|
|
23327
|
+
* @param payer - The payer of the transaction
|
|
23328
|
+
* @param virtualPool - The virtual pool address
|
|
23328
23329
|
* @returns A withdraw leftover transaction
|
|
23329
23330
|
*/
|
|
23330
|
-
async withdrawLeftover(
|
|
23331
|
-
const
|
|
23332
|
-
|
|
23333
|
-
);
|
|
23331
|
+
async withdrawLeftover(params) {
|
|
23332
|
+
const { virtualPool, payer } = params;
|
|
23333
|
+
const poolState = await this.state.getPool(virtualPool);
|
|
23334
23334
|
if (!poolState) {
|
|
23335
|
-
throw new Error(
|
|
23336
|
-
`Pool not found: ${withdrawLeftoverParam.virtualPool.toString()}`
|
|
23337
|
-
);
|
|
23335
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
23338
23336
|
}
|
|
23339
23337
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
23338
|
+
if (!poolConfigState) {
|
|
23339
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
23340
|
+
}
|
|
23340
23341
|
const tokenBaseProgram = getTokenProgram(poolConfigState.tokenType);
|
|
23341
23342
|
const preInstructions = [];
|
|
23342
23343
|
const { ataPubkey: tokenBaseAccount, ix: createBaseTokenAccountIx } = await getOrCreateATAInstruction(
|
|
23343
23344
|
this.connection,
|
|
23344
23345
|
poolState.baseMint,
|
|
23345
23346
|
poolConfigState.leftoverReceiver,
|
|
23346
|
-
|
|
23347
|
+
payer,
|
|
23347
23348
|
true,
|
|
23348
23349
|
tokenBaseProgram
|
|
23349
23350
|
);
|
|
@@ -23351,7 +23352,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23351
23352
|
return this.program.methods.withdrawLeftover().accountsPartial({
|
|
23352
23353
|
poolAuthority: this.poolAuthority,
|
|
23353
23354
|
config: poolState.config,
|
|
23354
|
-
virtualPool
|
|
23355
|
+
virtualPool,
|
|
23355
23356
|
tokenBaseAccount,
|
|
23356
23357
|
baseVault: poolState.baseVault,
|
|
23357
23358
|
baseMint: poolState.baseMint,
|
|
@@ -23364,42 +23365,45 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23364
23365
|
///////////////////////
|
|
23365
23366
|
/**
|
|
23366
23367
|
* Create metadata for the migration of Meteora DAMM V1
|
|
23367
|
-
* @param
|
|
23368
|
+
* @param payer - The payer of the transaction
|
|
23369
|
+
* @param virtualPool - The virtual pool address
|
|
23370
|
+
* @param config - The config address
|
|
23368
23371
|
* @returns A migration transaction
|
|
23369
23372
|
*/
|
|
23370
|
-
async createDammV1MigrationMetadata(
|
|
23371
|
-
const
|
|
23372
|
-
|
|
23373
|
-
);
|
|
23373
|
+
async createDammV1MigrationMetadata(params) {
|
|
23374
|
+
const { virtualPool, config, payer } = params;
|
|
23375
|
+
const migrationMetadata = deriveDammV1MigrationMetadataAddress(virtualPool);
|
|
23374
23376
|
const accounts = {
|
|
23375
|
-
virtualPool
|
|
23376
|
-
config
|
|
23377
|
+
virtualPool,
|
|
23378
|
+
config,
|
|
23377
23379
|
migrationMetadata,
|
|
23378
|
-
payer
|
|
23380
|
+
payer,
|
|
23379
23381
|
systemProgram: _web3js.SystemProgram.programId
|
|
23380
23382
|
};
|
|
23381
23383
|
return this.program.methods.migrationMeteoraDammCreateMetadata().accountsPartial(accounts).transaction();
|
|
23382
23384
|
}
|
|
23383
23385
|
/**
|
|
23384
23386
|
* Migrate to DAMM V1
|
|
23385
|
-
* @param
|
|
23387
|
+
* @param payer - The payer of the transaction
|
|
23388
|
+
* @param virtualPool - The virtual pool address
|
|
23389
|
+
* @param dammConfig - The damm config address
|
|
23386
23390
|
* @returns A migrate transaction
|
|
23387
23391
|
*/
|
|
23388
|
-
async migrateToDammV1(
|
|
23389
|
-
const
|
|
23390
|
-
|
|
23391
|
-
);
|
|
23392
|
+
async migrateToDammV1(params) {
|
|
23393
|
+
const { virtualPool, dammConfig, payer } = params;
|
|
23394
|
+
const poolState = await this.state.getPool(virtualPool);
|
|
23392
23395
|
if (!poolState) {
|
|
23396
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
23397
|
+
}
|
|
23398
|
+
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
23399
|
+
if (!poolConfigState) {
|
|
23393
23400
|
throw new Error(
|
|
23394
|
-
`Pool not found: ${
|
|
23401
|
+
`Pool config not found for virtual pool: ${virtualPool.toString()}`
|
|
23395
23402
|
);
|
|
23396
23403
|
}
|
|
23397
|
-
const
|
|
23398
|
-
const migrationMetadata = deriveDammV1MigrationMetadataAddress(
|
|
23399
|
-
migrateToDammV1Param.virtualPool
|
|
23400
|
-
);
|
|
23404
|
+
const migrationMetadata = deriveDammV1MigrationMetadataAddress(virtualPool);
|
|
23401
23405
|
const dammPool = deriveDammV1PoolAddress(
|
|
23402
|
-
|
|
23406
|
+
dammConfig,
|
|
23403
23407
|
poolState.baseMint,
|
|
23404
23408
|
poolConfigState.quoteMint
|
|
23405
23409
|
);
|
|
@@ -23435,7 +23439,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23435
23439
|
if (!aVaultAccount) {
|
|
23436
23440
|
const createVaultAIx = await createInitializePermissionlessDynamicVaultIx(
|
|
23437
23441
|
poolState.baseMint,
|
|
23438
|
-
|
|
23442
|
+
payer,
|
|
23439
23443
|
vaultProgram
|
|
23440
23444
|
);
|
|
23441
23445
|
if (createVaultAIx) {
|
|
@@ -23447,7 +23451,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23447
23451
|
if (!bVaultAccount) {
|
|
23448
23452
|
const createVaultBIx = await createInitializePermissionlessDynamicVaultIx(
|
|
23449
23453
|
poolConfigState.quoteMint,
|
|
23450
|
-
|
|
23454
|
+
payer,
|
|
23451
23455
|
vaultProgram
|
|
23452
23456
|
);
|
|
23453
23457
|
if (createVaultBIx) {
|
|
@@ -23468,12 +23472,12 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23468
23472
|
_spltoken.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
23469
23473
|
);
|
|
23470
23474
|
const transaction = await this.program.methods.migrateMeteoraDamm().accountsPartial({
|
|
23471
|
-
virtualPool
|
|
23475
|
+
virtualPool,
|
|
23472
23476
|
migrationMetadata,
|
|
23473
23477
|
config: poolState.config,
|
|
23474
23478
|
poolAuthority: this.poolAuthority,
|
|
23475
23479
|
pool: dammPool,
|
|
23476
|
-
dammConfig
|
|
23480
|
+
dammConfig,
|
|
23477
23481
|
lpMint,
|
|
23478
23482
|
tokenAMint: poolState.baseMint,
|
|
23479
23483
|
tokenBMint: poolConfigState.quoteMint,
|
|
@@ -23490,7 +23494,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23490
23494
|
virtualPoolLp,
|
|
23491
23495
|
protocolTokenAFee,
|
|
23492
23496
|
protocolTokenBFee,
|
|
23493
|
-
payer
|
|
23497
|
+
payer,
|
|
23494
23498
|
rent: _web3js.SYSVAR_RENT_PUBKEY,
|
|
23495
23499
|
mintMetadata,
|
|
23496
23500
|
metadataProgram: METAPLEX_PROGRAM_ID,
|
|
@@ -23507,27 +23511,28 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23507
23511
|
}
|
|
23508
23512
|
/**
|
|
23509
23513
|
* Lock DAMM V1 LP token for creator or partner
|
|
23510
|
-
* @param
|
|
23514
|
+
* @param payer - The payer of the transaction
|
|
23515
|
+
* @param virtualPool - The virtual pool address
|
|
23516
|
+
* @param dammConfig - The damm config address
|
|
23517
|
+
* @param isPartner - Whether the partner is locking the LP token
|
|
23511
23518
|
* @returns A lock transaction
|
|
23512
23519
|
*/
|
|
23513
|
-
async lockDammV1LpToken(
|
|
23514
|
-
const
|
|
23515
|
-
|
|
23516
|
-
);
|
|
23520
|
+
async lockDammV1LpToken(params) {
|
|
23521
|
+
const { virtualPool, dammConfig, payer, isPartner } = params;
|
|
23522
|
+
const poolState = await this.state.getPool(params.virtualPool);
|
|
23517
23523
|
if (!poolState) {
|
|
23518
|
-
throw new Error(
|
|
23519
|
-
`Pool not found: ${lockDammV1LpTokenParam.virtualPool.toString()}`
|
|
23520
|
-
);
|
|
23524
|
+
throw new Error(`Pool not found: ${params.virtualPool.toString()}`);
|
|
23521
23525
|
}
|
|
23522
23526
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
23527
|
+
if (!poolConfigState) {
|
|
23528
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
23529
|
+
}
|
|
23523
23530
|
const dammPool = deriveDammV1PoolAddress(
|
|
23524
|
-
|
|
23531
|
+
dammConfig,
|
|
23525
23532
|
poolState.baseMint,
|
|
23526
23533
|
poolConfigState.quoteMint
|
|
23527
23534
|
);
|
|
23528
|
-
const migrationMetadata = deriveDammV1MigrationMetadataAddress(
|
|
23529
|
-
lockDammV1LpTokenParam.virtualPool
|
|
23530
|
-
);
|
|
23535
|
+
const migrationMetadata = deriveDammV1MigrationMetadataAddress(virtualPool);
|
|
23531
23536
|
const vaultProgram = this.getVaultProgram();
|
|
23532
23537
|
const [
|
|
23533
23538
|
{ vaultPda: aVault, lpMintPda: aLpMintPda },
|
|
@@ -23546,7 +23551,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23546
23551
|
if (!aVaultAccount) {
|
|
23547
23552
|
const createVaultAIx = await createInitializePermissionlessDynamicVaultIx(
|
|
23548
23553
|
poolState.baseMint,
|
|
23549
|
-
|
|
23554
|
+
payer,
|
|
23550
23555
|
vaultProgram
|
|
23551
23556
|
);
|
|
23552
23557
|
if (createVaultAIx) {
|
|
@@ -23558,7 +23563,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23558
23563
|
if (!bVaultAccount) {
|
|
23559
23564
|
const createVaultBIx = await createInitializePermissionlessDynamicVaultIx(
|
|
23560
23565
|
poolConfigState.quoteMint,
|
|
23561
|
-
|
|
23566
|
+
payer,
|
|
23562
23567
|
vaultProgram
|
|
23563
23568
|
);
|
|
23564
23569
|
if (createVaultBIx) {
|
|
@@ -23574,7 +23579,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23574
23579
|
const lpMint = deriveDammV1LpMintAddress(dammPool);
|
|
23575
23580
|
const dammV1Program = this.getDammV1Program();
|
|
23576
23581
|
let lockEscrowKey;
|
|
23577
|
-
if (
|
|
23582
|
+
if (isPartner) {
|
|
23578
23583
|
lockEscrowKey = deriveDammV1LockEscrowAddress(
|
|
23579
23584
|
dammPool,
|
|
23580
23585
|
poolConfigState.feeClaimer
|
|
@@ -23582,7 +23587,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23582
23587
|
const lockEscrowData = await this.connection.getAccountInfo(lockEscrowKey);
|
|
23583
23588
|
if (!lockEscrowData) {
|
|
23584
23589
|
const ix = await createLockEscrowIx(
|
|
23585
|
-
|
|
23590
|
+
payer,
|
|
23586
23591
|
dammPool,
|
|
23587
23592
|
lpMint,
|
|
23588
23593
|
poolConfigState.feeClaimer,
|
|
@@ -23599,7 +23604,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23599
23604
|
const lockEscrowData = await this.connection.getAccountInfo(lockEscrowKey);
|
|
23600
23605
|
if (!lockEscrowData) {
|
|
23601
23606
|
const ix = await createLockEscrowIx(
|
|
23602
|
-
|
|
23607
|
+
payer,
|
|
23603
23608
|
dammPool,
|
|
23604
23609
|
lpMint,
|
|
23605
23610
|
poolState.creator,
|
|
@@ -23617,7 +23622,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23617
23622
|
_spltoken.ASSOCIATED_TOKEN_PROGRAM_ID
|
|
23618
23623
|
);
|
|
23619
23624
|
const createEscrowVaultIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
23620
|
-
|
|
23625
|
+
payer,
|
|
23621
23626
|
escrowVault,
|
|
23622
23627
|
lockEscrowKey,
|
|
23623
23628
|
lpMint,
|
|
@@ -23631,13 +23636,13 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23631
23636
|
true
|
|
23632
23637
|
);
|
|
23633
23638
|
return this.program.methods.migrateMeteoraDammLockLpToken().accountsPartial({
|
|
23634
|
-
virtualPool
|
|
23639
|
+
virtualPool,
|
|
23635
23640
|
migrationMetadata,
|
|
23636
23641
|
poolAuthority: this.poolAuthority,
|
|
23637
23642
|
pool: dammPool,
|
|
23638
23643
|
lpMint,
|
|
23639
23644
|
lockEscrow: lockEscrowKey,
|
|
23640
|
-
owner:
|
|
23645
|
+
owner: isPartner ? poolConfigState.feeClaimer : poolState.creator,
|
|
23641
23646
|
sourceTokens,
|
|
23642
23647
|
escrowVault,
|
|
23643
23648
|
aVault,
|
|
@@ -23652,33 +23657,33 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23652
23657
|
}
|
|
23653
23658
|
/**
|
|
23654
23659
|
* Claim DAMM V1 LP token for creator or partner
|
|
23655
|
-
* @param
|
|
23660
|
+
* @param payer - The payer of the transaction
|
|
23661
|
+
* @param virtualPool - The virtual pool address
|
|
23662
|
+
* @param dammConfig - The damm config address
|
|
23663
|
+
* @param isPartner - Whether the partner is claiming the LP token
|
|
23656
23664
|
* @returns A claim transaction
|
|
23657
23665
|
*/
|
|
23658
|
-
async claimDammV1LpToken(
|
|
23659
|
-
const
|
|
23660
|
-
const virtualPoolState = await this.state.getPool(
|
|
23661
|
-
claimDammV1LpTokenParam.virtualPool
|
|
23662
|
-
);
|
|
23666
|
+
async claimDammV1LpToken(params) {
|
|
23667
|
+
const { virtualPool, dammConfig, payer, isPartner } = params;
|
|
23668
|
+
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
23663
23669
|
if (!virtualPoolState) {
|
|
23664
|
-
throw new Error(
|
|
23665
|
-
`Pool not found: ${claimDammV1LpTokenParam.virtualPool.toString()}`
|
|
23666
|
-
);
|
|
23670
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
23667
23671
|
}
|
|
23668
23672
|
const poolConfigState = await this.state.getPoolConfig(
|
|
23669
23673
|
virtualPoolState.config
|
|
23670
23674
|
);
|
|
23675
|
+
if (!poolConfigState) {
|
|
23676
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
23677
|
+
}
|
|
23671
23678
|
const dammPool = deriveDammV1PoolAddress(
|
|
23672
|
-
|
|
23679
|
+
dammConfig,
|
|
23673
23680
|
virtualPoolState.baseMint,
|
|
23674
23681
|
poolConfigState.quoteMint
|
|
23675
23682
|
);
|
|
23676
|
-
const migrationMetadata = deriveDammV1MigrationMetadataAddress(
|
|
23677
|
-
claimDammV1LpTokenParam.virtualPool
|
|
23678
|
-
);
|
|
23683
|
+
const migrationMetadata = deriveDammV1MigrationMetadataAddress(virtualPool);
|
|
23679
23684
|
const lpMint = deriveDammV1LpMintAddress(dammPool);
|
|
23680
23685
|
let destinationToken;
|
|
23681
|
-
if (
|
|
23686
|
+
if (isPartner) {
|
|
23682
23687
|
destinationToken = findAssociatedTokenAddress(
|
|
23683
23688
|
poolConfigState.feeClaimer,
|
|
23684
23689
|
lpMint,
|
|
@@ -23693,27 +23698,27 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23693
23698
|
}
|
|
23694
23699
|
const preInstructions = [];
|
|
23695
23700
|
const createDestinationTokenIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
23696
|
-
|
|
23701
|
+
payer,
|
|
23697
23702
|
destinationToken,
|
|
23698
|
-
|
|
23703
|
+
isPartner ? poolConfigState.feeClaimer : virtualPoolState.creator,
|
|
23699
23704
|
lpMint,
|
|
23700
23705
|
_spltoken.TOKEN_PROGRAM_ID
|
|
23701
23706
|
);
|
|
23702
23707
|
preInstructions.push(createDestinationTokenIx);
|
|
23703
23708
|
const sourceToken = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
23704
23709
|
lpMint,
|
|
23705
|
-
poolAuthority,
|
|
23710
|
+
this.poolAuthority,
|
|
23706
23711
|
true
|
|
23707
23712
|
);
|
|
23708
23713
|
const accounts = {
|
|
23709
|
-
virtualPool
|
|
23714
|
+
virtualPool,
|
|
23710
23715
|
migrationMetadata,
|
|
23711
|
-
poolAuthority,
|
|
23716
|
+
poolAuthority: this.poolAuthority,
|
|
23712
23717
|
lpMint,
|
|
23713
23718
|
sourceToken,
|
|
23714
23719
|
destinationToken,
|
|
23715
|
-
owner:
|
|
23716
|
-
sender:
|
|
23720
|
+
owner: isPartner ? poolConfigState.feeClaimer : virtualPoolState.creator,
|
|
23721
|
+
sender: payer,
|
|
23717
23722
|
tokenProgram: _spltoken.TOKEN_PROGRAM_ID
|
|
23718
23723
|
};
|
|
23719
23724
|
return this.program.methods.migrateMeteoraDammClaimLpToken().accountsPartial(accounts).preInstructions(preInstructions).transaction();
|
|
@@ -23723,47 +23728,47 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23723
23728
|
///////////////////////
|
|
23724
23729
|
/**
|
|
23725
23730
|
* Create metadata for the migration of Meteora DAMM V2
|
|
23726
|
-
* @param
|
|
23731
|
+
* @param payer - The payer of the transaction
|
|
23732
|
+
* @param virtualPool - The virtual pool address
|
|
23733
|
+
* @param config - The config address
|
|
23727
23734
|
* @returns A migration transaction
|
|
23728
23735
|
*/
|
|
23729
|
-
async createDammV2MigrationMetadata(
|
|
23730
|
-
const
|
|
23731
|
-
|
|
23732
|
-
);
|
|
23736
|
+
async createDammV2MigrationMetadata(params) {
|
|
23737
|
+
const { virtualPool, config, payer } = params;
|
|
23738
|
+
const migrationMetadata = deriveDammV2MigrationMetadataAddress(virtualPool);
|
|
23733
23739
|
const accounts = {
|
|
23734
|
-
virtualPool
|
|
23735
|
-
config
|
|
23740
|
+
virtualPool,
|
|
23741
|
+
config,
|
|
23736
23742
|
migrationMetadata,
|
|
23737
|
-
payer
|
|
23743
|
+
payer,
|
|
23738
23744
|
systemProgram: _web3js.SystemProgram.programId
|
|
23739
23745
|
};
|
|
23740
23746
|
return this.program.methods.migrationDammV2CreateMetadata().accountsPartial(accounts).transaction();
|
|
23741
23747
|
}
|
|
23742
23748
|
/**
|
|
23743
23749
|
* Migrate to DAMM V2
|
|
23744
|
-
* @param
|
|
23750
|
+
* @param payer - The payer of the transaction
|
|
23751
|
+
* @param virtualPool - The virtual pool address
|
|
23752
|
+
* @param dammConfig - The damm config address
|
|
23745
23753
|
* @returns A migrate transaction
|
|
23746
23754
|
*/
|
|
23747
|
-
async migrateToDammV2(
|
|
23748
|
-
const
|
|
23755
|
+
async migrateToDammV2(params) {
|
|
23756
|
+
const { virtualPool, dammConfig, payer } = params;
|
|
23749
23757
|
const dammPoolAuthority = deriveDammV2PoolAuthority();
|
|
23750
23758
|
const dammEventAuthority = deriveDammV2EventAuthority();
|
|
23751
|
-
const virtualPoolState = await this.state.getPool(
|
|
23752
|
-
migrateToDammV2Param.virtualPool
|
|
23753
|
-
);
|
|
23759
|
+
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
23754
23760
|
if (!virtualPoolState) {
|
|
23755
|
-
throw new Error(
|
|
23756
|
-
`Pool not found: ${migrateToDammV2Param.virtualPool.toString()}`
|
|
23757
|
-
);
|
|
23761
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
23758
23762
|
}
|
|
23759
23763
|
const poolConfigState = await this.state.getPoolConfig(
|
|
23760
23764
|
virtualPoolState.config
|
|
23761
23765
|
);
|
|
23762
|
-
|
|
23763
|
-
|
|
23764
|
-
|
|
23766
|
+
if (!poolConfigState) {
|
|
23767
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
23768
|
+
}
|
|
23769
|
+
const migrationMetadata = deriveDammV2MigrationMetadataAddress(virtualPool);
|
|
23765
23770
|
const dammPool = deriveDammV2PoolAddress(
|
|
23766
|
-
|
|
23771
|
+
dammConfig,
|
|
23767
23772
|
virtualPoolState.baseMint,
|
|
23768
23773
|
poolConfigState.quoteMint
|
|
23769
23774
|
);
|
|
@@ -23792,10 +23797,10 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23792
23797
|
const tokenBaseProgram = poolConfigState.tokenType == 0 ? _spltoken.TOKEN_PROGRAM_ID : _spltoken.TOKEN_2022_PROGRAM_ID;
|
|
23793
23798
|
const tokenQuoteProgram = poolConfigState.quoteTokenFlag == 0 ? _spltoken.TOKEN_PROGRAM_ID : _spltoken.TOKEN_2022_PROGRAM_ID;
|
|
23794
23799
|
const tx = await this.program.methods.migrationDammV2().accountsStrict({
|
|
23795
|
-
virtualPool
|
|
23800
|
+
virtualPool,
|
|
23796
23801
|
migrationMetadata,
|
|
23797
23802
|
config: virtualPoolState.config,
|
|
23798
|
-
poolAuthority,
|
|
23803
|
+
poolAuthority: this.poolAuthority,
|
|
23799
23804
|
pool: dammPool,
|
|
23800
23805
|
firstPositionNftMint: firstPositionNftKP.publicKey,
|
|
23801
23806
|
firstPosition,
|
|
@@ -23811,7 +23816,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23811
23816
|
tokenBVault,
|
|
23812
23817
|
baseVault: virtualPoolState.baseVault,
|
|
23813
23818
|
quoteVault: virtualPoolState.quoteVault,
|
|
23814
|
-
payer
|
|
23819
|
+
payer,
|
|
23815
23820
|
tokenBaseProgram,
|
|
23816
23821
|
tokenQuoteProgram,
|
|
23817
23822
|
token2022Program: _spltoken.TOKEN_2022_PROGRAM_ID,
|
|
@@ -23821,7 +23826,7 @@ var MigrationService = class extends DynamicBondingCurveProgram {
|
|
|
23821
23826
|
{
|
|
23822
23827
|
isSigner: false,
|
|
23823
23828
|
isWritable: false,
|
|
23824
|
-
pubkey:
|
|
23829
|
+
pubkey: dammConfig
|
|
23825
23830
|
}
|
|
23826
23831
|
]).transaction();
|
|
23827
23832
|
const modifyComputeUnits = _web3js.ComputeBudgetProgram.setComputeUnitLimit({
|
|
@@ -23851,10 +23856,15 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
23851
23856
|
}
|
|
23852
23857
|
/**
|
|
23853
23858
|
* Create a new config
|
|
23854
|
-
* @param createConfigParam - The parameters
|
|
23859
|
+
* @param createConfigParam - The config parameters
|
|
23860
|
+
* @param config - The config address
|
|
23861
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
23862
|
+
* @param leftoverReceiver - The leftover receiver address
|
|
23863
|
+
* @param quoteMint - The quote mint
|
|
23864
|
+
* @param payer - The payer of the transaction
|
|
23855
23865
|
* @returns A new config
|
|
23856
23866
|
*/
|
|
23857
|
-
async createConfig(
|
|
23867
|
+
async createConfig(params) {
|
|
23858
23868
|
const {
|
|
23859
23869
|
config,
|
|
23860
23870
|
feeClaimer,
|
|
@@ -23862,7 +23872,7 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
23862
23872
|
quoteMint,
|
|
23863
23873
|
payer,
|
|
23864
23874
|
...configParam
|
|
23865
|
-
} =
|
|
23875
|
+
} = params;
|
|
23866
23876
|
validateConfigParameters({ ...configParam, leftoverReceiver });
|
|
23867
23877
|
return this.program.methods.createConfig(configParam).accountsPartial({
|
|
23868
23878
|
config,
|
|
@@ -23874,32 +23884,44 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
23874
23884
|
}
|
|
23875
23885
|
/**
|
|
23876
23886
|
* Create partner metadata
|
|
23877
|
-
* @param
|
|
23887
|
+
* @param name - The name of the partner
|
|
23888
|
+
* @param website - The website of the partner
|
|
23889
|
+
* @param logo - The logo of the partner
|
|
23890
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
23891
|
+
* @param payer - The payer of the transaction
|
|
23878
23892
|
* @returns A create partner metadata transaction
|
|
23879
23893
|
*/
|
|
23880
|
-
async createPartnerMetadata(
|
|
23881
|
-
const
|
|
23882
|
-
|
|
23883
|
-
);
|
|
23894
|
+
async createPartnerMetadata(params) {
|
|
23895
|
+
const { name, website, logo, feeClaimer, payer } = params;
|
|
23896
|
+
const partnerMetadata = derivePartnerMetadata(feeClaimer);
|
|
23884
23897
|
const partnerMetadataParam = {
|
|
23885
23898
|
padding: new Array(96).fill(0),
|
|
23886
|
-
name
|
|
23887
|
-
website
|
|
23888
|
-
logo
|
|
23899
|
+
name,
|
|
23900
|
+
website,
|
|
23901
|
+
logo
|
|
23889
23902
|
};
|
|
23890
23903
|
return this.program.methods.createPartnerMetadata(partnerMetadataParam).accountsPartial({
|
|
23891
23904
|
partnerMetadata,
|
|
23892
|
-
payer
|
|
23893
|
-
feeClaimer
|
|
23905
|
+
payer,
|
|
23906
|
+
feeClaimer,
|
|
23894
23907
|
systemProgram: _web3js.SystemProgram.programId
|
|
23895
23908
|
}).transaction();
|
|
23896
23909
|
}
|
|
23897
23910
|
/**
|
|
23898
23911
|
* Private method to claim trading fee with quote mint SOL
|
|
23899
|
-
* @param
|
|
23912
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
23913
|
+
* @param payer - The payer of the transaction
|
|
23914
|
+
* @param feeReceiver - The wallet that will receive the tokens
|
|
23915
|
+
* @param config - The config address
|
|
23916
|
+
* @param pool - The pool address
|
|
23917
|
+
* @param poolState - The pool state
|
|
23918
|
+
* @param poolConfigState - The pool config state
|
|
23919
|
+
* @param tokenBaseProgram - The token base program
|
|
23920
|
+
* @param tokenQuoteProgram - The token quote program
|
|
23921
|
+
* @param tempWSolAcc - The temporary wallet that will receive the SOL
|
|
23900
23922
|
* @returns A claim trading fee with quote mint SOL accounts, pre instructions and post instructions
|
|
23901
23923
|
*/
|
|
23902
|
-
async claimWithQuoteMintSol(
|
|
23924
|
+
async claimWithQuoteMintSol(params) {
|
|
23903
23925
|
const {
|
|
23904
23926
|
feeClaimer,
|
|
23905
23927
|
payer,
|
|
@@ -23911,7 +23933,7 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
23911
23933
|
poolConfigState,
|
|
23912
23934
|
tokenBaseProgram,
|
|
23913
23935
|
tokenQuoteProgram
|
|
23914
|
-
} =
|
|
23936
|
+
} = params;
|
|
23915
23937
|
const preInstructions = [];
|
|
23916
23938
|
const postInstructions = [];
|
|
23917
23939
|
const tokenBaseAccount = findAssociatedTokenAddress(
|
|
@@ -23960,10 +23982,18 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
23960
23982
|
}
|
|
23961
23983
|
/**
|
|
23962
23984
|
* Private method to claim trading fee with quote mint not SOL
|
|
23963
|
-
* @param
|
|
23985
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
23986
|
+
* @param payer - The payer of the transaction
|
|
23987
|
+
* @param feeReceiver - The wallet that will receive the tokens
|
|
23988
|
+
* @param config - The config address
|
|
23989
|
+
* @param pool - The pool address
|
|
23990
|
+
* @param poolState - The pool state
|
|
23991
|
+
* @param poolConfigState - The pool config state
|
|
23992
|
+
* @param tokenBaseProgram - The token base program
|
|
23993
|
+
* @param tokenQuoteProgram - The token quote program
|
|
23964
23994
|
* @returns A claim trading fee with quote mint not SOL accounts and pre instructions
|
|
23965
23995
|
*/
|
|
23966
|
-
async claimWithQuoteMintNotSol(
|
|
23996
|
+
async claimWithQuoteMintNotSol(params) {
|
|
23967
23997
|
const {
|
|
23968
23998
|
feeClaimer,
|
|
23969
23999
|
payer,
|
|
@@ -23974,7 +24004,7 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
23974
24004
|
poolConfigState,
|
|
23975
24005
|
tokenBaseProgram,
|
|
23976
24006
|
tokenQuoteProgram
|
|
23977
|
-
} =
|
|
24007
|
+
} = params;
|
|
23978
24008
|
const {
|
|
23979
24009
|
ataTokenA: tokenBaseAccount,
|
|
23980
24010
|
ataTokenB: tokenQuoteAccount,
|
|
@@ -24005,10 +24035,16 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24005
24035
|
}
|
|
24006
24036
|
/**
|
|
24007
24037
|
* Claim partner trading fee
|
|
24008
|
-
* @param
|
|
24038
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
24039
|
+
* @param payer - The payer of the transaction
|
|
24040
|
+
* @param pool - The pool address
|
|
24041
|
+
* @param maxBaseAmount - The maximum base amount
|
|
24042
|
+
* @param maxQuoteAmount - The maximum quote amount
|
|
24043
|
+
* @param receiver - The wallet that will receive the tokens (Optional)
|
|
24044
|
+
* @param tempWSolAcc - The temporary wallet that will receive the SOL (Optional)
|
|
24009
24045
|
* @returns A claim trading fee transaction
|
|
24010
24046
|
*/
|
|
24011
|
-
async claimPartnerTradingFee(
|
|
24047
|
+
async claimPartnerTradingFee(params) {
|
|
24012
24048
|
const {
|
|
24013
24049
|
feeClaimer,
|
|
24014
24050
|
payer,
|
|
@@ -24017,14 +24053,14 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24017
24053
|
maxQuoteAmount,
|
|
24018
24054
|
receiver,
|
|
24019
24055
|
tempWSolAcc
|
|
24020
|
-
} =
|
|
24056
|
+
} = params;
|
|
24021
24057
|
const poolState = await this.state.getPool(pool);
|
|
24022
24058
|
if (!poolState) {
|
|
24023
24059
|
throw new Error(`Pool not found: ${pool.toString()}`);
|
|
24024
24060
|
}
|
|
24025
24061
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
24026
24062
|
if (!poolConfigState) {
|
|
24027
|
-
throw new Error(`Pool config not found
|
|
24063
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24028
24064
|
}
|
|
24029
24065
|
const tokenBaseProgram = getTokenProgram(poolConfigState.tokenType);
|
|
24030
24066
|
const tokenQuoteProgram = getTokenProgram(
|
|
@@ -24065,10 +24101,15 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24065
24101
|
}
|
|
24066
24102
|
/**
|
|
24067
24103
|
* Claim partner trading fee
|
|
24068
|
-
* @param
|
|
24104
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
24105
|
+
* @param payer - The payer of the transaction
|
|
24106
|
+
* @param pool - The pool address
|
|
24107
|
+
* @param maxBaseAmount - The maximum base amount
|
|
24108
|
+
* @param maxQuoteAmount - The maximum quote amount
|
|
24109
|
+
* @param receiver - The wallet that will receive the tokens
|
|
24069
24110
|
* @returns A claim trading fee transaction
|
|
24070
24111
|
*/
|
|
24071
|
-
async claimPartnerTradingFee2(
|
|
24112
|
+
async claimPartnerTradingFee2(params) {
|
|
24072
24113
|
const {
|
|
24073
24114
|
feeClaimer,
|
|
24074
24115
|
payer,
|
|
@@ -24076,7 +24117,7 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24076
24117
|
maxBaseAmount,
|
|
24077
24118
|
maxQuoteAmount,
|
|
24078
24119
|
receiver
|
|
24079
|
-
} =
|
|
24120
|
+
} = params;
|
|
24080
24121
|
const poolState = await this.state.getPool(pool);
|
|
24081
24122
|
if (!poolState) {
|
|
24082
24123
|
throw new Error(`Pool not found: ${pool.toString()}`);
|
|
@@ -24152,19 +24193,20 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24152
24193
|
}
|
|
24153
24194
|
/**
|
|
24154
24195
|
* Partner withdraw surplus
|
|
24155
|
-
* @param
|
|
24196
|
+
* @param feeClaimer - The partner's fee claimer address
|
|
24197
|
+
* @param virtualPool - The virtual pool address
|
|
24156
24198
|
* @returns A partner withdraw surplus transaction
|
|
24157
24199
|
*/
|
|
24158
|
-
async partnerWithdrawSurplus(
|
|
24159
|
-
const
|
|
24160
|
-
|
|
24161
|
-
);
|
|
24200
|
+
async partnerWithdrawSurplus(params) {
|
|
24201
|
+
const { virtualPool, feeClaimer } = params;
|
|
24202
|
+
const poolState = await this.state.getPool(virtualPool);
|
|
24162
24203
|
if (!poolState) {
|
|
24163
|
-
throw new Error(
|
|
24164
|
-
`Pool not found: ${partnerWithdrawSurplusParam.virtualPool.toString()}`
|
|
24165
|
-
);
|
|
24204
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
24166
24205
|
}
|
|
24167
24206
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
24207
|
+
if (!poolConfigState) {
|
|
24208
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24209
|
+
}
|
|
24168
24210
|
const tokenQuoteProgram = getTokenProgram(
|
|
24169
24211
|
poolConfigState.quoteTokenFlag
|
|
24170
24212
|
);
|
|
@@ -24173,53 +24215,59 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24173
24215
|
const { ataPubkey: tokenQuoteAccount, ix: createQuoteTokenAccountIx } = await getOrCreateATAInstruction(
|
|
24174
24216
|
this.connection,
|
|
24175
24217
|
poolConfigState.quoteMint,
|
|
24176
|
-
|
|
24177
|
-
|
|
24218
|
+
feeClaimer,
|
|
24219
|
+
feeClaimer,
|
|
24178
24220
|
true,
|
|
24179
24221
|
tokenQuoteProgram
|
|
24180
24222
|
);
|
|
24181
24223
|
createQuoteTokenAccountIx && preInstructions.push(createQuoteTokenAccountIx);
|
|
24182
24224
|
if (poolConfigState.quoteMint.equals(_spltoken.NATIVE_MINT)) {
|
|
24183
|
-
const unwrapSolIx = unwrapSOLInstruction(
|
|
24184
|
-
partnerWithdrawSurplusParam.feeClaimer,
|
|
24185
|
-
partnerWithdrawSurplusParam.feeClaimer
|
|
24186
|
-
);
|
|
24225
|
+
const unwrapSolIx = unwrapSOLInstruction(feeClaimer, feeClaimer);
|
|
24187
24226
|
unwrapSolIx && postInstructions.push(unwrapSolIx);
|
|
24188
24227
|
}
|
|
24189
24228
|
return this.program.methods.partnerWithdrawSurplus().accountsPartial({
|
|
24190
24229
|
poolAuthority: this.poolAuthority,
|
|
24191
24230
|
config: poolState.config,
|
|
24192
|
-
virtualPool
|
|
24231
|
+
virtualPool,
|
|
24193
24232
|
tokenQuoteAccount,
|
|
24194
24233
|
quoteVault: poolState.quoteVault,
|
|
24195
24234
|
quoteMint: poolConfigState.quoteMint,
|
|
24196
|
-
feeClaimer
|
|
24235
|
+
feeClaimer,
|
|
24197
24236
|
tokenQuoteProgram
|
|
24198
24237
|
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
24199
24238
|
}
|
|
24200
24239
|
/**
|
|
24201
24240
|
* Partner withdraw migration fee
|
|
24202
|
-
* @param
|
|
24241
|
+
* @param virtualPool - The virtual pool address
|
|
24242
|
+
* @param sender - The sender of the pool
|
|
24203
24243
|
* @returns A partner withdraw migration fee transaction
|
|
24204
24244
|
*/
|
|
24205
|
-
async partnerWithdrawMigrationFee(
|
|
24206
|
-
const { virtualPool, sender
|
|
24245
|
+
async partnerWithdrawMigrationFee(params) {
|
|
24246
|
+
const { virtualPool, sender } = params;
|
|
24207
24247
|
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
24248
|
+
if (!virtualPoolState) {
|
|
24249
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
24250
|
+
}
|
|
24208
24251
|
const configState = await this.state.getPoolConfig(
|
|
24209
24252
|
virtualPoolState.config
|
|
24210
24253
|
);
|
|
24211
|
-
|
|
24254
|
+
if (!configState) {
|
|
24255
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24256
|
+
}
|
|
24257
|
+
const preInstructions = [];
|
|
24258
|
+
const postInstructions = [];
|
|
24259
|
+
const { ataPubkey: tokenQuoteAccount, ix: createTokenQuoteAccountIx } = await getOrCreateATAInstruction(
|
|
24212
24260
|
this.program.provider.connection,
|
|
24213
24261
|
configState.quoteMint,
|
|
24214
24262
|
sender,
|
|
24215
|
-
|
|
24263
|
+
sender,
|
|
24216
24264
|
true,
|
|
24217
24265
|
getTokenProgram(configState.quoteTokenFlag)
|
|
24218
24266
|
);
|
|
24219
|
-
|
|
24267
|
+
createTokenQuoteAccountIx && preInstructions.push(createTokenQuoteAccountIx);
|
|
24220
24268
|
if (configState.quoteMint.equals(_spltoken.NATIVE_MINT)) {
|
|
24221
|
-
const
|
|
24222
|
-
|
|
24269
|
+
const unwrapSolIx = unwrapSOLInstruction(sender, sender);
|
|
24270
|
+
unwrapSolIx && postInstructions.push(unwrapSolIx);
|
|
24223
24271
|
}
|
|
24224
24272
|
const transaction = await this.program.methods.withdrawMigrationFee(0).accountsPartial({
|
|
24225
24273
|
poolAuthority: this.poolAuthority,
|
|
@@ -24230,7 +24278,7 @@ var PartnerService = class extends DynamicBondingCurveProgram {
|
|
|
24230
24278
|
quoteMint: configState.quoteMint,
|
|
24231
24279
|
sender,
|
|
24232
24280
|
tokenQuoteProgram: getTokenProgram(configState.quoteTokenFlag)
|
|
24233
|
-
}).preInstructions(
|
|
24281
|
+
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
24234
24282
|
return transaction;
|
|
24235
24283
|
}
|
|
24236
24284
|
};
|
|
@@ -24251,10 +24299,21 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24251
24299
|
}
|
|
24252
24300
|
/**
|
|
24253
24301
|
* Private method to initialize a pool with SPL token
|
|
24254
|
-
* @param
|
|
24302
|
+
* @param name - The name of the token
|
|
24303
|
+
* @param symbol - The symbol of the token
|
|
24304
|
+
* @param uri - The URI of the token
|
|
24305
|
+
* @param pool - The pool address
|
|
24306
|
+
* @param config - The config address
|
|
24307
|
+
* @param payer - The payer address
|
|
24308
|
+
* @param poolCreator - The pool creator address
|
|
24309
|
+
* @param baseMint - The base mint address
|
|
24310
|
+
* @param baseVault - The base vault address
|
|
24311
|
+
* @param quoteVault - The quote vault address
|
|
24312
|
+
* @param quoteMint - The quote mint address
|
|
24313
|
+
* @param mintMetadata - The mint metadata address (Optional)
|
|
24255
24314
|
* @returns A transaction that initializes the pool with SPL token
|
|
24256
24315
|
*/
|
|
24257
|
-
async initializeSplPool(
|
|
24316
|
+
async initializeSplPool(params) {
|
|
24258
24317
|
const {
|
|
24259
24318
|
name,
|
|
24260
24319
|
symbol,
|
|
@@ -24268,7 +24327,7 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24268
24327
|
baseVault,
|
|
24269
24328
|
quoteVault,
|
|
24270
24329
|
quoteMint
|
|
24271
|
-
} =
|
|
24330
|
+
} = params;
|
|
24272
24331
|
return this.program.methods.initializeVirtualPoolWithSplToken({
|
|
24273
24332
|
name,
|
|
24274
24333
|
symbol,
|
|
@@ -24291,10 +24350,21 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24291
24350
|
}
|
|
24292
24351
|
/**
|
|
24293
24352
|
* Private method to initialize a pool with Token2022
|
|
24294
|
-
* @param
|
|
24353
|
+
* @param name - The name of the token
|
|
24354
|
+
* @param symbol - The symbol of the token
|
|
24355
|
+
* @param uri - The URI of the token
|
|
24356
|
+
* @param pool - The pool address
|
|
24357
|
+
* @param config - The config address
|
|
24358
|
+
* @param payer - The payer address
|
|
24359
|
+
* @param poolCreator - The pool creator address
|
|
24360
|
+
* @param baseMint - The base mint address
|
|
24361
|
+
* @param baseVault - The base vault address
|
|
24362
|
+
* @param quoteVault - The quote vault address
|
|
24363
|
+
* @param quoteMint - The quote mint address
|
|
24364
|
+
* @param mintMetadata - The mint metadata address (Optional)
|
|
24295
24365
|
* @returns A transaction that initializes the pool with Token2022
|
|
24296
24366
|
*/
|
|
24297
|
-
async initializeToken2022Pool(
|
|
24367
|
+
async initializeToken2022Pool(params) {
|
|
24298
24368
|
const {
|
|
24299
24369
|
name,
|
|
24300
24370
|
symbol,
|
|
@@ -24307,7 +24377,7 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24307
24377
|
baseVault,
|
|
24308
24378
|
quoteVault,
|
|
24309
24379
|
quoteMint
|
|
24310
|
-
} =
|
|
24380
|
+
} = params;
|
|
24311
24381
|
return this.program.methods.initializeVirtualPoolWithToken2022({
|
|
24312
24382
|
name,
|
|
24313
24383
|
symbol,
|
|
@@ -24329,8 +24399,8 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24329
24399
|
/**
|
|
24330
24400
|
* Private method to prepare swap parameters
|
|
24331
24401
|
* @param swapBaseForQuote - Whether to swap base for quote
|
|
24332
|
-
* @param virtualPoolState - The virtual pool state
|
|
24333
|
-
* @param poolConfigState - The pool config state
|
|
24402
|
+
* @param virtualPoolState - The virtual pool state consisting of baseMint and poolType
|
|
24403
|
+
* @param poolConfigState - The pool config state consisting of quoteMint and quoteTokenFlag
|
|
24334
24404
|
* @returns The prepare swap parameters
|
|
24335
24405
|
*/
|
|
24336
24406
|
prepareSwapParams(swapBaseForQuote, virtualPoolState, poolConfigState) {
|
|
@@ -24376,7 +24446,7 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24376
24446
|
}
|
|
24377
24447
|
/**
|
|
24378
24448
|
* Private method to create pool transaction
|
|
24379
|
-
* @param createPoolParam - The parameters for the pool
|
|
24449
|
+
* @param createPoolParam - The parameters for the pool consisting of baseMint, name, symbol, uri, poolCreator, config, and payer
|
|
24380
24450
|
* @param tokenType - The token type
|
|
24381
24451
|
* @param quoteMint - The quote mint token
|
|
24382
24452
|
* @returns A transaction that creates the pool
|
|
@@ -24408,10 +24478,12 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24408
24478
|
}
|
|
24409
24479
|
/**
|
|
24410
24480
|
* Private method to create first buy transaction
|
|
24411
|
-
* @param firstBuyParam - The parameters for the first buy
|
|
24481
|
+
* @param firstBuyParam - The parameters for the first buy consisting of buyer, receiver (optional), buyAmount, minimumAmountOut, and referralTokenAccount
|
|
24412
24482
|
* @param baseMint - The base mint token
|
|
24413
24483
|
* @param config - The config key
|
|
24414
|
-
* @param
|
|
24484
|
+
* @param baseFee - The base fee
|
|
24485
|
+
* @param swapBaseForQuote - Whether to swap base for quote
|
|
24486
|
+
* @param currentPoint - The current point
|
|
24415
24487
|
* @param tokenType - The token type
|
|
24416
24488
|
* @param quoteMint - The quote mint token
|
|
24417
24489
|
* @returns Instructions for the first buy
|
|
@@ -24516,12 +24588,21 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24516
24588
|
}
|
|
24517
24589
|
/**
|
|
24518
24590
|
* Create a new pool
|
|
24519
|
-
* @param
|
|
24591
|
+
* @param name - The name of the token
|
|
24592
|
+
* @param symbol - The symbol of the token
|
|
24593
|
+
* @param uri - The URI of the token
|
|
24594
|
+
* @param config - The config address
|
|
24595
|
+
* @param payer - The payer address
|
|
24596
|
+
* @param poolCreator - The pool creator address
|
|
24597
|
+
* @param baseMint - The base mint address
|
|
24520
24598
|
* @returns A new pool
|
|
24521
24599
|
*/
|
|
24522
|
-
async createPool(
|
|
24523
|
-
const { baseMint, config, name, symbol, uri, payer, poolCreator } =
|
|
24600
|
+
async createPool(params) {
|
|
24601
|
+
const { baseMint, config, name, symbol, uri, payer, poolCreator } = params;
|
|
24524
24602
|
const poolConfigState = await this.state.getPoolConfig(config);
|
|
24603
|
+
if (!poolConfigState) {
|
|
24604
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24605
|
+
}
|
|
24525
24606
|
const { quoteMint, tokenType } = poolConfigState;
|
|
24526
24607
|
const pool = deriveDbcPoolAddress(quoteMint, baseMint, config);
|
|
24527
24608
|
const baseVault = deriveDbcTokenVaultAddress(pool, baseMint);
|
|
@@ -24548,10 +24629,16 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24548
24629
|
}
|
|
24549
24630
|
/**
|
|
24550
24631
|
* Create a new config and pool
|
|
24551
|
-
* @param
|
|
24632
|
+
* @param config - The config address
|
|
24633
|
+
* @param feeClaimer - The fee claimer address
|
|
24634
|
+
* @param leftoverReceiver - The leftover receiver address
|
|
24635
|
+
* @param quoteMint - The quote mint address
|
|
24636
|
+
* @param payer - The payer address
|
|
24637
|
+
* @param configParam - The parameters for the config
|
|
24638
|
+
* @param preCreatePoolParam - The parameters for the pool
|
|
24552
24639
|
* @returns A new config and pool
|
|
24553
24640
|
*/
|
|
24554
|
-
async createConfigAndPool(
|
|
24641
|
+
async createConfigAndPool(params) {
|
|
24555
24642
|
const {
|
|
24556
24643
|
config,
|
|
24557
24644
|
feeClaimer,
|
|
@@ -24559,7 +24646,7 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24559
24646
|
quoteMint,
|
|
24560
24647
|
payer,
|
|
24561
24648
|
...configParam
|
|
24562
|
-
} =
|
|
24649
|
+
} = params;
|
|
24563
24650
|
const configKey = new (0, _web3js.PublicKey)(config);
|
|
24564
24651
|
const quoteMintToken = new (0, _web3js.PublicKey)(quoteMint);
|
|
24565
24652
|
const payerAddress = new (0, _web3js.PublicKey)(payer);
|
|
@@ -24577,11 +24664,11 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24577
24664
|
tx.add(createConfigTx);
|
|
24578
24665
|
const createPoolTx = await this.createPoolTx(
|
|
24579
24666
|
{
|
|
24580
|
-
...
|
|
24667
|
+
...params.preCreatePoolParam,
|
|
24581
24668
|
config: configKey,
|
|
24582
24669
|
payer: payerAddress
|
|
24583
24670
|
},
|
|
24584
|
-
|
|
24671
|
+
params.tokenType,
|
|
24585
24672
|
quoteMintToken
|
|
24586
24673
|
);
|
|
24587
24674
|
tx.add(createPoolTx);
|
|
@@ -24589,10 +24676,17 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24589
24676
|
}
|
|
24590
24677
|
/**
|
|
24591
24678
|
* Create a new config and pool and buy tokens
|
|
24592
|
-
* @param
|
|
24679
|
+
* @param config - The config address
|
|
24680
|
+
* @param feeClaimer - The fee claimer address
|
|
24681
|
+
* @param leftoverReceiver - The leftover receiver address
|
|
24682
|
+
* @param quoteMint - The quote mint address
|
|
24683
|
+
* @param payer - The payer address
|
|
24684
|
+
* @param configParam - The parameters for the config
|
|
24685
|
+
* @param preCreatePoolParam - The parameters for the pool
|
|
24686
|
+
* @param firstBuyParam - The parameters for the first buy
|
|
24593
24687
|
* @returns An object containing the new config transaction, new pool transaction, and first buy transaction
|
|
24594
24688
|
*/
|
|
24595
|
-
async createConfigAndPoolWithFirstBuy(
|
|
24689
|
+
async createConfigAndPoolWithFirstBuy(params) {
|
|
24596
24690
|
const {
|
|
24597
24691
|
config,
|
|
24598
24692
|
feeClaimer,
|
|
@@ -24600,7 +24694,7 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24600
24694
|
quoteMint,
|
|
24601
24695
|
payer,
|
|
24602
24696
|
...configParam
|
|
24603
|
-
} =
|
|
24697
|
+
} = params;
|
|
24604
24698
|
const configKey = new (0, _web3js.PublicKey)(config);
|
|
24605
24699
|
const quoteMintToken = new (0, _web3js.PublicKey)(quoteMint);
|
|
24606
24700
|
const payerAddress = new (0, _web3js.PublicKey)(payer);
|
|
@@ -24616,11 +24710,11 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24616
24710
|
);
|
|
24617
24711
|
const createPoolTx = await this.createPoolTx(
|
|
24618
24712
|
{
|
|
24619
|
-
...
|
|
24713
|
+
...params.preCreatePoolParam,
|
|
24620
24714
|
config: configKey,
|
|
24621
24715
|
payer: payerAddress
|
|
24622
24716
|
},
|
|
24623
|
-
|
|
24717
|
+
params.tokenType,
|
|
24624
24718
|
quoteMintToken
|
|
24625
24719
|
);
|
|
24626
24720
|
const currentPoint = await getCurrentPoint(
|
|
@@ -24628,17 +24722,15 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24628
24722
|
configParam.activationType
|
|
24629
24723
|
);
|
|
24630
24724
|
let swapBuyTx;
|
|
24631
|
-
if (
|
|
24632
|
-
new (0, _bnjs2.default)(0)
|
|
24633
|
-
)) {
|
|
24725
|
+
if (params.firstBuyParam && params.firstBuyParam.buyAmount.gt(new (0, _bnjs2.default)(0))) {
|
|
24634
24726
|
swapBuyTx = await this.swapBuyTx(
|
|
24635
|
-
|
|
24636
|
-
|
|
24727
|
+
params.firstBuyParam,
|
|
24728
|
+
params.preCreatePoolParam.baseMint,
|
|
24637
24729
|
configKey,
|
|
24638
24730
|
configParam.poolFees.baseFee,
|
|
24639
24731
|
false,
|
|
24640
24732
|
currentPoint,
|
|
24641
|
-
|
|
24733
|
+
params.tokenType,
|
|
24642
24734
|
quoteMintToken
|
|
24643
24735
|
);
|
|
24644
24736
|
}
|
|
@@ -24650,15 +24742,20 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24650
24742
|
}
|
|
24651
24743
|
/**
|
|
24652
24744
|
* Create a new pool and buy tokens
|
|
24653
|
-
* @param
|
|
24745
|
+
* @param createPoolParam - The parameters for the pool
|
|
24746
|
+
* @param firstBuyParam - The parameters for the first buy
|
|
24654
24747
|
* @returns An object containing the new pool transaction and swap buy transaction
|
|
24655
24748
|
*/
|
|
24656
|
-
async createPoolWithFirstBuy(
|
|
24657
|
-
const {
|
|
24749
|
+
async createPoolWithFirstBuy(params) {
|
|
24750
|
+
const { createPoolParam, firstBuyParam } = params;
|
|
24751
|
+
const { config } = createPoolParam;
|
|
24658
24752
|
const poolConfigState = await this.state.getPoolConfig(config);
|
|
24753
|
+
if (!poolConfigState) {
|
|
24754
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24755
|
+
}
|
|
24659
24756
|
const { quoteMint, tokenType } = poolConfigState;
|
|
24660
24757
|
const createPoolTx = await this.createPoolTx(
|
|
24661
|
-
|
|
24758
|
+
createPoolParam,
|
|
24662
24759
|
tokenType,
|
|
24663
24760
|
quoteMint
|
|
24664
24761
|
);
|
|
@@ -24667,10 +24764,10 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24667
24764
|
poolConfigState.activationType
|
|
24668
24765
|
);
|
|
24669
24766
|
let swapBuyTx;
|
|
24670
|
-
if (
|
|
24767
|
+
if (firstBuyParam && firstBuyParam.buyAmount.gt(new (0, _bnjs2.default)(0))) {
|
|
24671
24768
|
swapBuyTx = await this.swapBuyTx(
|
|
24672
|
-
|
|
24673
|
-
|
|
24769
|
+
firstBuyParam,
|
|
24770
|
+
createPoolParam.baseMint,
|
|
24674
24771
|
config,
|
|
24675
24772
|
poolConfigState.poolFees.baseFee,
|
|
24676
24773
|
false,
|
|
@@ -24686,15 +24783,18 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24686
24783
|
}
|
|
24687
24784
|
/**
|
|
24688
24785
|
* Create a new pool and buy tokens with partner and creator
|
|
24689
|
-
* @param
|
|
24690
|
-
* @
|
|
24786
|
+
* @param createPoolParam - The parameters for the pool
|
|
24787
|
+
* @param partnerFirstBuyParam - The parameters for the partner first buy
|
|
24788
|
+
* @param creatorFirstBuyParam - The parameters for the creator first buy
|
|
24789
|
+
* @returns An object containing the new pool transaction and swap buy transactions for partner and creator
|
|
24691
24790
|
*/
|
|
24692
|
-
async createPoolWithPartnerAndCreatorFirstBuy(
|
|
24693
|
-
const {
|
|
24791
|
+
async createPoolWithPartnerAndCreatorFirstBuy(params) {
|
|
24792
|
+
const { createPoolParam, partnerFirstBuyParam, creatorFirstBuyParam } = params;
|
|
24793
|
+
const { config } = createPoolParam;
|
|
24694
24794
|
const poolConfigState = await this.state.getPoolConfig(config);
|
|
24695
24795
|
const { quoteMint, tokenType } = poolConfigState;
|
|
24696
24796
|
const createPoolTx = await this.createPoolTx(
|
|
24697
|
-
|
|
24797
|
+
createPoolParam,
|
|
24698
24798
|
tokenType,
|
|
24699
24799
|
quoteMint
|
|
24700
24800
|
);
|
|
@@ -24703,18 +24803,16 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24703
24803
|
poolConfigState.activationType
|
|
24704
24804
|
);
|
|
24705
24805
|
let partnerSwapBuyTx;
|
|
24706
|
-
if (
|
|
24707
|
-
new (0, _bnjs2.default)(0)
|
|
24708
|
-
)) {
|
|
24806
|
+
if (partnerFirstBuyParam && partnerFirstBuyParam.buyAmount.gt(new (0, _bnjs2.default)(0))) {
|
|
24709
24807
|
partnerSwapBuyTx = await this.swapBuyTx(
|
|
24710
24808
|
{
|
|
24711
|
-
buyer:
|
|
24712
|
-
receiver:
|
|
24713
|
-
buyAmount:
|
|
24714
|
-
minimumAmountOut:
|
|
24715
|
-
referralTokenAccount:
|
|
24809
|
+
buyer: partnerFirstBuyParam.partner,
|
|
24810
|
+
receiver: partnerFirstBuyParam.receiver,
|
|
24811
|
+
buyAmount: partnerFirstBuyParam.buyAmount,
|
|
24812
|
+
minimumAmountOut: partnerFirstBuyParam.minimumAmountOut,
|
|
24813
|
+
referralTokenAccount: partnerFirstBuyParam.referralTokenAccount
|
|
24716
24814
|
},
|
|
24717
|
-
|
|
24815
|
+
createPoolParam.baseMint,
|
|
24718
24816
|
config,
|
|
24719
24817
|
poolConfigState.poolFees.baseFee,
|
|
24720
24818
|
false,
|
|
@@ -24724,18 +24822,16 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24724
24822
|
);
|
|
24725
24823
|
}
|
|
24726
24824
|
let creatorSwapBuyTx;
|
|
24727
|
-
if (
|
|
24728
|
-
new (0, _bnjs2.default)(0)
|
|
24729
|
-
)) {
|
|
24825
|
+
if (creatorFirstBuyParam && creatorFirstBuyParam.buyAmount.gt(new (0, _bnjs2.default)(0))) {
|
|
24730
24826
|
creatorSwapBuyTx = await this.swapBuyTx(
|
|
24731
24827
|
{
|
|
24732
|
-
buyer:
|
|
24733
|
-
receiver:
|
|
24734
|
-
buyAmount:
|
|
24735
|
-
minimumAmountOut:
|
|
24736
|
-
referralTokenAccount:
|
|
24828
|
+
buyer: creatorFirstBuyParam.creator,
|
|
24829
|
+
receiver: creatorFirstBuyParam.receiver,
|
|
24830
|
+
buyAmount: creatorFirstBuyParam.buyAmount,
|
|
24831
|
+
minimumAmountOut: creatorFirstBuyParam.minimumAmountOut,
|
|
24832
|
+
referralTokenAccount: creatorFirstBuyParam.referralTokenAccount
|
|
24737
24833
|
},
|
|
24738
|
-
|
|
24834
|
+
createPoolParam.baseMint,
|
|
24739
24835
|
config,
|
|
24740
24836
|
poolConfigState.poolFees.baseFee,
|
|
24741
24837
|
false,
|
|
@@ -24752,17 +24848,33 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24752
24848
|
}
|
|
24753
24849
|
/**
|
|
24754
24850
|
* Swap between base and quote
|
|
24851
|
+
* @param owner - The owner of the swap
|
|
24755
24852
|
* @param pool - The pool address
|
|
24756
|
-
* @param
|
|
24853
|
+
* @param amountIn - The amount in
|
|
24854
|
+
* @param minimumAmountOut - The minimum amount out
|
|
24855
|
+
* @param swapBaseForQuote - Whether to swap base for quote
|
|
24856
|
+
* @param referralTokenAccount - The referral token account (nullible)
|
|
24857
|
+
* @param payer - The payer of the swap (optional)
|
|
24757
24858
|
* @returns A swap transaction
|
|
24758
24859
|
*/
|
|
24759
|
-
async swap(
|
|
24760
|
-
const
|
|
24860
|
+
async swap(params) {
|
|
24861
|
+
const {
|
|
24862
|
+
amountIn,
|
|
24863
|
+
minimumAmountOut,
|
|
24864
|
+
swapBaseForQuote,
|
|
24865
|
+
owner,
|
|
24866
|
+
payer,
|
|
24867
|
+
pool,
|
|
24868
|
+
referralTokenAccount
|
|
24869
|
+
} = params;
|
|
24870
|
+
const poolState = await this.state.getPool(pool);
|
|
24761
24871
|
if (!poolState) {
|
|
24762
|
-
throw new Error(`Pool not found: ${
|
|
24872
|
+
throw new Error(`Pool not found: ${pool.toString()}`);
|
|
24763
24873
|
}
|
|
24764
24874
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
24765
|
-
|
|
24875
|
+
if (!poolConfigState) {
|
|
24876
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24877
|
+
}
|
|
24766
24878
|
validateSwapAmount(amountIn);
|
|
24767
24879
|
const currentPoint = await getCurrentPoint(
|
|
24768
24880
|
this.connection,
|
|
@@ -24818,12 +24930,12 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24818
24930
|
}).accountsPartial({
|
|
24819
24931
|
baseMint: poolState.baseMint,
|
|
24820
24932
|
quoteMint: poolConfigState.quoteMint,
|
|
24821
|
-
pool
|
|
24933
|
+
pool,
|
|
24822
24934
|
baseVault: poolState.baseVault,
|
|
24823
24935
|
quoteVault: poolState.quoteVault,
|
|
24824
24936
|
config: poolState.config,
|
|
24825
24937
|
poolAuthority: this.poolAuthority,
|
|
24826
|
-
referralTokenAccount
|
|
24938
|
+
referralTokenAccount,
|
|
24827
24939
|
inputTokenAccount,
|
|
24828
24940
|
outputTokenAccount,
|
|
24829
24941
|
payer: owner,
|
|
@@ -24833,10 +24945,19 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24833
24945
|
}
|
|
24834
24946
|
/**
|
|
24835
24947
|
* Swap V2 between base and quote (included SwapMode: ExactIn, PartialFill, ExactOut)
|
|
24836
|
-
* @param
|
|
24948
|
+
* @param owner - The owner of the swap
|
|
24949
|
+
* @param pool - The pool address
|
|
24950
|
+
* @param swapBaseForQuote - Whether to swap base for quote
|
|
24951
|
+
* @param referralTokenAccount - The referral token account (nullible)
|
|
24952
|
+
* @param payer - The payer of the swap (optional)
|
|
24953
|
+
* @param swapMode - The swap mode (ExactIn: 0, PartialFill: 1, ExactOut: 2)
|
|
24954
|
+
* @param amountIn - The amount in (for ExactIn and PartialFill)
|
|
24955
|
+
* @param minimumAmountOut - The minimum amount out (for ExactIn and PartialFill)
|
|
24956
|
+
* @param amountOut - The amount out (for ExactOut)
|
|
24957
|
+
* @param maximumAmountIn - The maximum amount in (for ExactOut)
|
|
24837
24958
|
* @returns A swap transaction
|
|
24838
24959
|
*/
|
|
24839
|
-
async swap2(
|
|
24960
|
+
async swap2(params) {
|
|
24840
24961
|
const {
|
|
24841
24962
|
pool,
|
|
24842
24963
|
swapBaseForQuote,
|
|
@@ -24844,15 +24965,15 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24844
24965
|
owner,
|
|
24845
24966
|
payer,
|
|
24846
24967
|
referralTokenAccount
|
|
24847
|
-
} =
|
|
24968
|
+
} = params;
|
|
24848
24969
|
let amount0;
|
|
24849
24970
|
let amount1;
|
|
24850
24971
|
if (swapMode === 2 /* ExactOut */) {
|
|
24851
|
-
amount0 =
|
|
24852
|
-
amount1 =
|
|
24972
|
+
amount0 = params.amountOut;
|
|
24973
|
+
amount1 = params.maximumAmountIn;
|
|
24853
24974
|
} else {
|
|
24854
|
-
amount0 =
|
|
24855
|
-
amount1 =
|
|
24975
|
+
amount0 = params.amountIn;
|
|
24976
|
+
amount1 = params.minimumAmountOut;
|
|
24856
24977
|
}
|
|
24857
24978
|
validateSwapAmount(amount0);
|
|
24858
24979
|
const poolState = await this.state.getPool(pool);
|
|
@@ -24860,6 +24981,9 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24860
24981
|
throw new Error(`Pool not found: ${pool.toString()}`);
|
|
24861
24982
|
}
|
|
24862
24983
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
24984
|
+
if (!poolConfigState) {
|
|
24985
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
24986
|
+
}
|
|
24863
24987
|
const currentPoint = await getCurrentPoint(
|
|
24864
24988
|
this.connection,
|
|
24865
24989
|
poolConfigState.activationType
|
|
@@ -24935,12 +25059,12 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24935
25059
|
* @param config - The config
|
|
24936
25060
|
* @param swapBaseForQuote - Whether to swap base for quote
|
|
24937
25061
|
* @param amountIn - The amount in
|
|
24938
|
-
* @param slippageBps - Slippage tolerance in basis points (100 = 1%)
|
|
25062
|
+
* @param slippageBps - Slippage tolerance in basis points (100 = 1%) (optional)
|
|
24939
25063
|
* @param hasReferral - Whether the referral is enabled
|
|
24940
25064
|
* @param currentPoint - The current point
|
|
24941
25065
|
* @returns The swap quote result
|
|
24942
25066
|
*/
|
|
24943
|
-
swapQuote(
|
|
25067
|
+
swapQuote(params) {
|
|
24944
25068
|
const {
|
|
24945
25069
|
virtualPool,
|
|
24946
25070
|
config,
|
|
@@ -24949,7 +25073,7 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24949
25073
|
slippageBps,
|
|
24950
25074
|
hasReferral,
|
|
24951
25075
|
currentPoint
|
|
24952
|
-
} =
|
|
25076
|
+
} = params;
|
|
24953
25077
|
return swapQuote(
|
|
24954
25078
|
virtualPool,
|
|
24955
25079
|
config,
|
|
@@ -24962,10 +25086,18 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24962
25086
|
}
|
|
24963
25087
|
/**
|
|
24964
25088
|
* Calculate the amount out for a swap (quote) based on swap mode (for swap2)
|
|
24965
|
-
* @param
|
|
25089
|
+
* @param virtualPool - The virtual pool
|
|
25090
|
+
* @param config - The config
|
|
25091
|
+
* @param swapBaseForQuote - Whether to swap base for quote
|
|
25092
|
+
* @param hasReferral - Whether the referral is enabled
|
|
25093
|
+
* @param currentPoint - The current point
|
|
25094
|
+
* @param slippageBps - Slippage tolerance in basis points (100 = 1%) (optional)
|
|
25095
|
+
* @param swapMode - The swap mode (ExactIn: 0, PartialFill: 1, ExactOut: 2)
|
|
25096
|
+
* @param amountIn - The amount in (for ExactIn and PartialFill)
|
|
25097
|
+
* @param amountOut - The amount out (for ExactOut)
|
|
24966
25098
|
* @returns The swap quote result
|
|
24967
25099
|
*/
|
|
24968
|
-
swapQuote2(
|
|
25100
|
+
swapQuote2(params) {
|
|
24969
25101
|
const {
|
|
24970
25102
|
virtualPool,
|
|
24971
25103
|
config,
|
|
@@ -24974,15 +25106,15 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24974
25106
|
hasReferral,
|
|
24975
25107
|
currentPoint,
|
|
24976
25108
|
slippageBps
|
|
24977
|
-
} =
|
|
25109
|
+
} = params;
|
|
24978
25110
|
switch (swapMode) {
|
|
24979
25111
|
case 0 /* ExactIn */:
|
|
24980
|
-
if ("amountIn" in
|
|
25112
|
+
if ("amountIn" in params) {
|
|
24981
25113
|
return swapQuoteExactIn(
|
|
24982
25114
|
virtualPool,
|
|
24983
25115
|
config,
|
|
24984
25116
|
swapBaseForQuote,
|
|
24985
|
-
|
|
25117
|
+
params.amountIn,
|
|
24986
25118
|
slippageBps,
|
|
24987
25119
|
hasReferral,
|
|
24988
25120
|
currentPoint
|
|
@@ -24990,12 +25122,12 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
24990
25122
|
}
|
|
24991
25123
|
throw new Error("amountIn is required for ExactIn swap mode");
|
|
24992
25124
|
case 2 /* ExactOut */:
|
|
24993
|
-
if ("amountOut" in
|
|
25125
|
+
if ("amountOut" in params) {
|
|
24994
25126
|
return swapQuoteExactOut(
|
|
24995
25127
|
virtualPool,
|
|
24996
25128
|
config,
|
|
24997
25129
|
swapBaseForQuote,
|
|
24998
|
-
|
|
25130
|
+
params.amountOut,
|
|
24999
25131
|
slippageBps,
|
|
25000
25132
|
hasReferral,
|
|
25001
25133
|
currentPoint
|
|
@@ -25003,12 +25135,12 @@ var PoolService = class extends DynamicBondingCurveProgram {
|
|
|
25003
25135
|
}
|
|
25004
25136
|
throw new Error("outAmount is required for ExactOut swap mode");
|
|
25005
25137
|
case 1 /* PartialFill */:
|
|
25006
|
-
if ("amountIn" in
|
|
25138
|
+
if ("amountIn" in params) {
|
|
25007
25139
|
return swapQuotePartialFill(
|
|
25008
25140
|
virtualPool,
|
|
25009
25141
|
config,
|
|
25010
25142
|
swapBaseForQuote,
|
|
25011
|
-
|
|
25143
|
+
params.amountIn,
|
|
25012
25144
|
slippageBps,
|
|
25013
25145
|
hasReferral,
|
|
25014
25146
|
currentPoint
|
|
@@ -25039,32 +25171,44 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25039
25171
|
}
|
|
25040
25172
|
/**
|
|
25041
25173
|
* Create virtual pool metadata
|
|
25042
|
-
* @param
|
|
25174
|
+
* @param virtualPool - The virtual pool address
|
|
25175
|
+
* @param name - The name of the pool
|
|
25176
|
+
* @param website - The website of the pool
|
|
25177
|
+
* @param logo - The logo of the pool
|
|
25178
|
+
* @param creator - The creator of the pool
|
|
25179
|
+
* @param payer - The payer of the transaction
|
|
25043
25180
|
* @returns A create virtual pool metadata transaction
|
|
25044
25181
|
*/
|
|
25045
|
-
async createPoolMetadata(
|
|
25046
|
-
const
|
|
25047
|
-
|
|
25048
|
-
);
|
|
25182
|
+
async createPoolMetadata(params) {
|
|
25183
|
+
const { virtualPool, name, website, logo, creator, payer } = params;
|
|
25184
|
+
const virtualPoolMetadata = deriveDbcPoolMetadata(virtualPool);
|
|
25049
25185
|
return this.program.methods.createVirtualPoolMetadata({
|
|
25050
25186
|
padding: new Array(96).fill(0),
|
|
25051
|
-
name
|
|
25052
|
-
website
|
|
25053
|
-
logo
|
|
25187
|
+
name,
|
|
25188
|
+
website,
|
|
25189
|
+
logo
|
|
25054
25190
|
}).accountsPartial({
|
|
25055
|
-
virtualPool
|
|
25191
|
+
virtualPool,
|
|
25056
25192
|
virtualPoolMetadata,
|
|
25057
|
-
creator
|
|
25058
|
-
payer
|
|
25193
|
+
creator,
|
|
25194
|
+
payer,
|
|
25059
25195
|
systemProgram: _web3js.SystemProgram.programId
|
|
25060
25196
|
}).transaction();
|
|
25061
25197
|
}
|
|
25062
25198
|
/**
|
|
25063
25199
|
* Private method to claim trading fee with quote mint SOL
|
|
25064
|
-
* @param
|
|
25200
|
+
* @param creator - The creator of the pool
|
|
25201
|
+
* @param payer - The payer of the transaction
|
|
25202
|
+
* @param feeReceiver - The wallet that will receive the tokens
|
|
25203
|
+
* @param pool - The pool address
|
|
25204
|
+
* @param poolState - The pool state
|
|
25205
|
+
* @param poolConfigState - The pool config state
|
|
25206
|
+
* @param tokenBaseProgram - The token base program
|
|
25207
|
+
* @param tokenQuoteProgram - The token quote program
|
|
25208
|
+
* @param tempWSolAcc - The temporary wallet that will receive the SOL
|
|
25065
25209
|
* @returns A claim trading fee with quote mint SOL accounts, pre instructions and post instructions
|
|
25066
25210
|
*/
|
|
25067
|
-
async claimWithQuoteMintSol(
|
|
25211
|
+
async claimWithQuoteMintSol(params) {
|
|
25068
25212
|
const {
|
|
25069
25213
|
creator,
|
|
25070
25214
|
payer,
|
|
@@ -25075,7 +25219,7 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25075
25219
|
poolConfigState,
|
|
25076
25220
|
tokenBaseProgram,
|
|
25077
25221
|
tokenQuoteProgram
|
|
25078
|
-
} =
|
|
25222
|
+
} = params;
|
|
25079
25223
|
const preInstructions = [];
|
|
25080
25224
|
const postInstructions = [];
|
|
25081
25225
|
const tokenBaseAccount = findAssociatedTokenAddress(
|
|
@@ -25123,10 +25267,17 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25123
25267
|
}
|
|
25124
25268
|
/**
|
|
25125
25269
|
* Private method to claim trading fee with quote mint not SOL
|
|
25126
|
-
* @param
|
|
25270
|
+
* @param creator - The creator of the pool
|
|
25271
|
+
* @param payer - The payer of the transaction
|
|
25272
|
+
* @param feeReceiver - The wallet that will receive the tokens
|
|
25273
|
+
* @param pool - The pool address
|
|
25274
|
+
* @param poolState - The pool state
|
|
25275
|
+
* @param poolConfigState - The pool config state
|
|
25276
|
+
* @param tokenBaseProgram - The token base program
|
|
25277
|
+
* @param tokenQuoteProgram - The token quote program
|
|
25127
25278
|
* @returns A claim trading fee with quote mint not SOL accounts and pre instructions
|
|
25128
25279
|
*/
|
|
25129
|
-
async claimWithQuoteMintNotSol(
|
|
25280
|
+
async claimWithQuoteMintNotSol(params) {
|
|
25130
25281
|
const {
|
|
25131
25282
|
creator,
|
|
25132
25283
|
payer,
|
|
@@ -25136,7 +25287,7 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25136
25287
|
poolConfigState,
|
|
25137
25288
|
tokenBaseProgram,
|
|
25138
25289
|
tokenQuoteProgram
|
|
25139
|
-
} =
|
|
25290
|
+
} = params;
|
|
25140
25291
|
const {
|
|
25141
25292
|
ataTokenA: tokenBaseAccount,
|
|
25142
25293
|
ataTokenB: tokenQuoteAccount,
|
|
@@ -25166,10 +25317,16 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25166
25317
|
}
|
|
25167
25318
|
/**
|
|
25168
25319
|
* Claim creator trading fee
|
|
25169
|
-
* @param
|
|
25320
|
+
* @param creator - The creator of the pool
|
|
25321
|
+
* @param payer - The payer of the transaction
|
|
25322
|
+
* @param pool - The pool address
|
|
25323
|
+
* @param maxBaseAmount - The maximum base amount
|
|
25324
|
+
* @param maxQuoteAmount - The maximum quote amount
|
|
25325
|
+
* @param receiver - The wallet that will receive the tokens (Optional)
|
|
25326
|
+
* @param tempWSolAcc - The temporary wallet that will receive the SOL (Optional)
|
|
25170
25327
|
* @returns A claim creator trading fee transaction
|
|
25171
25328
|
*/
|
|
25172
|
-
async claimCreatorTradingFee(
|
|
25329
|
+
async claimCreatorTradingFee(params) {
|
|
25173
25330
|
const {
|
|
25174
25331
|
creator,
|
|
25175
25332
|
pool,
|
|
@@ -25178,14 +25335,14 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25178
25335
|
receiver,
|
|
25179
25336
|
payer,
|
|
25180
25337
|
tempWSolAcc
|
|
25181
|
-
} =
|
|
25338
|
+
} = params;
|
|
25182
25339
|
const poolState = await this.state.getPool(pool);
|
|
25183
25340
|
if (!poolState) {
|
|
25184
25341
|
throw new Error(`Pool not found: ${pool.toString()}`);
|
|
25185
25342
|
}
|
|
25186
25343
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
25187
25344
|
if (!poolConfigState) {
|
|
25188
|
-
throw new Error(`Pool config not found
|
|
25345
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
25189
25346
|
}
|
|
25190
25347
|
const tokenBaseProgram = getTokenProgram(poolConfigState.tokenType);
|
|
25191
25348
|
const tokenQuoteProgram = getTokenProgram(
|
|
@@ -25224,10 +25381,15 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25224
25381
|
}
|
|
25225
25382
|
/**
|
|
25226
25383
|
* Claim creator trading fee
|
|
25227
|
-
* @param
|
|
25384
|
+
* @param creator - The creator of the pool
|
|
25385
|
+
* @param payer - The payer of the transaction
|
|
25386
|
+
* @param pool - The pool address
|
|
25387
|
+
* @param maxBaseAmount - The maximum base amount
|
|
25388
|
+
* @param maxQuoteAmount - The maximum quote amount
|
|
25389
|
+
* @param receiver - The wallet that will receive the tokens
|
|
25228
25390
|
* @returns A claim creator trading fee transaction
|
|
25229
25391
|
*/
|
|
25230
|
-
async claimCreatorTradingFee2(
|
|
25392
|
+
async claimCreatorTradingFee2(params) {
|
|
25231
25393
|
const {
|
|
25232
25394
|
creator,
|
|
25233
25395
|
pool,
|
|
@@ -25235,14 +25397,14 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25235
25397
|
maxQuoteAmount,
|
|
25236
25398
|
receiver,
|
|
25237
25399
|
payer
|
|
25238
|
-
} =
|
|
25400
|
+
} = params;
|
|
25239
25401
|
const poolState = await this.state.getPool(pool);
|
|
25240
25402
|
if (!poolState) {
|
|
25241
25403
|
throw new Error(`Pool not found: ${pool.toString()}`);
|
|
25242
25404
|
}
|
|
25243
25405
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
25244
25406
|
if (!poolConfigState) {
|
|
25245
|
-
throw new Error(`Pool config not found
|
|
25407
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
25246
25408
|
}
|
|
25247
25409
|
const tokenBaseProgram = getTokenProgram(poolConfigState.tokenType);
|
|
25248
25410
|
const tokenQuoteProgram = getTokenProgram(
|
|
@@ -25310,18 +25472,19 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25310
25472
|
}
|
|
25311
25473
|
/**
|
|
25312
25474
|
* Withdraw creator surplus
|
|
25313
|
-
* @param
|
|
25475
|
+
* @param creator - The creator of the pool
|
|
25476
|
+
* @param virtualPool - The virtual pool address
|
|
25314
25477
|
* @returns A creator withdraw surplus transaction
|
|
25315
25478
|
*/
|
|
25316
|
-
async creatorWithdrawSurplus(
|
|
25317
|
-
const { creator, virtualPool } =
|
|
25479
|
+
async creatorWithdrawSurplus(params) {
|
|
25480
|
+
const { creator, virtualPool } = params;
|
|
25318
25481
|
const poolState = await this.state.getPool(virtualPool);
|
|
25319
25482
|
if (!poolState) {
|
|
25320
25483
|
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
25321
25484
|
}
|
|
25322
25485
|
const poolConfigState = await this.state.getPoolConfig(poolState.config);
|
|
25323
25486
|
if (!poolConfigState) {
|
|
25324
|
-
throw new Error(`Pool config not found
|
|
25487
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
25325
25488
|
}
|
|
25326
25489
|
const preInstructions = [];
|
|
25327
25490
|
const postInstructions = [];
|
|
@@ -25361,12 +25524,17 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25361
25524
|
}
|
|
25362
25525
|
/**
|
|
25363
25526
|
* Transfer pool creator
|
|
25364
|
-
* @param
|
|
25527
|
+
* @param virtualPool - The virtual pool address
|
|
25528
|
+
* @param creator - The creator of the pool
|
|
25529
|
+
* @param newCreator - The new creator of the pool
|
|
25365
25530
|
* @returns A transfer pool creator transaction
|
|
25366
25531
|
*/
|
|
25367
|
-
async transferPoolCreator(
|
|
25368
|
-
const { virtualPool, creator, newCreator } =
|
|
25532
|
+
async transferPoolCreator(params) {
|
|
25533
|
+
const { virtualPool, creator, newCreator } = params;
|
|
25369
25534
|
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
25535
|
+
if (!virtualPoolState) {
|
|
25536
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
25537
|
+
}
|
|
25370
25538
|
const migrationMetadata = deriveDammV1MigrationMetadataAddress(virtualPool);
|
|
25371
25539
|
const transaction = await this.program.methods.transferPoolCreator().accountsPartial({
|
|
25372
25540
|
virtualPool,
|
|
@@ -25384,27 +25552,36 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25384
25552
|
}
|
|
25385
25553
|
/**
|
|
25386
25554
|
* Creator withdraw migration fee
|
|
25387
|
-
* @param
|
|
25555
|
+
* @param virtualPool - The virtual pool address
|
|
25556
|
+
* @param sender - The sender of the pool
|
|
25388
25557
|
* @returns A creator withdraw migration fee transaction
|
|
25389
25558
|
*/
|
|
25390
|
-
async creatorWithdrawMigrationFee(
|
|
25391
|
-
const { virtualPool, sender
|
|
25559
|
+
async creatorWithdrawMigrationFee(params) {
|
|
25560
|
+
const { virtualPool, sender } = params;
|
|
25392
25561
|
const virtualPoolState = await this.state.getPool(virtualPool);
|
|
25562
|
+
if (!virtualPoolState) {
|
|
25563
|
+
throw new Error(`Pool not found: ${virtualPool.toString()}`);
|
|
25564
|
+
}
|
|
25393
25565
|
const configState = await this.state.getPoolConfig(
|
|
25394
25566
|
virtualPoolState.config
|
|
25395
25567
|
);
|
|
25396
|
-
|
|
25568
|
+
if (!configState) {
|
|
25569
|
+
throw new Error(`Pool config not found for virtual pool`);
|
|
25570
|
+
}
|
|
25571
|
+
const preInstructions = [];
|
|
25572
|
+
const postInstructions = [];
|
|
25573
|
+
const { ataPubkey: tokenQuoteAccount, ix: createTokenQuoteAccountIx } = await getOrCreateATAInstruction(
|
|
25397
25574
|
this.program.provider.connection,
|
|
25398
25575
|
configState.quoteMint,
|
|
25399
25576
|
sender,
|
|
25400
|
-
|
|
25577
|
+
sender,
|
|
25401
25578
|
true,
|
|
25402
25579
|
getTokenProgram(configState.quoteTokenFlag)
|
|
25403
25580
|
);
|
|
25404
|
-
|
|
25581
|
+
createTokenQuoteAccountIx && preInstructions.push(createTokenQuoteAccountIx);
|
|
25405
25582
|
if (configState.quoteMint.equals(_spltoken.NATIVE_MINT)) {
|
|
25406
|
-
const
|
|
25407
|
-
|
|
25583
|
+
const unwrapSolIx = unwrapSOLInstruction(sender, sender);
|
|
25584
|
+
unwrapSolIx && postInstructions.push(unwrapSolIx);
|
|
25408
25585
|
}
|
|
25409
25586
|
const transaction = await this.program.methods.withdrawMigrationFee(1).accountsPartial({
|
|
25410
25587
|
poolAuthority: this.poolAuthority,
|
|
@@ -25415,7 +25592,7 @@ var CreatorService = class extends DynamicBondingCurveProgram {
|
|
|
25415
25592
|
quoteMint: configState.quoteMint,
|
|
25416
25593
|
sender,
|
|
25417
25594
|
tokenQuoteProgram: getTokenProgram(configState.quoteTokenFlag)
|
|
25418
|
-
}).preInstructions(
|
|
25595
|
+
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
25419
25596
|
return transaction;
|
|
25420
25597
|
}
|
|
25421
25598
|
};
|
|
@@ -25434,6 +25611,7 @@ var DynamicBondingCurveClient = class _DynamicBondingCurveClient {
|
|
|
25434
25611
|
/**
|
|
25435
25612
|
* Static method to create a client instance for a specific pool
|
|
25436
25613
|
* @param connection - The connection to the Solana network
|
|
25614
|
+
* @param commitment - The commitment to the Solana network
|
|
25437
25615
|
* @returns A DynamicBondingCurveClient instance
|
|
25438
25616
|
*/
|
|
25439
25617
|
static create(connection, commitment = "confirmed") {
|