@meteora-ag/dlmm 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +64 -7
- package/dist/index.js +239 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +191 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15649,6 +15649,71 @@ async function chunkedGetMultipleAccountInfos(connection, pks, chunkSize = 100)
|
|
|
15649
15649
|
)).flat();
|
|
15650
15650
|
return accountInfos;
|
|
15651
15651
|
}
|
|
15652
|
+
async function chunkedGetProgramAccounts(connection, programId, filters, chunkSize = 100, onChunkFetched, isParallelExecution = false) {
|
|
15653
|
+
const accountsWithoutData = await connection.getProgramAccounts(programId, {
|
|
15654
|
+
filters,
|
|
15655
|
+
dataSlice: { offset: 0, length: 0 }
|
|
15656
|
+
});
|
|
15657
|
+
if (accountsWithoutData.length === 0) {
|
|
15658
|
+
return [];
|
|
15659
|
+
}
|
|
15660
|
+
const pubkeys = accountsWithoutData.map((account) => account.pubkey);
|
|
15661
|
+
const totalAccounts = pubkeys.length;
|
|
15662
|
+
const chunkedPks = chunks(pubkeys, chunkSize);
|
|
15663
|
+
const totalChunks = chunkedPks.length;
|
|
15664
|
+
let chunksLoaded = 0;
|
|
15665
|
+
let accountsLoaded = 0;
|
|
15666
|
+
const chunkResults = new Array(totalChunks);
|
|
15667
|
+
const processChunk = async (chunk, chunkIndex) => {
|
|
15668
|
+
const chunkAccountInfos = await connection.getMultipleAccountsInfo(chunk);
|
|
15669
|
+
chunkResults[chunkIndex] = chunkAccountInfos;
|
|
15670
|
+
if (onChunkFetched) {
|
|
15671
|
+
const chunkAccounts = [];
|
|
15672
|
+
const startIdx = chunkIndex * chunkSize;
|
|
15673
|
+
for (let i = 0; i < chunkAccountInfos.length; i++) {
|
|
15674
|
+
const accountInfo = chunkAccountInfos[i];
|
|
15675
|
+
if (accountInfo) {
|
|
15676
|
+
chunkAccounts.push({
|
|
15677
|
+
pubkey: pubkeys[startIdx + i],
|
|
15678
|
+
account: accountInfo
|
|
15679
|
+
});
|
|
15680
|
+
}
|
|
15681
|
+
}
|
|
15682
|
+
chunksLoaded++;
|
|
15683
|
+
accountsLoaded += chunkAccounts.length;
|
|
15684
|
+
onChunkFetched(chunkAccounts, {
|
|
15685
|
+
chunksLoaded,
|
|
15686
|
+
totalChunks,
|
|
15687
|
+
accountsLoaded,
|
|
15688
|
+
totalAccounts
|
|
15689
|
+
});
|
|
15690
|
+
}
|
|
15691
|
+
};
|
|
15692
|
+
if (isParallelExecution) {
|
|
15693
|
+
await Promise.all(
|
|
15694
|
+
chunkedPks.map((chunk, chunkIndex) => processChunk(chunk, chunkIndex))
|
|
15695
|
+
);
|
|
15696
|
+
} else {
|
|
15697
|
+
for (let chunkIndex = 0; chunkIndex < chunkedPks.length; chunkIndex++) {
|
|
15698
|
+
await processChunk(chunkedPks[chunkIndex], chunkIndex);
|
|
15699
|
+
}
|
|
15700
|
+
}
|
|
15701
|
+
const result = [];
|
|
15702
|
+
for (let chunkIndex = 0; chunkIndex < chunkResults.length; chunkIndex++) {
|
|
15703
|
+
const chunkAccountInfos = chunkResults[chunkIndex];
|
|
15704
|
+
const startIdx = chunkIndex * chunkSize;
|
|
15705
|
+
for (let i = 0; i < chunkAccountInfos.length; i++) {
|
|
15706
|
+
const accountInfo = chunkAccountInfos[i];
|
|
15707
|
+
if (accountInfo) {
|
|
15708
|
+
result.push({
|
|
15709
|
+
pubkey: pubkeys[startIdx + i],
|
|
15710
|
+
account: accountInfo
|
|
15711
|
+
});
|
|
15712
|
+
}
|
|
15713
|
+
}
|
|
15714
|
+
}
|
|
15715
|
+
return result;
|
|
15716
|
+
}
|
|
15652
15717
|
var getEstimatedComputeUnitUsageWithBuffer = async (connection, instructions, feePayer, buffer, altAddress) => {
|
|
15653
15718
|
if (!buffer) {
|
|
15654
15719
|
buffer = 0.1;
|
|
@@ -16669,17 +16734,20 @@ var DLMM = class {
|
|
|
16669
16734
|
* class, which represents the connection to the Solana blockchain.
|
|
16670
16735
|
* @param {PublicKey} userPubKey - The user's wallet public key.
|
|
16671
16736
|
* @param {Opt} [opt] - An optional object that contains additional options for the function.
|
|
16737
|
+
* @param {GetPositionsOpt} [getPositionsOpt] - Optional settings for chunked position fetching
|
|
16672
16738
|
* @returns The function `getAllLbPairPositionsByUser` returns a `Promise` that resolves to a `Map`
|
|
16673
16739
|
* object. The `Map` object contains key-value pairs, where the key is a string representing the LB
|
|
16674
16740
|
* Pair account, and the value is an object of PositionInfo
|
|
16675
16741
|
*/
|
|
16676
|
-
static async getAllLbPairPositionsByUser(connection, userPubKey, opt) {
|
|
16742
|
+
static async getAllLbPairPositionsByUser(connection, userPubKey, opt, getPositionsOpt) {
|
|
16677
16743
|
const program = createProgram(connection, opt);
|
|
16678
|
-
const positionsV2 = await
|
|
16744
|
+
const positionsV2 = await chunkedGetProgramAccounts(
|
|
16745
|
+
program.provider.connection,
|
|
16679
16746
|
program.programId,
|
|
16680
|
-
|
|
16681
|
-
|
|
16682
|
-
|
|
16747
|
+
[positionV2Filter(), positionOwnerFilter(userPubKey)],
|
|
16748
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _60 => _60.chunkSize]),
|
|
16749
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _61 => _61.onChunkFetched]),
|
|
16750
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _62 => _62.isParallelExecution])
|
|
16683
16751
|
);
|
|
16684
16752
|
const positionWrappers = [
|
|
16685
16753
|
...positionsV2.map((p) => wrapPosition(program, p.pubkey, p.account))
|
|
@@ -16810,8 +16878,8 @@ var DLMM = class {
|
|
|
16810
16878
|
const { mintX, mintY, rewardMint0, rewardMint1 } = lbPairMintMap.get(
|
|
16811
16879
|
lbPair.toBase58()
|
|
16812
16880
|
);
|
|
16813
|
-
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
16814
|
-
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access',
|
|
16881
|
+
const reserveXBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _63 => _63.get, 'call', _64 => _64(lbPair.toBase58()), 'optionalAccess', _65 => _65.reserveX]), () => ( BigInt(0)));
|
|
16882
|
+
const reserveYBalance = _nullishCoalesce(_optionalChain([lbPairReserveMap, 'access', _66 => _66.get, 'call', _67 => _67(lbPair.toBase58()), 'optionalAccess', _68 => _68.reserveY]), () => ( BigInt(0)));
|
|
16815
16883
|
const { tokenXProgram, tokenYProgram } = getTokenProgramId(lbPairAcc);
|
|
16816
16884
|
const tokenX = {
|
|
16817
16885
|
publicKey: lbPairAcc.tokenXMint,
|
|
@@ -16849,7 +16917,7 @@ var DLMM = class {
|
|
|
16849
16917
|
tokenX,
|
|
16850
16918
|
tokenY,
|
|
16851
16919
|
lbPairPositionsData: [
|
|
16852
|
-
..._nullishCoalesce(_optionalChain([positionsMap, 'access',
|
|
16920
|
+
..._nullishCoalesce(_optionalChain([positionsMap, 'access', _69 => _69.get, 'call', _70 => _70(lbPair.toBase58()), 'optionalAccess', _71 => _71.lbPairPositionsData]), () => ( [])),
|
|
16853
16921
|
{
|
|
16854
16922
|
publicKey: positionPubkey,
|
|
16855
16923
|
positionData,
|
|
@@ -16873,16 +16941,19 @@ var DLMM = class {
|
|
|
16873
16941
|
* The function `getLbPairLockInfo` retrieves all pair positions that has locked liquidity.
|
|
16874
16942
|
* @param {number} [lockDurationOpt] - An optional value indicating the minimum position lock duration that the function should return.
|
|
16875
16943
|
* Depending on the lbPair activationType, the param should be a number of seconds or a number of slots.
|
|
16944
|
+
* @param {GetPositionsOpt} [getPositionsOpt] - Optional settings for chunked position fetching
|
|
16876
16945
|
* @returns The function `getLbPairLockInfo` returns a `Promise` that resolves to a `PairLockInfo`
|
|
16877
16946
|
* object. The `PairLockInfo` object contains an array of `PositionLockInfo` objects.
|
|
16878
16947
|
*/
|
|
16879
|
-
async getLbPairLockInfo(lockDurationOpt) {
|
|
16948
|
+
async getLbPairLockInfo(lockDurationOpt, getPositionsOpt) {
|
|
16880
16949
|
const lockDuration = lockDurationOpt | 0;
|
|
16881
|
-
const positionAccounts = await
|
|
16950
|
+
const positionAccounts = await chunkedGetProgramAccounts(
|
|
16951
|
+
this.program.provider.connection,
|
|
16882
16952
|
this.program.programId,
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16953
|
+
[positionLbPairFilter(this.pubkey)],
|
|
16954
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _72 => _72.chunkSize]),
|
|
16955
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _73 => _73.onChunkFetched]),
|
|
16956
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _74 => _74.isParallelExecution])
|
|
16886
16957
|
);
|
|
16887
16958
|
const lbPairPositions = positionAccounts.map((acc) => {
|
|
16888
16959
|
return wrapPosition(this.program, acc.pubkey, acc.account);
|
|
@@ -17017,18 +17088,59 @@ var DLMM = class {
|
|
|
17017
17088
|
baseFeePowerFactor: baseFeePowerFactor.toNumber(),
|
|
17018
17089
|
padding: Array(63).fill(0)
|
|
17019
17090
|
};
|
|
17091
|
+
const preInstructions = [];
|
|
17020
17092
|
const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
17021
17093
|
tokenX,
|
|
17022
17094
|
creatorKey,
|
|
17023
17095
|
true,
|
|
17024
17096
|
tokenXAccount.owner
|
|
17025
17097
|
);
|
|
17098
|
+
const createUserTokenXIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
17099
|
+
creatorKey,
|
|
17100
|
+
userTokenX,
|
|
17101
|
+
creatorKey,
|
|
17102
|
+
tokenX,
|
|
17103
|
+
tokenXAccount.owner
|
|
17104
|
+
);
|
|
17105
|
+
preInstructions.push(createUserTokenXIx);
|
|
17026
17106
|
const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
17027
17107
|
tokenY,
|
|
17028
17108
|
creatorKey,
|
|
17029
17109
|
true,
|
|
17030
17110
|
tokenYAccount.owner
|
|
17031
17111
|
);
|
|
17112
|
+
const createUserTokenYIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
17113
|
+
creatorKey,
|
|
17114
|
+
userTokenY,
|
|
17115
|
+
creatorKey,
|
|
17116
|
+
tokenY,
|
|
17117
|
+
tokenYAccount.owner
|
|
17118
|
+
);
|
|
17119
|
+
preInstructions.push(createUserTokenYIx);
|
|
17120
|
+
const postInstructions = [];
|
|
17121
|
+
if ((tokenX.equals(_spltoken.NATIVE_MINT) || tokenY.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([opt, 'optionalAccess', _75 => _75.skipSolWrappingOperation])) {
|
|
17122
|
+
const wrapAmount = BigInt(1);
|
|
17123
|
+
if (tokenX.equals(_spltoken.NATIVE_MINT)) {
|
|
17124
|
+
const wrapSOLIxX = wrapSOLInstruction(
|
|
17125
|
+
creatorKey,
|
|
17126
|
+
userTokenX,
|
|
17127
|
+
wrapAmount
|
|
17128
|
+
);
|
|
17129
|
+
preInstructions.push(...wrapSOLIxX);
|
|
17130
|
+
}
|
|
17131
|
+
if (tokenY.equals(_spltoken.NATIVE_MINT)) {
|
|
17132
|
+
const wrapSOLIxY = wrapSOLInstruction(
|
|
17133
|
+
creatorKey,
|
|
17134
|
+
userTokenY,
|
|
17135
|
+
wrapAmount
|
|
17136
|
+
);
|
|
17137
|
+
preInstructions.push(...wrapSOLIxY);
|
|
17138
|
+
}
|
|
17139
|
+
const unwrapSOLIx = await unwrapSOLInstruction(creatorKey);
|
|
17140
|
+
if (unwrapSOLIx) {
|
|
17141
|
+
postInstructions.push(unwrapSOLIx);
|
|
17142
|
+
}
|
|
17143
|
+
}
|
|
17032
17144
|
return program.methods.initializeCustomizablePermissionlessLbPair2(ixData).accountsPartial({
|
|
17033
17145
|
tokenBadgeX: tokenBadgeXAccount ? tokenBadgeX : program.programId,
|
|
17034
17146
|
tokenBadgeY: tokenBadgeYAccount ? tokenBadgeY : program.programId,
|
|
@@ -17045,7 +17157,7 @@ var DLMM = class {
|
|
|
17045
17157
|
funder: creatorKey,
|
|
17046
17158
|
tokenProgramX: tokenXAccount.owner,
|
|
17047
17159
|
tokenProgramY: tokenYAccount.owner
|
|
17048
|
-
}).transaction();
|
|
17160
|
+
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
17049
17161
|
}
|
|
17050
17162
|
/**
|
|
17051
17163
|
* Create a new customizable permissionless pair. Support only token program.
|
|
@@ -17069,6 +17181,7 @@ var DLMM = class {
|
|
|
17069
17181
|
tokenY,
|
|
17070
17182
|
program.programId
|
|
17071
17183
|
);
|
|
17184
|
+
const [tokenXAccount, tokenYAccount] = await connection.getMultipleAccountsInfo([tokenX, tokenY]);
|
|
17072
17185
|
const [reserveX] = deriveReserve(tokenX, lbPair, program.programId);
|
|
17073
17186
|
const [reserveY] = deriveReserve(tokenY, lbPair, program.programId);
|
|
17074
17187
|
const [oracle] = deriveOracle(lbPair, program.programId);
|
|
@@ -17095,8 +17208,59 @@ var DLMM = class {
|
|
|
17095
17208
|
creatorPoolOnOffControl: creatorPoolOnOffControl ? creatorPoolOnOffControl : false,
|
|
17096
17209
|
padding: Array(63).fill(0)
|
|
17097
17210
|
};
|
|
17098
|
-
const
|
|
17099
|
-
const
|
|
17211
|
+
const preInstructions = [];
|
|
17212
|
+
const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
17213
|
+
tokenX,
|
|
17214
|
+
creatorKey,
|
|
17215
|
+
true,
|
|
17216
|
+
tokenXAccount.owner
|
|
17217
|
+
);
|
|
17218
|
+
const createUserTokenXIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
17219
|
+
creatorKey,
|
|
17220
|
+
userTokenX,
|
|
17221
|
+
creatorKey,
|
|
17222
|
+
tokenX,
|
|
17223
|
+
tokenXAccount.owner
|
|
17224
|
+
);
|
|
17225
|
+
preInstructions.push(createUserTokenXIx);
|
|
17226
|
+
const userTokenY = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
17227
|
+
tokenY,
|
|
17228
|
+
creatorKey,
|
|
17229
|
+
true,
|
|
17230
|
+
tokenYAccount.owner
|
|
17231
|
+
);
|
|
17232
|
+
const createUserTokenYIx = _spltoken.createAssociatedTokenAccountIdempotentInstruction.call(void 0,
|
|
17233
|
+
creatorKey,
|
|
17234
|
+
userTokenY,
|
|
17235
|
+
creatorKey,
|
|
17236
|
+
tokenY,
|
|
17237
|
+
tokenYAccount.owner
|
|
17238
|
+
);
|
|
17239
|
+
preInstructions.push(createUserTokenYIx);
|
|
17240
|
+
const postInstructions = [];
|
|
17241
|
+
if ((tokenX.equals(_spltoken.NATIVE_MINT) || tokenY.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([opt, 'optionalAccess', _76 => _76.skipSolWrappingOperation])) {
|
|
17242
|
+
const wrapAmount = BigInt(1);
|
|
17243
|
+
if (tokenX.equals(_spltoken.NATIVE_MINT)) {
|
|
17244
|
+
const wrapSOLIxX = wrapSOLInstruction(
|
|
17245
|
+
creatorKey,
|
|
17246
|
+
userTokenX,
|
|
17247
|
+
wrapAmount
|
|
17248
|
+
);
|
|
17249
|
+
preInstructions.push(...wrapSOLIxX);
|
|
17250
|
+
}
|
|
17251
|
+
if (tokenY.equals(_spltoken.NATIVE_MINT)) {
|
|
17252
|
+
const wrapSOLIxY = wrapSOLInstruction(
|
|
17253
|
+
creatorKey,
|
|
17254
|
+
userTokenY,
|
|
17255
|
+
wrapAmount
|
|
17256
|
+
);
|
|
17257
|
+
preInstructions.push(...wrapSOLIxY);
|
|
17258
|
+
}
|
|
17259
|
+
const unwrapSOLIx = await unwrapSOLInstruction(creatorKey);
|
|
17260
|
+
if (unwrapSOLIx) {
|
|
17261
|
+
postInstructions.push(unwrapSOLIx);
|
|
17262
|
+
}
|
|
17263
|
+
}
|
|
17100
17264
|
return program.methods.initializeCustomizablePermissionlessLbPair(ixData).accountsPartial({
|
|
17101
17265
|
lbPair,
|
|
17102
17266
|
reserveX,
|
|
@@ -17109,7 +17273,7 @@ var DLMM = class {
|
|
|
17109
17273
|
userTokenX,
|
|
17110
17274
|
userTokenY,
|
|
17111
17275
|
funder: creatorKey
|
|
17112
|
-
}).transaction();
|
|
17276
|
+
}).preInstructions(preInstructions).postInstructions(postInstructions).transaction();
|
|
17113
17277
|
}
|
|
17114
17278
|
/**
|
|
17115
17279
|
* Create a new liquidity pair. Support only token program.
|
|
@@ -17205,8 +17369,8 @@ var DLMM = class {
|
|
|
17205
17369
|
new (0, _anchor.BN)(presetParameterState.baseFactor),
|
|
17206
17370
|
new (0, _anchor.BN)(presetParameterState.baseFeePowerFactor),
|
|
17207
17371
|
{
|
|
17208
|
-
cluster: _optionalChain([opt, 'optionalAccess',
|
|
17209
|
-
programId: _optionalChain([opt, 'optionalAccess',
|
|
17372
|
+
cluster: _optionalChain([opt, 'optionalAccess', _77 => _77.cluster]),
|
|
17373
|
+
programId: _optionalChain([opt, 'optionalAccess', _78 => _78.programId])
|
|
17210
17374
|
}
|
|
17211
17375
|
);
|
|
17212
17376
|
if (existsPool) {
|
|
@@ -17434,7 +17598,7 @@ var DLMM = class {
|
|
|
17434
17598
|
swapForY,
|
|
17435
17599
|
new (0, _anchor.BN)(activeIdToLoop),
|
|
17436
17600
|
this.lbPair,
|
|
17437
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
17601
|
+
_nullishCoalesce(_optionalChain([this, 'access', _79 => _79.binArrayBitmapExtension, 'optionalAccess', _80 => _80.account]), () => ( null))
|
|
17438
17602
|
);
|
|
17439
17603
|
if (binArrayIndex === null)
|
|
17440
17604
|
shouldStop = true;
|
|
@@ -17683,24 +17847,27 @@ var DLMM = class {
|
|
|
17683
17847
|
* `PublicKey`. It represents the public key of a user. If no `userPubKey` is provided, the function
|
|
17684
17848
|
* will return an object with an empty `userPositions` array and the active bin information obtained
|
|
17685
17849
|
* from the `getActive
|
|
17850
|
+
* @param {GetPositionsOpt} [getPositionsOpt] - Optional settings for chunked position fetching
|
|
17686
17851
|
* @returns The function `getPositionsByUserAndLbPair` returns a Promise that resolves to an object
|
|
17687
17852
|
* with two properties:
|
|
17688
17853
|
* - "activeBin" which is an object with two properties: "binId" and "price". The value of "binId"
|
|
17689
17854
|
* is the active bin ID of the lbPair, and the value of "price" is the price of the active bin.
|
|
17690
17855
|
* - "userPositions" which is an array of Position objects.
|
|
17691
17856
|
*/
|
|
17692
|
-
async getPositionsByUserAndLbPair(userPubKey) {
|
|
17857
|
+
async getPositionsByUserAndLbPair(userPubKey, getPositionsOpt) {
|
|
17693
17858
|
const promiseResults = await Promise.all([
|
|
17694
17859
|
this.getActiveBin(),
|
|
17695
|
-
userPubKey &&
|
|
17860
|
+
userPubKey && chunkedGetProgramAccounts(
|
|
17861
|
+
this.program.provider.connection,
|
|
17696
17862
|
this.program.programId,
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
|
|
17863
|
+
[
|
|
17864
|
+
positionV2Filter(),
|
|
17865
|
+
positionOwnerFilter(userPubKey),
|
|
17866
|
+
positionLbPairFilter(this.pubkey)
|
|
17867
|
+
],
|
|
17868
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _81 => _81.chunkSize]),
|
|
17869
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _82 => _82.onChunkFetched]),
|
|
17870
|
+
_optionalChain([getPositionsOpt, 'optionalAccess', _83 => _83.isParallelExecution])
|
|
17704
17871
|
)
|
|
17705
17872
|
]);
|
|
17706
17873
|
const [activeBin, positionsV2] = promiseResults;
|
|
@@ -17765,8 +17932,8 @@ var DLMM = class {
|
|
|
17765
17932
|
position,
|
|
17766
17933
|
this.tokenX.mint,
|
|
17767
17934
|
this.tokenY.mint,
|
|
17768
|
-
_optionalChain([this, 'access',
|
|
17769
|
-
_optionalChain([this, 'access',
|
|
17935
|
+
_optionalChain([this, 'access', _84 => _84.rewards, 'access', _85 => _85[0], 'optionalAccess', _86 => _86.mint]),
|
|
17936
|
+
_optionalChain([this, 'access', _87 => _87.rewards, 'access', _88 => _88[1], 'optionalAccess', _89 => _89.mint]),
|
|
17770
17937
|
positionBinArraysMapV2
|
|
17771
17938
|
),
|
|
17772
17939
|
version: position.version()
|
|
@@ -17954,8 +18121,8 @@ var DLMM = class {
|
|
|
17954
18121
|
position,
|
|
17955
18122
|
this.tokenX.mint,
|
|
17956
18123
|
this.tokenY.mint,
|
|
17957
|
-
_optionalChain([this, 'access',
|
|
17958
|
-
_optionalChain([this, 'access',
|
|
18124
|
+
_optionalChain([this, 'access', _90 => _90.rewards, 'access', _91 => _91[0], 'optionalAccess', _92 => _92.mint]),
|
|
18125
|
+
_optionalChain([this, 'access', _93 => _93.rewards, 'access', _94 => _94[1], 'optionalAccess', _95 => _95.mint]),
|
|
17959
18126
|
binArrayMap
|
|
17960
18127
|
),
|
|
17961
18128
|
version: position.version()
|
|
@@ -17980,7 +18147,7 @@ var DLMM = class {
|
|
|
17980
18147
|
);
|
|
17981
18148
|
const { minBinId, maxBinId } = strategy;
|
|
17982
18149
|
const binCount = getBinCount(minBinId, maxBinId);
|
|
17983
|
-
const defaultAltAddressString = _nullishCoalesce(altAddress, () => ( ALT_ADDRESS[_optionalChain([this, 'access',
|
|
18150
|
+
const defaultAltAddressString = _nullishCoalesce(altAddress, () => ( ALT_ADDRESS[_optionalChain([this, 'access', _96 => _96.opt, 'optionalAccess', _97 => _97.cluster])]));
|
|
17984
18151
|
if (defaultAltAddressString) {
|
|
17985
18152
|
altAddress = new (0, _web3js.PublicKey)(defaultAltAddressString);
|
|
17986
18153
|
}
|
|
@@ -18043,7 +18210,7 @@ var DLMM = class {
|
|
|
18043
18210
|
owner,
|
|
18044
18211
|
payer,
|
|
18045
18212
|
true,
|
|
18046
|
-
_optionalChain([this, 'access',
|
|
18213
|
+
_optionalChain([this, 'access', _98 => _98.opt, 'optionalAccess', _99 => _99.skipSolWrappingOperation])
|
|
18047
18214
|
);
|
|
18048
18215
|
for (const instructions of addLiquidityIxs) {
|
|
18049
18216
|
const txIxs = [];
|
|
@@ -18165,7 +18332,7 @@ var DLMM = class {
|
|
|
18165
18332
|
owner,
|
|
18166
18333
|
payer,
|
|
18167
18334
|
false,
|
|
18168
|
-
_optionalChain([this, 'access',
|
|
18335
|
+
_optionalChain([this, 'access', _100 => _100.opt, 'optionalAccess', _101 => _101.skipSolWrappingOperation])
|
|
18169
18336
|
);
|
|
18170
18337
|
instructionsByPositions.push({
|
|
18171
18338
|
positionKeypair: position,
|
|
@@ -18229,7 +18396,7 @@ var DLMM = class {
|
|
|
18229
18396
|
user,
|
|
18230
18397
|
user,
|
|
18231
18398
|
true,
|
|
18232
|
-
_optionalChain([this, 'access',
|
|
18399
|
+
_optionalChain([this, 'access', _102 => _102.opt, 'optionalAccess', _103 => _103.skipSolWrappingOperation])
|
|
18233
18400
|
);
|
|
18234
18401
|
const latestBlockhashInfo = await this.program.provider.connection.getLatestBlockhash();
|
|
18235
18402
|
return chunkedAddLiquidityIx.map((ixs) => {
|
|
@@ -18304,7 +18471,7 @@ var DLMM = class {
|
|
|
18304
18471
|
]);
|
|
18305
18472
|
createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
|
|
18306
18473
|
createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
|
|
18307
|
-
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access',
|
|
18474
|
+
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _104 => _104.opt, 'optionalAccess', _105 => _105.skipSolWrappingOperation])) {
|
|
18308
18475
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18309
18476
|
user,
|
|
18310
18477
|
userTokenX,
|
|
@@ -18312,7 +18479,7 @@ var DLMM = class {
|
|
|
18312
18479
|
);
|
|
18313
18480
|
preInstructions.push(...wrapSOLIx);
|
|
18314
18481
|
}
|
|
18315
|
-
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access',
|
|
18482
|
+
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _106 => _106.opt, 'optionalAccess', _107 => _107.skipSolWrappingOperation])) {
|
|
18316
18483
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18317
18484
|
user,
|
|
18318
18485
|
userTokenY,
|
|
@@ -18324,7 +18491,7 @@ var DLMM = class {
|
|
|
18324
18491
|
if ([
|
|
18325
18492
|
this.tokenX.publicKey.toBase58(),
|
|
18326
18493
|
this.tokenY.publicKey.toBase58()
|
|
18327
|
-
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access',
|
|
18494
|
+
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _108 => _108.opt, 'optionalAccess', _109 => _109.skipSolWrappingOperation])) {
|
|
18328
18495
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
18329
18496
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
18330
18497
|
}
|
|
@@ -18458,7 +18625,7 @@ var DLMM = class {
|
|
|
18458
18625
|
]);
|
|
18459
18626
|
createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
|
|
18460
18627
|
createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
|
|
18461
|
-
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access',
|
|
18628
|
+
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _110 => _110.opt, 'optionalAccess', _111 => _111.skipSolWrappingOperation])) {
|
|
18462
18629
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18463
18630
|
user,
|
|
18464
18631
|
userTokenX,
|
|
@@ -18466,7 +18633,7 @@ var DLMM = class {
|
|
|
18466
18633
|
);
|
|
18467
18634
|
preInstructions.push(...wrapSOLIx);
|
|
18468
18635
|
}
|
|
18469
|
-
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access',
|
|
18636
|
+
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _112 => _112.opt, 'optionalAccess', _113 => _113.skipSolWrappingOperation])) {
|
|
18470
18637
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18471
18638
|
user,
|
|
18472
18639
|
userTokenY,
|
|
@@ -18478,7 +18645,7 @@ var DLMM = class {
|
|
|
18478
18645
|
if ([
|
|
18479
18646
|
this.tokenX.publicKey.toBase58(),
|
|
18480
18647
|
this.tokenY.publicKey.toBase58()
|
|
18481
|
-
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access',
|
|
18648
|
+
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _114 => _114.opt, 'optionalAccess', _115 => _115.skipSolWrappingOperation])) {
|
|
18482
18649
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
18483
18650
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
18484
18651
|
}
|
|
@@ -18662,7 +18829,7 @@ var DLMM = class {
|
|
|
18662
18829
|
]);
|
|
18663
18830
|
createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
|
|
18664
18831
|
createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
|
|
18665
|
-
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access',
|
|
18832
|
+
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _116 => _116.opt, 'optionalAccess', _117 => _117.skipSolWrappingOperation])) {
|
|
18666
18833
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18667
18834
|
user,
|
|
18668
18835
|
userTokenX,
|
|
@@ -18670,7 +18837,7 @@ var DLMM = class {
|
|
|
18670
18837
|
);
|
|
18671
18838
|
preInstructions.push(...wrapSOLIx);
|
|
18672
18839
|
}
|
|
18673
|
-
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access',
|
|
18840
|
+
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _118 => _118.opt, 'optionalAccess', _119 => _119.skipSolWrappingOperation])) {
|
|
18674
18841
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18675
18842
|
user,
|
|
18676
18843
|
userTokenY,
|
|
@@ -18682,7 +18849,7 @@ var DLMM = class {
|
|
|
18682
18849
|
if ([
|
|
18683
18850
|
this.tokenX.publicKey.toBase58(),
|
|
18684
18851
|
this.tokenY.publicKey.toBase58()
|
|
18685
|
-
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access',
|
|
18852
|
+
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _120 => _120.opt, 'optionalAccess', _121 => _121.skipSolWrappingOperation])) {
|
|
18686
18853
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
18687
18854
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
18688
18855
|
}
|
|
@@ -18830,7 +18997,7 @@ var DLMM = class {
|
|
|
18830
18997
|
]);
|
|
18831
18998
|
createPayerTokenXIx && preInstructions.push(createPayerTokenXIx);
|
|
18832
18999
|
createPayerTokenYIx && preInstructions.push(createPayerTokenYIx);
|
|
18833
|
-
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access',
|
|
19000
|
+
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && !totalXAmount.isZero() && !_optionalChain([this, 'access', _122 => _122.opt, 'optionalAccess', _123 => _123.skipSolWrappingOperation])) {
|
|
18834
19001
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18835
19002
|
user,
|
|
18836
19003
|
userTokenX,
|
|
@@ -18838,7 +19005,7 @@ var DLMM = class {
|
|
|
18838
19005
|
);
|
|
18839
19006
|
preInstructions.push(...wrapSOLIx);
|
|
18840
19007
|
}
|
|
18841
|
-
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access',
|
|
19008
|
+
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && !totalYAmount.isZero() && !_optionalChain([this, 'access', _124 => _124.opt, 'optionalAccess', _125 => _125.skipSolWrappingOperation])) {
|
|
18842
19009
|
const wrapSOLIx = wrapSOLInstruction(
|
|
18843
19010
|
user,
|
|
18844
19011
|
userTokenY,
|
|
@@ -18850,7 +19017,7 @@ var DLMM = class {
|
|
|
18850
19017
|
if ([
|
|
18851
19018
|
this.tokenX.publicKey.toBase58(),
|
|
18852
19019
|
this.tokenY.publicKey.toBase58()
|
|
18853
|
-
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access',
|
|
19020
|
+
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _126 => _126.opt, 'optionalAccess', _127 => _127.skipSolWrappingOperation])) {
|
|
18854
19021
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
18855
19022
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
18856
19023
|
}
|
|
@@ -19127,7 +19294,7 @@ var DLMM = class {
|
|
|
19127
19294
|
if ([
|
|
19128
19295
|
this.tokenX.publicKey.toBase58(),
|
|
19129
19296
|
this.tokenY.publicKey.toBase58()
|
|
19130
|
-
].includes(_spltoken.NATIVE_MINT.toBase58()) && (!skipUnwrapSOL || !_optionalChain([this, 'access',
|
|
19297
|
+
].includes(_spltoken.NATIVE_MINT.toBase58()) && (!skipUnwrapSOL || !_optionalChain([this, 'access', _128 => _128.opt, 'optionalAccess', _129 => _129.skipSolWrappingOperation]))) {
|
|
19131
19298
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19132
19299
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19133
19300
|
}
|
|
@@ -19282,7 +19449,7 @@ var DLMM = class {
|
|
|
19282
19449
|
swapForY,
|
|
19283
19450
|
activeId,
|
|
19284
19451
|
this.lbPair,
|
|
19285
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
19452
|
+
_nullishCoalesce(_optionalChain([this, 'access', _130 => _130.binArrayBitmapExtension, 'optionalAccess', _131 => _131.account]), () => ( null)),
|
|
19286
19453
|
binArrays
|
|
19287
19454
|
);
|
|
19288
19455
|
if (binArrayAccountToSwap == null) {
|
|
@@ -19347,7 +19514,7 @@ var DLMM = class {
|
|
|
19347
19514
|
swapForY,
|
|
19348
19515
|
activeId,
|
|
19349
19516
|
this.lbPair,
|
|
19350
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
19517
|
+
_nullishCoalesce(_optionalChain([this, 'access', _132 => _132.binArrayBitmapExtension, 'optionalAccess', _133 => _133.account]), () => ( null)),
|
|
19351
19518
|
binArrays
|
|
19352
19519
|
);
|
|
19353
19520
|
if (binArrayAccountToSwap == null) {
|
|
@@ -19444,7 +19611,7 @@ var DLMM = class {
|
|
|
19444
19611
|
swapForY,
|
|
19445
19612
|
activeId,
|
|
19446
19613
|
this.lbPair,
|
|
19447
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
19614
|
+
_nullishCoalesce(_optionalChain([this, 'access', _134 => _134.binArrayBitmapExtension, 'optionalAccess', _135 => _135.account]), () => ( null)),
|
|
19448
19615
|
binArrays
|
|
19449
19616
|
);
|
|
19450
19617
|
if (binArrayAccountToSwap == null) {
|
|
@@ -19532,7 +19699,7 @@ var DLMM = class {
|
|
|
19532
19699
|
swapForY,
|
|
19533
19700
|
activeId,
|
|
19534
19701
|
this.lbPair,
|
|
19535
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
19702
|
+
_nullishCoalesce(_optionalChain([this, 'access', _136 => _136.binArrayBitmapExtension, 'optionalAccess', _137 => _137.account]), () => ( null)),
|
|
19536
19703
|
binArrays
|
|
19537
19704
|
);
|
|
19538
19705
|
if (binArrayAccountToSwap == null) {
|
|
@@ -19614,7 +19781,7 @@ var DLMM = class {
|
|
|
19614
19781
|
]);
|
|
19615
19782
|
createInTokenAccountIx && preInstructions.push(createInTokenAccountIx);
|
|
19616
19783
|
createOutTokenAccountIx && preInstructions.push(createOutTokenAccountIx);
|
|
19617
|
-
if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access',
|
|
19784
|
+
if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _138 => _138.opt, 'optionalAccess', _139 => _139.skipSolWrappingOperation])) {
|
|
19618
19785
|
const wrapSOLIx = wrapSOLInstruction(
|
|
19619
19786
|
user,
|
|
19620
19787
|
userTokenIn,
|
|
@@ -19624,7 +19791,7 @@ var DLMM = class {
|
|
|
19624
19791
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19625
19792
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19626
19793
|
}
|
|
19627
|
-
if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access',
|
|
19794
|
+
if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _140 => _140.opt, 'optionalAccess', _141 => _141.skipSolWrappingOperation])) {
|
|
19628
19795
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19629
19796
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19630
19797
|
}
|
|
@@ -19707,7 +19874,7 @@ var DLMM = class {
|
|
|
19707
19874
|
]);
|
|
19708
19875
|
createInTokenAccountIx && preInstructions.push(createInTokenAccountIx);
|
|
19709
19876
|
createOutTokenAccountIx && preInstructions.push(createOutTokenAccountIx);
|
|
19710
|
-
if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access',
|
|
19877
|
+
if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _142 => _142.opt, 'optionalAccess', _143 => _143.skipSolWrappingOperation])) {
|
|
19711
19878
|
const wrapSOLIx = wrapSOLInstruction(
|
|
19712
19879
|
user,
|
|
19713
19880
|
userTokenIn,
|
|
@@ -19717,7 +19884,7 @@ var DLMM = class {
|
|
|
19717
19884
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19718
19885
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19719
19886
|
}
|
|
19720
|
-
if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access',
|
|
19887
|
+
if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _144 => _144.opt, 'optionalAccess', _145 => _145.skipSolWrappingOperation])) {
|
|
19721
19888
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19722
19889
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19723
19890
|
}
|
|
@@ -19809,7 +19976,7 @@ var DLMM = class {
|
|
|
19809
19976
|
]);
|
|
19810
19977
|
createInTokenAccountIx && preInstructions.push(createInTokenAccountIx);
|
|
19811
19978
|
createOutTokenAccountIx && preInstructions.push(createOutTokenAccountIx);
|
|
19812
|
-
if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access',
|
|
19979
|
+
if (inToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _146 => _146.opt, 'optionalAccess', _147 => _147.skipSolWrappingOperation])) {
|
|
19813
19980
|
const wrapSOLIx = wrapSOLInstruction(
|
|
19814
19981
|
user,
|
|
19815
19982
|
userTokenIn,
|
|
@@ -19819,7 +19986,7 @@ var DLMM = class {
|
|
|
19819
19986
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19820
19987
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19821
19988
|
}
|
|
19822
|
-
if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access',
|
|
19989
|
+
if (outToken.equals(_spltoken.NATIVE_MINT) && !_optionalChain([this, 'access', _148 => _148.opt, 'optionalAccess', _149 => _149.skipSolWrappingOperation])) {
|
|
19823
19990
|
const closeWrappedSOLIx = await unwrapSOLInstruction(user);
|
|
19824
19991
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
19825
19992
|
}
|
|
@@ -20878,7 +21045,7 @@ var DLMM = class {
|
|
|
20878
21045
|
swapForY,
|
|
20879
21046
|
new (0, _anchor.BN)(activeBinId),
|
|
20880
21047
|
this.lbPair,
|
|
20881
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
21048
|
+
_nullishCoalesce(_optionalChain([this, 'access', _150 => _150.binArrayBitmapExtension, 'optionalAccess', _151 => _151.account]), () => ( null))
|
|
20882
21049
|
);
|
|
20883
21050
|
if (toBinArrayIndex === null)
|
|
20884
21051
|
return true;
|
|
@@ -20915,7 +21082,7 @@ var DLMM = class {
|
|
|
20915
21082
|
swapForY,
|
|
20916
21083
|
new (0, _anchor.BN)(activeBinId),
|
|
20917
21084
|
this.lbPair,
|
|
20918
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
21085
|
+
_nullishCoalesce(_optionalChain([this, 'access', _152 => _152.binArrayBitmapExtension, 'optionalAccess', _153 => _153.account]), () => ( null))
|
|
20919
21086
|
);
|
|
20920
21087
|
const marketPriceBinArrayIndex = binIdToBinArrayIndex(
|
|
20921
21088
|
new (0, _anchor.BN)(marketPriceBinId)
|
|
@@ -20951,7 +21118,7 @@ var DLMM = class {
|
|
|
20951
21118
|
let binArrayBitmapExtension = null;
|
|
20952
21119
|
if (binArrayBitMapExtensionPubkey) {
|
|
20953
21120
|
binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
|
|
20954
|
-
if (!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
21121
|
+
if (!_optionalChain([binArrayAccounts, 'optionalAccess', _154 => _154[0]])) {
|
|
20955
21122
|
const initializeBitmapExtensionIx = await this.program.methods.initializeBinArrayBitmapExtension().accountsPartial({
|
|
20956
21123
|
binArrayBitmapExtension: binArrayBitMapExtensionPubkey,
|
|
20957
21124
|
funder: owner,
|
|
@@ -20960,10 +21127,10 @@ var DLMM = class {
|
|
|
20960
21127
|
preInstructions.push(initializeBitmapExtensionIx);
|
|
20961
21128
|
}
|
|
20962
21129
|
}
|
|
20963
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
21130
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _155 => _155[1]])) {
|
|
20964
21131
|
fromBinArray = fromBinArrayPubkey;
|
|
20965
21132
|
}
|
|
20966
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
21133
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _156 => _156[2]]) && !!toBinArrayIndex) {
|
|
20967
21134
|
toBinArray = toBinArrayPubkey;
|
|
20968
21135
|
}
|
|
20969
21136
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -21409,7 +21576,7 @@ var DLMM = class {
|
|
|
21409
21576
|
slippage
|
|
21410
21577
|
);
|
|
21411
21578
|
const postInstructions = [];
|
|
21412
|
-
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountXDeposited.gtn(0) && !_optionalChain([this, 'access',
|
|
21579
|
+
if (this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountXDeposited.gtn(0) && !_optionalChain([this, 'access', _157 => _157.opt, 'optionalAccess', _158 => _158.skipSolWrappingOperation])) {
|
|
21413
21580
|
const wrapSOLIx = wrapSOLInstruction(
|
|
21414
21581
|
owner,
|
|
21415
21582
|
userTokenX,
|
|
@@ -21417,7 +21584,7 @@ var DLMM = class {
|
|
|
21417
21584
|
);
|
|
21418
21585
|
preInstructions.push(...wrapSOLIx);
|
|
21419
21586
|
}
|
|
21420
|
-
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountYDeposited.gtn(0) && !_optionalChain([this, 'access',
|
|
21587
|
+
if (this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT) && simulationResult.actualAmountYDeposited.gtn(0) && !_optionalChain([this, 'access', _159 => _159.opt, 'optionalAccess', _160 => _160.skipSolWrappingOperation])) {
|
|
21421
21588
|
const wrapSOLIx = wrapSOLInstruction(
|
|
21422
21589
|
owner,
|
|
21423
21590
|
userTokenY,
|
|
@@ -21425,7 +21592,7 @@ var DLMM = class {
|
|
|
21425
21592
|
);
|
|
21426
21593
|
preInstructions.push(...wrapSOLIx);
|
|
21427
21594
|
}
|
|
21428
|
-
if ((this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) || this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([this, 'access',
|
|
21595
|
+
if ((this.tokenX.publicKey.equals(_spltoken.NATIVE_MINT) || this.tokenY.publicKey.equals(_spltoken.NATIVE_MINT)) && !_optionalChain([this, 'access', _161 => _161.opt, 'optionalAccess', _162 => _162.skipSolWrappingOperation])) {
|
|
21429
21596
|
const closeWrappedSOLIx = await unwrapSOLInstruction(owner);
|
|
21430
21597
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
21431
21598
|
}
|
|
@@ -21871,7 +22038,7 @@ var DLMM = class {
|
|
|
21871
22038
|
);
|
|
21872
22039
|
})
|
|
21873
22040
|
);
|
|
21874
|
-
const version = _nullishCoalesce(_optionalChain([binArrays, 'access',
|
|
22041
|
+
const version = _nullishCoalesce(_optionalChain([binArrays, 'access', _163 => _163.find, 'call', _164 => _164((binArray) => binArray != null), 'optionalAccess', _165 => _165.version]), () => ( 1));
|
|
21875
22042
|
return Array.from(
|
|
21876
22043
|
enumerateBins(
|
|
21877
22044
|
binsById,
|
|
@@ -22066,7 +22233,7 @@ var DLMM = class {
|
|
|
22066
22233
|
if ([
|
|
22067
22234
|
this.tokenX.publicKey.toBase58(),
|
|
22068
22235
|
this.tokenY.publicKey.toBase58()
|
|
22069
|
-
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access',
|
|
22236
|
+
].includes(_spltoken.NATIVE_MINT.toBase58()) && !_optionalChain([this, 'access', _166 => _166.opt, 'optionalAccess', _167 => _167.skipSolWrappingOperation])) {
|
|
22070
22237
|
const closeWrappedSOLIx = await unwrapSOLInstruction(owner);
|
|
22071
22238
|
closeWrappedSOLIx && postInstructions.push(closeWrappedSOLIx);
|
|
22072
22239
|
}
|
|
@@ -22300,7 +22467,8 @@ var src_default = DLMM;
|
|
|
22300
22467
|
|
|
22301
22468
|
|
|
22302
22469
|
|
|
22303
|
-
|
|
22470
|
+
|
|
22471
|
+
exports.ADMIN = ADMIN; exports.ALT_ADDRESS = ALT_ADDRESS; exports.ActionType = ActionType; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_FEE = BIN_ARRAY_BITMAP_FEE; exports.BIN_ARRAY_BITMAP_FEE_BN = BIN_ARRAY_BITMAP_FEE_BN; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BIN_ARRAY_FEE_BN = BIN_ARRAY_FEE_BN; exports.BinLiquidity = BinLiquidity; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DEFAULT_BIN_PER_POSITION = DEFAULT_BIN_PER_POSITION; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.FunctionType = FunctionType; exports.IDL = idl_default; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; exports.MAX_BINS_PER_POSITION = MAX_BINS_PER_POSITION; exports.MAX_BIN_ARRAY_SIZE = MAX_BIN_ARRAY_SIZE; exports.MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_EXTRA_BIN_ARRAYS = MAX_EXTRA_BIN_ARRAYS; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.MAX_RESIZE_LENGTH = MAX_RESIZE_LENGTH; exports.MEMO_PROGRAM_ID = MEMO_PROGRAM_ID; exports.Network = Network; exports.POOL_FEE = POOL_FEE; exports.POOL_FEE_BN = POOL_FEE_BN; exports.POSITION_BIN_DATA_SIZE = POSITION_BIN_DATA_SIZE; exports.POSITION_FEE = POSITION_FEE; exports.POSITION_FEE_BN = POSITION_FEE_BN; exports.POSITION_MAX_LENGTH = POSITION_MAX_LENGTH; exports.POSITION_MIN_SIZE = POSITION_MIN_SIZE; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionV2Wrapper = PositionV2Wrapper; exports.PositionVersion = PositionVersion; exports.REBALANCE_POSITION_PADDING = REBALANCE_POSITION_PADDING; exports.RebalancePosition = RebalancePosition; exports.ResizeSide = ResizeSide; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.ShrinkMode = ShrinkMode; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.TOKEN_ACCOUNT_FEE = TOKEN_ACCOUNT_FEE; exports.TOKEN_ACCOUNT_FEE_BN = TOKEN_ACCOUNT_FEE_BN; exports.U64_MAX = U64_MAX; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binArrayLbPairFilter = binArrayLbPairFilter; exports.binDeltaToMinMaxBinId = binDeltaToMinMaxBinId; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.buildBitFlagAndNegateStrategyParameters = buildBitFlagAndNegateStrategyParameters; exports.buildLiquidityStrategyParameters = buildLiquidityStrategyParameters; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculatePositionSize = calculatePositionSize; exports.calculateSpotDistribution = calculateSpotDistribution; exports.capSlippagePercentage = capSlippagePercentage; exports.chunkBinRange = chunkBinRange; exports.chunkBinRangeIntoExtendedPositions = chunkBinRangeIntoExtendedPositions; exports.chunkDepositWithRebalanceEndpoint = chunkDepositWithRebalanceEndpoint; exports.chunkPositionBinRange = chunkPositionBinRange; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunkedGetProgramAccounts = chunkedGetProgramAccounts; exports.chunks = chunks; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.createProgram = createProgram; exports.decodeAccount = decodeAccount; exports.decodeExtendedPosition = decodeExtendedPosition; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveEventAuthority = deriveEventAuthority; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveLbPairWithPresetParamWithIndexKey = deriveLbPairWithPresetParamWithIndexKey; exports.deriveOperator = deriveOperator; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePlaceHolderAccountMeta = derivePlaceHolderAccountMeta; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.derivePresetParameterWithIndex = derivePresetParameterWithIndex; exports.deriveReserve = deriveReserve; exports.deriveRewardVault = deriveRewardVault; exports.deriveTokenBadge = deriveTokenBadge; exports.enumerateBins = enumerateBins; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getAccountDiscriminator = getAccountDiscriminator; exports.getAmountInBinsAskSide = getAmountInBinsAskSide; exports.getAmountInBinsBidSide = getAmountInBinsBidSide; exports.getAndCapMaxActiveBinSlippage = getAndCapMaxActiveBinSlippage; exports.getAutoFillAmountByRebalancedPosition = getAutoFillAmountByRebalancedPosition; exports.getBaseFee = getBaseFee; exports.getBinArrayAccountMetasCoverage = getBinArrayAccountMetasCoverage; exports.getBinArrayIndexesCoverage = getBinArrayIndexesCoverage; exports.getBinArrayKeysCoverage = getBinArrayKeysCoverage; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinCount = getBinCount; exports.getBinFromBinArray = getBinFromBinArray; exports.getBinIdIndexInBinArray = getBinIdIndexInBinArray; exports.getEstimatedComputeUnitIxWithBuffer = getEstimatedComputeUnitIxWithBuffer; exports.getEstimatedComputeUnitUsageWithBuffer = getEstimatedComputeUnitUsageWithBuffer; exports.getExtendedPositionBinCount = getExtendedPositionBinCount; exports.getLiquidityStrategyParameterBuilder = getLiquidityStrategyParameterBuilder; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPositionCountByBinCount = getPositionCountByBinCount; exports.getPositionExpandRentExemption = getPositionExpandRentExemption; exports.getPositionLowerUpperBinIdWithLiquidity = getPositionLowerUpperBinIdWithLiquidity; exports.getPositionRentExemption = getPositionRentExemption; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getRebalanceBinArrayIndexesAndBitmapCoverage = getRebalanceBinArrayIndexesAndBitmapCoverage; exports.getSlippageMaxAmount = getSlippageMaxAmount; exports.getSlippageMinAmount = getSlippageMinAmount; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokenProgramId = getTokenProgramId; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.isPositionNoFee = isPositionNoFee; exports.isPositionNoReward = isPositionNoReward; exports.parseLogs = parseLogs; exports.positionLbPairFilter = positionLbPairFilter; exports.positionOwnerFilter = positionOwnerFilter; exports.positionV2Filter = positionV2Filter; exports.presetParameter2BaseFactorFilter = presetParameter2BaseFactorFilter; exports.presetParameter2BaseFeePowerFactor = presetParameter2BaseFeePowerFactor; exports.presetParameter2BinStepFilter = presetParameter2BinStepFilter; exports.range = range; exports.resetUninvolvedLiquidityParams = resetUninvolvedLiquidityParams; exports.suggestBalancedXParametersFromY = suggestBalancedXParametersFromY; exports.suggestBalancedYParametersFromX = suggestBalancedYParametersFromX; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountIntoBins = toAmountIntoBins; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.updateBinArray = updateBinArray; exports.wrapPosition = wrapPosition; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
22304
22472
|
//# sourceMappingURL=index.js.map
|
|
22305
22473
|
|
|
22306
22474
|
// CJS interop: Make default export primary for require() compatibility
|