@hawksightco/hawk-sdk 1.1.57 → 1.1.58

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.
@@ -177,6 +177,15 @@ export declare class Transactions {
177
177
  * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
178
178
  */
179
179
  orcaDeposit({ connection, params }: TxgenParams<OrcaDeposit>): Promise<TransactionMetadataResponse>;
180
+ /**
181
+ * Creates orca instruction that deposits to a position
182
+ *
183
+ * @param connection The Solana web3 connection object for blockchain interactions.
184
+ * @param payer The public key of the payer for transaction fees.
185
+ * @param params Parameters required
186
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
187
+ */
188
+ orcaDepositPda({ connection, params }: TxgenParams<OrcaDeposit>): Promise<TransactionMetadataResponse>;
180
189
  /**
181
190
  * Creates orca instruction that withdraws from a position
182
191
  *
@@ -186,6 +195,15 @@ export declare class Transactions {
186
195
  * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
187
196
  */
188
197
  orcaWithdraw({ connection, params }: TxgenParams<OrcaWithdraw>): Promise<TransactionMetadataResponse>;
198
+ /**
199
+ * Creates orca instruction that withdraws from a position
200
+ *
201
+ * @param connection The Solana web3 connection object for blockchain interactions.
202
+ * @param payer The public key of the payer for transaction fees.
203
+ * @param params Parameters required
204
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
205
+ */
206
+ orcaWithdrawPda({ connection, params }: TxgenParams<OrcaWithdraw>): Promise<TransactionMetadataResponse>;
189
207
  /**
190
208
  * Creates orca instruction that claims fees and rewards
191
209
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAgBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,kCAAkC,EAClC,cAAc,EACd,0BAA0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,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA4F3G;;;;;;;OAOG;IACG,eAAe,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA4F9G;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CA0GpH;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
@@ -1227,6 +1227,157 @@ class Transactions {
1227
1227
  });
1228
1228
  });
1229
1229
  }
1230
+ /**
1231
+ * Creates orca instruction that deposits to a position
1232
+ *
1233
+ * @param connection The Solana web3 connection object for blockchain interactions.
1234
+ * @param payer The public key of the payer for transaction fees.
1235
+ * @param params Parameters required
1236
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
1237
+ */
1238
+ orcaDepositPda(_a) {
1239
+ return __awaiter(this, arguments, void 0, function* ({ connection, params }) {
1240
+ const farm = addresses_1.USDC_FARM;
1241
+ const userPda = (0, functions_1.generateUserPda)(params.userWallet, farm);
1242
+ let position;
1243
+ let positionMint;
1244
+ let positionData;
1245
+ if (params.mintOrPosition.position !== undefined) {
1246
+ position = params.mintOrPosition.position;
1247
+ positionData = yield anchor_1.Anchor.instance().orcaProgram.account.position.fetch(position);
1248
+ positionMint = positionData.positionMint;
1249
+ }
1250
+ else if (params.mintOrPosition.positionMint !== undefined) {
1251
+ positionMint = params.mintOrPosition.positionMint;
1252
+ position = (0, functions_1.generateOrcaPositionPDA)(positionMint);
1253
+ }
1254
+ else {
1255
+ throw new Error('Position mint or orca position needs to be provided.');
1256
+ }
1257
+ const positionTokenAccount = (0, functions_1.generateAta)(userPda, positionMint);
1258
+ if (params.newPosition) {
1259
+ positionData = {
1260
+ positionMint,
1261
+ whirlpool: params.newPosition.whirlpool,
1262
+ tickLowerIndex: params.newPosition.tickLowerIndex,
1263
+ tickUpperIndex: params.newPosition.tickUpperIndex,
1264
+ };
1265
+ }
1266
+ else {
1267
+ positionData = yield anchor_1.Anchor.instance().orcaProgram.account.position.fetch(position);
1268
+ }
1269
+ if (positionData === null) {
1270
+ throw new Error(`Position: ${position} does not exist or already closed. Position mint: ${positionMint}`);
1271
+ }
1272
+ const whirlpool = positionData.whirlpool;
1273
+ const whirlpoolData = yield anchor_1.Anchor.instance().orcaProgram.account.whirlpool.fetch(whirlpool);
1274
+ const mintA = whirlpoolData.tokenMintA;
1275
+ const mintB = whirlpoolData.tokenMintB;
1276
+ const tokenSeeds = [
1277
+ { owner: params.userWallet, mint: mintA },
1278
+ { owner: params.userWallet, mint: mintB },
1279
+ ];
1280
+ const resultMap = yield (0, functions_1.tokenAccountExists)(connection, tokenSeeds);
1281
+ resultMap.map((result, index) => {
1282
+ const tokenKey = result.tokenKey;
1283
+ const token = tokenSeeds[index];
1284
+ if (!result.exists && `${token.mint}` !== 'So11111111111111111111111111111111111111112') {
1285
+ throw new Error(`Token: ${tokenKey} owned by ${token.owner} does not exist. Mint: ${token.mint}`);
1286
+ }
1287
+ });
1288
+ const tokenOwnerAccountA = (0, functions_1.generateAta)(userPda, mintA);
1289
+ const tokenOwnerAccountB = (0, functions_1.generateAta)(userPda, mintB);
1290
+ const { publicKey: tickArrayLower } = (0, orca_1.getTickArrayFromTickIndex)(positionData.tickLowerIndex, whirlpoolData.tickSpacing, whirlpool, addresses_1.ORCA_WHIRLPOOL_PROGRAM);
1291
+ const { publicKey: tickArrayUpper } = (0, orca_1.getTickArrayFromTickIndex)(positionData.tickUpperIndex, whirlpoolData.tickSpacing, whirlpool, addresses_1.ORCA_WHIRLPOOL_PROGRAM);
1292
+ const ownerFeeA = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, mintA);
1293
+ const ownerFeeB = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, mintB);
1294
+ // Step 1: Init wSOL token account for user wallet (if X or Y token is wSOL)
1295
+ const wrapSolIx = (0, functions_1.wrapSolIfMintIsWsol)(params.userWallet, params.userWallet, [
1296
+ { mint: mintA, amount: params.totalXAmount },
1297
+ { mint: mintB, amount: params.totalYAmount },
1298
+ ]);
1299
+ // const depositIx = await depositMultipleToken({
1300
+ // payer: params.userWallet,
1301
+ // deposit: [
1302
+ // {
1303
+ // mint: mintA,
1304
+ // amount: params.totalXAmount,
1305
+ // },
1306
+ // {
1307
+ // mint: mintB,
1308
+ // amount: params.totalYAmount,
1309
+ // },
1310
+ // ]
1311
+ // });
1312
+ // @ts-ignore
1313
+ const extensionIx = yield anchor_1.Anchor.instance().iyfExtension.methods
1314
+ .orcaDeposit()
1315
+ .accounts({
1316
+ farm,
1317
+ userPda,
1318
+ authority: params.userWallet,
1319
+ iyfProgram: addresses_1.IYF_MAIN,
1320
+ positionMint,
1321
+ whirlpool,
1322
+ position,
1323
+ positionTokenAccount,
1324
+ tokenOwnerAccountA,
1325
+ tokenOwnerAccountB,
1326
+ tokenVaultA: whirlpoolData.tokenVaultA,
1327
+ tokenVaultB: whirlpoolData.tokenVaultB,
1328
+ tickArrayLower,
1329
+ tickArrayUpper,
1330
+ ownerFeeA,
1331
+ ownerFeeB,
1332
+ orcaWhirlpoolProgram: addresses_1.ORCA_WHIRLPOOL_PROGRAM,
1333
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
1334
+ associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
1335
+ })
1336
+ .instruction();
1337
+ const orcaIx = yield anchor_1.Anchor.instance().iyfMain.methods
1338
+ .iyfExtensionExecute(extensionIx.data)
1339
+ .accounts({
1340
+ farm,
1341
+ userPda,
1342
+ authority: params.userWallet,
1343
+ iyfProgram: addresses_1.IYF_MAIN,
1344
+ iyfExtensionProgram: addresses_1.IYF_EXTENSION,
1345
+ })
1346
+ .remainingAccounts([
1347
+ extensionIx.keys[4],
1348
+ extensionIx.keys[5],
1349
+ extensionIx.keys[6],
1350
+ extensionIx.keys[7],
1351
+ extensionIx.keys[8],
1352
+ extensionIx.keys[9],
1353
+ extensionIx.keys[10],
1354
+ extensionIx.keys[11],
1355
+ extensionIx.keys[12],
1356
+ extensionIx.keys[13],
1357
+ extensionIx.keys[14],
1358
+ extensionIx.keys[15],
1359
+ extensionIx.keys[16],
1360
+ extensionIx.keys[17],
1361
+ extensionIx.keys[18],
1362
+ ])
1363
+ .instruction();
1364
+ // const clearRemainingTokensIxs = await withdrawMultipleToken({
1365
+ // payer: params.userWallet,
1366
+ // withdraw: [
1367
+ // { mint: mintA },
1368
+ // { mint: mintB },
1369
+ // ],
1370
+ // });
1371
+ orcaIx.keys[2].isSigner = true; // authority must be signer.
1372
+ const mainInstructions = [...wrapSolIx, orcaIx];
1373
+ return (0, functions_1.createTransactionMeta)({
1374
+ payer: params.userWallet,
1375
+ description: `Deposit to Orca Position via PDA: ${position}`,
1376
+ addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
1377
+ mainInstructions,
1378
+ });
1379
+ });
1380
+ }
1230
1381
  /**
1231
1382
  * Creates orca instruction that withdraws from a position
1232
1383
  *
@@ -1326,6 +1477,105 @@ class Transactions {
1326
1477
  });
1327
1478
  });
1328
1479
  }
1480
+ /**
1481
+ * Creates orca instruction that withdraws from a position
1482
+ *
1483
+ * @param connection The Solana web3 connection object for blockchain interactions.
1484
+ * @param payer The public key of the payer for transaction fees.
1485
+ * @param params Parameters required
1486
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse.
1487
+ */
1488
+ orcaWithdrawPda(_a) {
1489
+ return __awaiter(this, arguments, void 0, function* ({ connection, params }) {
1490
+ const farm = addresses_1.USDC_FARM;
1491
+ const userPda = (0, functions_1.generateUserPda)(params.userWallet, farm);
1492
+ const positionData = yield anchor_1.Anchor.instance().orcaProgram.account.position.fetch(params.position);
1493
+ if (positionData === null) {
1494
+ throw new Error(`Position: ${params.position} does not exist or already closed.`);
1495
+ }
1496
+ const liquidityAmount = positionData.liquidity
1497
+ .mul(new bn_js_1.default(Math.round(params.percentage * 100)))
1498
+ .div(new bn_js_1.default(10000));
1499
+ const positionTokenAccount = (0, functions_1.generateAta)(userPda, positionData.positionMint);
1500
+ const whirlpool = positionData.whirlpool;
1501
+ const whirlpoolData = yield anchor_1.Anchor.instance().orcaProgram.account.whirlpool.fetch(whirlpool);
1502
+ const mintA = whirlpoolData.tokenMintA;
1503
+ const mintB = whirlpoolData.tokenMintB;
1504
+ const tokenOwnerAccountA = (0, functions_1.generateAta)(userPda, mintA);
1505
+ const tokenOwnerAccountB = (0, functions_1.generateAta)(userPda, mintB);
1506
+ const { publicKey: tickArrayLower } = (0, orca_1.getTickArrayFromTickIndex)(positionData.tickLowerIndex, whirlpoolData.tickSpacing, whirlpool, addresses_1.ORCA_WHIRLPOOL_PROGRAM);
1507
+ const { publicKey: tickArrayUpper } = (0, orca_1.getTickArrayFromTickIndex)(positionData.tickUpperIndex, whirlpoolData.tickSpacing, whirlpool, addresses_1.ORCA_WHIRLPOOL_PROGRAM);
1508
+ const ownerFeeA = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, mintA);
1509
+ const ownerFeeB = (0, functions_1.generateAta)(addresses_1.SITE_FEE_OWNER, mintB);
1510
+ // @ts-ignore
1511
+ const extensionIx = yield anchor_1.Anchor.instance().iyfExtension.methods
1512
+ .orcaWithdraw(liquidityAmount)
1513
+ .accounts({
1514
+ farm,
1515
+ userPda,
1516
+ authority: params.userWallet,
1517
+ iyfProgram: addresses_1.IYF_MAIN,
1518
+ positionMint: positionData.positionMint,
1519
+ whirlpool,
1520
+ position: params.position,
1521
+ positionTokenAccount,
1522
+ tokenOwnerAccountA,
1523
+ tokenOwnerAccountB,
1524
+ tokenVaultA: whirlpoolData.tokenVaultA,
1525
+ tokenVaultB: whirlpoolData.tokenVaultB,
1526
+ tickArrayLower,
1527
+ tickArrayUpper,
1528
+ ownerFeeA,
1529
+ ownerFeeB,
1530
+ orcaWhirlpoolProgram: addresses_1.ORCA_WHIRLPOOL_PROGRAM,
1531
+ tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
1532
+ associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
1533
+ })
1534
+ .instruction();
1535
+ const orcaIx = yield anchor_1.Anchor.instance().iyfMain.methods
1536
+ .iyfExtensionExecute(extensionIx.data)
1537
+ .accounts({
1538
+ farm,
1539
+ userPda,
1540
+ authority: params.userWallet,
1541
+ iyfProgram: addresses_1.IYF_MAIN,
1542
+ iyfExtensionProgram: addresses_1.IYF_EXTENSION,
1543
+ })
1544
+ .remainingAccounts([
1545
+ extensionIx.keys[4],
1546
+ extensionIx.keys[5],
1547
+ extensionIx.keys[6],
1548
+ extensionIx.keys[7],
1549
+ extensionIx.keys[8],
1550
+ extensionIx.keys[9],
1551
+ extensionIx.keys[10],
1552
+ extensionIx.keys[11],
1553
+ extensionIx.keys[12],
1554
+ extensionIx.keys[13],
1555
+ extensionIx.keys[14],
1556
+ extensionIx.keys[15],
1557
+ extensionIx.keys[16],
1558
+ extensionIx.keys[17],
1559
+ extensionIx.keys[18],
1560
+ ])
1561
+ .instruction();
1562
+ // const withdrawFromPda = await withdrawMultipleToken({
1563
+ // payer: params.userWallet,
1564
+ // withdraw: [
1565
+ // { mint: mintA },
1566
+ // { mint: mintB },
1567
+ // ],
1568
+ // });
1569
+ orcaIx.keys[2].isSigner = true; // authority must be signer.
1570
+ const mainInstructions = [orcaIx];
1571
+ return (0, functions_1.createTransactionMeta)({
1572
+ payer: params.userWallet,
1573
+ description: `Withdraw deposits from Orca Position to Pda: ${params.position}`,
1574
+ addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
1575
+ mainInstructions,
1576
+ });
1577
+ });
1578
+ }
1329
1579
  /**
1330
1580
  * Creates orca instruction that claims fees and rewards
1331
1581
  *
@@ -165,6 +165,15 @@ export declare class TxGenerator {
165
165
  * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
166
166
  */
167
167
  orcaDeposit(connection: web3.Connection, payer: string, params: OrcaDeposit): Promise<ResponseWithStatus<TransactionMetadata>>;
168
+ /**
169
+ * Creates orca instruction that deposits to a position
170
+ *
171
+ * @param connection The Solana web3 connection object for blockchain interactions.
172
+ * @param payer The public key of the payer for transaction fees.
173
+ * @param params Parameters required
174
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
175
+ */
176
+ orcaDepositPda(connection: web3.Connection, payer: string, params: OrcaDeposit): Promise<ResponseWithStatus<TransactionMetadata>>;
168
177
  /**
169
178
  * Creates orca instruction that withdraws from a position
170
179
  *
@@ -174,6 +183,15 @@ export declare class TxGenerator {
174
183
  * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
175
184
  */
176
185
  orcaWithdraw(connection: web3.Connection, payer: string, params: OrcaWithdraw): Promise<ResponseWithStatus<TransactionMetadata>>;
186
+ /**
187
+ * Creates orca instruction that withdraws from a position
188
+ *
189
+ * @param connection The Solana web3 connection object for blockchain interactions.
190
+ * @param payer The public key of the payer for transaction fees.
191
+ * @param params Parameters required
192
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
193
+ */
194
+ orcaWithdrawPda(connection: web3.Connection, payer: string, params: OrcaWithdraw): Promise<ResponseWithStatus<TransactionMetadata>>;
177
195
  /**
178
196
  * Creates orca instruction that claims fees and rewards
179
197
  *
@@ -1 +1 @@
1
- {"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAkE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,kCAAkC,EAAE,6BAA6B,EAAE,kBAAkB,EAAE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AAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiCtI;;;;;;;OAOG;IACG,eAAe,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiCzI;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA+B/I"}
@@ -640,6 +640,46 @@ class TxGenerator {
640
640
  }
641
641
  });
642
642
  }
643
+ /**
644
+ * Creates orca instruction that deposits to a position
645
+ *
646
+ * @param connection The Solana web3 connection object for blockchain interactions.
647
+ * @param payer The public key of the payer for transaction fees.
648
+ * @param params Parameters required
649
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
650
+ */
651
+ orcaDepositPda(connection, payer, params) {
652
+ return __awaiter(this, void 0, void 0, function* () {
653
+ // Initialize anchor
654
+ anchor_1.Anchor.initialize(connection);
655
+ try {
656
+ const result = yield Transactions_1.txgen.orcaDepositPda({
657
+ connection,
658
+ params: {
659
+ userWallet: params.userWallet,
660
+ mintOrPosition: params.mintOrPosition,
661
+ totalXAmount: params.totalXAmount,
662
+ totalYAmount: params.totalYAmount,
663
+ newPosition: params.newPosition,
664
+ }
665
+ });
666
+ return {
667
+ status: 200,
668
+ data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
669
+ };
670
+ }
671
+ catch (e) {
672
+ return {
673
+ status: 400,
674
+ data: {
675
+ code: "custom",
676
+ message: e,
677
+ path: [],
678
+ },
679
+ };
680
+ }
681
+ });
682
+ }
643
683
  /**
644
684
  * Creates orca instruction that withdraws from a position
645
685
  *
@@ -678,6 +718,44 @@ class TxGenerator {
678
718
  }
679
719
  });
680
720
  }
721
+ /**
722
+ * Creates orca instruction that withdraws from a position
723
+ *
724
+ * @param connection The Solana web3 connection object for blockchain interactions.
725
+ * @param payer The public key of the payer for transaction fees.
726
+ * @param params Parameters required
727
+ * @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
728
+ */
729
+ orcaWithdrawPda(connection, payer, params) {
730
+ return __awaiter(this, void 0, void 0, function* () {
731
+ // Initialize anchor
732
+ anchor_1.Anchor.initialize(connection);
733
+ try {
734
+ const result = yield Transactions_1.txgen.orcaWithdrawPda({
735
+ connection,
736
+ params: {
737
+ userWallet: params.userWallet,
738
+ position: params.position,
739
+ percentage: params.percentage,
740
+ }
741
+ });
742
+ return {
743
+ status: 200,
744
+ data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
745
+ };
746
+ }
747
+ catch (e) {
748
+ return {
749
+ status: 400,
750
+ data: {
751
+ code: "custom",
752
+ message: e,
753
+ path: [],
754
+ },
755
+ };
756
+ }
757
+ });
758
+ }
681
759
  /**
682
760
  * Creates orca instruction that claims fees and rewards
683
761
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawksightco/hawk-sdk",
3
- "version": "1.1.57",
3
+ "version": "1.1.58",
4
4
  "description": "Hawksight v2 SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": "https://github.com/ghabxph/hawk-api-client.git",