@meteora-ag/dlmm 1.2.3 → 1.3.0
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 +333 -249
- package/dist/index.js +429 -288
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +420 -279
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _web3js = require('@solana/web3.js');
|
|
|
9
9
|
|
|
10
10
|
// src/dlmm/idl.ts
|
|
11
11
|
var IDL = {
|
|
12
|
-
"version": "0.8.
|
|
12
|
+
"version": "0.8.2",
|
|
13
13
|
"name": "lb_clmm",
|
|
14
14
|
"constants": [
|
|
15
15
|
{
|
|
@@ -97,6 +97,21 @@ var IDL = {
|
|
|
97
97
|
},
|
|
98
98
|
"value": "15"
|
|
99
99
|
},
|
|
100
|
+
{
|
|
101
|
+
"name": "MAX_BIN_STEP",
|
|
102
|
+
"type": "u16",
|
|
103
|
+
"value": "400"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "MAX_BASE_FEE",
|
|
107
|
+
"type": "u128",
|
|
108
|
+
"value": "100_000_000"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "MIN_BASE_FEE",
|
|
112
|
+
"type": "u128",
|
|
113
|
+
"value": "100_000"
|
|
114
|
+
},
|
|
100
115
|
{
|
|
101
116
|
"name": "BIN_ARRAY",
|
|
102
117
|
"type": "bytes",
|
|
@@ -294,6 +309,90 @@ var IDL = {
|
|
|
294
309
|
}
|
|
295
310
|
]
|
|
296
311
|
},
|
|
312
|
+
{
|
|
313
|
+
"name": "initializeCustomizablePermissionlessLbPair",
|
|
314
|
+
"accounts": [
|
|
315
|
+
{
|
|
316
|
+
"name": "lbPair",
|
|
317
|
+
"isMut": true,
|
|
318
|
+
"isSigner": false
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"name": "binArrayBitmapExtension",
|
|
322
|
+
"isMut": true,
|
|
323
|
+
"isSigner": false,
|
|
324
|
+
"isOptional": true
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"name": "tokenMintX",
|
|
328
|
+
"isMut": false,
|
|
329
|
+
"isSigner": false
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"name": "tokenMintY",
|
|
333
|
+
"isMut": false,
|
|
334
|
+
"isSigner": false
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"name": "reserveX",
|
|
338
|
+
"isMut": true,
|
|
339
|
+
"isSigner": false
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"name": "reserveY",
|
|
343
|
+
"isMut": true,
|
|
344
|
+
"isSigner": false
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "oracle",
|
|
348
|
+
"isMut": true,
|
|
349
|
+
"isSigner": false
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "userTokenX",
|
|
353
|
+
"isMut": false,
|
|
354
|
+
"isSigner": false
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"name": "funder",
|
|
358
|
+
"isMut": true,
|
|
359
|
+
"isSigner": true
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"name": "tokenProgram",
|
|
363
|
+
"isMut": false,
|
|
364
|
+
"isSigner": false
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
"name": "systemProgram",
|
|
368
|
+
"isMut": false,
|
|
369
|
+
"isSigner": false
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"name": "rent",
|
|
373
|
+
"isMut": false,
|
|
374
|
+
"isSigner": false
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"name": "eventAuthority",
|
|
378
|
+
"isMut": false,
|
|
379
|
+
"isSigner": false
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"name": "program",
|
|
383
|
+
"isMut": false,
|
|
384
|
+
"isSigner": false
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
"args": [
|
|
388
|
+
{
|
|
389
|
+
"name": "params",
|
|
390
|
+
"type": {
|
|
391
|
+
"defined": "CustomizableParams"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
},
|
|
297
396
|
{
|
|
298
397
|
"name": "initializeBinArrayBitmapExtension",
|
|
299
398
|
"accounts": [
|
|
@@ -1026,6 +1125,11 @@ var IDL = {
|
|
|
1026
1125
|
"isMut": false,
|
|
1027
1126
|
"isSigner": false
|
|
1028
1127
|
},
|
|
1128
|
+
{
|
|
1129
|
+
"name": "owner",
|
|
1130
|
+
"isMut": false,
|
|
1131
|
+
"isSigner": false
|
|
1132
|
+
},
|
|
1029
1133
|
{
|
|
1030
1134
|
"name": "operator",
|
|
1031
1135
|
"isMut": false,
|
|
@@ -1035,12 +1139,17 @@ var IDL = {
|
|
|
1035
1139
|
]
|
|
1036
1140
|
},
|
|
1037
1141
|
{
|
|
1038
|
-
"name": "
|
|
1142
|
+
"name": "operatorTokenX",
|
|
1039
1143
|
"isMut": false,
|
|
1040
1144
|
"isSigner": false
|
|
1041
1145
|
},
|
|
1042
1146
|
{
|
|
1043
|
-
"name": "
|
|
1147
|
+
"name": "ownerTokenX",
|
|
1148
|
+
"isMut": false,
|
|
1149
|
+
"isSigner": false
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
"name": "systemProgram",
|
|
1044
1153
|
"isMut": false,
|
|
1045
1154
|
"isSigner": false
|
|
1046
1155
|
},
|
|
@@ -1065,12 +1174,12 @@ var IDL = {
|
|
|
1065
1174
|
"type": "i32"
|
|
1066
1175
|
},
|
|
1067
1176
|
{
|
|
1068
|
-
"name": "
|
|
1177
|
+
"name": "feeOwner",
|
|
1069
1178
|
"type": "publicKey"
|
|
1070
1179
|
},
|
|
1071
1180
|
{
|
|
1072
|
-
"name": "
|
|
1073
|
-
"type": "
|
|
1181
|
+
"name": "lockReleasePoint",
|
|
1182
|
+
"type": "u64"
|
|
1074
1183
|
}
|
|
1075
1184
|
]
|
|
1076
1185
|
},
|
|
@@ -2048,73 +2157,6 @@ var IDL = {
|
|
|
2048
2157
|
],
|
|
2049
2158
|
"args": []
|
|
2050
2159
|
},
|
|
2051
|
-
{
|
|
2052
|
-
"name": "removeLiquiditySingleSide",
|
|
2053
|
-
"accounts": [
|
|
2054
|
-
{
|
|
2055
|
-
"name": "position",
|
|
2056
|
-
"isMut": true,
|
|
2057
|
-
"isSigner": false
|
|
2058
|
-
},
|
|
2059
|
-
{
|
|
2060
|
-
"name": "lbPair",
|
|
2061
|
-
"isMut": true,
|
|
2062
|
-
"isSigner": false
|
|
2063
|
-
},
|
|
2064
|
-
{
|
|
2065
|
-
"name": "binArrayBitmapExtension",
|
|
2066
|
-
"isMut": true,
|
|
2067
|
-
"isSigner": false,
|
|
2068
|
-
"isOptional": true
|
|
2069
|
-
},
|
|
2070
|
-
{
|
|
2071
|
-
"name": "userToken",
|
|
2072
|
-
"isMut": true,
|
|
2073
|
-
"isSigner": false
|
|
2074
|
-
},
|
|
2075
|
-
{
|
|
2076
|
-
"name": "reserve",
|
|
2077
|
-
"isMut": true,
|
|
2078
|
-
"isSigner": false
|
|
2079
|
-
},
|
|
2080
|
-
{
|
|
2081
|
-
"name": "tokenMint",
|
|
2082
|
-
"isMut": false,
|
|
2083
|
-
"isSigner": false
|
|
2084
|
-
},
|
|
2085
|
-
{
|
|
2086
|
-
"name": "binArrayLower",
|
|
2087
|
-
"isMut": true,
|
|
2088
|
-
"isSigner": false
|
|
2089
|
-
},
|
|
2090
|
-
{
|
|
2091
|
-
"name": "binArrayUpper",
|
|
2092
|
-
"isMut": true,
|
|
2093
|
-
"isSigner": false
|
|
2094
|
-
},
|
|
2095
|
-
{
|
|
2096
|
-
"name": "sender",
|
|
2097
|
-
"isMut": false,
|
|
2098
|
-
"isSigner": true
|
|
2099
|
-
},
|
|
2100
|
-
{
|
|
2101
|
-
"name": "tokenProgram",
|
|
2102
|
-
"isMut": false,
|
|
2103
|
-
"isSigner": false
|
|
2104
|
-
},
|
|
2105
|
-
{
|
|
2106
|
-
"name": "eventAuthority",
|
|
2107
|
-
"isMut": false,
|
|
2108
|
-
"isSigner": false
|
|
2109
|
-
},
|
|
2110
|
-
{
|
|
2111
|
-
"name": "program",
|
|
2112
|
-
"isMut": false,
|
|
2113
|
-
"isSigner": false
|
|
2114
|
-
}
|
|
2115
|
-
],
|
|
2116
|
-
"args": []
|
|
2117
|
-
},
|
|
2118
2160
|
{
|
|
2119
2161
|
"name": "togglePairStatus",
|
|
2120
2162
|
"accounts": [
|
|
@@ -2131,27 +2173,6 @@ var IDL = {
|
|
|
2131
2173
|
],
|
|
2132
2174
|
"args": []
|
|
2133
2175
|
},
|
|
2134
|
-
{
|
|
2135
|
-
"name": "updateWhitelistedWallet",
|
|
2136
|
-
"accounts": [
|
|
2137
|
-
{
|
|
2138
|
-
"name": "lbPair",
|
|
2139
|
-
"isMut": true,
|
|
2140
|
-
"isSigner": false
|
|
2141
|
-
},
|
|
2142
|
-
{
|
|
2143
|
-
"name": "creator",
|
|
2144
|
-
"isMut": false,
|
|
2145
|
-
"isSigner": true
|
|
2146
|
-
}
|
|
2147
|
-
],
|
|
2148
|
-
"args": [
|
|
2149
|
-
{
|
|
2150
|
-
"name": "wallet",
|
|
2151
|
-
"type": "publicKey"
|
|
2152
|
-
}
|
|
2153
|
-
]
|
|
2154
|
-
},
|
|
2155
2176
|
{
|
|
2156
2177
|
"name": "migratePosition",
|
|
2157
2178
|
"accounts": [
|
|
@@ -2327,42 +2348,6 @@ var IDL = {
|
|
|
2327
2348
|
}
|
|
2328
2349
|
]
|
|
2329
2350
|
},
|
|
2330
|
-
{
|
|
2331
|
-
"name": "setLockReleasePoint",
|
|
2332
|
-
"accounts": [
|
|
2333
|
-
{
|
|
2334
|
-
"name": "position",
|
|
2335
|
-
"isMut": true,
|
|
2336
|
-
"isSigner": false
|
|
2337
|
-
},
|
|
2338
|
-
{
|
|
2339
|
-
"name": "lbPair",
|
|
2340
|
-
"isMut": false,
|
|
2341
|
-
"isSigner": false
|
|
2342
|
-
},
|
|
2343
|
-
{
|
|
2344
|
-
"name": "sender",
|
|
2345
|
-
"isMut": false,
|
|
2346
|
-
"isSigner": true
|
|
2347
|
-
},
|
|
2348
|
-
{
|
|
2349
|
-
"name": "eventAuthority",
|
|
2350
|
-
"isMut": false,
|
|
2351
|
-
"isSigner": false
|
|
2352
|
-
},
|
|
2353
|
-
{
|
|
2354
|
-
"name": "program",
|
|
2355
|
-
"isMut": false,
|
|
2356
|
-
"isSigner": false
|
|
2357
|
-
}
|
|
2358
|
-
],
|
|
2359
|
-
"args": [
|
|
2360
|
-
{
|
|
2361
|
-
"name": "newLockReleasePoint",
|
|
2362
|
-
"type": "u64"
|
|
2363
|
-
}
|
|
2364
|
-
]
|
|
2365
|
-
},
|
|
2366
2351
|
{
|
|
2367
2352
|
"name": "removeLiquidityByRange",
|
|
2368
2353
|
"accounts": [
|
|
@@ -2598,7 +2583,7 @@ var IDL = {
|
|
|
2598
2583
|
"args": [
|
|
2599
2584
|
{
|
|
2600
2585
|
"name": "preActivationDuration",
|
|
2601
|
-
"type": "
|
|
2586
|
+
"type": "u64"
|
|
2602
2587
|
}
|
|
2603
2588
|
]
|
|
2604
2589
|
},
|
|
@@ -2909,11 +2894,16 @@ var IDL = {
|
|
|
2909
2894
|
"type": "i64"
|
|
2910
2895
|
},
|
|
2911
2896
|
{
|
|
2912
|
-
"name": "
|
|
2897
|
+
"name": "padding2",
|
|
2913
2898
|
"docs": [
|
|
2914
|
-
"
|
|
2899
|
+
"_padding_2, previous whitelisted_wallet, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"
|
|
2915
2900
|
],
|
|
2916
|
-
"type":
|
|
2901
|
+
"type": {
|
|
2902
|
+
"array": [
|
|
2903
|
+
"u8",
|
|
2904
|
+
32
|
|
2905
|
+
]
|
|
2906
|
+
}
|
|
2917
2907
|
},
|
|
2918
2908
|
{
|
|
2919
2909
|
"name": "preActivationSwapAddress",
|
|
@@ -2944,9 +2934,9 @@ var IDL = {
|
|
|
2944
2934
|
"type": "u64"
|
|
2945
2935
|
},
|
|
2946
2936
|
{
|
|
2947
|
-
"name": "
|
|
2937
|
+
"name": "padding3",
|
|
2948
2938
|
"docs": [
|
|
2949
|
-
"_padding
|
|
2939
|
+
"_padding 3 is reclaimed free space from swap_cap_deactivate_point and swap_cap_amount before, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"
|
|
2950
2940
|
],
|
|
2951
2941
|
"type": {
|
|
2952
2942
|
"array": [
|
|
@@ -2956,9 +2946,9 @@ var IDL = {
|
|
|
2956
2946
|
}
|
|
2957
2947
|
},
|
|
2958
2948
|
{
|
|
2959
|
-
"name": "
|
|
2949
|
+
"name": "padding4",
|
|
2960
2950
|
"docs": [
|
|
2961
|
-
"
|
|
2951
|
+
"_padding_4, previous lock_duration, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"
|
|
2962
2952
|
],
|
|
2963
2953
|
"type": "u64"
|
|
2964
2954
|
},
|
|
@@ -3255,9 +3245,9 @@ var IDL = {
|
|
|
3255
3245
|
"type": "u64"
|
|
3256
3246
|
},
|
|
3257
3247
|
{
|
|
3258
|
-
"name": "
|
|
3248
|
+
"name": "padding0",
|
|
3259
3249
|
"docs": [
|
|
3260
|
-
"
|
|
3250
|
+
"_padding_0, previous subjected_to_bootstrap_liquidity_locking, BE CAREFUL FOR TOMBSTONE WHEN REUSE !!"
|
|
3261
3251
|
],
|
|
3262
3252
|
"type": "u8"
|
|
3263
3253
|
},
|
|
@@ -3284,7 +3274,87 @@ var IDL = {
|
|
|
3284
3274
|
}
|
|
3285
3275
|
},
|
|
3286
3276
|
{
|
|
3287
|
-
"name": "presetParameter",
|
|
3277
|
+
"name": "presetParameter",
|
|
3278
|
+
"type": {
|
|
3279
|
+
"kind": "struct",
|
|
3280
|
+
"fields": [
|
|
3281
|
+
{
|
|
3282
|
+
"name": "binStep",
|
|
3283
|
+
"docs": [
|
|
3284
|
+
"Bin step. Represent the price increment / decrement."
|
|
3285
|
+
],
|
|
3286
|
+
"type": "u16"
|
|
3287
|
+
},
|
|
3288
|
+
{
|
|
3289
|
+
"name": "baseFactor",
|
|
3290
|
+
"docs": [
|
|
3291
|
+
"Used for base fee calculation. base_fee_rate = base_factor * bin_step"
|
|
3292
|
+
],
|
|
3293
|
+
"type": "u16"
|
|
3294
|
+
},
|
|
3295
|
+
{
|
|
3296
|
+
"name": "filterPeriod",
|
|
3297
|
+
"docs": [
|
|
3298
|
+
"Filter period determine high frequency trading time window."
|
|
3299
|
+
],
|
|
3300
|
+
"type": "u16"
|
|
3301
|
+
},
|
|
3302
|
+
{
|
|
3303
|
+
"name": "decayPeriod",
|
|
3304
|
+
"docs": [
|
|
3305
|
+
"Decay period determine when the volatile fee start decay / decrease."
|
|
3306
|
+
],
|
|
3307
|
+
"type": "u16"
|
|
3308
|
+
},
|
|
3309
|
+
{
|
|
3310
|
+
"name": "reductionFactor",
|
|
3311
|
+
"docs": [
|
|
3312
|
+
"Reduction factor controls the volatile fee rate decrement rate."
|
|
3313
|
+
],
|
|
3314
|
+
"type": "u16"
|
|
3315
|
+
},
|
|
3316
|
+
{
|
|
3317
|
+
"name": "variableFeeControl",
|
|
3318
|
+
"docs": [
|
|
3319
|
+
"Used to scale the variable fee component depending on the dynamic of the market"
|
|
3320
|
+
],
|
|
3321
|
+
"type": "u32"
|
|
3322
|
+
},
|
|
3323
|
+
{
|
|
3324
|
+
"name": "maxVolatilityAccumulator",
|
|
3325
|
+
"docs": [
|
|
3326
|
+
"Maximum number of bin crossed can be accumulated. Used to cap volatile fee rate."
|
|
3327
|
+
],
|
|
3328
|
+
"type": "u32"
|
|
3329
|
+
},
|
|
3330
|
+
{
|
|
3331
|
+
"name": "minBinId",
|
|
3332
|
+
"docs": [
|
|
3333
|
+
"Min bin id supported by the pool based on the configured bin step."
|
|
3334
|
+
],
|
|
3335
|
+
"type": "i32"
|
|
3336
|
+
},
|
|
3337
|
+
{
|
|
3338
|
+
"name": "maxBinId",
|
|
3339
|
+
"docs": [
|
|
3340
|
+
"Max bin id supported by the pool based on the configured bin step."
|
|
3341
|
+
],
|
|
3342
|
+
"type": "i32"
|
|
3343
|
+
},
|
|
3344
|
+
{
|
|
3345
|
+
"name": "protocolShare",
|
|
3346
|
+
"docs": [
|
|
3347
|
+
"Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee"
|
|
3348
|
+
],
|
|
3349
|
+
"type": "u16"
|
|
3350
|
+
}
|
|
3351
|
+
]
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
],
|
|
3355
|
+
"types": [
|
|
3356
|
+
{
|
|
3357
|
+
"name": "InitPresetParametersIx",
|
|
3288
3358
|
"type": {
|
|
3289
3359
|
"kind": "struct",
|
|
3290
3360
|
"fields": [
|
|
@@ -3360,9 +3430,29 @@ var IDL = {
|
|
|
3360
3430
|
}
|
|
3361
3431
|
]
|
|
3362
3432
|
}
|
|
3363
|
-
}
|
|
3364
|
-
|
|
3365
|
-
|
|
3433
|
+
},
|
|
3434
|
+
{
|
|
3435
|
+
"name": "FeeParameter",
|
|
3436
|
+
"type": {
|
|
3437
|
+
"kind": "struct",
|
|
3438
|
+
"fields": [
|
|
3439
|
+
{
|
|
3440
|
+
"name": "protocolShare",
|
|
3441
|
+
"docs": [
|
|
3442
|
+
"Portion of swap fees retained by the protocol by controlling protocol_share parameter. protocol_swap_fee = protocol_share * total_swap_fee"
|
|
3443
|
+
],
|
|
3444
|
+
"type": "u16"
|
|
3445
|
+
},
|
|
3446
|
+
{
|
|
3447
|
+
"name": "baseFactor",
|
|
3448
|
+
"docs": [
|
|
3449
|
+
"Base factor for base fee rate"
|
|
3450
|
+
],
|
|
3451
|
+
"type": "u16"
|
|
3452
|
+
}
|
|
3453
|
+
]
|
|
3454
|
+
}
|
|
3455
|
+
},
|
|
3366
3456
|
{
|
|
3367
3457
|
"name": "LiquidityParameterByStrategyOneSide",
|
|
3368
3458
|
"type": {
|
|
@@ -3697,137 +3787,97 @@ var IDL = {
|
|
|
3697
3787
|
}
|
|
3698
3788
|
},
|
|
3699
3789
|
{
|
|
3700
|
-
"name": "
|
|
3790
|
+
"name": "CustomizableParams",
|
|
3701
3791
|
"type": {
|
|
3702
3792
|
"kind": "struct",
|
|
3703
3793
|
"fields": [
|
|
3704
3794
|
{
|
|
3705
3795
|
"name": "activeId",
|
|
3796
|
+
"docs": [
|
|
3797
|
+
"Pool price"
|
|
3798
|
+
],
|
|
3706
3799
|
"type": "i32"
|
|
3707
3800
|
},
|
|
3708
|
-
{
|
|
3709
|
-
"name": "binStep",
|
|
3710
|
-
"type": "u16"
|
|
3711
|
-
},
|
|
3712
|
-
{
|
|
3713
|
-
"name": "baseFactor",
|
|
3714
|
-
"type": "u16"
|
|
3715
|
-
},
|
|
3716
|
-
{
|
|
3717
|
-
"name": "minBinId",
|
|
3718
|
-
"type": "i32"
|
|
3719
|
-
},
|
|
3720
|
-
{
|
|
3721
|
-
"name": "maxBinId",
|
|
3722
|
-
"type": "i32"
|
|
3723
|
-
},
|
|
3724
|
-
{
|
|
3725
|
-
"name": "lockDuration",
|
|
3726
|
-
"type": "u64"
|
|
3727
|
-
},
|
|
3728
|
-
{
|
|
3729
|
-
"name": "activationType",
|
|
3730
|
-
"type": "u8"
|
|
3731
|
-
}
|
|
3732
|
-
]
|
|
3733
|
-
}
|
|
3734
|
-
},
|
|
3735
|
-
{
|
|
3736
|
-
"name": "InitPresetParametersIx",
|
|
3737
|
-
"type": {
|
|
3738
|
-
"kind": "struct",
|
|
3739
|
-
"fields": [
|
|
3740
3801
|
{
|
|
3741
3802
|
"name": "binStep",
|
|
3742
3803
|
"docs": [
|
|
3743
|
-
"Bin step
|
|
3804
|
+
"Bin step"
|
|
3744
3805
|
],
|
|
3745
3806
|
"type": "u16"
|
|
3746
3807
|
},
|
|
3747
3808
|
{
|
|
3748
3809
|
"name": "baseFactor",
|
|
3749
3810
|
"docs": [
|
|
3750
|
-
"
|
|
3751
|
-
],
|
|
3752
|
-
"type": "u16"
|
|
3753
|
-
},
|
|
3754
|
-
{
|
|
3755
|
-
"name": "filterPeriod",
|
|
3756
|
-
"docs": [
|
|
3757
|
-
"Filter period determine high frequency trading time window."
|
|
3758
|
-
],
|
|
3759
|
-
"type": "u16"
|
|
3760
|
-
},
|
|
3761
|
-
{
|
|
3762
|
-
"name": "decayPeriod",
|
|
3763
|
-
"docs": [
|
|
3764
|
-
"Decay period determine when the volatile fee start decay / decrease."
|
|
3765
|
-
],
|
|
3766
|
-
"type": "u16"
|
|
3767
|
-
},
|
|
3768
|
-
{
|
|
3769
|
-
"name": "reductionFactor",
|
|
3770
|
-
"docs": [
|
|
3771
|
-
"Reduction factor controls the volatile fee rate decrement rate."
|
|
3811
|
+
"Base factor"
|
|
3772
3812
|
],
|
|
3773
3813
|
"type": "u16"
|
|
3774
3814
|
},
|
|
3775
3815
|
{
|
|
3776
|
-
"name": "
|
|
3777
|
-
"docs": [
|
|
3778
|
-
"Used to scale the variable fee component depending on the dynamic of the market"
|
|
3779
|
-
],
|
|
3780
|
-
"type": "u32"
|
|
3781
|
-
},
|
|
3782
|
-
{
|
|
3783
|
-
"name": "maxVolatilityAccumulator",
|
|
3816
|
+
"name": "activationType",
|
|
3784
3817
|
"docs": [
|
|
3785
|
-
"
|
|
3818
|
+
"Activation type. 0 = Slot, 1 = Time. Check ActivationType enum"
|
|
3786
3819
|
],
|
|
3787
|
-
"type": "
|
|
3820
|
+
"type": "u8"
|
|
3788
3821
|
},
|
|
3789
3822
|
{
|
|
3790
|
-
"name": "
|
|
3823
|
+
"name": "hasAlphaVault",
|
|
3791
3824
|
"docs": [
|
|
3792
|
-
"
|
|
3825
|
+
"Whether the pool has an alpha vault"
|
|
3793
3826
|
],
|
|
3794
|
-
"type": "
|
|
3827
|
+
"type": "bool"
|
|
3795
3828
|
},
|
|
3796
3829
|
{
|
|
3797
|
-
"name": "
|
|
3830
|
+
"name": "activationPoint",
|
|
3798
3831
|
"docs": [
|
|
3799
|
-
"
|
|
3832
|
+
"Decide when does the pool start trade. None = Now"
|
|
3800
3833
|
],
|
|
3801
|
-
"type":
|
|
3834
|
+
"type": {
|
|
3835
|
+
"option": "u64"
|
|
3836
|
+
}
|
|
3802
3837
|
},
|
|
3803
3838
|
{
|
|
3804
|
-
"name": "
|
|
3839
|
+
"name": "padding",
|
|
3805
3840
|
"docs": [
|
|
3806
|
-
"
|
|
3841
|
+
"Padding, for future use"
|
|
3807
3842
|
],
|
|
3808
|
-
"type":
|
|
3843
|
+
"type": {
|
|
3844
|
+
"array": [
|
|
3845
|
+
"u8",
|
|
3846
|
+
64
|
|
3847
|
+
]
|
|
3848
|
+
}
|
|
3809
3849
|
}
|
|
3810
3850
|
]
|
|
3811
3851
|
}
|
|
3812
3852
|
},
|
|
3813
3853
|
{
|
|
3814
|
-
"name": "
|
|
3854
|
+
"name": "InitPermissionPairIx",
|
|
3815
3855
|
"type": {
|
|
3816
3856
|
"kind": "struct",
|
|
3817
3857
|
"fields": [
|
|
3818
3858
|
{
|
|
3819
|
-
"name": "
|
|
3820
|
-
"
|
|
3821
|
-
|
|
3822
|
-
|
|
3859
|
+
"name": "activeId",
|
|
3860
|
+
"type": "i32"
|
|
3861
|
+
},
|
|
3862
|
+
{
|
|
3863
|
+
"name": "binStep",
|
|
3823
3864
|
"type": "u16"
|
|
3824
3865
|
},
|
|
3825
3866
|
{
|
|
3826
3867
|
"name": "baseFactor",
|
|
3827
|
-
"docs": [
|
|
3828
|
-
"Base factor for base fee rate"
|
|
3829
|
-
],
|
|
3830
3868
|
"type": "u16"
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
"name": "minBinId",
|
|
3872
|
+
"type": "i32"
|
|
3873
|
+
},
|
|
3874
|
+
{
|
|
3875
|
+
"name": "maxBinId",
|
|
3876
|
+
"type": "i32"
|
|
3877
|
+
},
|
|
3878
|
+
{
|
|
3879
|
+
"name": "activationType",
|
|
3880
|
+
"type": "u8"
|
|
3831
3881
|
}
|
|
3832
3882
|
]
|
|
3833
3883
|
}
|
|
@@ -4286,35 +4336,35 @@ var IDL = {
|
|
|
4286
4336
|
}
|
|
4287
4337
|
},
|
|
4288
4338
|
{
|
|
4289
|
-
"name": "
|
|
4339
|
+
"name": "ActivationType",
|
|
4290
4340
|
"docs": [
|
|
4291
|
-
"
|
|
4341
|
+
"Type of the activation"
|
|
4292
4342
|
],
|
|
4293
4343
|
"type": {
|
|
4294
4344
|
"kind": "enum",
|
|
4295
4345
|
"variants": [
|
|
4296
4346
|
{
|
|
4297
|
-
"name": "
|
|
4347
|
+
"name": "Slot"
|
|
4298
4348
|
},
|
|
4299
4349
|
{
|
|
4300
|
-
"name": "
|
|
4350
|
+
"name": "Timestamp"
|
|
4301
4351
|
}
|
|
4302
4352
|
]
|
|
4303
4353
|
}
|
|
4304
4354
|
},
|
|
4305
4355
|
{
|
|
4306
|
-
"name": "
|
|
4356
|
+
"name": "LayoutVersion",
|
|
4307
4357
|
"docs": [
|
|
4308
|
-
"
|
|
4358
|
+
"Layout version"
|
|
4309
4359
|
],
|
|
4310
4360
|
"type": {
|
|
4311
4361
|
"kind": "enum",
|
|
4312
4362
|
"variants": [
|
|
4313
4363
|
{
|
|
4314
|
-
"name": "
|
|
4364
|
+
"name": "V0"
|
|
4315
4365
|
},
|
|
4316
4366
|
{
|
|
4317
|
-
"name": "
|
|
4367
|
+
"name": "V1"
|
|
4318
4368
|
}
|
|
4319
4369
|
]
|
|
4320
4370
|
}
|
|
@@ -4322,7 +4372,7 @@ var IDL = {
|
|
|
4322
4372
|
{
|
|
4323
4373
|
"name": "PairType",
|
|
4324
4374
|
"docs": [
|
|
4325
|
-
"Type of the Pair. 0 = Permissionless, 1 = Permission. Putting 0 as permissionless for backward compatibility."
|
|
4375
|
+
"Type of the Pair. 0 = Permissionless, 1 = Permission, 2 = CustomizablePermissionless. Putting 0 as permissionless for backward compatibility."
|
|
4326
4376
|
],
|
|
4327
4377
|
"type": {
|
|
4328
4378
|
"kind": "enum",
|
|
@@ -4332,6 +4382,9 @@ var IDL = {
|
|
|
4332
4382
|
},
|
|
4333
4383
|
{
|
|
4334
4384
|
"name": "Permission"
|
|
4385
|
+
},
|
|
4386
|
+
{
|
|
4387
|
+
"name": "CustomizablePermissionless"
|
|
4335
4388
|
}
|
|
4336
4389
|
]
|
|
4337
4390
|
}
|
|
@@ -5166,6 +5219,41 @@ var IDL = {
|
|
|
5166
5219
|
"code": 6058,
|
|
5167
5220
|
"name": "InvalidActivationType",
|
|
5168
5221
|
"msg": "Invalid activation type"
|
|
5222
|
+
},
|
|
5223
|
+
{
|
|
5224
|
+
"code": 6059,
|
|
5225
|
+
"name": "InvalidActivationDuration",
|
|
5226
|
+
"msg": "Invalid activation duration"
|
|
5227
|
+
},
|
|
5228
|
+
{
|
|
5229
|
+
"code": 6060,
|
|
5230
|
+
"name": "MissingTokenAmountAsTokenLaunchProof",
|
|
5231
|
+
"msg": "Missing token amount as token launch owner proof"
|
|
5232
|
+
},
|
|
5233
|
+
{
|
|
5234
|
+
"code": 6061,
|
|
5235
|
+
"name": "InvalidQuoteToken",
|
|
5236
|
+
"msg": "Quote token must be SOL or USDC"
|
|
5237
|
+
},
|
|
5238
|
+
{
|
|
5239
|
+
"code": 6062,
|
|
5240
|
+
"name": "InvalidBinStep",
|
|
5241
|
+
"msg": "Invalid bin step"
|
|
5242
|
+
},
|
|
5243
|
+
{
|
|
5244
|
+
"code": 6063,
|
|
5245
|
+
"name": "InvalidBaseFee",
|
|
5246
|
+
"msg": "Invalid base fee"
|
|
5247
|
+
},
|
|
5248
|
+
{
|
|
5249
|
+
"code": 6064,
|
|
5250
|
+
"name": "InvalidPreActivationDuration",
|
|
5251
|
+
"msg": "Invalid pre-activation duration"
|
|
5252
|
+
},
|
|
5253
|
+
{
|
|
5254
|
+
"code": 6065,
|
|
5255
|
+
"name": "AlreadyPassPreActivationSwapPoint",
|
|
5256
|
+
"msg": "Already pass pre-activation swap point"
|
|
5169
5257
|
}
|
|
5170
5258
|
]
|
|
5171
5259
|
};
|
|
@@ -5217,6 +5305,9 @@ var MAX_CLAIM_ALL_ALLOWED = 3;
|
|
|
5217
5305
|
var MAX_BIN_LENGTH_ALLOWED_IN_ONE_TX = 26;
|
|
5218
5306
|
var MAX_BIN_PER_TX = 69;
|
|
5219
5307
|
var MAX_ACTIVE_BIN_SLIPPAGE = 3;
|
|
5308
|
+
var ILM_BASE = new (0, _web3js.PublicKey)(
|
|
5309
|
+
"MFGQxwAmB91SwuYX36okv2Qmdc9aMuHTwWGUrp4AtB1"
|
|
5310
|
+
);
|
|
5220
5311
|
|
|
5221
5312
|
// src/dlmm/types/index.ts
|
|
5222
5313
|
var _borsh = require('@coral-xyz/borsh');
|
|
@@ -6301,6 +6392,13 @@ function deriveLbPair(tokenX, tokenY, binStep, programId) {
|
|
|
6301
6392
|
programId
|
|
6302
6393
|
);
|
|
6303
6394
|
}
|
|
6395
|
+
function deriveCustomizablePermissionlessLbPair(tokenX, tokenY, programId) {
|
|
6396
|
+
const [minKey, maxKey] = sortTokenMints(tokenX, tokenY);
|
|
6397
|
+
return _web3js.PublicKey.findProgramAddressSync(
|
|
6398
|
+
[ILM_BASE.toBuffer(), minKey.toBuffer(), maxKey.toBuffer()],
|
|
6399
|
+
programId
|
|
6400
|
+
);
|
|
6401
|
+
}
|
|
6304
6402
|
function derivePermissionLbPair(baseKey, tokenX, tokenY, binStep, programId) {
|
|
6305
6403
|
const [minKey, maxKey] = sortTokenMints(tokenX, tokenY);
|
|
6306
6404
|
return _web3js.PublicKey.findProgramAddressSync(
|
|
@@ -8280,7 +8378,7 @@ var DLMM = class {
|
|
|
8280
8378
|
return (min ? binId.floor() : binId.ceil()).toNumber();
|
|
8281
8379
|
}
|
|
8282
8380
|
/** Public methods */
|
|
8283
|
-
static async createPermissionLbPair(connection, binStep, tokenX, tokenY, activeId, baseKey, creatorKey, feeBps,
|
|
8381
|
+
static async createPermissionLbPair(connection, binStep, tokenX, tokenY, activeId, baseKey, creatorKey, feeBps, activationType, opt) {
|
|
8284
8382
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
8285
8383
|
connection,
|
|
8286
8384
|
{},
|
|
@@ -8312,7 +8410,6 @@ var DLMM = class {
|
|
|
8312
8410
|
baseFactor: computeBaseFactorFromFeeBps(binStep, feeBps).toNumber(),
|
|
8313
8411
|
minBinId: minBinId.toNumber(),
|
|
8314
8412
|
maxBinId: maxBinId.toNumber(),
|
|
8315
|
-
lockDuration,
|
|
8316
8413
|
activationType
|
|
8317
8414
|
};
|
|
8318
8415
|
return program.methods.initializePermissionLbPair(ixData).accounts({
|
|
@@ -8330,7 +8427,7 @@ var DLMM = class {
|
|
|
8330
8427
|
base: baseKey
|
|
8331
8428
|
}).transaction();
|
|
8332
8429
|
}
|
|
8333
|
-
static async
|
|
8430
|
+
static async createCustomizablePermissionlessLbPair(connection, binStep, tokenX, tokenY, activeId, feeBps, activationType, hasAlphaVault, creatorKey, activationPoint, opt) {
|
|
8334
8431
|
const provider = new (0, _anchor.AnchorProvider)(
|
|
8335
8432
|
connection,
|
|
8336
8433
|
{},
|
|
@@ -8341,6 +8438,54 @@ var DLMM = class {
|
|
|
8341
8438
|
_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _68 => _68.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
|
|
8342
8439
|
provider
|
|
8343
8440
|
);
|
|
8441
|
+
const [lbPair] = deriveCustomizablePermissionlessLbPair(
|
|
8442
|
+
tokenX,
|
|
8443
|
+
tokenY,
|
|
8444
|
+
program.programId
|
|
8445
|
+
);
|
|
8446
|
+
const [reserveX] = deriveReserve(tokenX, lbPair, program.programId);
|
|
8447
|
+
const [reserveY] = deriveReserve(tokenY, lbPair, program.programId);
|
|
8448
|
+
const [oracle] = deriveOracle(lbPair, program.programId);
|
|
8449
|
+
const activeBinArrayIndex = binIdToBinArrayIndex(activeId);
|
|
8450
|
+
const binArrayBitmapExtension = isOverflowDefaultBinArrayBitmap(
|
|
8451
|
+
activeBinArrayIndex
|
|
8452
|
+
) ? deriveBinArrayBitmapExtension(lbPair, program.programId)[0] : null;
|
|
8453
|
+
const ixData = {
|
|
8454
|
+
activeId: activeId.toNumber(),
|
|
8455
|
+
binStep: binStep.toNumber(),
|
|
8456
|
+
baseFactor: computeBaseFactorFromFeeBps(binStep, feeBps).toNumber(),
|
|
8457
|
+
activationType,
|
|
8458
|
+
activationPoint: activationPoint ? activationPoint : null,
|
|
8459
|
+
hasAlphaVault,
|
|
8460
|
+
padding: Array(64).fill(0)
|
|
8461
|
+
};
|
|
8462
|
+
const userTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0, tokenX, creatorKey);
|
|
8463
|
+
return program.methods.initializeCustomizablePermissionlessLbPair(ixData).accounts({
|
|
8464
|
+
lbPair,
|
|
8465
|
+
rent: _web3js.SYSVAR_RENT_PUBKEY,
|
|
8466
|
+
reserveX,
|
|
8467
|
+
reserveY,
|
|
8468
|
+
binArrayBitmapExtension,
|
|
8469
|
+
tokenMintX: tokenX,
|
|
8470
|
+
tokenMintY: tokenY,
|
|
8471
|
+
tokenProgram: _spltoken.TOKEN_PROGRAM_ID,
|
|
8472
|
+
oracle,
|
|
8473
|
+
systemProgram: _web3js.SystemProgram.programId,
|
|
8474
|
+
userTokenX,
|
|
8475
|
+
funder: creatorKey
|
|
8476
|
+
}).transaction();
|
|
8477
|
+
}
|
|
8478
|
+
static async createLbPair(connection, funder, tokenX, tokenY, binStep, baseFactor, presetParameter, activeId, opt) {
|
|
8479
|
+
const provider = new (0, _anchor.AnchorProvider)(
|
|
8480
|
+
connection,
|
|
8481
|
+
{},
|
|
8482
|
+
_anchor.AnchorProvider.defaultOptions()
|
|
8483
|
+
);
|
|
8484
|
+
const program = new (0, _anchor.Program)(
|
|
8485
|
+
IDL,
|
|
8486
|
+
_nullishCoalesce(_optionalChain([opt, 'optionalAccess', _69 => _69.programId]), () => ( LBCLMM_PROGRAM_IDS[opt.cluster])),
|
|
8487
|
+
provider
|
|
8488
|
+
);
|
|
8344
8489
|
const existsPool = await this.getPairPubkeyIfExists(
|
|
8345
8490
|
connection,
|
|
8346
8491
|
tokenX,
|
|
@@ -8474,7 +8619,7 @@ var DLMM = class {
|
|
|
8474
8619
|
swapForY,
|
|
8475
8620
|
new (0, _anchor.BN)(activeIdToLoop),
|
|
8476
8621
|
this.lbPair,
|
|
8477
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
8622
|
+
_nullishCoalesce(_optionalChain([this, 'access', _70 => _70.binArrayBitmapExtension, 'optionalAccess', _71 => _71.account]), () => ( null))
|
|
8478
8623
|
);
|
|
8479
8624
|
if (binArrayIndex === null)
|
|
8480
8625
|
shouldStop = true;
|
|
@@ -9338,8 +9483,12 @@ var DLMM = class {
|
|
|
9338
9483
|
const useExtension = isOverflowDefaultBinArrayBitmap(minBinArrayIndex) || isOverflowDefaultBinArrayBitmap(maxBinArrayIndex);
|
|
9339
9484
|
const binArrayBitmapExtension = useExtension ? deriveBinArrayBitmapExtension(this.pubkey, this.program.programId)[0] : null;
|
|
9340
9485
|
const strategyParameters = toStrategyParameters(strategy);
|
|
9341
|
-
const positionAccount = await this.program.account.positionV2.fetch(
|
|
9342
|
-
|
|
9486
|
+
const positionAccount = await this.program.account.positionV2.fetch(
|
|
9487
|
+
positionPubKey
|
|
9488
|
+
);
|
|
9489
|
+
const lowerBinArrayIndex = binIdToBinArrayIndex(
|
|
9490
|
+
new (0, _anchor.BN)(positionAccount.lowerBinId)
|
|
9491
|
+
);
|
|
9343
9492
|
const upperBinArrayIndex = lowerBinArrayIndex.add(new (0, _anchor.BN)(1));
|
|
9344
9493
|
const [binArrayLower] = deriveBinArray(
|
|
9345
9494
|
this.pubkey,
|
|
@@ -9891,7 +10040,7 @@ var DLMM = class {
|
|
|
9891
10040
|
swapForY,
|
|
9892
10041
|
activeId,
|
|
9893
10042
|
this.lbPair,
|
|
9894
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
10043
|
+
_nullishCoalesce(_optionalChain([this, 'access', _72 => _72.binArrayBitmapExtension, 'optionalAccess', _73 => _73.account]), () => ( null)),
|
|
9895
10044
|
binArrays
|
|
9896
10045
|
);
|
|
9897
10046
|
if (binArrayAccountToSwap == null) {
|
|
@@ -9995,7 +10144,7 @@ var DLMM = class {
|
|
|
9995
10144
|
swapForY,
|
|
9996
10145
|
activeId,
|
|
9997
10146
|
this.lbPair,
|
|
9998
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
10147
|
+
_nullishCoalesce(_optionalChain([this, 'access', _74 => _74.binArrayBitmapExtension, 'optionalAccess', _75 => _75.account]), () => ( null)),
|
|
9999
10148
|
binArrays
|
|
10000
10149
|
);
|
|
10001
10150
|
if (binArrayAccountToSwap == null) {
|
|
@@ -10396,27 +10545,6 @@ var DLMM = class {
|
|
|
10396
10545
|
lastValidBlockHeight
|
|
10397
10546
|
}).add(setActivationPointTx);
|
|
10398
10547
|
}
|
|
10399
|
-
/**
|
|
10400
|
-
* The function `updateWhitelistedWallet` is used to whitelist a wallet, enabling it to deposit into a permissioned pool before the activation point.
|
|
10401
|
-
* @param
|
|
10402
|
-
* - `walletsToWhitelist`: The public key of the wallet.
|
|
10403
|
-
* - `overrideIndexes`: Index of the whitelisted wallet to be inserted. Check DLMM.lbPair.whitelistedWallet for the index
|
|
10404
|
-
* @returns {Promise<Transaction>}
|
|
10405
|
-
*/
|
|
10406
|
-
async updateWhitelistedWallet(walletsToWhitelist) {
|
|
10407
|
-
const instructions = [];
|
|
10408
|
-
const updateWhitelistedWalletIx = await this.program.methods.updateWhitelistedWallet(walletsToWhitelist).accounts({
|
|
10409
|
-
lbPair: this.pubkey,
|
|
10410
|
-
creator: this.lbPair.creator
|
|
10411
|
-
}).instruction();
|
|
10412
|
-
instructions.push(updateWhitelistedWalletIx);
|
|
10413
|
-
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
10414
|
-
return new (0, _web3js.Transaction)({
|
|
10415
|
-
feePayer: this.lbPair.creator,
|
|
10416
|
-
blockhash,
|
|
10417
|
-
lastValidBlockHeight
|
|
10418
|
-
}).add(...instructions);
|
|
10419
|
-
}
|
|
10420
10548
|
/**
|
|
10421
10549
|
* The function `claimSwapFee` is used to claim swap fees for a specific position owned by a specific owner.
|
|
10422
10550
|
* @param
|
|
@@ -10552,15 +10680,13 @@ var DLMM = class {
|
|
|
10552
10680
|
* The `seedLiquidity` function create multiple grouped instructions. The grouped instructions will be either [initialize bin array + initialize position instructions] or [deposit instruction] combination.
|
|
10553
10681
|
* @param
|
|
10554
10682
|
* - `owner`: The public key of the positions owner.
|
|
10555
|
-
* - `operator`: The public key of the operator. Operator can add liquidity for the position owner, withdraw on behalf of position owner (only can withdraw to position owner), and claim fee on behalf of position owner / fee owner (only can claim fee to position / fee owner)
|
|
10556
|
-
* - `feeOwner`: The public key to receive claimed fee.
|
|
10557
10683
|
* - `seedAmount`: Lamport amount to be seeded to the pool.
|
|
10558
10684
|
* - `minPrice`: Start price in UI format
|
|
10559
10685
|
* - `maxPrice`: End price in UI format
|
|
10560
10686
|
* - `base`: Base key
|
|
10561
10687
|
* @returns {Promise<SeedLiquidityResponse>}
|
|
10562
10688
|
*/
|
|
10563
|
-
async seedLiquidity(owner,
|
|
10689
|
+
async seedLiquidity(owner, seedAmount, curvature, minPrice, maxPrice, base) {
|
|
10564
10690
|
const toLamportMultiplier = new (0, _decimaljs2.default)(
|
|
10565
10691
|
10 ** (this.tokenY.decimal - this.tokenX.decimal)
|
|
10566
10692
|
);
|
|
@@ -10606,7 +10732,7 @@ var DLMM = class {
|
|
|
10606
10732
|
const positionCount = getPositionCount(minBinId, maxBinId.sub(new (0, _anchor.BN)(1)));
|
|
10607
10733
|
const seederTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
10608
10734
|
this.lbPair.tokenXMint,
|
|
10609
|
-
|
|
10735
|
+
owner,
|
|
10610
10736
|
false
|
|
10611
10737
|
);
|
|
10612
10738
|
const initializeBinArraysAndPositionIxs = [];
|
|
@@ -10646,7 +10772,7 @@ var DLMM = class {
|
|
|
10646
10772
|
await this.program.methods.initializeBinArray(lowerBinArrayIndex).accounts({
|
|
10647
10773
|
lbPair: this.pubkey,
|
|
10648
10774
|
binArray: lowerBinArray,
|
|
10649
|
-
funder:
|
|
10775
|
+
funder: owner
|
|
10650
10776
|
}).instruction()
|
|
10651
10777
|
);
|
|
10652
10778
|
appendedInitBinArrayIx.add(lowerBinArray.toBase58());
|
|
@@ -10657,7 +10783,7 @@ var DLMM = class {
|
|
|
10657
10783
|
await this.program.methods.initializeBinArray(upperBinArrayIndex).accounts({
|
|
10658
10784
|
lbPair: this.pubkey,
|
|
10659
10785
|
binArray: upperBinArray,
|
|
10660
|
-
funder:
|
|
10786
|
+
funder: owner
|
|
10661
10787
|
}).instruction()
|
|
10662
10788
|
);
|
|
10663
10789
|
appendedInitBinArrayIx.add(upperBinArray.toBase58());
|
|
@@ -10665,17 +10791,15 @@ var DLMM = class {
|
|
|
10665
10791
|
const positionAccount = accounts[2];
|
|
10666
10792
|
if (!positionAccount) {
|
|
10667
10793
|
instructions.push(
|
|
10668
|
-
await this.program.methods.
|
|
10794
|
+
await this.program.methods.initializePositionPda(
|
|
10669
10795
|
lowerBinId.toNumber(),
|
|
10670
|
-
MAX_BIN_PER_POSITION.toNumber()
|
|
10671
|
-
owner,
|
|
10672
|
-
feeOwner
|
|
10796
|
+
MAX_BIN_PER_POSITION.toNumber()
|
|
10673
10797
|
).accounts({
|
|
10674
10798
|
lbPair: this.pubkey,
|
|
10675
10799
|
position: positionPda,
|
|
10676
10800
|
base,
|
|
10677
|
-
|
|
10678
|
-
payer:
|
|
10801
|
+
owner,
|
|
10802
|
+
payer: owner
|
|
10679
10803
|
}).instruction()
|
|
10680
10804
|
);
|
|
10681
10805
|
}
|
|
@@ -10709,7 +10833,7 @@ var DLMM = class {
|
|
|
10709
10833
|
tokenMint: this.lbPair.tokenXMint,
|
|
10710
10834
|
binArrayLower: lowerBinArray,
|
|
10711
10835
|
binArrayUpper: upperBinArray,
|
|
10712
|
-
sender:
|
|
10836
|
+
sender: owner
|
|
10713
10837
|
}).instruction()
|
|
10714
10838
|
);
|
|
10715
10839
|
if (i + 1 >= positionCount.toNumber() && !finalLoss.isZero()) {
|
|
@@ -10733,7 +10857,7 @@ var DLMM = class {
|
|
|
10733
10857
|
tokenMint: this.lbPair.tokenXMint,
|
|
10734
10858
|
binArrayLower: lowerBinArray,
|
|
10735
10859
|
binArrayUpper: upperBinArray,
|
|
10736
|
-
sender:
|
|
10860
|
+
sender: owner
|
|
10737
10861
|
}).instruction()
|
|
10738
10862
|
);
|
|
10739
10863
|
}
|
|
@@ -10783,6 +10907,7 @@ var DLMM = class {
|
|
|
10783
10907
|
* - `base`: Base key
|
|
10784
10908
|
* - `feeOwner`: Owner of the fees earned by the position.
|
|
10785
10909
|
* - `payer`: Payer for the position account rental.
|
|
10910
|
+
* - `lockReleasePoint`: The lock release point of the position.
|
|
10786
10911
|
* @returns
|
|
10787
10912
|
*/
|
|
10788
10913
|
async initializePositionByOperator({
|
|
@@ -10792,7 +10917,8 @@ var DLMM = class {
|
|
|
10792
10917
|
feeOwner,
|
|
10793
10918
|
base,
|
|
10794
10919
|
operator,
|
|
10795
|
-
payer
|
|
10920
|
+
payer,
|
|
10921
|
+
lockReleasePoint
|
|
10796
10922
|
}) {
|
|
10797
10923
|
const [positionPda, _bump] = derivePosition(
|
|
10798
10924
|
this.pubkey,
|
|
@@ -10801,16 +10927,29 @@ var DLMM = class {
|
|
|
10801
10927
|
positionWidth,
|
|
10802
10928
|
this.program.programId
|
|
10803
10929
|
);
|
|
10930
|
+
const operatorTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
10931
|
+
this.lbPair.tokenXMint,
|
|
10932
|
+
operator,
|
|
10933
|
+
true
|
|
10934
|
+
);
|
|
10935
|
+
const ownerTokenX = _spltoken.getAssociatedTokenAddressSync.call(void 0,
|
|
10936
|
+
this.lbPair.tokenXMint,
|
|
10937
|
+
owner,
|
|
10938
|
+
true
|
|
10939
|
+
);
|
|
10804
10940
|
let initializePositionByOperatorTx = await this.program.methods.initializePositionByOperator(
|
|
10805
10941
|
lowerBinId.toNumber(),
|
|
10806
10942
|
MAX_BIN_PER_POSITION.toNumber(),
|
|
10807
|
-
|
|
10808
|
-
|
|
10943
|
+
feeOwner,
|
|
10944
|
+
lockReleasePoint
|
|
10809
10945
|
).accounts({
|
|
10810
10946
|
lbPair: this.pubkey,
|
|
10811
10947
|
position: positionPda,
|
|
10812
10948
|
base,
|
|
10813
10949
|
operator,
|
|
10950
|
+
owner,
|
|
10951
|
+
ownerTokenX,
|
|
10952
|
+
operatorTokenX,
|
|
10814
10953
|
payer
|
|
10815
10954
|
}).transaction();
|
|
10816
10955
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -10939,7 +11078,7 @@ var DLMM = class {
|
|
|
10939
11078
|
swapForY,
|
|
10940
11079
|
new (0, _anchor.BN)(activeBinId),
|
|
10941
11080
|
this.lbPair,
|
|
10942
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
11081
|
+
_nullishCoalesce(_optionalChain([this, 'access', _76 => _76.binArrayBitmapExtension, 'optionalAccess', _77 => _77.account]), () => ( null))
|
|
10943
11082
|
);
|
|
10944
11083
|
if (toBinArrayIndex === null)
|
|
10945
11084
|
return true;
|
|
@@ -10976,7 +11115,7 @@ var DLMM = class {
|
|
|
10976
11115
|
swapForY,
|
|
10977
11116
|
new (0, _anchor.BN)(activeBinId),
|
|
10978
11117
|
this.lbPair,
|
|
10979
|
-
_nullishCoalesce(_optionalChain([this, 'access',
|
|
11118
|
+
_nullishCoalesce(_optionalChain([this, 'access', _78 => _78.binArrayBitmapExtension, 'optionalAccess', _79 => _79.account]), () => ( null))
|
|
10980
11119
|
);
|
|
10981
11120
|
const accountsToFetch = [];
|
|
10982
11121
|
const [binArrayBitMapExtensionPubkey] = deriveBinArrayBitmapExtension(
|
|
@@ -11007,13 +11146,13 @@ var DLMM = class {
|
|
|
11007
11146
|
let fromBinArray = null;
|
|
11008
11147
|
let toBinArray = null;
|
|
11009
11148
|
let binArrayBitmapExtension = null;
|
|
11010
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
11149
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _80 => _80[0]])) {
|
|
11011
11150
|
binArrayBitmapExtension = binArrayBitMapExtensionPubkey;
|
|
11012
11151
|
}
|
|
11013
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
11152
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _81 => _81[1]])) {
|
|
11014
11153
|
fromBinArray = fromBinArrayPubkey;
|
|
11015
11154
|
}
|
|
11016
|
-
if (!!_optionalChain([binArrayAccounts, 'optionalAccess',
|
|
11155
|
+
if (!!_optionalChain([binArrayAccounts, 'optionalAccess', _82 => _82[2]]) && !!toBinArrayIndex) {
|
|
11017
11156
|
toBinArray = toBinArrayPubkey;
|
|
11018
11157
|
}
|
|
11019
11158
|
const { blockhash, lastValidBlockHeight } = await this.program.provider.connection.getLatestBlockhash("confirmed");
|
|
@@ -11849,5 +11988,7 @@ var src_default = DLMM;
|
|
|
11849
11988
|
|
|
11850
11989
|
|
|
11851
11990
|
|
|
11852
|
-
|
|
11991
|
+
|
|
11992
|
+
|
|
11993
|
+
exports.ADMIN = ADMIN; exports.ActivationType = ActivationType; exports.BASIS_POINT_MAX = BASIS_POINT_MAX; exports.BIN_ARRAY_BITMAP_SIZE = BIN_ARRAY_BITMAP_SIZE; exports.BIN_ARRAY_FEE = BIN_ARRAY_FEE; exports.BitmapType = BitmapType; exports.ClockLayout = ClockLayout; exports.DLMMError = DLMMError; exports.DlmmSdkError = DlmmSdkError; exports.EXTENSION_BINARRAY_BITMAP_SIZE = EXTENSION_BINARRAY_BITMAP_SIZE; exports.FEE_PRECISION = FEE_PRECISION; exports.IDL = IDL; exports.ILM_BASE = ILM_BASE; exports.LBCLMM_PROGRAM_IDS = LBCLMM_PROGRAM_IDS; exports.MAX_ACTIVE_BIN_SLIPPAGE = MAX_ACTIVE_BIN_SLIPPAGE; 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_BIN_PER_POSITION = MAX_BIN_PER_POSITION; exports.MAX_BIN_PER_TX = MAX_BIN_PER_TX; exports.MAX_CLAIM_ALL_ALLOWED = MAX_CLAIM_ALL_ALLOWED; exports.MAX_FEE_RATE = MAX_FEE_RATE; exports.Network = Network; exports.POSITION_FEE = POSITION_FEE; exports.PRECISION = PRECISION; exports.PairStatus = PairStatus; exports.PairType = PairType; exports.PositionVersion = PositionVersion; exports.SCALE = SCALE; exports.SCALE_OFFSET = SCALE_OFFSET; exports.SIMULATION_USER = SIMULATION_USER; exports.Strategy = Strategy; exports.StrategyType = StrategyType; exports.autoFillXByStrategy = autoFillXByStrategy; exports.autoFillXByWeight = autoFillXByWeight; exports.autoFillYByStrategy = autoFillYByStrategy; exports.autoFillYByWeight = autoFillYByWeight; exports.binIdToBinArrayIndex = binIdToBinArrayIndex; exports.calculateBidAskDistribution = calculateBidAskDistribution; exports.calculateNormalDistribution = calculateNormalDistribution; exports.calculateSpotDistribution = calculateSpotDistribution; exports.chunkedFetchMultipleBinArrayBitmapExtensionAccount = chunkedFetchMultipleBinArrayBitmapExtensionAccount; exports.chunkedFetchMultiplePoolAccount = chunkedFetchMultiplePoolAccount; exports.chunkedGetMultipleAccountInfos = chunkedGetMultipleAccountInfos; exports.chunks = chunks; exports.computeBudgetIx = computeBudgetIx; exports.computeFee = computeFee; exports.computeFeeFromAmount = computeFeeFromAmount; exports.computeProtocolFee = computeProtocolFee; exports.default = src_default; exports.deriveBinArray = deriveBinArray; exports.deriveBinArrayBitmapExtension = deriveBinArrayBitmapExtension; exports.deriveCustomizablePermissionlessLbPair = deriveCustomizablePermissionlessLbPair; exports.deriveLbPair = deriveLbPair; exports.deriveLbPair2 = deriveLbPair2; exports.deriveOracle = deriveOracle; exports.derivePermissionLbPair = derivePermissionLbPair; exports.derivePosition = derivePosition; exports.derivePresetParameter = derivePresetParameter; exports.derivePresetParameter2 = derivePresetParameter2; exports.deriveReserve = deriveReserve; exports.findNextBinArrayIndexWithLiquidity = findNextBinArrayIndexWithLiquidity; exports.findNextBinArrayWithLiquidity = findNextBinArrayWithLiquidity; exports.fromWeightDistributionToAmount = fromWeightDistributionToAmount; exports.fromWeightDistributionToAmountOneSide = fromWeightDistributionToAmountOneSide; exports.getBaseFee = getBaseFee; exports.getBinArrayLowerUpperBinId = getBinArrayLowerUpperBinId; exports.getBinArraysRequiredByPositionRange = getBinArraysRequiredByPositionRange; exports.getBinFromBinArray = getBinFromBinArray; exports.getOrCreateATAInstruction = getOrCreateATAInstruction; exports.getOutAmount = getOutAmount; exports.getPriceOfBinByBinId = getPriceOfBinByBinId; exports.getTokenBalance = getTokenBalance; exports.getTokenDecimals = getTokenDecimals; exports.getTokensMintFromPoolAddress = getTokensMintFromPoolAddress; exports.getTotalFee = getTotalFee; exports.getVariableFee = getVariableFee; exports.isBinIdWithinBinArray = isBinIdWithinBinArray; exports.isOverflowDefaultBinArrayBitmap = isOverflowDefaultBinArrayBitmap; exports.parseLogs = parseLogs; exports.swapExactInQuoteAtBin = swapExactInQuoteAtBin; exports.swapExactOutQuoteAtBin = swapExactOutQuoteAtBin; exports.toAmountAskSide = toAmountAskSide; exports.toAmountBidSide = toAmountBidSide; exports.toAmountBothSide = toAmountBothSide; exports.toAmountsBothSideByStrategy = toAmountsBothSideByStrategy; exports.toAmountsOneSideByStrategy = toAmountsOneSideByStrategy; exports.toStrategyParameters = toStrategyParameters; exports.toWeightDistribution = toWeightDistribution; exports.unwrapSOLInstruction = unwrapSOLInstruction; exports.wrapSOLInstruction = wrapSOLInstruction;
|
|
11853
11994
|
//# sourceMappingURL=index.js.map
|