@meteora-ag/cp-amm-sdk 1.0.5 → 1.0.6
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 +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5692,8 +5692,6 @@ type CreatePositionAndAddLiquidity = {
|
|
|
5692
5692
|
tokenBAmountThreshold: BN;
|
|
5693
5693
|
tokenAMint: PublicKey;
|
|
5694
5694
|
tokenBMint: PublicKey;
|
|
5695
|
-
tokenAVault: PublicKey;
|
|
5696
|
-
tokenBVault: PublicKey;
|
|
5697
5695
|
tokenAProgram: PublicKey;
|
|
5698
5696
|
tokenBProgram: PublicKey;
|
|
5699
5697
|
};
|
|
@@ -5868,11 +5866,12 @@ type LockPositionParams = {
|
|
|
5868
5866
|
};
|
|
5869
5867
|
type SetupFeeClaimAccountsParams = {
|
|
5870
5868
|
payer: PublicKey;
|
|
5869
|
+
owner: PublicKey;
|
|
5871
5870
|
tokenAMint: PublicKey;
|
|
5872
5871
|
tokenBMint: PublicKey;
|
|
5873
5872
|
tokenAProgram: PublicKey;
|
|
5874
5873
|
tokenBProgram: PublicKey;
|
|
5875
|
-
receiver
|
|
5874
|
+
receiver?: PublicKey;
|
|
5876
5875
|
tempWSolAccount?: PublicKey;
|
|
5877
5876
|
};
|
|
5878
5877
|
type ClaimPositionFeeInstructionParams = {
|
|
@@ -5901,7 +5900,7 @@ type ClaimPositionFeeParams = {
|
|
|
5901
5900
|
tokenBVault: PublicKey;
|
|
5902
5901
|
tokenAProgram: PublicKey;
|
|
5903
5902
|
tokenBProgram: PublicKey;
|
|
5904
|
-
receiver
|
|
5903
|
+
receiver?: PublicKey;
|
|
5905
5904
|
feePayer?: PublicKey;
|
|
5906
5905
|
tempWSolAccount?: PublicKey;
|
|
5907
5906
|
};
|
|
@@ -5949,7 +5948,7 @@ type ClaimPartnerFeeParams = {
|
|
|
5949
5948
|
pool: PublicKey;
|
|
5950
5949
|
maxAmountA: BN;
|
|
5951
5950
|
maxAmountB: BN;
|
|
5952
|
-
receiver
|
|
5951
|
+
receiver?: PublicKey;
|
|
5953
5952
|
feePayer?: PublicKey;
|
|
5954
5953
|
tempWSolAccount?: PublicKey;
|
|
5955
5954
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -5692,8 +5692,6 @@ type CreatePositionAndAddLiquidity = {
|
|
|
5692
5692
|
tokenBAmountThreshold: BN;
|
|
5693
5693
|
tokenAMint: PublicKey;
|
|
5694
5694
|
tokenBMint: PublicKey;
|
|
5695
|
-
tokenAVault: PublicKey;
|
|
5696
|
-
tokenBVault: PublicKey;
|
|
5697
5695
|
tokenAProgram: PublicKey;
|
|
5698
5696
|
tokenBProgram: PublicKey;
|
|
5699
5697
|
};
|
|
@@ -5868,11 +5866,12 @@ type LockPositionParams = {
|
|
|
5868
5866
|
};
|
|
5869
5867
|
type SetupFeeClaimAccountsParams = {
|
|
5870
5868
|
payer: PublicKey;
|
|
5869
|
+
owner: PublicKey;
|
|
5871
5870
|
tokenAMint: PublicKey;
|
|
5872
5871
|
tokenBMint: PublicKey;
|
|
5873
5872
|
tokenAProgram: PublicKey;
|
|
5874
5873
|
tokenBProgram: PublicKey;
|
|
5875
|
-
receiver
|
|
5874
|
+
receiver?: PublicKey;
|
|
5876
5875
|
tempWSolAccount?: PublicKey;
|
|
5877
5876
|
};
|
|
5878
5877
|
type ClaimPositionFeeInstructionParams = {
|
|
@@ -5901,7 +5900,7 @@ type ClaimPositionFeeParams = {
|
|
|
5901
5900
|
tokenBVault: PublicKey;
|
|
5902
5901
|
tokenAProgram: PublicKey;
|
|
5903
5902
|
tokenBProgram: PublicKey;
|
|
5904
|
-
receiver
|
|
5903
|
+
receiver?: PublicKey;
|
|
5905
5904
|
feePayer?: PublicKey;
|
|
5906
5905
|
tempWSolAccount?: PublicKey;
|
|
5907
5906
|
};
|
|
@@ -5949,7 +5948,7 @@ type ClaimPartnerFeeParams = {
|
|
|
5949
5948
|
pool: PublicKey;
|
|
5950
5949
|
maxAmountA: BN;
|
|
5951
5950
|
maxAmountB: BN;
|
|
5952
|
-
receiver
|
|
5951
|
+
receiver?: PublicKey;
|
|
5953
5952
|
feePayer?: PublicKey;
|
|
5954
5953
|
tempWSolAccount?: PublicKey;
|
|
5955
5954
|
};
|
package/dist/index.js
CHANGED
|
@@ -7288,10 +7288,10 @@ function getDynamicFeeNumerator(volatilityAccumulator, binStep, variableFeeContr
|
|
|
7288
7288
|
return vFee.add(new (0, _anchor.BN)(99999999999)).div(new (0, _anchor.BN)(1e11));
|
|
7289
7289
|
}
|
|
7290
7290
|
function getFeeNumerator(currentPoint, activationPoint, numberOfPeriod, periodFrequency, feeSchedulerMode, cliffFeeNumerator, reductionFactor, dynamicFeeParams) {
|
|
7291
|
-
if (Number(periodFrequency) == 0) {
|
|
7291
|
+
if (Number(periodFrequency) == 0 || new (0, _anchor.BN)(currentPoint).lt(activationPoint)) {
|
|
7292
7292
|
return cliffFeeNumerator;
|
|
7293
7293
|
}
|
|
7294
|
-
const period =
|
|
7294
|
+
const period = _anchor.BN.min(
|
|
7295
7295
|
new (0, _anchor.BN)(numberOfPeriod),
|
|
7296
7296
|
new (0, _anchor.BN)(currentPoint).sub(activationPoint).div(periodFrequency)
|
|
7297
7297
|
);
|
|
@@ -8162,6 +8162,7 @@ var CpAmm = class {
|
|
|
8162
8162
|
return __async(this, null, function* () {
|
|
8163
8163
|
const {
|
|
8164
8164
|
payer,
|
|
8165
|
+
owner,
|
|
8165
8166
|
tokenAMint,
|
|
8166
8167
|
tokenBMint,
|
|
8167
8168
|
tokenAProgram,
|
|
@@ -8176,8 +8177,12 @@ var CpAmm = class {
|
|
|
8176
8177
|
const postInstructions = [];
|
|
8177
8178
|
let tokenAAccount;
|
|
8178
8179
|
let tokenBAccount;
|
|
8179
|
-
|
|
8180
|
-
|
|
8180
|
+
let tokenAOwner = owner;
|
|
8181
|
+
let tokenBOwner = owner;
|
|
8182
|
+
if (receiver) {
|
|
8183
|
+
tokenAOwner = tokenAIsSOL ? tempWSolAccount : receiver;
|
|
8184
|
+
tokenBOwner = tokenBIsSOL ? tempWSolAccount : receiver;
|
|
8185
|
+
}
|
|
8181
8186
|
const { tokenAAta, tokenBAta, instructions } = yield this.prepareTokenAccounts({
|
|
8182
8187
|
payer,
|
|
8183
8188
|
tokenAOwner,
|
|
@@ -8192,8 +8197,8 @@ var CpAmm = class {
|
|
|
8192
8197
|
preInstructions.push(...instructions);
|
|
8193
8198
|
if (hasSolToken) {
|
|
8194
8199
|
const closeWrappedSOLIx = yield unwrapSOLInstruction(
|
|
8195
|
-
tempWSolAccount != null ? tempWSolAccount :
|
|
8196
|
-
receiver
|
|
8200
|
+
tempWSolAccount != null ? tempWSolAccount : owner,
|
|
8201
|
+
receiver != null ? receiver : owner
|
|
8197
8202
|
);
|
|
8198
8203
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
8199
8204
|
}
|
|
@@ -9090,8 +9095,6 @@ var CpAmm = class {
|
|
|
9090
9095
|
tokenBAmountThreshold,
|
|
9091
9096
|
tokenAMint,
|
|
9092
9097
|
tokenBMint,
|
|
9093
|
-
tokenAVault,
|
|
9094
|
-
tokenBVault,
|
|
9095
9098
|
tokenAProgram,
|
|
9096
9099
|
tokenBProgram
|
|
9097
9100
|
} = params;
|
|
@@ -9108,6 +9111,8 @@ var CpAmm = class {
|
|
|
9108
9111
|
tokenAProgram,
|
|
9109
9112
|
tokenBProgram
|
|
9110
9113
|
});
|
|
9114
|
+
const tokenAVault = deriveTokenVaultAddress(tokenAMint, pool);
|
|
9115
|
+
const tokenBVault = deriveTokenVaultAddress(tokenBMint, pool);
|
|
9111
9116
|
if (tokenAMint.equals(_spltoken.NATIVE_MINT)) {
|
|
9112
9117
|
const wrapSOLIx = wrapSOLInstruction(
|
|
9113
9118
|
owner,
|
|
@@ -9835,6 +9840,7 @@ var CpAmm = class {
|
|
|
9835
9840
|
const payer = feePayer != null ? feePayer : partner;
|
|
9836
9841
|
const { tokenAAccount, tokenBAccount, preInstructions, postInstructions } = yield this.setupFeeClaimAccounts({
|
|
9837
9842
|
payer,
|
|
9843
|
+
owner: partner,
|
|
9838
9844
|
tokenAMint,
|
|
9839
9845
|
tokenBMint,
|
|
9840
9846
|
tokenAProgram,
|
|
@@ -9882,6 +9888,7 @@ var CpAmm = class {
|
|
|
9882
9888
|
const payer = feePayer != null ? feePayer : owner;
|
|
9883
9889
|
const { tokenAAccount, tokenBAccount, preInstructions, postInstructions } = yield this.setupFeeClaimAccounts({
|
|
9884
9890
|
payer,
|
|
9891
|
+
owner,
|
|
9885
9892
|
tokenAMint,
|
|
9886
9893
|
tokenBMint,
|
|
9887
9894
|
tokenAProgram,
|