@hawksightco/hawk-sdk 1.3.98 → 1.3.100
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/src/classes/Transactions.d.ts +1 -0
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +221 -264
- package/dist/src/functions.d.ts +7 -0
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +10 -0
- package/dist/src/idl/iyf-extension-idl.d.ts +41 -77
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +41 -77
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +38 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +110 -0
- package/package.json +1 -1
|
@@ -158,6 +158,7 @@ export declare class Transactions {
|
|
|
158
158
|
limitCloseAutomationIx({ connection, params, }: TxgenParams<MeteoraLimitCloseAutomation>): Promise<TransactionMetadataResponse>;
|
|
159
159
|
limitCloseAutomationIx2({ connection, params, }: TxgenParams<MeteoraLimitCloseAutomation2>): Promise<TransactionMetadataResponse>;
|
|
160
160
|
private removeLiquidityByRangeInfo;
|
|
161
|
+
private removeLiquidityByRange2Info;
|
|
161
162
|
/**
|
|
162
163
|
* Creates orca instruction that opens new position
|
|
163
164
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAoBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,WAAW,EACX,6BAA6B,EAC7B,2BA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CAAC;IA8DxE;;;;;;OAMG;IACG,kBAAkB,CAAC,EACvB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,kBAAkB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA0CnE,oBAAoB,CAAC,EACzB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,eAAe,CAAC;IAuGzB,iBAAiB,CAAC,EACtB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,eAAe,CAAC;IAiGzB,qBAAqB,CAAC,EAC1B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,gBAAgB,CAAC;IAqF1B,sBAAsB,CAAC,EAC3B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAgJ3B,gBAAgB,CAAC,EACrB,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,gBAAgB,CAAC;IA4C1B,iBAAiB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC;IAgInE,sBAAsB,CAAC,EAC3B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAoBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,4BAA4B,EAC5B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAEpB,gBAAgB,EAChB,+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118
1118
|
}
|
|
1119
1119
|
limitCloseAutomationIx(_a) {
|
|
1120
1120
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1121
|
+
try {
|
|
1122
|
+
console.log('=== LIMIT CLOSE AUTOMATION IX START ===');
|
|
1123
|
+
console.log('Params:', JSON.stringify({
|
|
1124
|
+
userWallet: params.userWallet.toString(),
|
|
1125
|
+
position: params.position.toString(),
|
|
1126
|
+
minBinId: params.minBinId,
|
|
1127
|
+
maxBinId: params.maxBinId,
|
|
1128
|
+
pdaTokenType: params.pdaTokenType
|
|
1129
|
+
}, null, 2));
|
|
1130
|
+
console.log('Step 1: Fetching position data...');
|
|
1131
|
+
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
1132
|
+
const position = yield program.account.positionV2.fetch(params.position);
|
|
1133
|
+
console.log('Position data:', {
|
|
1134
|
+
lbPair: position.lbPair.toString(),
|
|
1135
|
+
lowerBinId: position.lowerBinId,
|
|
1136
|
+
upperBinId: position.upperBinId,
|
|
1137
|
+
owner: position.owner.toString()
|
|
1138
|
+
});
|
|
1139
|
+
console.log('Step 2: Creating DLMM pool...');
|
|
1140
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, position.lbPair, this.ix);
|
|
1141
|
+
console.log('DLMM pool created successfully');
|
|
1142
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
1143
|
+
console.log('User PDA generated:', userPda.toString());
|
|
1144
|
+
// Step 1: Claim all fees/rewards, remove all liquidity and close current position
|
|
1145
|
+
// const { userPositions } = await dlmmPool.getPositionsByUserAndLbPair(
|
|
1146
|
+
// userPda
|
|
1147
|
+
// );
|
|
1148
|
+
// const binIdsToRemove = userPositions[0].positionData.positionBinData.map(
|
|
1149
|
+
// (bin) => bin.binId
|
|
1150
|
+
// );
|
|
1151
|
+
const binIdsToRemove = [];
|
|
1152
|
+
for (let i = position.lowerBinId; i <= position.upperBinId; i++) {
|
|
1153
|
+
binIdsToRemove.push(i);
|
|
1154
|
+
}
|
|
1155
|
+
console.log('Bin IDs to remove:', binIdsToRemove);
|
|
1156
|
+
console.log('Step 3: Calling removeLiquidity...');
|
|
1157
|
+
console.log('removeLiquidity params:', {
|
|
1158
|
+
user: userPda.toString(),
|
|
1159
|
+
position: params.position.toString(),
|
|
1160
|
+
fromBinId: position.lowerBinId,
|
|
1161
|
+
toBinId: position.upperBinId,
|
|
1162
|
+
bps: 10000,
|
|
1163
|
+
shouldClaimAndClose: true
|
|
1164
|
+
});
|
|
1165
|
+
// Claim fees and/or rewards, remove liquidity, and possibly close position from Meteora API (if set)
|
|
1166
|
+
const txn = yield dlmmPool.dlmm.removeLiquidity({
|
|
1167
|
+
user: userPda,
|
|
1168
|
+
position: params.position,
|
|
1169
|
+
fromBinId: position.lowerBinId,
|
|
1170
|
+
toBinId: position.upperBinId,
|
|
1171
|
+
bps: new bn_js_1.default(10000),
|
|
1172
|
+
shouldClaimAndClose: true,
|
|
1173
|
+
});
|
|
1174
|
+
console.log('removeLiquidity completed successfully');
|
|
1175
|
+
console.log('Transaction array length:', txn.length);
|
|
1176
|
+
console.log('Total instructions across all transactions:', txn.reduce((total, tx) => total + tx.instructions.length, 0));
|
|
1177
|
+
console.log('Step 4: Filtering Meteora instructions...');
|
|
1178
|
+
// Filter out non-meteora instructions
|
|
1179
|
+
const ixs = (0, functions_1.getIxs)(txn).filter((ix) => ix.programId.equals(addresses_1.METEORA_DLMM_PROGRAM));
|
|
1180
|
+
console.log('Filtered Meteora instructions count:', ixs.length);
|
|
1181
|
+
const farm = addresses_1.USDC_FARM;
|
|
1182
|
+
const authority = params.userWallet;
|
|
1183
|
+
const iyfProgram = addresses_1.IYF_MAIN;
|
|
1184
|
+
const hawksightAuthority = addresses_1.HS_AUTHORITY;
|
|
1185
|
+
const { params: _params, data } = this.removeLiquidityByRange2Info(ixs);
|
|
1186
|
+
let { position: _position, lbPair, binArrayBitmapExtension, reserveX, reserveY, tokenXMint, tokenYMint, sender, tokenXProgram, tokenYProgram, memoProgram, eventAuthority, program: meteoraDlmmProgram, binArrays, } = _params;
|
|
1187
|
+
let ix;
|
|
1188
|
+
if (params.isLimitOrder) {
|
|
1189
|
+
const limitTokenX = (0, functions_1.generateLimitToken)(userPda, tokenXMint.pubkey);
|
|
1190
|
+
const limitTokenY = (0, functions_1.generateLimitToken)(userPda, tokenYMint.pubkey);
|
|
1191
|
+
const authorityTokenX = (0, functions_1.generateAta)(hawksightAuthority, tokenXMint.pubkey);
|
|
1192
|
+
const authorityTokenY = (0, functions_1.generateAta)(hawksightAuthority, tokenYMint.pubkey);
|
|
1193
|
+
// Use MeteoraDlmmIxGenerator for limitOrderCloseV2
|
|
1194
|
+
const limitCloseAutomationIx = yield this.ix.meteoraDlmm.limitOrderCloseV2({
|
|
1195
|
+
connection,
|
|
1196
|
+
userWallet: params.userWallet,
|
|
1197
|
+
position: _position.pubkey,
|
|
1198
|
+
lbPair: lbPair.pubkey,
|
|
1199
|
+
tokenXMint: tokenXMint.pubkey,
|
|
1200
|
+
tokenYMint: tokenYMint.pubkey,
|
|
1201
|
+
reserveX: reserveX.pubkey,
|
|
1202
|
+
reserveY: reserveY.pubkey,
|
|
1203
|
+
tokenXProgram: tokenXProgram.pubkey,
|
|
1204
|
+
tokenYProgram: tokenYProgram.pubkey,
|
|
1205
|
+
useFuelAccount: false, // todo: update this
|
|
1206
|
+
param: data,
|
|
1207
|
+
minBinId: params.minBinId,
|
|
1208
|
+
maxBinId: params.maxBinId,
|
|
1209
|
+
binArrays,
|
|
1210
|
+
});
|
|
1211
|
+
// Instruction via main hawksight contract
|
|
1212
|
+
// @ts-ignore
|
|
1213
|
+
ix = yield anchor_1.Anchor.instance()
|
|
1214
|
+
.iyfMain.methods.iyfExtensionExecuteV2(limitCloseAutomationIx.data)
|
|
1215
|
+
.accounts({
|
|
1216
|
+
userPda,
|
|
1217
|
+
authority,
|
|
1218
|
+
iyfExtensionProgram: addresses_1.IYF_EXTENSION,
|
|
1219
|
+
})
|
|
1220
|
+
.remainingAccounts([...limitCloseAutomationIx.keys.slice(2)])
|
|
1221
|
+
.instruction();
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1224
|
+
// @ts-ignore
|
|
1225
|
+
const limitCloseAutomationIx = yield this.ix.meteoraDlmm.meteoraDlmmLimitCloseAutomationV2({
|
|
1226
|
+
connection,
|
|
1227
|
+
userWallet: params.userWallet,
|
|
1228
|
+
position: _position.pubkey,
|
|
1229
|
+
lbPair: lbPair.pubkey,
|
|
1230
|
+
tokenXMint: tokenXMint.pubkey,
|
|
1231
|
+
tokenYMint: tokenYMint.pubkey,
|
|
1232
|
+
reserveX: reserveX.pubkey,
|
|
1233
|
+
reserveY: reserveY.pubkey,
|
|
1234
|
+
tokenXProgram: tokenXProgram.pubkey,
|
|
1235
|
+
tokenYProgram: tokenYProgram.pubkey,
|
|
1236
|
+
pdaTokenType: params.pdaTokenType,
|
|
1237
|
+
useFuelAccount: false,
|
|
1238
|
+
param: data,
|
|
1239
|
+
minBinId: params.minBinId,
|
|
1240
|
+
maxBinId: params.maxBinId,
|
|
1241
|
+
isHawkRefund: false,
|
|
1242
|
+
binArrays: binArrays,
|
|
1243
|
+
});
|
|
1244
|
+
// Instruction via main hawksight contract using iyfExtensionExecuteV2
|
|
1245
|
+
ix = yield this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
|
|
1246
|
+
userPda,
|
|
1247
|
+
authority: hawksightAuthority,
|
|
1248
|
+
ix: limitCloseAutomationIx,
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
console.log('Step 7: Creating transaction metadata...');
|
|
1252
|
+
const mainInstructions = [
|
|
1253
|
+
// Limit Close Automation Instruction (Hawksight CPI)
|
|
1254
|
+
ix,
|
|
1255
|
+
];
|
|
1256
|
+
console.log('=== LIMIT CLOSE AUTOMATION IX SUCCESS ===');
|
|
1257
|
+
return (0, functions_1.createTransactionMeta)({
|
|
1258
|
+
payer: params.userWallet,
|
|
1259
|
+
description: "Automation IX: Meteora limit close instruction (Full withdraw and close on to specific bin id)",
|
|
1260
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
1261
|
+
mainInstructions,
|
|
1262
|
+
});
|
|
1213
1263
|
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
iyfProgram,
|
|
1223
|
-
hawksightAuthority,
|
|
1224
|
-
position: _position.pubkey,
|
|
1225
|
-
lbPair: lbPair.pubkey,
|
|
1226
|
-
binArrayBitmapExtension: binArrayBitmapExtension.pubkey,
|
|
1227
|
-
userTokenX,
|
|
1228
|
-
userTokenY,
|
|
1229
|
-
reserveX: reserveX.pubkey,
|
|
1230
|
-
reserveY: reserveY.pubkey,
|
|
1231
|
-
tokenXMint: tokenXMint.pubkey,
|
|
1232
|
-
tokenYMint: tokenYMint.pubkey,
|
|
1233
|
-
tokenXProgram: tokenXProgram.pubkey,
|
|
1234
|
-
tokenYProgram: tokenYProgram.pubkey,
|
|
1235
|
-
binArrayLower: binArrayLower.pubkey,
|
|
1236
|
-
binArrayUpper: binArrayUpper.pubkey,
|
|
1237
|
-
eventAuthority: eventAuthority.pubkey,
|
|
1238
|
-
meteoraDlmmProgram: meteoraDlmmProgram.pubkey,
|
|
1239
|
-
ownerFeeX: (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, tokenXMint.pubkey),
|
|
1240
|
-
ownerFeeY: (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, tokenYMint.pubkey),
|
|
1241
|
-
})
|
|
1242
|
-
.instruction();
|
|
1243
|
-
// Instruction via main hawksight contract
|
|
1244
|
-
ix = yield anchor_1.Anchor.instance()
|
|
1245
|
-
.iyfMain.methods.iyfExtensionExecute(limitCloseAutomationIx.data)
|
|
1246
|
-
.accounts({
|
|
1247
|
-
farm,
|
|
1248
|
-
userPda,
|
|
1249
|
-
authority,
|
|
1250
|
-
iyfProgram,
|
|
1251
|
-
iyfExtensionProgram: addresses_1.IYF_EXTENSION,
|
|
1252
|
-
})
|
|
1253
|
-
.remainingAccounts([
|
|
1254
|
-
limitCloseAutomationIx.keys[4],
|
|
1255
|
-
limitCloseAutomationIx.keys[5],
|
|
1256
|
-
limitCloseAutomationIx.keys[6],
|
|
1257
|
-
limitCloseAutomationIx.keys[7],
|
|
1258
|
-
limitCloseAutomationIx.keys[8],
|
|
1259
|
-
limitCloseAutomationIx.keys[9],
|
|
1260
|
-
limitCloseAutomationIx.keys[10],
|
|
1261
|
-
limitCloseAutomationIx.keys[11],
|
|
1262
|
-
limitCloseAutomationIx.keys[12],
|
|
1263
|
-
limitCloseAutomationIx.keys[13],
|
|
1264
|
-
limitCloseAutomationIx.keys[14],
|
|
1265
|
-
limitCloseAutomationIx.keys[15],
|
|
1266
|
-
limitCloseAutomationIx.keys[16],
|
|
1267
|
-
limitCloseAutomationIx.keys[17],
|
|
1268
|
-
limitCloseAutomationIx.keys[18],
|
|
1269
|
-
limitCloseAutomationIx.keys[19],
|
|
1270
|
-
limitCloseAutomationIx.keys[20],
|
|
1271
|
-
limitCloseAutomationIx.keys[21],
|
|
1272
|
-
])
|
|
1273
|
-
.instruction();
|
|
1264
|
+
catch (error) {
|
|
1265
|
+
console.error('=== LIMIT CLOSE AUTOMATION IX ERROR ===');
|
|
1266
|
+
console.error('Error type:', error instanceof Error ? error.constructor.name : typeof error);
|
|
1267
|
+
console.error('Error message:', error instanceof Error ? error.message : String(error));
|
|
1268
|
+
console.error('Error stack:', error instanceof Error ? error.stack : 'No stack trace');
|
|
1269
|
+
console.error('Full error object:', error);
|
|
1270
|
+
console.error('=== END LIMIT CLOSE ERROR LOG ===');
|
|
1271
|
+
throw error;
|
|
1274
1272
|
}
|
|
1275
|
-
const mainInstructions = [
|
|
1276
|
-
// Limit Close Automation Instruction (Hawksight CPI)
|
|
1277
|
-
ix,
|
|
1278
|
-
];
|
|
1279
|
-
return (0, functions_1.createTransactionMeta)({
|
|
1280
|
-
payer: params.userWallet,
|
|
1281
|
-
description: "Automation IX: Meteora limit close instruction (Full withdraw and close on to specific bin id)",
|
|
1282
|
-
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
1283
|
-
mainInstructions,
|
|
1284
|
-
});
|
|
1285
1273
|
});
|
|
1286
1274
|
}
|
|
1287
1275
|
limitCloseAutomationIx2(_a) {
|
|
@@ -1290,13 +1278,6 @@ class Transactions {
|
|
|
1290
1278
|
const position = yield program.account.positionV2.fetch(params.position);
|
|
1291
1279
|
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, position.lbPair, this.ix);
|
|
1292
1280
|
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
1293
|
-
// Step 1: Claim all fees/rewards, remove all liquidity and close current position
|
|
1294
|
-
// const { userPositions } = await dlmmPool.getPositionsByUserAndLbPair(
|
|
1295
|
-
// userPda
|
|
1296
|
-
// );
|
|
1297
|
-
// const binIdsToRemove = userPositions[0].positionData.positionBinData.map(
|
|
1298
|
-
// (bin) => bin.binId
|
|
1299
|
-
// );
|
|
1300
1281
|
// Claim fees and/or rewards, remove liquidity, and possibly close position from Meteora API (if set)
|
|
1301
1282
|
const txn = yield dlmmPool.dlmm.removeLiquidity({
|
|
1302
1283
|
user: userPda,
|
|
@@ -1312,58 +1293,34 @@ class Transactions {
|
|
|
1312
1293
|
const authority = params.userWallet;
|
|
1313
1294
|
const iyfProgram = addresses_1.IYF_MAIN;
|
|
1314
1295
|
const hawksightAuthority = addresses_1.HS_AUTHORITY;
|
|
1315
|
-
const { params: _params, data } = this.
|
|
1316
|
-
|
|
1317
|
-
let userTokenX;
|
|
1318
|
-
let userTokenY;
|
|
1319
|
-
if (params.pdaTokenType === types_1.TokenType.STA) {
|
|
1320
|
-
userTokenX = (0, functions_1.generateUserPdaStorageAccount)(userPda, tokenXMint.pubkey);
|
|
1321
|
-
userTokenY = (0, functions_1.generateUserPdaStorageAccount)(userPda, tokenYMint.pubkey);
|
|
1322
|
-
}
|
|
1323
|
-
else if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
1324
|
-
userTokenX = (0, functions_1.generateLimitToken)(userPda, tokenXMint.pubkey);
|
|
1325
|
-
userTokenY = (0, functions_1.generateLimitToken)(userPda, tokenYMint.pubkey);
|
|
1326
|
-
}
|
|
1327
|
-
else {
|
|
1328
|
-
userTokenX = (0, functions_1.generateAta)(userPda, tokenXMint.pubkey);
|
|
1329
|
-
userTokenY = (0, functions_1.generateAta)(userPda, tokenYMint.pubkey);
|
|
1330
|
-
}
|
|
1296
|
+
const { params: _params, data } = this.removeLiquidityByRange2Info(ixs);
|
|
1297
|
+
let { position: _position, lbPair, binArrayBitmapExtension, reserveX, reserveY, tokenXMint, tokenYMint, sender, tokenXProgram, tokenYProgram, memoProgram, eventAuthority, program: meteoraDlmmProgram, binArrays, } = _params;
|
|
1331
1298
|
let ix;
|
|
1332
1299
|
if (params.isLimitOrder) {
|
|
1333
1300
|
const limitTokenX = (0, functions_1.generateLimitToken)(userPda, tokenXMint.pubkey);
|
|
1334
1301
|
const limitTokenY = (0, functions_1.generateLimitToken)(userPda, tokenYMint.pubkey);
|
|
1335
1302
|
const authorityTokenX = (0, functions_1.generateAta)(hawksightAuthority, tokenXMint.pubkey);
|
|
1336
1303
|
const authorityTokenY = (0, functions_1.generateAta)(hawksightAuthority, tokenYMint.pubkey);
|
|
1337
|
-
//
|
|
1338
|
-
const limitCloseAutomationIx = yield
|
|
1339
|
-
|
|
1340
|
-
.
|
|
1341
|
-
userPda,
|
|
1342
|
-
hawksightAuthority,
|
|
1343
|
-
authority,
|
|
1304
|
+
// Use MeteoraDlmmIxGenerator for limitOrderCloseV2
|
|
1305
|
+
const limitCloseAutomationIx = yield this.ix.meteoraDlmm.limitOrderCloseV2({
|
|
1306
|
+
connection,
|
|
1307
|
+
userWallet: params.userWallet,
|
|
1344
1308
|
position: _position.pubkey,
|
|
1345
1309
|
lbPair: lbPair.pubkey,
|
|
1346
|
-
binArrayBitmapExtension: binArrayBitmapExtension.pubkey,
|
|
1347
|
-
limitTokenX,
|
|
1348
|
-
limitTokenY,
|
|
1349
|
-
authorityTokenX,
|
|
1350
|
-
authorityTokenY,
|
|
1351
|
-
systemProgram: web3.SystemProgram.programId,
|
|
1352
|
-
reserveX: reserveX.pubkey,
|
|
1353
|
-
reserveY: reserveY.pubkey,
|
|
1354
1310
|
tokenXMint: tokenXMint.pubkey,
|
|
1355
1311
|
tokenYMint: tokenYMint.pubkey,
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1312
|
+
reserveX: reserveX.pubkey,
|
|
1313
|
+
reserveY: reserveY.pubkey,
|
|
1314
|
+
tokenXProgram: tokenXProgram.pubkey,
|
|
1315
|
+
tokenYProgram: tokenYProgram.pubkey,
|
|
1316
|
+
useFuelAccount: false,
|
|
1317
|
+
param: data,
|
|
1318
|
+
minBinId: params.minBinId,
|
|
1319
|
+
maxBinId: params.maxBinId,
|
|
1320
|
+
binArrays: binArrays,
|
|
1321
|
+
});
|
|
1366
1322
|
// Instruction via main hawksight contract
|
|
1323
|
+
// @ts-ignore
|
|
1367
1324
|
ix = yield anchor_1.Anchor.instance()
|
|
1368
1325
|
.iyfMain.methods.iyfExtensionExecuteV2(limitCloseAutomationIx.data)
|
|
1369
1326
|
.accounts({
|
|
@@ -1376,64 +1333,31 @@ class Transactions {
|
|
|
1376
1333
|
}
|
|
1377
1334
|
else {
|
|
1378
1335
|
// @ts-ignore
|
|
1379
|
-
const limitCloseAutomationIx = yield
|
|
1380
|
-
|
|
1381
|
-
.
|
|
1382
|
-
farm,
|
|
1383
|
-
userPda,
|
|
1384
|
-
authority,
|
|
1385
|
-
iyfProgram,
|
|
1386
|
-
hawksightAuthority,
|
|
1336
|
+
const limitCloseAutomationIx = yield this.ix.meteoraDlmm.meteoraDlmmLimitCloseAutomationV2({
|
|
1337
|
+
connection,
|
|
1338
|
+
userWallet: params.userWallet,
|
|
1387
1339
|
position: _position.pubkey,
|
|
1388
1340
|
lbPair: lbPair.pubkey,
|
|
1389
|
-
binArrayBitmapExtension: binArrayBitmapExtension.pubkey,
|
|
1390
|
-
userTokenX,
|
|
1391
|
-
userTokenY,
|
|
1392
|
-
reserveX: reserveX.pubkey,
|
|
1393
|
-
reserveY: reserveY.pubkey,
|
|
1394
1341
|
tokenXMint: tokenXMint.pubkey,
|
|
1395
1342
|
tokenYMint: tokenYMint.pubkey,
|
|
1343
|
+
reserveX: reserveX.pubkey,
|
|
1344
|
+
reserveY: reserveY.pubkey,
|
|
1396
1345
|
tokenXProgram: tokenXProgram.pubkey,
|
|
1397
1346
|
tokenYProgram: tokenYProgram.pubkey,
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
// Instruction via main hawksight contract
|
|
1407
|
-
ix = yield
|
|
1408
|
-
.iyfMain.methods.iyfExtensionExecute(limitCloseAutomationIx.data)
|
|
1409
|
-
.accounts({
|
|
1410
|
-
farm,
|
|
1347
|
+
pdaTokenType: params.pdaTokenType,
|
|
1348
|
+
useFuelAccount: false,
|
|
1349
|
+
param: data,
|
|
1350
|
+
minBinId: params.minBinId,
|
|
1351
|
+
maxBinId: params.maxBinId,
|
|
1352
|
+
isHawkRefund: params.isHawkRefund,
|
|
1353
|
+
binArrays: binArrays,
|
|
1354
|
+
});
|
|
1355
|
+
// Instruction via main hawksight contract using iyfExtensionExecuteV2
|
|
1356
|
+
ix = yield this.ix.iyfMain.iyfExtensionExecuteV2(connection, {
|
|
1411
1357
|
userPda,
|
|
1412
|
-
authority,
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
})
|
|
1416
|
-
.remainingAccounts([
|
|
1417
|
-
limitCloseAutomationIx.keys[4],
|
|
1418
|
-
limitCloseAutomationIx.keys[5],
|
|
1419
|
-
limitCloseAutomationIx.keys[6],
|
|
1420
|
-
limitCloseAutomationIx.keys[7],
|
|
1421
|
-
limitCloseAutomationIx.keys[8],
|
|
1422
|
-
limitCloseAutomationIx.keys[9],
|
|
1423
|
-
limitCloseAutomationIx.keys[10],
|
|
1424
|
-
limitCloseAutomationIx.keys[11],
|
|
1425
|
-
limitCloseAutomationIx.keys[12],
|
|
1426
|
-
limitCloseAutomationIx.keys[13],
|
|
1427
|
-
limitCloseAutomationIx.keys[14],
|
|
1428
|
-
limitCloseAutomationIx.keys[15],
|
|
1429
|
-
limitCloseAutomationIx.keys[16],
|
|
1430
|
-
limitCloseAutomationIx.keys[17],
|
|
1431
|
-
limitCloseAutomationIx.keys[18],
|
|
1432
|
-
limitCloseAutomationIx.keys[19],
|
|
1433
|
-
limitCloseAutomationIx.keys[20],
|
|
1434
|
-
limitCloseAutomationIx.keys[21],
|
|
1435
|
-
])
|
|
1436
|
-
.instruction();
|
|
1358
|
+
authority: hawksightAuthority,
|
|
1359
|
+
ix: limitCloseAutomationIx,
|
|
1360
|
+
});
|
|
1437
1361
|
}
|
|
1438
1362
|
const mainInstructions = [
|
|
1439
1363
|
// Limit Close Automation Instruction (Hawksight CPI)
|
|
@@ -1450,8 +1374,9 @@ class Transactions {
|
|
|
1450
1374
|
removeLiquidityByRangeInfo(ixs) {
|
|
1451
1375
|
for (const ix of ixs) {
|
|
1452
1376
|
const programIdMatch = ix.programId.equals(addresses_1.METEORA_DLMM_PROGRAM);
|
|
1453
|
-
const
|
|
1454
|
-
|
|
1377
|
+
const removeLiquidityByRange = (0, functions_1.sighashMatch)(ix.data, "RemoveLiquidityByRange");
|
|
1378
|
+
// Handle original RemoveLiquidityByRange instruction
|
|
1379
|
+
if (programIdMatch && removeLiquidityByRange) {
|
|
1455
1380
|
return {
|
|
1456
1381
|
data: ix.data,
|
|
1457
1382
|
params: {
|
|
@@ -1475,7 +1400,38 @@ class Transactions {
|
|
|
1475
1400
|
};
|
|
1476
1401
|
}
|
|
1477
1402
|
}
|
|
1478
|
-
throw new Error(`Unexpected error: Cannot find "RemoveLiquidityByRange" instruction from instructions`);
|
|
1403
|
+
throw new Error(`Unexpected error: Cannot find "RemoveLiquidityByRange" or "RemoveLiquidityByRange2" instruction from instructions`);
|
|
1404
|
+
}
|
|
1405
|
+
removeLiquidityByRange2Info(ixs) {
|
|
1406
|
+
for (const ix of ixs) {
|
|
1407
|
+
const programIdMatch = ix.programId.equals(addresses_1.METEORA_DLMM_PROGRAM);
|
|
1408
|
+
const removeLiquidityByRange2 = (0, functions_1.sighashMatch)(ix.data, "remove_liquidity_by_range2", undefined, true);
|
|
1409
|
+
// Handle RemoveLiquidityByRange2 instruction with different account structure
|
|
1410
|
+
if (programIdMatch && removeLiquidityByRange2) {
|
|
1411
|
+
return {
|
|
1412
|
+
data: ix.data,
|
|
1413
|
+
params: {
|
|
1414
|
+
position: ix.keys[0],
|
|
1415
|
+
lbPair: ix.keys[1],
|
|
1416
|
+
binArrayBitmapExtension: ix.keys[2],
|
|
1417
|
+
userTokenX: ix.keys[3],
|
|
1418
|
+
userTokenY: ix.keys[4],
|
|
1419
|
+
reserveX: ix.keys[5],
|
|
1420
|
+
reserveY: ix.keys[6],
|
|
1421
|
+
tokenXMint: ix.keys[7],
|
|
1422
|
+
tokenYMint: ix.keys[8],
|
|
1423
|
+
sender: ix.keys[9],
|
|
1424
|
+
tokenXProgram: ix.keys[10],
|
|
1425
|
+
tokenYProgram: ix.keys[11],
|
|
1426
|
+
memoProgram: ix.keys[12],
|
|
1427
|
+
eventAuthority: ix.keys[13],
|
|
1428
|
+
program: ix.keys[14],
|
|
1429
|
+
binArrays: ix.keys.slice(15).map(key => key.pubkey), // Remaining accounts as pubkeys
|
|
1430
|
+
},
|
|
1431
|
+
};
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
throw new Error(`Unexpected error: Cannot find "RemoveLiquidityByRange" or "RemoveLiquidityByRange2" instruction from instructions`);
|
|
1479
1435
|
}
|
|
1480
1436
|
/**
|
|
1481
1437
|
* Creates orca instruction that opens new position
|
|
@@ -1491,6 +1447,7 @@ class Transactions {
|
|
|
1491
1447
|
const userPda = (0, functions_1.generateUserPda)(params.userWallet, farm);
|
|
1492
1448
|
const position = (0, functions_1.generateOrcaPositionPDA)(params.positionMint);
|
|
1493
1449
|
const positionTokenAccount = (0, functions_1.generateAta)(userPda, params.positionMint);
|
|
1450
|
+
// @ts-ignore
|
|
1494
1451
|
const extensionIx = yield anchor_1.Anchor.instance()
|
|
1495
1452
|
.iyfExtension.methods.orcaOpenPosition(params.tickLowerIndex, params.tickUpperIndex)
|
|
1496
1453
|
.accounts({
|
package/dist/src/functions.d.ts
CHANGED
|
@@ -397,5 +397,12 @@ export declare function getBatchedMultipleAccountsInfo(connection: web3.Connecti
|
|
|
397
397
|
export declare function getTokenProgramForMints(connection: web3.Connection, mints: web3.PublicKey[]): Promise<web3.PublicKey>;
|
|
398
398
|
export declare function getTokenProgramMapForMints(connection: web3.Connection, mints: web3.PublicKey[]): Promise<Record<string, web3.PublicKey>>;
|
|
399
399
|
export declare function getMeteoraStrategyType(strategyType: StrategyType, totalXAmount: BN, totalYAmount: BN): [MeteoraStrategyType, (boolean | undefined)];
|
|
400
|
+
/**
|
|
401
|
+
* Generate Hawksight fee accounts for X and Y tokens
|
|
402
|
+
*/
|
|
403
|
+
export declare function generateHawksightFeeAccounts(tokenXMint: web3.PublicKey, tokenYMint: web3.PublicKey, tokenXProgram: web3.PublicKey, tokenYProgram: web3.PublicKey): {
|
|
404
|
+
ownerFeeX: web3.PublicKey;
|
|
405
|
+
ownerFeeY: web3.PublicKey;
|
|
406
|
+
};
|
|
400
407
|
export {};
|
|
401
408
|
//# sourceMappingURL=functions.d.ts.map
|