@hawksightco/hawk-sdk 1.2.128 → 1.2.130
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/CHANGELOG.md +96 -0
- package/dist/src/addresses.d.ts +1 -0
- package/dist/src/addresses.d.ts.map +1 -1
- package/dist/src/addresses.js +2 -1
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +1 -1
- package/dist/src/classes/SimpleIxGenerator.js +1 -1
- package/dist/src/functions.d.ts +1 -1
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +3 -8
- package/dist/src/idl/iyf-extension-idl.d.ts +352 -0
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +352 -0
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts +53 -2
- package/dist/src/ixGenerator/OrcaIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/OrcaIxGenerator.js +152 -3
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts +8 -0
- package/dist/src/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -1
- package/dist/src/pdaGenerator/OrcaPdaGenerator.js +13 -0
- package/package.json +1 -1
|
@@ -4967,6 +4967,72 @@ exports.IDL = {
|
|
|
4967
4967
|
],
|
|
4968
4968
|
"args": []
|
|
4969
4969
|
},
|
|
4970
|
+
{
|
|
4971
|
+
"name": "orcaAutoClosePositionWithTokenExtension",
|
|
4972
|
+
"docs": [
|
|
4973
|
+
"Orca whirlpool - Auto close position with Token2022 (Automation)"
|
|
4974
|
+
],
|
|
4975
|
+
"discriminator": [
|
|
4976
|
+
184,
|
|
4977
|
+
162,
|
|
4978
|
+
77,
|
|
4979
|
+
124,
|
|
4980
|
+
203,
|
|
4981
|
+
145,
|
|
4982
|
+
143,
|
|
4983
|
+
112
|
|
4984
|
+
],
|
|
4985
|
+
"accounts": [
|
|
4986
|
+
{
|
|
4987
|
+
"name": "userPda",
|
|
4988
|
+
"docs": [
|
|
4989
|
+
"Hawksight user pda (FIRST account - required by iyf_extension_execute_v2)"
|
|
4990
|
+
]
|
|
4991
|
+
},
|
|
4992
|
+
{
|
|
4993
|
+
"name": "hawksightAuthority",
|
|
4994
|
+
"docs": [
|
|
4995
|
+
"Hawksight authority (SECOND account - required by iyf_extension_execute_v2)"
|
|
4996
|
+
],
|
|
4997
|
+
"signer": true
|
|
4998
|
+
},
|
|
4999
|
+
{
|
|
5000
|
+
"name": "position",
|
|
5001
|
+
"docs": [
|
|
5002
|
+
"Position account to be closed"
|
|
5003
|
+
],
|
|
5004
|
+
"writable": true
|
|
5005
|
+
},
|
|
5006
|
+
{
|
|
5007
|
+
"name": "positionMint",
|
|
5008
|
+
"docs": [
|
|
5009
|
+
"Position mint"
|
|
5010
|
+
],
|
|
5011
|
+
"writable": true
|
|
5012
|
+
},
|
|
5013
|
+
{
|
|
5014
|
+
"name": "positionTokenAccount",
|
|
5015
|
+
"docs": [
|
|
5016
|
+
"Position token account to be closed"
|
|
5017
|
+
],
|
|
5018
|
+
"writable": true
|
|
5019
|
+
},
|
|
5020
|
+
{
|
|
5021
|
+
"name": "token2022Program",
|
|
5022
|
+
"docs": [
|
|
5023
|
+
"Token2022 program"
|
|
5024
|
+
]
|
|
5025
|
+
},
|
|
5026
|
+
{
|
|
5027
|
+
"name": "orcaWhirlpoolProgram",
|
|
5028
|
+
"docs": [
|
|
5029
|
+
"Orca Whirlpool program"
|
|
5030
|
+
],
|
|
5031
|
+
"address": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
|
|
5032
|
+
}
|
|
5033
|
+
],
|
|
5034
|
+
"args": []
|
|
5035
|
+
},
|
|
4970
5036
|
{
|
|
4971
5037
|
"name": "orcaAutoDeposit",
|
|
4972
5038
|
"docs": [
|
|
@@ -5593,6 +5659,113 @@ exports.IDL = {
|
|
|
5593
5659
|
}
|
|
5594
5660
|
]
|
|
5595
5661
|
},
|
|
5662
|
+
{
|
|
5663
|
+
"name": "orcaAutoOpenPositionWithTokenExtension",
|
|
5664
|
+
"docs": [
|
|
5665
|
+
"Orca whirlpool - Auto open position with Token2022 (Automation)"
|
|
5666
|
+
],
|
|
5667
|
+
"discriminator": [
|
|
5668
|
+
109,
|
|
5669
|
+
130,
|
|
5670
|
+
108,
|
|
5671
|
+
211,
|
|
5672
|
+
187,
|
|
5673
|
+
233,
|
|
5674
|
+
251,
|
|
5675
|
+
196
|
|
5676
|
+
],
|
|
5677
|
+
"accounts": [
|
|
5678
|
+
{
|
|
5679
|
+
"name": "userPda",
|
|
5680
|
+
"docs": [
|
|
5681
|
+
"Hawksight user pda (FIRST account - required by iyf_extension_execute_v2)"
|
|
5682
|
+
]
|
|
5683
|
+
},
|
|
5684
|
+
{
|
|
5685
|
+
"name": "hawksightAuthority",
|
|
5686
|
+
"docs": [
|
|
5687
|
+
"Hawksight authority (for automation instructions)"
|
|
5688
|
+
],
|
|
5689
|
+
"signer": true
|
|
5690
|
+
},
|
|
5691
|
+
{
|
|
5692
|
+
"name": "position",
|
|
5693
|
+
"docs": [
|
|
5694
|
+
"Position account to be created"
|
|
5695
|
+
],
|
|
5696
|
+
"writable": true
|
|
5697
|
+
},
|
|
5698
|
+
{
|
|
5699
|
+
"name": "positionMint",
|
|
5700
|
+
"docs": [
|
|
5701
|
+
"Position mint (signer for creation)"
|
|
5702
|
+
],
|
|
5703
|
+
"writable": true,
|
|
5704
|
+
"signer": true
|
|
5705
|
+
},
|
|
5706
|
+
{
|
|
5707
|
+
"name": "positionTokenAccount",
|
|
5708
|
+
"docs": [
|
|
5709
|
+
"Position token account to be created (uninitialized)"
|
|
5710
|
+
],
|
|
5711
|
+
"writable": true
|
|
5712
|
+
},
|
|
5713
|
+
{
|
|
5714
|
+
"name": "whirlpool",
|
|
5715
|
+
"docs": [
|
|
5716
|
+
"Whirlpool account"
|
|
5717
|
+
]
|
|
5718
|
+
},
|
|
5719
|
+
{
|
|
5720
|
+
"name": "token2022Program",
|
|
5721
|
+
"docs": [
|
|
5722
|
+
"Token2022 program"
|
|
5723
|
+
]
|
|
5724
|
+
},
|
|
5725
|
+
{
|
|
5726
|
+
"name": "systemProgram",
|
|
5727
|
+
"docs": [
|
|
5728
|
+
"System program"
|
|
5729
|
+
],
|
|
5730
|
+
"address": "11111111111111111111111111111111"
|
|
5731
|
+
},
|
|
5732
|
+
{
|
|
5733
|
+
"name": "associatedTokenProgram",
|
|
5734
|
+
"docs": [
|
|
5735
|
+
"Associated token program"
|
|
5736
|
+
],
|
|
5737
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
5738
|
+
},
|
|
5739
|
+
{
|
|
5740
|
+
"name": "metadataUpdateAuth",
|
|
5741
|
+
"docs": [
|
|
5742
|
+
"Metadata update authority"
|
|
5743
|
+
],
|
|
5744
|
+
"address": "3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr"
|
|
5745
|
+
},
|
|
5746
|
+
{
|
|
5747
|
+
"name": "orcaWhirlpoolProgram",
|
|
5748
|
+
"docs": [
|
|
5749
|
+
"Orca Whirlpool program"
|
|
5750
|
+
],
|
|
5751
|
+
"address": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
|
|
5752
|
+
}
|
|
5753
|
+
],
|
|
5754
|
+
"args": [
|
|
5755
|
+
{
|
|
5756
|
+
"name": "tickLowerIndex",
|
|
5757
|
+
"type": "i32"
|
|
5758
|
+
},
|
|
5759
|
+
{
|
|
5760
|
+
"name": "tickUpperIndex",
|
|
5761
|
+
"type": "i32"
|
|
5762
|
+
},
|
|
5763
|
+
{
|
|
5764
|
+
"name": "withTokenMetadata",
|
|
5765
|
+
"type": "bool"
|
|
5766
|
+
}
|
|
5767
|
+
]
|
|
5768
|
+
},
|
|
5596
5769
|
{
|
|
5597
5770
|
"name": "orcaAutoWithdraw",
|
|
5598
5771
|
"docs": [
|
|
@@ -6243,6 +6416,75 @@ exports.IDL = {
|
|
|
6243
6416
|
],
|
|
6244
6417
|
"args": []
|
|
6245
6418
|
},
|
|
6419
|
+
{
|
|
6420
|
+
"name": "orcaClosePositionWithTokenExtension",
|
|
6421
|
+
"docs": [
|
|
6422
|
+
"Orca whirlpool - Close position with Token2022 (User)"
|
|
6423
|
+
],
|
|
6424
|
+
"discriminator": [
|
|
6425
|
+
37,
|
|
6426
|
+
88,
|
|
6427
|
+
149,
|
|
6428
|
+
116,
|
|
6429
|
+
68,
|
|
6430
|
+
45,
|
|
6431
|
+
159,
|
|
6432
|
+
64
|
|
6433
|
+
],
|
|
6434
|
+
"accounts": [
|
|
6435
|
+
{
|
|
6436
|
+
"name": "userPda",
|
|
6437
|
+
"docs": [
|
|
6438
|
+
"Hawksight user pda (FIRST account - required by iyf_extension_execute_v2)"
|
|
6439
|
+
]
|
|
6440
|
+
},
|
|
6441
|
+
{
|
|
6442
|
+
"name": "authority",
|
|
6443
|
+
"docs": [
|
|
6444
|
+
"Authority (SECOND account - required by iyf_extension_execute_v2)"
|
|
6445
|
+
],
|
|
6446
|
+
"signer": true,
|
|
6447
|
+
"relations": [
|
|
6448
|
+
"userPda"
|
|
6449
|
+
]
|
|
6450
|
+
},
|
|
6451
|
+
{
|
|
6452
|
+
"name": "position",
|
|
6453
|
+
"docs": [
|
|
6454
|
+
"Position account to be closed"
|
|
6455
|
+
],
|
|
6456
|
+
"writable": true
|
|
6457
|
+
},
|
|
6458
|
+
{
|
|
6459
|
+
"name": "positionMint",
|
|
6460
|
+
"docs": [
|
|
6461
|
+
"Position mint"
|
|
6462
|
+
],
|
|
6463
|
+
"writable": true
|
|
6464
|
+
},
|
|
6465
|
+
{
|
|
6466
|
+
"name": "positionTokenAccount",
|
|
6467
|
+
"docs": [
|
|
6468
|
+
"Position token account to be closed"
|
|
6469
|
+
],
|
|
6470
|
+
"writable": true
|
|
6471
|
+
},
|
|
6472
|
+
{
|
|
6473
|
+
"name": "token2022Program",
|
|
6474
|
+
"docs": [
|
|
6475
|
+
"Token2022 program"
|
|
6476
|
+
]
|
|
6477
|
+
},
|
|
6478
|
+
{
|
|
6479
|
+
"name": "orcaWhirlpoolProgram",
|
|
6480
|
+
"docs": [
|
|
6481
|
+
"Orca Whirlpool program"
|
|
6482
|
+
],
|
|
6483
|
+
"address": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
|
|
6484
|
+
}
|
|
6485
|
+
],
|
|
6486
|
+
"args": []
|
|
6487
|
+
},
|
|
6246
6488
|
{
|
|
6247
6489
|
"name": "orcaCompound",
|
|
6248
6490
|
"docs": [
|
|
@@ -8123,6 +8365,116 @@ exports.IDL = {
|
|
|
8123
8365
|
}
|
|
8124
8366
|
]
|
|
8125
8367
|
},
|
|
8368
|
+
{
|
|
8369
|
+
"name": "orcaOpenPositionWithTokenExtension",
|
|
8370
|
+
"docs": [
|
|
8371
|
+
"Orca whirlpool - Open position with Token2022 (User)"
|
|
8372
|
+
],
|
|
8373
|
+
"discriminator": [
|
|
8374
|
+
89,
|
|
8375
|
+
88,
|
|
8376
|
+
26,
|
|
8377
|
+
171,
|
|
8378
|
+
10,
|
|
8379
|
+
192,
|
|
8380
|
+
49,
|
|
8381
|
+
250
|
|
8382
|
+
],
|
|
8383
|
+
"accounts": [
|
|
8384
|
+
{
|
|
8385
|
+
"name": "userPda",
|
|
8386
|
+
"docs": [
|
|
8387
|
+
"Hawksight user pda (FIRST account - required by iyf_extension_execute_v2)"
|
|
8388
|
+
]
|
|
8389
|
+
},
|
|
8390
|
+
{
|
|
8391
|
+
"name": "authority",
|
|
8392
|
+
"docs": [
|
|
8393
|
+
"Authority (SECOND account - required by iyf_extension_execute_v2)"
|
|
8394
|
+
],
|
|
8395
|
+
"signer": true,
|
|
8396
|
+
"relations": [
|
|
8397
|
+
"userPda"
|
|
8398
|
+
]
|
|
8399
|
+
},
|
|
8400
|
+
{
|
|
8401
|
+
"name": "position",
|
|
8402
|
+
"docs": [
|
|
8403
|
+
"Position account to be created"
|
|
8404
|
+
],
|
|
8405
|
+
"writable": true
|
|
8406
|
+
},
|
|
8407
|
+
{
|
|
8408
|
+
"name": "positionMint",
|
|
8409
|
+
"docs": [
|
|
8410
|
+
"Position mint (signer for creation)"
|
|
8411
|
+
],
|
|
8412
|
+
"writable": true,
|
|
8413
|
+
"signer": true
|
|
8414
|
+
},
|
|
8415
|
+
{
|
|
8416
|
+
"name": "positionTokenAccount",
|
|
8417
|
+
"docs": [
|
|
8418
|
+
"Position token account to be created (uninitialized)"
|
|
8419
|
+
],
|
|
8420
|
+
"writable": true
|
|
8421
|
+
},
|
|
8422
|
+
{
|
|
8423
|
+
"name": "whirlpool",
|
|
8424
|
+
"docs": [
|
|
8425
|
+
"Whirlpool account"
|
|
8426
|
+
]
|
|
8427
|
+
},
|
|
8428
|
+
{
|
|
8429
|
+
"name": "token2022Program",
|
|
8430
|
+
"docs": [
|
|
8431
|
+
"Token2022 program"
|
|
8432
|
+
]
|
|
8433
|
+
},
|
|
8434
|
+
{
|
|
8435
|
+
"name": "systemProgram",
|
|
8436
|
+
"docs": [
|
|
8437
|
+
"System program"
|
|
8438
|
+
],
|
|
8439
|
+
"address": "11111111111111111111111111111111"
|
|
8440
|
+
},
|
|
8441
|
+
{
|
|
8442
|
+
"name": "associatedTokenProgram",
|
|
8443
|
+
"docs": [
|
|
8444
|
+
"Associated token program"
|
|
8445
|
+
],
|
|
8446
|
+
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
8447
|
+
},
|
|
8448
|
+
{
|
|
8449
|
+
"name": "metadataUpdateAuth",
|
|
8450
|
+
"docs": [
|
|
8451
|
+
"Metadata update authority"
|
|
8452
|
+
],
|
|
8453
|
+
"address": "3axbTs2z5GBy6usVbNVoqEgZMng3vZvMnAoX29BFfwhr"
|
|
8454
|
+
},
|
|
8455
|
+
{
|
|
8456
|
+
"name": "orcaWhirlpoolProgram",
|
|
8457
|
+
"docs": [
|
|
8458
|
+
"Orca Whirlpool program"
|
|
8459
|
+
],
|
|
8460
|
+
"address": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"
|
|
8461
|
+
}
|
|
8462
|
+
],
|
|
8463
|
+
"args": [
|
|
8464
|
+
{
|
|
8465
|
+
"name": "tickLowerIndex",
|
|
8466
|
+
"type": "i32"
|
|
8467
|
+
},
|
|
8468
|
+
{
|
|
8469
|
+
"name": "tickUpperIndex",
|
|
8470
|
+
"type": "i32"
|
|
8471
|
+
},
|
|
8472
|
+
{
|
|
8473
|
+
"name": "withTokenMetadata",
|
|
8474
|
+
"type": "bool"
|
|
8475
|
+
}
|
|
8476
|
+
]
|
|
8477
|
+
},
|
|
8126
8478
|
{
|
|
8127
8479
|
"name": "orcaRebalance",
|
|
8128
8480
|
"docs": [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
|
|
2
2
|
import * as web3 from "@solana/web3.js";
|
|
3
3
|
import { IyfMainIxGenerator } from "./IyfMainIxGenerator";
|
|
4
|
+
import { SimplePdaGenerator } from "../classes/SimplePdaGenerator";
|
|
4
5
|
type OrcaLimitClosePositionAutomation = {
|
|
5
6
|
connection: web3.Connection;
|
|
6
7
|
userWallet: web3.PublicKey;
|
|
@@ -8,17 +9,67 @@ type OrcaLimitClosePositionAutomation = {
|
|
|
8
9
|
minBinId: number;
|
|
9
10
|
maxBinId: number;
|
|
10
11
|
useAta?: boolean;
|
|
12
|
+
is2022Position?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type OrcaAutoOpenPositionWithTokenExtension = {
|
|
15
|
+
connection: web3.Connection;
|
|
16
|
+
userWallet: web3.PublicKey;
|
|
17
|
+
positionMint: web3.PublicKey;
|
|
18
|
+
whirlpool: web3.PublicKey;
|
|
19
|
+
tickLowerIndex: number;
|
|
20
|
+
tickUpperIndex: number;
|
|
21
|
+
withTokenMetadata: boolean;
|
|
22
|
+
is2022Position?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type OrcaAutoClosePositionWithTokenExtension = {
|
|
25
|
+
connection: web3.Connection;
|
|
26
|
+
userWallet: web3.PublicKey;
|
|
27
|
+
positionMint: web3.PublicKey;
|
|
28
|
+
is2022Position?: boolean;
|
|
29
|
+
};
|
|
30
|
+
type OrcaOpenPositionWithTokenExtension = {
|
|
31
|
+
connection: web3.Connection;
|
|
32
|
+
userWallet: web3.PublicKey;
|
|
33
|
+
positionMint: web3.PublicKey;
|
|
34
|
+
whirlpool: web3.PublicKey;
|
|
35
|
+
tickLowerIndex: number;
|
|
36
|
+
tickUpperIndex: number;
|
|
37
|
+
withTokenMetadata: boolean;
|
|
38
|
+
is2022Position?: boolean;
|
|
39
|
+
};
|
|
40
|
+
type OrcaClosePositionWithTokenExtension = {
|
|
41
|
+
connection: web3.Connection;
|
|
42
|
+
userWallet: web3.PublicKey;
|
|
43
|
+
positionMint: web3.PublicKey;
|
|
44
|
+
is2022Position?: boolean;
|
|
11
45
|
};
|
|
12
46
|
/**
|
|
13
47
|
* Orca IX Generator
|
|
14
48
|
*/
|
|
15
49
|
export declare class OrcaIxGenerator {
|
|
16
50
|
private iyfMain;
|
|
17
|
-
|
|
51
|
+
private pda;
|
|
52
|
+
constructor(iyfMain: IyfMainIxGenerator, pda: SimplePdaGenerator);
|
|
18
53
|
/**
|
|
19
54
|
* Orca limit close position automation
|
|
20
55
|
*/
|
|
21
|
-
orcaLimitClosePositionAutomation({ connection, userWallet, position, minBinId, maxBinId, useAta, }: OrcaLimitClosePositionAutomation): Promise<web3.TransactionInstruction>;
|
|
56
|
+
orcaLimitClosePositionAutomation({ connection, userWallet, position, minBinId, maxBinId, useAta, is2022Position, }: OrcaLimitClosePositionAutomation): Promise<web3.TransactionInstruction>;
|
|
57
|
+
/**
|
|
58
|
+
* Orca auto open position with Token2022 (Automation)
|
|
59
|
+
*/
|
|
60
|
+
orcaAutoOpenPositionWithTokenExtension({ connection, userWallet, positionMint, whirlpool, tickLowerIndex, tickUpperIndex, withTokenMetadata, is2022Position, }: OrcaAutoOpenPositionWithTokenExtension): Promise<web3.TransactionInstruction>;
|
|
61
|
+
/**
|
|
62
|
+
* Orca auto close position with Token2022 (Automation)
|
|
63
|
+
*/
|
|
64
|
+
orcaAutoClosePositionWithTokenExtension({ connection, userWallet, positionMint, is2022Position, }: OrcaAutoClosePositionWithTokenExtension): Promise<web3.TransactionInstruction>;
|
|
65
|
+
/**
|
|
66
|
+
* Orca open position with Token2022 (User)
|
|
67
|
+
*/
|
|
68
|
+
orcaOpenPositionWithTokenExtension({ connection, userWallet, positionMint, whirlpool, tickLowerIndex, tickUpperIndex, withTokenMetadata, is2022Position, }: OrcaOpenPositionWithTokenExtension): Promise<web3.TransactionInstruction>;
|
|
69
|
+
/**
|
|
70
|
+
* Orca close position with Token2022 (User)
|
|
71
|
+
*/
|
|
72
|
+
orcaClosePositionWithTokenExtension({ connection, userWallet, positionMint, is2022Position, }: OrcaClosePositionWithTokenExtension): Promise<web3.TransactionInstruction>;
|
|
22
73
|
}
|
|
23
74
|
export {};
|
|
24
75
|
//# sourceMappingURL=OrcaIxGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrcaIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/ixGenerator/OrcaIxGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAIxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"OrcaIxGenerator.d.ts","sourceRoot":"","sources":["../../../src/ixGenerator/OrcaIxGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAIxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,KAAK,gCAAgC,GAAG;IACtC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;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(iyfMain) {
|
|
45
|
+
constructor(iyfMain, pda) {
|
|
46
46
|
this.iyfMain = iyfMain;
|
|
47
|
+
this.pda = pda;
|
|
47
48
|
}
|
|
48
49
|
/**
|
|
49
50
|
* Orca limit close position automation
|
|
50
51
|
*/
|
|
51
52
|
orcaLimitClosePositionAutomation(_a) {
|
|
52
|
-
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, position, minBinId, maxBinId, useAta = true, }) {
|
|
53
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, position, minBinId, maxBinId, useAta = true, is2022Position = false, }) {
|
|
53
54
|
// Initialize anchor
|
|
54
55
|
anchor_1.Anchor.initialize(connection);
|
|
55
56
|
// Generate user pda
|
|
@@ -58,7 +59,7 @@ class OrcaIxGenerator {
|
|
|
58
59
|
const whirlpoolInfo = yield anchor_1.Anchor.instance().orcaProgram.account.whirlpool.fetch(positionInfo.whirlpool);
|
|
59
60
|
const whirlpool = positionInfo.whirlpool;
|
|
60
61
|
const positionMint = positionInfo.positionMint;
|
|
61
|
-
const positionTokenAccount =
|
|
62
|
+
const positionTokenAccount = this.pda.orca.generatePositionTokenAccount(userPda, positionMint, is2022Position);
|
|
62
63
|
const tokenOwnerAccountA = useAta ? (0, functions_1.generateAta)(userPda, whirlpoolInfo.tokenMintA) : (0, functions_1.generateUserPdaStorageAccount)(userPda, whirlpoolInfo.tokenMintA);
|
|
63
64
|
const tokenOwnerAccountB = useAta ? (0, functions_1.generateAta)(userPda, whirlpoolInfo.tokenMintB) : (0, functions_1.generateUserPdaStorageAccount)(userPda, whirlpoolInfo.tokenMintB);
|
|
64
65
|
const tokenVaultA = whirlpoolInfo.tokenVaultA;
|
|
@@ -115,5 +116,153 @@ class OrcaIxGenerator {
|
|
|
115
116
|
});
|
|
116
117
|
});
|
|
117
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Orca auto open position with Token2022 (Automation)
|
|
121
|
+
*/
|
|
122
|
+
orcaAutoOpenPositionWithTokenExtension(_a) {
|
|
123
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, positionMint, whirlpool, tickLowerIndex, tickUpperIndex, withTokenMetadata, is2022Position = true, }) {
|
|
124
|
+
// Initialize anchor
|
|
125
|
+
anchor_1.Anchor.initialize(connection);
|
|
126
|
+
// Generate user pda
|
|
127
|
+
const userPda = (0, functions_1.generateUserPda)(userWallet);
|
|
128
|
+
// Generate position and position token account
|
|
129
|
+
const position = this.pda.orca.generateOrcaPositionPDA(positionMint);
|
|
130
|
+
const positionTokenAccount = this.pda.orca.generatePositionTokenAccount(userPda, positionMint, is2022Position);
|
|
131
|
+
// Generate orca auto open position with token extension instruction
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
const ix = yield anchor_1.Anchor.instance().iyfExtension
|
|
134
|
+
.methods
|
|
135
|
+
.orcaAutoOpenPositionWithTokenExtension(tickLowerIndex, tickUpperIndex, withTokenMetadata)
|
|
136
|
+
.accounts({
|
|
137
|
+
userPda,
|
|
138
|
+
hawksightAuthority: addresses_1.HS_AUTHORITY,
|
|
139
|
+
position,
|
|
140
|
+
positionMint,
|
|
141
|
+
positionTokenAccount,
|
|
142
|
+
whirlpool,
|
|
143
|
+
token2022Program: addresses_1.TOKEN_2022,
|
|
144
|
+
systemProgram: web3.SystemProgram.programId,
|
|
145
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
146
|
+
metadataUpdateAuth: addresses_1.ORCA_METADATA_UPDATE_AUTH,
|
|
147
|
+
orcaWhirlpoolProgram: addresses_1.ORCA_WHIRLPOOL_PROGRAM,
|
|
148
|
+
})
|
|
149
|
+
.instruction();
|
|
150
|
+
// Wrap instruction in iyf extension executeV2 (iyf-main)
|
|
151
|
+
return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
|
|
152
|
+
userPda,
|
|
153
|
+
authority: addresses_1.HS_AUTHORITY,
|
|
154
|
+
ix
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Orca auto close position with Token2022 (Automation)
|
|
160
|
+
*/
|
|
161
|
+
orcaAutoClosePositionWithTokenExtension(_a) {
|
|
162
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, positionMint, is2022Position = true, }) {
|
|
163
|
+
// Initialize anchor
|
|
164
|
+
anchor_1.Anchor.initialize(connection);
|
|
165
|
+
// Generate user pda
|
|
166
|
+
const userPda = (0, functions_1.generateUserPda)(userWallet);
|
|
167
|
+
// Generate position and position token account
|
|
168
|
+
const position = this.pda.orca.generateOrcaPositionPDA(positionMint);
|
|
169
|
+
const positionTokenAccount = this.pda.orca.generatePositionTokenAccount(userPda, positionMint, is2022Position);
|
|
170
|
+
// Generate orca auto close position with token extension instruction
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
const ix = yield anchor_1.Anchor.instance().iyfExtension
|
|
173
|
+
.methods
|
|
174
|
+
.orcaAutoClosePositionWithTokenExtension()
|
|
175
|
+
.accounts({
|
|
176
|
+
userPda,
|
|
177
|
+
hawksightAuthority: addresses_1.HS_AUTHORITY,
|
|
178
|
+
position,
|
|
179
|
+
positionMint,
|
|
180
|
+
positionTokenAccount,
|
|
181
|
+
token2022Program: addresses_1.TOKEN_2022,
|
|
182
|
+
orcaWhirlpoolProgram: addresses_1.ORCA_WHIRLPOOL_PROGRAM,
|
|
183
|
+
})
|
|
184
|
+
.instruction();
|
|
185
|
+
// Wrap instruction in iyf extension executeV2 (iyf-main)
|
|
186
|
+
return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
|
|
187
|
+
userPda,
|
|
188
|
+
authority: addresses_1.HS_AUTHORITY,
|
|
189
|
+
ix
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Orca open position with Token2022 (User)
|
|
195
|
+
*/
|
|
196
|
+
orcaOpenPositionWithTokenExtension(_a) {
|
|
197
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, positionMint, whirlpool, tickLowerIndex, tickUpperIndex, withTokenMetadata, is2022Position = true, }) {
|
|
198
|
+
// Initialize anchor
|
|
199
|
+
anchor_1.Anchor.initialize(connection);
|
|
200
|
+
// Generate user pda
|
|
201
|
+
const userPda = (0, functions_1.generateUserPda)(userWallet);
|
|
202
|
+
// Generate position and position token account
|
|
203
|
+
const position = this.pda.orca.generateOrcaPositionPDA(positionMint);
|
|
204
|
+
const positionTokenAccount = this.pda.orca.generatePositionTokenAccount(userPda, positionMint, is2022Position);
|
|
205
|
+
// Generate orca open position with token extension instruction
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
const ix = yield anchor_1.Anchor.instance().iyfExtension
|
|
208
|
+
.methods
|
|
209
|
+
.orcaOpenPositionWithTokenExtension(tickLowerIndex, tickUpperIndex, withTokenMetadata)
|
|
210
|
+
.accounts({
|
|
211
|
+
userPda,
|
|
212
|
+
authority: userWallet,
|
|
213
|
+
position,
|
|
214
|
+
positionMint,
|
|
215
|
+
positionTokenAccount,
|
|
216
|
+
whirlpool,
|
|
217
|
+
token2022Program: addresses_1.TOKEN_2022,
|
|
218
|
+
systemProgram: web3.SystemProgram.programId,
|
|
219
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
220
|
+
metadataUpdateAuth: addresses_1.ORCA_METADATA_UPDATE_AUTH,
|
|
221
|
+
orcaWhirlpoolProgram: addresses_1.ORCA_WHIRLPOOL_PROGRAM,
|
|
222
|
+
})
|
|
223
|
+
.instruction();
|
|
224
|
+
// Wrap instruction in iyf extension executeV2 (iyf-main)
|
|
225
|
+
return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
|
|
226
|
+
userPda,
|
|
227
|
+
authority: userWallet,
|
|
228
|
+
ix
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Orca close position with Token2022 (User)
|
|
234
|
+
*/
|
|
235
|
+
orcaClosePositionWithTokenExtension(_a) {
|
|
236
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, userWallet, positionMint, is2022Position = true, }) {
|
|
237
|
+
// Initialize anchor
|
|
238
|
+
anchor_1.Anchor.initialize(connection);
|
|
239
|
+
// Generate user pda
|
|
240
|
+
const userPda = (0, functions_1.generateUserPda)(userWallet);
|
|
241
|
+
// Generate position and position token account
|
|
242
|
+
const position = this.pda.orca.generateOrcaPositionPDA(positionMint);
|
|
243
|
+
const positionTokenAccount = this.pda.orca.generatePositionTokenAccount(userPda, positionMint, is2022Position);
|
|
244
|
+
// Generate orca close position with token extension instruction
|
|
245
|
+
// @ts-ignore
|
|
246
|
+
const ix = yield anchor_1.Anchor.instance().iyfExtension
|
|
247
|
+
.methods
|
|
248
|
+
.orcaClosePositionWithTokenExtension()
|
|
249
|
+
.accounts({
|
|
250
|
+
userPda,
|
|
251
|
+
authority: userWallet,
|
|
252
|
+
position,
|
|
253
|
+
positionMint,
|
|
254
|
+
positionTokenAccount,
|
|
255
|
+
token2022Program: addresses_1.TOKEN_2022,
|
|
256
|
+
orcaWhirlpoolProgram: addresses_1.ORCA_WHIRLPOOL_PROGRAM,
|
|
257
|
+
})
|
|
258
|
+
.instruction();
|
|
259
|
+
// Wrap instruction in iyf extension executeV2 (iyf-main)
|
|
260
|
+
return yield this.iyfMain.iyfExtensionExecuteV2(connection, {
|
|
261
|
+
userPda,
|
|
262
|
+
authority: userWallet,
|
|
263
|
+
ix
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
}
|
|
118
267
|
}
|
|
119
268
|
exports.OrcaIxGenerator = OrcaIxGenerator;
|
|
@@ -12,5 +12,13 @@ export declare class OrcaPdaGenerator {
|
|
|
12
12
|
* @returns
|
|
13
13
|
*/
|
|
14
14
|
generateOrcaPositionPDA(positionMint: web3.PublicKey): web3.PublicKey;
|
|
15
|
+
/**
|
|
16
|
+
* Generate position token account based on token program type
|
|
17
|
+
* @param userPda - User PDA account
|
|
18
|
+
* @param positionMint - Position mint (NFT mint)
|
|
19
|
+
* @param is2022Position - Whether this is a Token2022 position (default: false)
|
|
20
|
+
* @returns Position token account address
|
|
21
|
+
*/
|
|
22
|
+
generatePositionTokenAccount(userPda: web3.PublicKey, positionMint: web3.PublicKey, is2022Position?: boolean): web3.PublicKey;
|
|
15
23
|
}
|
|
16
24
|
//# sourceMappingURL=OrcaPdaGenerator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrcaPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/OrcaPdaGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"OrcaPdaGenerator.d.ts","sourceRoot":"","sources":["../../../src/pdaGenerator/OrcaPdaGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAIxC;;GAEG;AACH,qBAAa,gBAAgB;IAE3B;;;;;;OAMG;IACH,uBAAuB,CACrB,YAAY,EAAE,IAAI,CAAC,SAAS,GAC3B,IAAI,CAAC,SAAS;IAQjB;;;;;;OAMG;IACH,4BAA4B,CAC1B,OAAO,EAAE,IAAI,CAAC,SAAS,EACvB,YAAY,EAAE,IAAI,CAAC,SAAS,EAC5B,cAAc,GAAE,OAAe,GAC9B,IAAI,CAAC,SAAS;CAKlB"}
|