@hawksightco/hawk-sdk 1.2.10 → 1.2.12
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 +2 -0
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +65 -0
- package/dist/src/classes/TxGeneratorAutomations.d.ts +23 -1
- package/dist/src/classes/TxGeneratorAutomations.d.ts.map +1 -1
- package/dist/src/classes/TxGeneratorAutomations.js +74 -0
- package/dist/src/hawksight.d.ts +14 -0
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +95 -5
- package/dist/src/idl/iyf-main-idl.d.ts +129 -0
- package/dist/src/idl/iyf-main-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-main-idl.js +129 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +28 -2
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +23 -3
- package/dist/src/meteora.js +6 -6
- package/package.json +1 -1
|
@@ -149,6 +149,8 @@ export declare class Transactions {
|
|
|
149
149
|
claimAutomationIx({ connection, params, }: TxgenParams<MeteoraCompound>): Promise<TransactionMetadataResponse>;
|
|
150
150
|
rebalanceAutomationIx({ connection, params, }: TxgenParams<MeteoraRebalance>): Promise<TransactionMetadataResponse>;
|
|
151
151
|
rebalanceAutomationIx2({ connection, params, }: TxgenParams<MeteoraRebalance2>): Promise<TransactionMetadataResponse>;
|
|
152
|
+
openAutomationIx({ connection, params, }: TxgenParams<MeteoraCreatePositionAndDeposit>): Promise<TransactionMetadataResponse>;
|
|
153
|
+
closeAutomationIx({ connection, params, }: TxgenParams<MeteoraClose>): Promise<TransactionMetadataResponse>;
|
|
152
154
|
limitCloseAutomationIx({ connection, params, }: TxgenParams<MeteoraLimitCloseAutomation>): Promise<TransactionMetadataResponse>;
|
|
153
155
|
private removeLiquidityByRangeInfo;
|
|
154
156
|
/**
|
|
@@ -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,EAGR,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAyBlB,OAAO,EAEL,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAKlB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAYxD,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO;IAIP;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAe;IAEtC;;OAEG;IACI,EAAE,EAAE,iBAAiB,CAAC;IAE7B;;;;OAIG;IACH,MAAM,CAAC,WAAW,IAAI,YAAY;IAOlC;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,IAAI,CAAC,SAAS,EAC1B,IAAI,GAAE,IAAI,CAAC,SAAqB,GAC/B,IAAI,CAAC,SAAS;IAIjB;;;;;;;OAOG;IACG,QAAQ,CAAC,EACb,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAA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C,EAC7B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,wBAAwB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAiChF;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
|
|
@@ -836,6 +836,71 @@ class Transactions {
|
|
|
836
836
|
});
|
|
837
837
|
});
|
|
838
838
|
}
|
|
839
|
+
openAutomationIx(_a) {
|
|
840
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
841
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, params.pool);
|
|
842
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
843
|
+
// Open new position
|
|
844
|
+
const initPositionAndAddLiquidityBuilder = yield dlmmPool.initializePositionAndAddLiquidityByStrategy(params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
845
|
+
positionPubKey: params.position,
|
|
846
|
+
user: userPda,
|
|
847
|
+
totalXAmount: new bn_js_1.default(100000), // This is overriden on-chain, so value here do not matter
|
|
848
|
+
totalYAmount: new bn_js_1.default(100000), // This is overriden on-chain, so value here do not matter
|
|
849
|
+
strategy: {
|
|
850
|
+
maxBinId: params.binRange.upperRange,
|
|
851
|
+
minBinId: params.binRange.lowerRange,
|
|
852
|
+
strategyType: types_1.StrategyTypeMap[params.distribution],
|
|
853
|
+
},
|
|
854
|
+
skipInputTokenCheck: true, // Rebalance should be independent of user wallet TA
|
|
855
|
+
pdaTokenType: types_1.TokenType.STA,
|
|
856
|
+
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
857
|
+
const mainInstructions = [
|
|
858
|
+
...initPositionAndAddLiquidityBuilder.mainIxs,
|
|
859
|
+
];
|
|
860
|
+
return (0, functions_1.createTransactionMeta)({
|
|
861
|
+
payer: params.userWallet,
|
|
862
|
+
description: "Automation IX: Meteora Open instruction (Open position)",
|
|
863
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
864
|
+
mainInstructions,
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
closeAutomationIx(_a) {
|
|
869
|
+
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
870
|
+
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
871
|
+
const position = yield program.account.positionV2.fetch(params.position);
|
|
872
|
+
const dlmmPool = yield meteora_1.MeteoraDLMM.create(connection, position.lbPair);
|
|
873
|
+
const userPda = (0, functions_1.generateUserPda)(params.userWallet);
|
|
874
|
+
// Claim all fees/rewards, remove all liquidity and close current position
|
|
875
|
+
const { userPositions } = yield dlmmPool.getPositionsByUserAndLbPair(userPda);
|
|
876
|
+
const userPosition = userPositions.find((userPosition) => userPosition.publicKey.equals(params.position));
|
|
877
|
+
if (userPosition === undefined) {
|
|
878
|
+
throw new Error(`Position: ${params.position} does not exist.`);
|
|
879
|
+
}
|
|
880
|
+
const binIdsToRemove = userPosition.positionData.positionBinData.map((bin) => bin.binId);
|
|
881
|
+
const removeLiquidityBuilder = yield dlmmPool.removeLiquidity(params.userWallet, addresses_1.HS_AUTHORITY, {
|
|
882
|
+
user: userPda,
|
|
883
|
+
position: params.position,
|
|
884
|
+
binIds: binIdsToRemove,
|
|
885
|
+
bps: new bn_js_1.default(10000),
|
|
886
|
+
shouldClaimAndClose: true,
|
|
887
|
+
pdaTokenType: types_1.TokenType.STA,
|
|
888
|
+
}, hsToMeteora_1.meteoraToHawksightAutomationIxs);
|
|
889
|
+
// Plain Close automation defaults to STA for claim fees and rewards
|
|
890
|
+
removeLiquidityBuilder.replaceClaimFeeTokenToSTA();
|
|
891
|
+
removeLiquidityBuilder.replaceClaimRewardToSTA();
|
|
892
|
+
const mainInstructions = [
|
|
893
|
+
// Remove liquidity
|
|
894
|
+
...removeLiquidityBuilder.mainIxs,
|
|
895
|
+
];
|
|
896
|
+
return (0, functions_1.createTransactionMeta)({
|
|
897
|
+
payer: params.userWallet,
|
|
898
|
+
description: "Automation IX: Meteora Close instruction (Close position)",
|
|
899
|
+
addressLookupTableAddresses: addresses_1.GLOBAL_ALT,
|
|
900
|
+
mainInstructions,
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
}
|
|
839
904
|
limitCloseAutomationIx(_a) {
|
|
840
905
|
return __awaiter(this, arguments, void 0, function* ({ connection, params, }) {
|
|
841
906
|
const program = yield meteora_1.MeteoraDLMM.program(connection);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as web3 from "@solana/web3.js";
|
|
2
2
|
import * as _client from "@hawksightco/swagger-client";
|
|
3
|
-
import { MeteoraCompound, MeteoraLimitCloseAutomation, MeteoraRebalance, MeteoraRebalance2, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
3
|
+
import { MeteoraClose, MeteoraCompound, MeteoraCreatePositionAndDeposit, MeteoraLimitCloseAutomation, MeteoraRebalance, MeteoraRebalance2, ResponseWithStatus, TransactionMetadata } from "../types";
|
|
4
4
|
import { Client } from "./Client";
|
|
5
5
|
import { GeneralUtility } from "./GeneralUtility";
|
|
6
6
|
/**
|
|
@@ -82,5 +82,27 @@ export declare class TxGeneratorAutomations {
|
|
|
82
82
|
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
83
83
|
*/
|
|
84
84
|
meteoraLimitCloseIxs(connection: web3.Connection, payer: string, params: MeteoraLimitCloseAutomation): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates meteora close instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
87
|
+
*
|
|
88
|
+
* NOTE: For hawksight devs only.
|
|
89
|
+
*
|
|
90
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
91
|
+
* @param payer The public key of the payer for transaction fees.
|
|
92
|
+
* @param params Parameters required
|
|
93
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
94
|
+
*/
|
|
95
|
+
meteoraCloseIxs(connection: web3.Connection, payer: string, params: MeteoraClose): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
96
|
+
/**
|
|
97
|
+
* Creates meteora open instruction (open position)
|
|
98
|
+
*
|
|
99
|
+
* NOTE: For hawksight devs only.
|
|
100
|
+
*
|
|
101
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
102
|
+
* @param payer The public key of the payer for transaction fees.
|
|
103
|
+
* @param params Parameters required
|
|
104
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
105
|
+
*/
|
|
106
|
+
meteoraOpenIxs(connection: web3.Connection, payer: string, params: MeteoraCreatePositionAndDeposit): Promise<ResponseWithStatus<TransactionMetadata>>;
|
|
85
107
|
}
|
|
86
108
|
//# sourceMappingURL=TxGeneratorAutomations.d.ts.map
|
|
@@ -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,iBAAiB,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;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAoD,MAAM,UAAU,CAAC;AACvP,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBA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AU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IA8BzI;;;;;;;;;OASG;IACG,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA6B5J"}
|
|
@@ -241,5 +241,79 @@ class TxGeneratorAutomations {
|
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Creates meteora close instruction (combination of claim fees/rewards + remove liquidity + close position)
|
|
246
|
+
*
|
|
247
|
+
* NOTE: For hawksight devs only.
|
|
248
|
+
*
|
|
249
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
250
|
+
* @param payer The public key of the payer for transaction fees.
|
|
251
|
+
* @param params Parameters required
|
|
252
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
253
|
+
*/
|
|
254
|
+
meteoraCloseIxs(connection, payer, params) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
256
|
+
// Initialize anchor
|
|
257
|
+
anchor_1.Anchor.initialize(connection);
|
|
258
|
+
try {
|
|
259
|
+
const result = yield Transactions_1.txgen.closeAutomationIx({
|
|
260
|
+
connection,
|
|
261
|
+
params,
|
|
262
|
+
fetch: undefined,
|
|
263
|
+
});
|
|
264
|
+
return {
|
|
265
|
+
status: 200,
|
|
266
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
return {
|
|
271
|
+
status: 400,
|
|
272
|
+
data: {
|
|
273
|
+
code: "custom",
|
|
274
|
+
message: e,
|
|
275
|
+
path: [],
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Creates meteora open instruction (open position)
|
|
283
|
+
*
|
|
284
|
+
* NOTE: For hawksight devs only.
|
|
285
|
+
*
|
|
286
|
+
* @param connection The Solana web3 connection object for blockchain interactions.
|
|
287
|
+
* @param payer The public key of the payer for transaction fees.
|
|
288
|
+
* @param params Parameters required
|
|
289
|
+
* @returns A ResponseWithStatus containing either TransactionMetadataResponse or TransactionMetadata.
|
|
290
|
+
*/
|
|
291
|
+
meteoraOpenIxs(connection, payer, params) {
|
|
292
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
293
|
+
// Initialize anchor
|
|
294
|
+
anchor_1.Anchor.initialize(connection);
|
|
295
|
+
try {
|
|
296
|
+
const result = yield Transactions_1.txgen.openAutomationIx({
|
|
297
|
+
connection,
|
|
298
|
+
params,
|
|
299
|
+
fetch: undefined,
|
|
300
|
+
});
|
|
301
|
+
return {
|
|
302
|
+
status: 200,
|
|
303
|
+
data: yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, result),
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
catch (e) {
|
|
307
|
+
return {
|
|
308
|
+
status: 400,
|
|
309
|
+
data: {
|
|
310
|
+
code: "custom",
|
|
311
|
+
message: e,
|
|
312
|
+
path: [],
|
|
313
|
+
},
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
244
318
|
}
|
|
245
319
|
exports.TxGeneratorAutomations = TxGeneratorAutomations;
|
package/dist/src/hawksight.d.ts
CHANGED
|
@@ -7,6 +7,13 @@ export declare function depositMultipleToken(params: {
|
|
|
7
7
|
mint: web3.PublicKey;
|
|
8
8
|
amount: BN;
|
|
9
9
|
}[];
|
|
10
|
+
}): Promise<web3.TransactionInstruction>;
|
|
11
|
+
export declare function depositMultipleTokenV2(params: {
|
|
12
|
+
payer: web3.PublicKey;
|
|
13
|
+
deposit: {
|
|
14
|
+
mint: web3.PublicKey;
|
|
15
|
+
amount: BN;
|
|
16
|
+
}[];
|
|
10
17
|
pdaTokenType?: TokenType;
|
|
11
18
|
}): Promise<web3.TransactionInstruction>;
|
|
12
19
|
export declare function withdrawMultipleToken(params: {
|
|
@@ -15,6 +22,13 @@ export declare function withdrawMultipleToken(params: {
|
|
|
15
22
|
mint: web3.PublicKey;
|
|
16
23
|
}[];
|
|
17
24
|
useSta?: boolean;
|
|
25
|
+
}): Promise<web3.TransactionInstruction>;
|
|
26
|
+
export declare function withdrawMultipleTokenV2(params: {
|
|
27
|
+
payer: web3.PublicKey;
|
|
28
|
+
withdraw: {
|
|
29
|
+
mint: web3.PublicKey;
|
|
30
|
+
}[];
|
|
31
|
+
useSta?: boolean;
|
|
18
32
|
pdaTokenType?: TokenType;
|
|
19
33
|
}): Promise<web3.TransactionInstruction>;
|
|
20
34
|
export type AtomicityContextParams = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hawksight.d.ts","sourceRoot":"","sources":["../../src/hawksight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,MAAM,OAAO,CAAC;AASvB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;IACJ,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,wCAmDA;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;KACtB,EAAE,CAAC;IACJ,MAAM,CA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ANGED
|
@@ -32,13 +32,58 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.storeToken = exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleToken = exports.depositMultipleToken = void 0;
|
|
35
|
+
exports.storeToken = exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleTokenV2 = exports.withdrawMultipleToken = exports.depositMultipleTokenV2 = exports.depositMultipleToken = void 0;
|
|
36
36
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
37
37
|
const anchor_1 = require("./anchor");
|
|
38
38
|
const addresses_1 = require("./addresses");
|
|
39
39
|
const util = __importStar(require("./functions"));
|
|
40
40
|
const types_1 = require("./types");
|
|
41
41
|
function depositMultipleToken(params) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const farm = addresses_1.USDC_FARM;
|
|
44
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
45
|
+
const amounts = params.deposit.map((d) => d.amount);
|
|
46
|
+
const remainingAccounts = [];
|
|
47
|
+
params.deposit.map((d) => {
|
|
48
|
+
const mint = d.mint;
|
|
49
|
+
const userToken = util.generateAta(params.payer, d.mint);
|
|
50
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
51
|
+
const userPdaToken = util.generateAta(userPda, d.mint);
|
|
52
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
53
|
+
remainingAccounts.push({
|
|
54
|
+
pubkey: userToken,
|
|
55
|
+
isSigner: false,
|
|
56
|
+
isWritable: true,
|
|
57
|
+
});
|
|
58
|
+
remainingAccounts.push({
|
|
59
|
+
pubkey: userPdaToken,
|
|
60
|
+
isSigner: false,
|
|
61
|
+
isWritable: true,
|
|
62
|
+
});
|
|
63
|
+
remainingAccounts.push({
|
|
64
|
+
pubkey: ownerFeeToken,
|
|
65
|
+
isSigner: false,
|
|
66
|
+
isWritable: true,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
70
|
+
.depositMultipleToken(amounts)
|
|
71
|
+
.accounts({
|
|
72
|
+
farm,
|
|
73
|
+
userPda,
|
|
74
|
+
payer: params.payer,
|
|
75
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
76
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
77
|
+
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
78
|
+
systemProgram: web3.SystemProgram.programId,
|
|
79
|
+
})
|
|
80
|
+
.remainingAccounts(remainingAccounts)
|
|
81
|
+
.instruction();
|
|
82
|
+
return ix;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
exports.depositMultipleToken = depositMultipleToken;
|
|
86
|
+
function depositMultipleTokenV2(params) {
|
|
42
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
88
|
const farm = addresses_1.USDC_FARM;
|
|
44
89
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
@@ -79,7 +124,7 @@ function depositMultipleToken(params) {
|
|
|
79
124
|
});
|
|
80
125
|
});
|
|
81
126
|
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
82
|
-
.
|
|
127
|
+
.depositMultipleTokenV2(amounts, skipIdempotent)
|
|
83
128
|
.accounts({
|
|
84
129
|
farm,
|
|
85
130
|
userPda,
|
|
@@ -94,8 +139,53 @@ function depositMultipleToken(params) {
|
|
|
94
139
|
return ix;
|
|
95
140
|
});
|
|
96
141
|
}
|
|
97
|
-
exports.
|
|
142
|
+
exports.depositMultipleTokenV2 = depositMultipleTokenV2;
|
|
98
143
|
function withdrawMultipleToken(params) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const farm = addresses_1.USDC_FARM;
|
|
146
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
147
|
+
const remainingAccounts = [];
|
|
148
|
+
let skipIdempotent = false;
|
|
149
|
+
params.withdraw.map((d) => {
|
|
150
|
+
const mint = d.mint;
|
|
151
|
+
const userToken = util.generateAta(params.payer, d.mint);
|
|
152
|
+
const userPdaToken = params.useSta ? util.generateUserPdaStorageAccount(userPda, d.mint) : util.generateAta(userPda, d.mint);
|
|
153
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
154
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
155
|
+
remainingAccounts.push({
|
|
156
|
+
pubkey: userToken,
|
|
157
|
+
isSigner: false,
|
|
158
|
+
isWritable: true,
|
|
159
|
+
});
|
|
160
|
+
remainingAccounts.push({
|
|
161
|
+
pubkey: userPdaToken,
|
|
162
|
+
isSigner: false,
|
|
163
|
+
isWritable: true,
|
|
164
|
+
});
|
|
165
|
+
remainingAccounts.push({
|
|
166
|
+
pubkey: ownerFeeToken,
|
|
167
|
+
isSigner: false,
|
|
168
|
+
isWritable: true,
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
172
|
+
.withdrawMultipleToken()
|
|
173
|
+
.accounts({
|
|
174
|
+
farm,
|
|
175
|
+
userPda,
|
|
176
|
+
payer: params.payer,
|
|
177
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
178
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
179
|
+
tokenProgram: addresses_1.TOKEN_PROGRAM_ID,
|
|
180
|
+
systemProgram: web3.SystemProgram.programId,
|
|
181
|
+
})
|
|
182
|
+
.remainingAccounts(remainingAccounts)
|
|
183
|
+
.instruction();
|
|
184
|
+
return ix;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
exports.withdrawMultipleToken = withdrawMultipleToken;
|
|
188
|
+
function withdrawMultipleTokenV2(params) {
|
|
99
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
190
|
const farm = addresses_1.USDC_FARM;
|
|
101
191
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
@@ -136,7 +226,7 @@ function withdrawMultipleToken(params) {
|
|
|
136
226
|
});
|
|
137
227
|
});
|
|
138
228
|
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
139
|
-
.
|
|
229
|
+
.withdrawMultipleTokenV2(skipIdempotent)
|
|
140
230
|
.accounts({
|
|
141
231
|
farm,
|
|
142
232
|
userPda,
|
|
@@ -151,7 +241,7 @@ function withdrawMultipleToken(params) {
|
|
|
151
241
|
return ix;
|
|
152
242
|
});
|
|
153
243
|
}
|
|
154
|
-
exports.
|
|
244
|
+
exports.withdrawMultipleTokenV2 = withdrawMultipleTokenV2;
|
|
155
245
|
function setTransactionSlot(_a) {
|
|
156
246
|
return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
|
|
157
247
|
const ix = yield anchor_1.Anchor
|
|
@@ -6055,6 +6055,74 @@ export type IndexYieldFarming = {
|
|
|
6055
6055
|
"isSigner": false;
|
|
6056
6056
|
}
|
|
6057
6057
|
];
|
|
6058
|
+
"args": [
|
|
6059
|
+
{
|
|
6060
|
+
"name": "amounts";
|
|
6061
|
+
"type": {
|
|
6062
|
+
"vec": "u64";
|
|
6063
|
+
};
|
|
6064
|
+
}
|
|
6065
|
+
];
|
|
6066
|
+
},
|
|
6067
|
+
{
|
|
6068
|
+
"name": "depositMultipleTokenV2";
|
|
6069
|
+
"accounts": [
|
|
6070
|
+
{
|
|
6071
|
+
"name": "farm";
|
|
6072
|
+
"isMut": false;
|
|
6073
|
+
"isSigner": false;
|
|
6074
|
+
},
|
|
6075
|
+
{
|
|
6076
|
+
"name": "userPda";
|
|
6077
|
+
"isMut": true;
|
|
6078
|
+
"isSigner": false;
|
|
6079
|
+
"pda": {
|
|
6080
|
+
"seeds": [
|
|
6081
|
+
{
|
|
6082
|
+
"kind": "const";
|
|
6083
|
+
"type": "string";
|
|
6084
|
+
"value": "multi-user";
|
|
6085
|
+
},
|
|
6086
|
+
{
|
|
6087
|
+
"kind": "account";
|
|
6088
|
+
"type": "publicKey";
|
|
6089
|
+
"account": "FarmAccountMulti";
|
|
6090
|
+
"path": "farm";
|
|
6091
|
+
},
|
|
6092
|
+
{
|
|
6093
|
+
"kind": "account";
|
|
6094
|
+
"type": "publicKey";
|
|
6095
|
+
"path": "payer";
|
|
6096
|
+
}
|
|
6097
|
+
];
|
|
6098
|
+
};
|
|
6099
|
+
},
|
|
6100
|
+
{
|
|
6101
|
+
"name": "payer";
|
|
6102
|
+
"isMut": false;
|
|
6103
|
+
"isSigner": true;
|
|
6104
|
+
},
|
|
6105
|
+
{
|
|
6106
|
+
"name": "hsFeeOwner";
|
|
6107
|
+
"isMut": false;
|
|
6108
|
+
"isSigner": false;
|
|
6109
|
+
},
|
|
6110
|
+
{
|
|
6111
|
+
"name": "associatedTokenProgram";
|
|
6112
|
+
"isMut": false;
|
|
6113
|
+
"isSigner": false;
|
|
6114
|
+
},
|
|
6115
|
+
{
|
|
6116
|
+
"name": "tokenProgram";
|
|
6117
|
+
"isMut": false;
|
|
6118
|
+
"isSigner": false;
|
|
6119
|
+
},
|
|
6120
|
+
{
|
|
6121
|
+
"name": "systemProgram";
|
|
6122
|
+
"isMut": false;
|
|
6123
|
+
"isSigner": false;
|
|
6124
|
+
}
|
|
6125
|
+
];
|
|
6058
6126
|
"args": [
|
|
6059
6127
|
{
|
|
6060
6128
|
"name": "amounts";
|
|
@@ -6127,6 +6195,67 @@ export type IndexYieldFarming = {
|
|
|
6127
6195
|
"isSigner": false;
|
|
6128
6196
|
}
|
|
6129
6197
|
];
|
|
6198
|
+
"args": [];
|
|
6199
|
+
},
|
|
6200
|
+
{
|
|
6201
|
+
"name": "withdrawMultipleTokenV2";
|
|
6202
|
+
"accounts": [
|
|
6203
|
+
{
|
|
6204
|
+
"name": "farm";
|
|
6205
|
+
"isMut": false;
|
|
6206
|
+
"isSigner": false;
|
|
6207
|
+
},
|
|
6208
|
+
{
|
|
6209
|
+
"name": "userPda";
|
|
6210
|
+
"isMut": true;
|
|
6211
|
+
"isSigner": false;
|
|
6212
|
+
"pda": {
|
|
6213
|
+
"seeds": [
|
|
6214
|
+
{
|
|
6215
|
+
"kind": "const";
|
|
6216
|
+
"type": "string";
|
|
6217
|
+
"value": "multi-user";
|
|
6218
|
+
},
|
|
6219
|
+
{
|
|
6220
|
+
"kind": "account";
|
|
6221
|
+
"type": "publicKey";
|
|
6222
|
+
"account": "FarmAccountMulti";
|
|
6223
|
+
"path": "farm";
|
|
6224
|
+
},
|
|
6225
|
+
{
|
|
6226
|
+
"kind": "account";
|
|
6227
|
+
"type": "publicKey";
|
|
6228
|
+
"path": "payer";
|
|
6229
|
+
}
|
|
6230
|
+
];
|
|
6231
|
+
};
|
|
6232
|
+
},
|
|
6233
|
+
{
|
|
6234
|
+
"name": "payer";
|
|
6235
|
+
"isMut": false;
|
|
6236
|
+
"isSigner": true;
|
|
6237
|
+
},
|
|
6238
|
+
{
|
|
6239
|
+
"name": "hsFeeOwner";
|
|
6240
|
+
"isMut": false;
|
|
6241
|
+
"isSigner": false;
|
|
6242
|
+
},
|
|
6243
|
+
{
|
|
6244
|
+
"name": "associatedTokenProgram";
|
|
6245
|
+
"isMut": false;
|
|
6246
|
+
"isSigner": false;
|
|
6247
|
+
},
|
|
6248
|
+
{
|
|
6249
|
+
"name": "tokenProgram";
|
|
6250
|
+
"isMut": false;
|
|
6251
|
+
"isSigner": false;
|
|
6252
|
+
},
|
|
6253
|
+
{
|
|
6254
|
+
"name": "systemProgram";
|
|
6255
|
+
"isMut": false;
|
|
6256
|
+
"isSigner": false;
|
|
6257
|
+
}
|
|
6258
|
+
];
|
|
6130
6259
|
"args": [
|
|
6131
6260
|
{
|
|
6132
6261
|
"name": "skipIdempotent";
|