@meteora-ag/cp-amm-sdk 1.3.3 → 1.3.4
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.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +45 -44
package/dist/index.d.mts
CHANGED
|
@@ -7871,7 +7871,7 @@ declare const getTokenDecimals: (connection: Connection, mint: PublicKey, tokenP
|
|
|
7871
7871
|
* @param tokenProgram - The token program
|
|
7872
7872
|
* @returns The ATA instruction
|
|
7873
7873
|
*/
|
|
7874
|
-
declare const getOrCreateATAInstruction: (
|
|
7874
|
+
declare const getOrCreateATAInstruction: (tokenMint: PublicKey, owner: PublicKey, payer: PublicKey, allowOwnerOffCurve: boolean, tokenProgram: PublicKey) => Promise<{
|
|
7875
7875
|
ataPubkey: PublicKey;
|
|
7876
7876
|
ix?: TransactionInstruction;
|
|
7877
7877
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -7871,7 +7871,7 @@ declare const getTokenDecimals: (connection: Connection, mint: PublicKey, tokenP
|
|
|
7871
7871
|
* @param tokenProgram - The token program
|
|
7872
7872
|
* @returns The ATA instruction
|
|
7873
7873
|
*/
|
|
7874
|
-
declare const getOrCreateATAInstruction: (
|
|
7874
|
+
declare const getOrCreateATAInstruction: (tokenMint: PublicKey, owner: PublicKey, payer: PublicKey, allowOwnerOffCurve: boolean, tokenProgram: PublicKey) => Promise<{
|
|
7875
7875
|
ataPubkey: PublicKey;
|
|
7876
7876
|
ix?: TransactionInstruction;
|
|
7877
7877
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -8317,40 +8317,27 @@ var _bytes = require('@coral-xyz/anchor/dist/cjs/utils/bytes');
|
|
|
8317
8317
|
|
|
8318
8318
|
|
|
8319
8319
|
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
8320
|
function getTokenProgram(flag) {
|
|
8324
8321
|
return flag == 0 ? _spltoken.TOKEN_PROGRAM_ID : _spltoken.TOKEN_2022_PROGRAM_ID;
|
|
8325
8322
|
}
|
|
8326
8323
|
var getTokenDecimals = (connection, mint, tokenProgram) => __async(null, null, function* () {
|
|
8327
8324
|
return (yield _spltoken.getMint.call(void 0, connection, mint, "confirmed", tokenProgram)).decimals;
|
|
8328
8325
|
});
|
|
8329
|
-
var getOrCreateATAInstruction = (_0, _1, _2
|
|
8330
|
-
const
|
|
8326
|
+
var getOrCreateATAInstruction = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (tokenMint, owner, payer = owner, allowOwnerOffCurve = true, tokenProgram) {
|
|
8327
|
+
const ataPubkey = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
8331
8328
|
tokenMint,
|
|
8332
8329
|
owner,
|
|
8333
8330
|
allowOwnerOffCurve,
|
|
8334
8331
|
tokenProgram
|
|
8335
8332
|
);
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
owner,
|
|
8345
|
-
tokenMint,
|
|
8346
|
-
tokenProgram
|
|
8347
|
-
);
|
|
8348
|
-
return { ataPubkey: toAccount, ix };
|
|
8349
|
-
} else {
|
|
8350
|
-
console.error("Error::getOrCreateATAInstruction", e);
|
|
8351
|
-
throw e;
|
|
8352
|
-
}
|
|
8353
|
-
}
|
|
8333
|
+
const ix = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
8334
|
+
payer,
|
|
8335
|
+
ataPubkey,
|
|
8336
|
+
owner,
|
|
8337
|
+
tokenMint,
|
|
8338
|
+
tokenProgram
|
|
8339
|
+
);
|
|
8340
|
+
return { ataPubkey, ix };
|
|
8354
8341
|
});
|
|
8355
8342
|
var wrapSOLInstruction = (from, to, amount) => {
|
|
8356
8343
|
return [
|
|
@@ -11221,7 +11208,6 @@ var CpAmm = class {
|
|
|
11221
11208
|
{ ataPubkey: tokenBAta, ix: createOutputTokenAccountIx }
|
|
11222
11209
|
] = yield Promise.all([
|
|
11223
11210
|
getOrCreateATAInstruction(
|
|
11224
|
-
this._program.provider.connection,
|
|
11225
11211
|
tokenAMint,
|
|
11226
11212
|
tokenAOwner,
|
|
11227
11213
|
payer,
|
|
@@ -11229,7 +11215,6 @@ var CpAmm = class {
|
|
|
11229
11215
|
tokenAProgram
|
|
11230
11216
|
),
|
|
11231
11217
|
getOrCreateATAInstruction(
|
|
11232
|
-
this._program.provider.connection,
|
|
11233
11218
|
tokenBMint,
|
|
11234
11219
|
tokenBOwner,
|
|
11235
11220
|
payer,
|
|
@@ -13606,7 +13591,6 @@ var CpAmm = class {
|
|
|
13606
13591
|
} = params;
|
|
13607
13592
|
const preInstructions = [];
|
|
13608
13593
|
const { ataPubkey: funderTokenAccount, ix: createFunderTokenAccountIx } = yield getOrCreateATAInstruction(
|
|
13609
|
-
this._program.provider.connection,
|
|
13610
13594
|
rewardMint,
|
|
13611
13595
|
funder,
|
|
13612
13596
|
funder,
|
|
@@ -13646,14 +13630,7 @@ var CpAmm = class {
|
|
|
13646
13630
|
const tokenProgram = getTokenProgram(rewardTokenFlag);
|
|
13647
13631
|
const preInstructions = [];
|
|
13648
13632
|
const postInstructions = [];
|
|
13649
|
-
const { ataPubkey: funderTokenAccount, ix: createFunderTokenAccountIx } = yield getOrCreateATAInstruction(
|
|
13650
|
-
this._program.provider.connection,
|
|
13651
|
-
mint,
|
|
13652
|
-
funder,
|
|
13653
|
-
funder,
|
|
13654
|
-
true,
|
|
13655
|
-
tokenProgram
|
|
13656
|
-
);
|
|
13633
|
+
const { ataPubkey: funderTokenAccount, ix: createFunderTokenAccountIx } = yield getOrCreateATAInstruction(mint, funder, funder, true, tokenProgram);
|
|
13657
13634
|
createFunderTokenAccountIx && preInstructions.push(createFunderTokenAccountIx);
|
|
13658
13635
|
if (mint.equals(_spltoken.NATIVE_MINT)) {
|
|
13659
13636
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(funder);
|
|
@@ -13874,7 +13851,6 @@ var CpAmm = class {
|
|
|
13874
13851
|
const preInstructions = [];
|
|
13875
13852
|
const postInstructions = [];
|
|
13876
13853
|
const { ataPubkey: userTokenAccount, ix: createUserTokenAccountIx } = yield getOrCreateATAInstruction(
|
|
13877
|
-
this._program.provider.connection,
|
|
13878
13854
|
rewardInfo.mint,
|
|
13879
13855
|
user,
|
|
13880
13856
|
feePayer != null ? feePayer : user,
|