@hawksightco/hawk-sdk 1.1.41 → 1.1.42-rc2
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/anchor.d.ts +113 -1
- package/dist/src/anchor.d.ts.map +1 -1
- package/dist/src/anchor.js +33 -1
- package/dist/src/classes/HawkAPI.d.ts.map +1 -1
- package/dist/src/classes/HawkAPI.js +2 -0
- package/dist/src/classes/Transactions.d.ts +21 -1
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +77 -1
- package/dist/src/classes/TxGeneratorAutomations.d.ts +12 -1
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +36 -0
- package/dist/src/idl/iyf-extension-idl.d.ts +6359 -4318
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +6364 -4329
- package/dist/src/idl/meteora-idl.d.ts +5251 -0
- package/dist/src/idl/meteora-idl.d.ts.map +1 -0
- package/dist/src/idl/meteora-idl.js +5252 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +14 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +65 -0
- package/dist/src/types.d.ts +10 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +2 -0
- package/package.json +1 -1
package/dist/src/anchor.d.ts
CHANGED
|
@@ -2,8 +2,118 @@
|
|
|
2
2
|
import * as web3 from "@solana/web3.js";
|
|
3
3
|
import * as anchor from "@coral-xyz/anchor";
|
|
4
4
|
import { IndexYieldFarming } from "./idl/iyf-main-idl";
|
|
5
|
-
import { IyfExtension } from "./idl/iyf-extension-idl";
|
|
5
|
+
import { IyfExtension as IyfExtensionNew } from "./idl/iyf-extension-idl";
|
|
6
6
|
import { Whirlpool } from "./idl/orca-idl";
|
|
7
|
+
import { LbClmm } from "./idl/meteora-idl";
|
|
8
|
+
type IdlInstruction = {
|
|
9
|
+
name: string;
|
|
10
|
+
docs?: string[];
|
|
11
|
+
accounts: IdlAccountItem[];
|
|
12
|
+
args: IdlField[];
|
|
13
|
+
returns?: IdlType;
|
|
14
|
+
};
|
|
15
|
+
type IdlAccountItem = IdlAccount | IdlAccounts;
|
|
16
|
+
type IdlAccount = {
|
|
17
|
+
name: string;
|
|
18
|
+
isMut: boolean;
|
|
19
|
+
isSigner: boolean;
|
|
20
|
+
isOptional?: boolean;
|
|
21
|
+
docs?: string[];
|
|
22
|
+
relations?: string[];
|
|
23
|
+
pda?: IdlPda;
|
|
24
|
+
};
|
|
25
|
+
type IdlPda = {
|
|
26
|
+
seeds: IdlSeed[];
|
|
27
|
+
programId?: IdlSeed;
|
|
28
|
+
};
|
|
29
|
+
type IdlSeed = any;
|
|
30
|
+
type IdlAccounts = {
|
|
31
|
+
name: string;
|
|
32
|
+
docs?: string[];
|
|
33
|
+
accounts: IdlAccountItem[];
|
|
34
|
+
};
|
|
35
|
+
type IdlField = {
|
|
36
|
+
name: string;
|
|
37
|
+
docs?: string[];
|
|
38
|
+
type: IdlType;
|
|
39
|
+
};
|
|
40
|
+
type IdlType = "bool" | "u8" | "i8" | "u16" | "i16" | "u32" | "i32" | "f32" | "u64" | "i64" | "f64" | "u128" | "i128" | "u256" | "i256" | "bytes" | "string" | "publicKey" | IdlTypeDefined | IdlTypeOption | IdlTypeCOption | IdlTypeVec | IdlTypeArray;
|
|
41
|
+
type IdlTypeDefined = {
|
|
42
|
+
defined: string;
|
|
43
|
+
};
|
|
44
|
+
type IdlTypeOption = {
|
|
45
|
+
option: IdlType;
|
|
46
|
+
};
|
|
47
|
+
type IdlTypeCOption = {
|
|
48
|
+
coption: IdlType;
|
|
49
|
+
};
|
|
50
|
+
type IdlTypeVec = {
|
|
51
|
+
vec: IdlType;
|
|
52
|
+
};
|
|
53
|
+
type IdlTypeArray = {
|
|
54
|
+
array: [idlType: IdlType, size: number];
|
|
55
|
+
};
|
|
56
|
+
type IdlAccountDef = {
|
|
57
|
+
name: string;
|
|
58
|
+
docs?: string[];
|
|
59
|
+
type: IdlTypeDefTyStruct;
|
|
60
|
+
};
|
|
61
|
+
type IdlTypeDefTyStruct = {
|
|
62
|
+
kind: "struct";
|
|
63
|
+
fields: IdlTypeDefStruct;
|
|
64
|
+
};
|
|
65
|
+
type IdlTypeDefStruct = Array<IdlField>;
|
|
66
|
+
type IdlTypeDef = {
|
|
67
|
+
name: string;
|
|
68
|
+
docs?: string[];
|
|
69
|
+
type: IdlTypeDefTy;
|
|
70
|
+
};
|
|
71
|
+
type IdlTypeDefTy = IdlTypeDefTyEnum | IdlTypeDefTyStruct | IdlTypeDefTyAlias;
|
|
72
|
+
type IdlTypeDefTyEnum = {
|
|
73
|
+
kind: "enum";
|
|
74
|
+
variants: IdlEnumVariant[];
|
|
75
|
+
};
|
|
76
|
+
type IdlEnumVariant = {
|
|
77
|
+
name: string;
|
|
78
|
+
fields?: IdlEnumFields;
|
|
79
|
+
};
|
|
80
|
+
type IdlTypeDefTyAlias = {
|
|
81
|
+
kind: "alias";
|
|
82
|
+
value: IdlType;
|
|
83
|
+
};
|
|
84
|
+
type IdlEnumFields = IdlEnumFieldsNamed | IdlEnumFieldsTuple;
|
|
85
|
+
type IdlEnumFieldsNamed = IdlField[];
|
|
86
|
+
type IdlEnumFieldsTuple = IdlType[];
|
|
87
|
+
type Instruction<I extends number> = {
|
|
88
|
+
name: IyfExtensionNew["instructions"][I]["name"];
|
|
89
|
+
accounts: IyfExtensionNew["instructions"][I]["accounts"];
|
|
90
|
+
args: IyfExtensionNew["instructions"][I]["args"];
|
|
91
|
+
} & IdlInstruction;
|
|
92
|
+
type GenerateInstructions<T extends any[], I extends number[] = []> = I["length"] extends T["length"] ? [] : [
|
|
93
|
+
Instruction<I["length"]>,
|
|
94
|
+
...GenerateInstructions<T, [...I, I["length"]]>
|
|
95
|
+
];
|
|
96
|
+
type FilteredInstructions = GenerateInstructions<IyfExtensionNew["instructions"]>;
|
|
97
|
+
type FindMatchingType<Name, Types extends any[]> = Types extends Array<infer T> ? T extends {
|
|
98
|
+
name: Name;
|
|
99
|
+
type: infer Type;
|
|
100
|
+
} ? Type : never : never;
|
|
101
|
+
type Account<I extends number> = {
|
|
102
|
+
name: unknown extends IyfExtensionNew["accounts"][I]["name"] ? never : IyfExtensionNew["accounts"][I]["name"];
|
|
103
|
+
type: unknown extends IyfExtensionNew["accounts"][I]["name"] ? never : FindMatchingType<IyfExtensionNew["accounts"][I]["name"], IyfExtensionNew["types"]>;
|
|
104
|
+
} & IdlAccountDef;
|
|
105
|
+
type GenerateAccounts<T extends any[], I extends number[] = []> = I["length"] extends T["length"] ? [] : [
|
|
106
|
+
Account<I["length"]>,
|
|
107
|
+
...GenerateAccounts<T, [...I, I["length"]]>
|
|
108
|
+
];
|
|
109
|
+
type FilteredAccounts = GenerateAccounts<IyfExtensionNew["accounts"]>;
|
|
110
|
+
export type IyfExtension = {
|
|
111
|
+
"version": string;
|
|
112
|
+
"name": string;
|
|
113
|
+
"instructions": FilteredInstructions;
|
|
114
|
+
"accounts": FilteredAccounts;
|
|
115
|
+
"types": IyfExtensionNew["types"] & Array<IdlTypeDef>;
|
|
116
|
+
};
|
|
7
117
|
export declare class Anchor {
|
|
8
118
|
connection: web3.Connection;
|
|
9
119
|
private static _instance;
|
|
@@ -11,8 +121,10 @@ export declare class Anchor {
|
|
|
11
121
|
iyfMain: anchor.Program<IndexYieldFarming>;
|
|
12
122
|
iyfExtension: anchor.Program<IyfExtension>;
|
|
13
123
|
orcaProgram: anchor.Program<Whirlpool>;
|
|
124
|
+
meteoraProgram: anchor.Program<LbClmm>;
|
|
14
125
|
private constructor();
|
|
15
126
|
static initialize(connection: web3.Connection): void;
|
|
16
127
|
static instance(): Anchor;
|
|
17
128
|
}
|
|
129
|
+
export {};
|
|
18
130
|
//# sourceMappingURL=anchor.d.ts.map
|
package/dist/src/anchor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/anchor.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAmB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAwB,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/anchor.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAmB,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAwB,YAAY,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAqB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAkB,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAS3D,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AACF,KAAK,cAAc,GAAG,UAAU,GAAG,WAAW,CAAC;AAC/C,KAAK,UAAU,GAAG;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,CAAC,EAAE,MAA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ACE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpB,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC5C,CAAC;AAER,KAAK,gBAAgB,GAAG,gBAAgB,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;AAEtE,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,oBAAoB,CAAC;IACrC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,EAAE,eAAe,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;CACvD,CAAC;AAEF,qBAAa,MAAM;IAUR,UAAU,EAAE,IAAI,CAAC,UAAU;IARpC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAS;IACjC,QAAQ,EAAE,MAAM,CAAC,cAAc,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACvC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,OAAO;IAwCP,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAI7C,MAAM,CAAC,QAAQ,IAAI,MAAM;CAO1B"}
|
package/dist/src/anchor.js
CHANGED
|
@@ -32,6 +32,7 @@ const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
|
32
32
|
const iyf_main_idl_1 = require("./idl/iyf-main-idl");
|
|
33
33
|
const iyf_extension_idl_1 = require("./idl/iyf-extension-idl");
|
|
34
34
|
const orca_idl_1 = require("./idl/orca-idl");
|
|
35
|
+
const meteora_idl_1 = require("./idl/meteora-idl");
|
|
35
36
|
const nodewallet_1 = __importDefault(require("@coral-xyz/anchor/dist/cjs/nodewallet"));
|
|
36
37
|
const addresses_1 = require("./addresses");
|
|
37
38
|
class Anchor {
|
|
@@ -39,8 +40,39 @@ class Anchor {
|
|
|
39
40
|
this.connection = connection;
|
|
40
41
|
this.provider = new anchor.AnchorProvider(connection, new nodewallet_1.default(web3.Keypair.generate()), {});
|
|
41
42
|
this.iyfMain = new anchor.Program(iyf_main_idl_1.IDL, addresses_1.IYF_MAIN, this.provider);
|
|
42
|
-
|
|
43
|
+
const p = iyf_extension_idl_1.IDL.instructions.map(instruction => {
|
|
44
|
+
return {
|
|
45
|
+
name: instruction.name,
|
|
46
|
+
accounts: [instruction.accounts.map(account => {
|
|
47
|
+
return {
|
|
48
|
+
name: account.name,
|
|
49
|
+
isMut: "writable" in account ? account.writable : false,
|
|
50
|
+
isSigner: "signer" in account ? account.signer : false,
|
|
51
|
+
};
|
|
52
|
+
})],
|
|
53
|
+
args: instruction.args,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const IyfExtension = {
|
|
57
|
+
version: iyf_extension_idl_1.IDL.metadata.version,
|
|
58
|
+
name: iyf_extension_idl_1.IDL.metadata.name,
|
|
59
|
+
instructions: iyf_extension_idl_1.IDL.instructions.map((instruction, index) => {
|
|
60
|
+
return {
|
|
61
|
+
name: instruction.name,
|
|
62
|
+
accounts: instruction.accounts.map(account => {
|
|
63
|
+
return {
|
|
64
|
+
name: account.name,
|
|
65
|
+
isMut: "writable" in account ? account.writable : false,
|
|
66
|
+
isSigner: "signer" in account ? account.signer : false,
|
|
67
|
+
};
|
|
68
|
+
}),
|
|
69
|
+
args: instruction.args,
|
|
70
|
+
};
|
|
71
|
+
}),
|
|
72
|
+
};
|
|
73
|
+
this.iyfExtension = new anchor.Program(IyfExtension, addresses_1.IYF_EXTENSION, this.provider);
|
|
43
74
|
this.orcaProgram = new anchor.Program(orca_idl_1.IDL, addresses_1.ORCA_WHIRLPOOL_PROGRAM, this.provider);
|
|
75
|
+
this.meteoraProgram = new anchor.Program(meteora_idl_1.IDL, addresses_1.METEORA_DLMM_PROGRAM, this.provider);
|
|
44
76
|
}
|
|
45
77
|
static initialize(connection) {
|
|
46
78
|
Anchor._instance = new Anchor(connection);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HawkAPI.d.ts","sourceRoot":"","sources":["../../../src/classes/HawkAPI.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"HawkAPI.d.ts","sourceRoot":"","sources":["../../../src/classes/HawkAPI.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eA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,mBAAmB;IACnB,SAAgB,OAAO,EAAE,WAAW,CAAC;IAErC,mBAAmB;IACnB,SAAgB,WAAW,EAAE,WAAW,CAAC;IAEzC;;;OAGG;gBAEkB,GAAG,GAAE,MAAoC,EACzC,OAAO,CAAC,4BAAgB;IA2B7C;;;;OAIG;IACH,mBAAmB,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,KAAK,WAAW;IAI9F;;;;OAIG;IACH,YAAY,CAAC,EAAC,oBAAoB,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,EAAE,6BAA6B;IAW5G;;;;OAIG;IACH,SAAS,CAAC,EAAC,oBAAoB,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAC,EAAE,6BAA6B;IAYzG;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO;CAGtB"}
|
|
@@ -16,6 +16,7 @@ const Atomicity_1 = require("./Atomicity");
|
|
|
16
16
|
const JupiterAlts_1 = require("./JupiterAlts");
|
|
17
17
|
const JupiterSwap_1 = require("./JupiterSwap");
|
|
18
18
|
const Logging_1 = require("./Logging");
|
|
19
|
+
const Transactions_1 = require("./Transactions");
|
|
19
20
|
/**
|
|
20
21
|
* HawkAPI is a central gateway class that aggregates access to various functional modules
|
|
21
22
|
* for interacting with HawkSight's blockchain APIs. This class initializes and exposes modules
|
|
@@ -46,6 +47,7 @@ class HawkAPI {
|
|
|
46
47
|
this.ix = new SimpleIxGenerator_1.SimpleIxGenerator();
|
|
47
48
|
this.jupAlts = new JupiterAlts_1.JupiterAlts();
|
|
48
49
|
this.jupiterSwap = new JupiterSwap_1.JupiterSwap(this.ix);
|
|
50
|
+
Transactions_1.txgen.ix = this.ix;
|
|
49
51
|
// Load create tx metadata module
|
|
50
52
|
if (this.options === undefined || !this.options.disableTxMetadataLoad) {
|
|
51
53
|
CreateTxMetadata_1.CreateTxMetadata.instance().load();
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
/// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
|
|
2
2
|
import * as web3 from "@solana/web3.js";
|
|
3
|
-
import { MeteoraClaim, MeteoraClaimAll, MeteoraClose, MeteoraCompound, MeteoraCreatePositionAndDeposit, MeteoraDeposit, MeteoraInitializeBinArrays, MeteoraRebalance, MeteoraWithdraw, Register, TxgenParams, InitializeStorageTokenAccount, MeteoraLimitCloseAutomation, OrcaOpenPosition, OrcaClosePosition, OrcaDeposit, OrcaWithdraw, OrcaClaimRewards, TransactionMetadataResponse } from '../types';
|
|
3
|
+
import { MeteoraClaim, MeteoraClaimAll, MeteoraClose, MeteoraCompound, MeteoraCreatePositionAndDeposit, MeteoraDeposit, MeteoraInitializeBinArrays, MeteoraRebalance, MeteoraWithdraw, Register, TxgenParams, InitializeStorageTokenAccount, MeteoraLimitCloseAutomation, OrcaOpenPosition, OrcaClosePosition, OrcaDeposit, OrcaWithdraw, OrcaClaimRewards, TransactionMetadataResponse, MeteoraRebalance2 } from '../types';
|
|
4
4
|
import { GeneralUtility } from "./GeneralUtility";
|
|
5
5
|
import { MultiTransaction } from "./MultiTransaction";
|
|
6
|
+
import { SimpleIxGenerator } from "./SimpleIxGenerator";
|
|
6
7
|
export declare class Transactions {
|
|
8
|
+
/**
|
|
9
|
+
* Prohibit creating instance other than getInstance
|
|
10
|
+
*/
|
|
11
|
+
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Singleton instance
|
|
14
|
+
*/
|
|
15
|
+
private static instance;
|
|
16
|
+
/**
|
|
17
|
+
* Simple IX Generator instance (overridable)
|
|
18
|
+
*/
|
|
19
|
+
ix: SimpleIxGenerator;
|
|
20
|
+
/**
|
|
21
|
+
* Get singleton instance
|
|
22
|
+
*
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
static getInstance(): Transactions;
|
|
7
26
|
/**
|
|
8
27
|
* Generate UserPDA
|
|
9
28
|
*
|
|
@@ -86,6 +105,7 @@ export declare class Transactions {
|
|
|
86
105
|
meteoraClosePosition({ connection, params, }: TxgenParams<MeteoraClose>): Promise<TransactionMetadataResponse>;
|
|
87
106
|
compoundAutomationIx({ connection, params, }: TxgenParams<MeteoraCompound>): Promise<TransactionMetadataResponse>;
|
|
88
107
|
rebalanceAutomationIx({ connection, params, }: TxgenParams<MeteoraRebalance>): Promise<TransactionMetadataResponse>;
|
|
108
|
+
rebalanceAutomationIx2({ connection, params, }: TxgenParams<MeteoraRebalance2>): Promise<TransactionMetadataResponse>;
|
|
89
109
|
/**
|
|
90
110
|
* Creates instructions to initialize storage token accounts
|
|
91
111
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAiBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAER,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAiBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAER,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,UA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W,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAuHzG;;;;;;;OAOG;IACG,YAAY,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAyF3G;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAqGpH;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
|
|
@@ -51,7 +51,25 @@ const types_2 = require("../types");
|
|
|
51
51
|
const Logging_1 = require("./Logging");
|
|
52
52
|
const TransactionBatchExecute2_1 = require("./TransactionBatchExecute2");
|
|
53
53
|
const CreateTxMetadata_1 = require("./CreateTxMetadata");
|
|
54
|
+
const SimpleIxGenerator_1 = require("./SimpleIxGenerator");
|
|
54
55
|
class Transactions {
|
|
56
|
+
/**
|
|
57
|
+
* Prohibit creating instance other than getInstance
|
|
58
|
+
*/
|
|
59
|
+
constructor() {
|
|
60
|
+
this.ix = new SimpleIxGenerator_1.SimpleIxGenerator();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get singleton instance
|
|
64
|
+
*
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
static getInstance() {
|
|
68
|
+
if (Transactions.instance === undefined) {
|
|
69
|
+
Transactions.instance = new Transactions();
|
|
70
|
+
}
|
|
71
|
+
return Transactions.instance;
|
|
72
|
+
}
|
|
55
73
|
/**
|
|
56
74
|
* Generate UserPDA
|
|
57
75
|
*
|
|
@@ -479,6 +497,64 @@ class Transactions {
|
|
|
479
497
|
});
|
|
480
498
|
});
|
|
481
499
|
}
|
|
500
|
+
rebalanceAutomationIx2(_a) {
|
|
501
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
502
|
+
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
503
|
+
const position = yield program.account.positionV2.fetch(params.currentPosition);
|
|
504
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, position.lbPair);
|
|
505
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
506
|
+
// Step 1: Claim all fees/rewards, remove all liquidity and close current position
|
|
507
|
+
const { userPositions } = yield dlmmPool.getPositionsByUserAndLbPair(userPda);
|
|
508
|
+
const userPosition = userPositions.find(userPosition => userPosition.publicKey.equals(params.currentPosition));
|
|
509
|
+
if (userPosition === undefined) {
|
|
510
|
+
throw new Error(`Position: ${params.currentPosition} does not exist.`);
|
|
511
|
+
}
|
|
512
|
+
const binIdsToRemove = userPosition.positionData.positionBinData.map((bin) => bin.binId);
|
|
513
|
+
const removeLiquidityBuilder = yield dlmmPool.removeLiquidity(params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
514
|
+
user: userPda,
|
|
515
|
+
position: params.currentPosition,
|
|
516
|
+
binIds: binIdsToRemove,
|
|
517
|
+
bps: new bn_js_1.default(10000),
|
|
518
|
+
shouldClaimAndClose: true,
|
|
519
|
+
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
520
|
+
if (!!params.useAta) {
|
|
521
|
+
removeLiquidityBuilder.replaceClaimFeeTokenToATA();
|
|
522
|
+
removeLiquidityBuilder.replaceClaimRewardToATA();
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
removeLiquidityBuilder.replaceClaimFeeTokenToSTA();
|
|
526
|
+
removeLiquidityBuilder.replaceClaimRewardToSTA();
|
|
527
|
+
}
|
|
528
|
+
// Re-deposit fees (TODO: How to re-deposit reward tokens that is not X or Y token?)
|
|
529
|
+
const { userWallet, newPosition, relativeBinRange, distribution, checkRange } = params;
|
|
530
|
+
const redepositIx = yield this.ix.meteoraDlmm.redepositAutomation(connection, {
|
|
531
|
+
userWallet,
|
|
532
|
+
lbPair: position.lbPair,
|
|
533
|
+
position: newPosition,
|
|
534
|
+
relativeLowerBinId: relativeBinRange.lowerRange,
|
|
535
|
+
relativeUpperBinId: relativeBinRange.upperRange,
|
|
536
|
+
strategyType: types_1.StrategyTypeMap[distribution],
|
|
537
|
+
checkRange: checkRange ? {
|
|
538
|
+
minBinId: checkRange.lowerRange,
|
|
539
|
+
maxBinId: checkRange.upperRange,
|
|
540
|
+
} : undefined,
|
|
541
|
+
});
|
|
542
|
+
const mainInstructions = [
|
|
543
|
+
// Initialize required ATA
|
|
544
|
+
...removeLiquidityBuilder.createAtaIxs,
|
|
545
|
+
// Remove liquidity
|
|
546
|
+
...removeLiquidityBuilder.mainIxs,
|
|
547
|
+
// Re-deposit liquidity
|
|
548
|
+
redepositIx,
|
|
549
|
+
];
|
|
550
|
+
return (0, functions_1.createTransactionMeta)({
|
|
551
|
+
payer: params.userWallet,
|
|
552
|
+
description: "Automation IX: Meteora Auto-rebalance instructions (Close position and deposit to new position)",
|
|
553
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
554
|
+
mainInstructions,
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
}
|
|
482
558
|
/**
|
|
483
559
|
* Creates instructions to initialize storage token accounts
|
|
484
560
|
*
|
|
@@ -1112,4 +1188,4 @@ class Transactions {
|
|
|
1112
1188
|
}
|
|
1113
1189
|
}
|
|
1114
1190
|
exports.Transactions = Transactions;
|
|
1115
|
-
exports.txgen =
|
|
1191
|
+
exports.txgen = Transactions.getInstance();
|
|
@@ -1,7 +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 * as _client from "@hawksightco/swagger-client";
|
|
4
|
-
import { MeteoraCompound, MeteoraLimitCloseAutomation, MeteoraRebalance, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
4
|
+
import { MeteoraCompound, MeteoraLimitCloseAutomation, MeteoraRebalance, MeteoraRebalance2, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
5
5
|
import { Client } from "./Client";
|
|
6
6
|
import { GeneralUtility } from "./GeneralUtility";
|
|
7
7
|
/**
|
|
@@ -50,6 +50,17 @@ export declare class TxGeneratorAutomations {
|
|
|
50
50
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
51
51
|
*/
|
|
52
52
|
meteoraRebalanceIxs(connection: web3.Connection, payer: string, params: MeteoraRebalance): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
53
|
+
/**
|
|
54
|
+
* Creates meteora auto-rebalance instruction (uses new re-deposit instruction)
|
|
55
|
+
*
|
|
56
|
+
* NOTE: For hawksight devs only.
|
|
57
|
+
*
|
|
58
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
59
|
+
* @param payer The public key of the payer for transaction fees.
|
|
60
|
+
* @param params Parameters required
|
|
61
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
62
|
+
*/
|
|
63
|
+
meteoraRebalanceIxs2(connection: web3.Connection, payer: string, params: MeteoraRebalance2): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
53
64
|
/**
|
|
54
65
|
* Creates meteora close limit instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
55
66
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxGeneratorAutomations.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGeneratorAutomations.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAoD,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TxGeneratorAutomations.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGeneratorAutomations.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;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CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA4B9J"}
|
|
@@ -128,6 +128,42 @@ class TxGeneratorAutomations {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Creates meteora auto-rebalance instruction (uses new re-deposit instruction)
|
|
133
|
+
*
|
|
134
|
+
* NOTE: For hawksight devs only.
|
|
135
|
+
*
|
|
136
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
137
|
+
* @param payer The public key of the payer for transaction fees.
|
|
138
|
+
* @param params Parameters required
|
|
139
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
140
|
+
*/
|
|
141
|
+
meteoraRebalanceIxs2(connection, payer, params) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
// Initialize anchor
|
|
144
|
+
anchor_1.Anchor.initialize(connection);
|
|
145
|
+
try {
|
|
146
|
+
const result = yield Transactions_1.txgen.rebalanceAutomationIx2({
|
|
147
|
+
connection,
|
|
148
|
+
params,
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
status: 200,
|
|
152
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
return {
|
|
157
|
+
status: 400,
|
|
158
|
+
data: {
|
|
159
|
+
code: "custom",
|
|
160
|
+
message: e,
|
|
161
|
+
path: [],
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
131
167
|
/**
|
|
132
168
|
* Creates meteora close limit instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
133
169
|
*
|