@hawksightco/hawk-sdk 1.3.265 → 1.3.267
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/addresses.d.ts +37 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +84 -0
- package/dist/anchor.d.ts +22 -0
- package/dist/anchor.d.ts.map +1 -0
- package/dist/anchor.js +121 -0
- package/dist/classes/AltStorage.d.ts +29 -0
- package/dist/classes/AltStorage.d.ts.map +1 -0
- package/dist/classes/AltStorage.js +58 -0
- package/dist/classes/Atomicity.d.ts +34 -0
- package/dist/classes/Atomicity.d.ts.map +1 -0
- package/dist/classes/Atomicity.js +110 -0
- package/dist/classes/Client.d.ts +35 -0
- package/dist/classes/Client.d.ts.map +1 -0
- package/dist/classes/Client.js +66 -0
- package/dist/classes/CombineTransactions.d.ts +11 -0
- package/dist/classes/CombineTransactions.d.ts.map +1 -0
- package/dist/classes/CombineTransactions.js +58 -0
- package/dist/classes/CreateTxMetadata.d.ts +100 -0
- package/dist/classes/CreateTxMetadata.d.ts.map +1 -0
- package/dist/classes/CreateTxMetadata.js +415 -0
- package/dist/classes/General.d.ts +87 -0
- package/dist/classes/General.d.ts.map +1 -0
- package/dist/classes/General.js +176 -0
- package/dist/classes/GeneralUtility.d.ts +79 -0
- package/dist/classes/GeneralUtility.d.ts.map +1 -0
- package/dist/classes/GeneralUtility.js +121 -0
- package/dist/classes/HawkAPI.d.ts +122 -0
- package/dist/classes/HawkAPI.d.ts.map +1 -0
- package/dist/classes/HawkAPI.js +169 -0
- package/dist/classes/Health.d.ts +29 -0
- package/dist/classes/Health.d.ts.map +1 -0
- package/dist/classes/Health.js +48 -0
- package/dist/classes/JupiterAlts.d.ts +37 -0
- package/dist/classes/JupiterAlts.d.ts.map +1 -0
- package/dist/classes/JupiterAlts.js +114 -0
- package/dist/classes/JupiterSwap.d.ts +21 -0
- package/dist/classes/JupiterSwap.d.ts.map +1 -0
- package/dist/classes/JupiterSwap.js +40 -0
- package/dist/classes/Logging.d.ts +13 -0
- package/dist/classes/Logging.d.ts.map +1 -0
- package/dist/classes/Logging.js +50 -0
- package/dist/classes/MultiTransaction.d.ts +75 -0
- package/dist/classes/MultiTransaction.d.ts.map +1 -0
- package/dist/classes/MultiTransaction.js +296 -0
- package/dist/classes/RaydiumSDK.d.ts +67 -0
- package/dist/classes/RaydiumSDK.d.ts.map +1 -0
- package/dist/classes/RaydiumSDK.js +206 -0
- package/dist/classes/Search.d.ts +100 -0
- package/dist/classes/Search.d.ts.map +1 -0
- package/dist/classes/Search.js +216 -0
- package/dist/classes/SimpleIxGenerator.d.ts +57 -0
- package/dist/classes/SimpleIxGenerator.d.ts.map +1 -0
- package/dist/classes/SimpleIxGenerator.js +62 -0
- package/dist/classes/SimplePdaGenerator.d.ts +28 -0
- package/dist/classes/SimplePdaGenerator.d.ts.map +1 -0
- package/dist/classes/SimplePdaGenerator.js +33 -0
- package/dist/classes/Transaction.d.ts +229 -0
- package/dist/classes/Transaction.d.ts.map +1 -0
- package/dist/classes/Transaction.js +643 -0
- package/dist/classes/Transaction2.d.ts +107 -0
- package/dist/classes/Transaction2.d.ts.map +1 -0
- package/dist/classes/Transaction2.js +249 -0
- package/dist/classes/Transaction3.d.ts +165 -0
- package/dist/classes/Transaction3.d.ts.map +1 -0
- package/dist/classes/Transaction3.js +416 -0
- package/dist/classes/TransactionBatchExecute.d.ts +163 -0
- package/dist/classes/TransactionBatchExecute.d.ts.map +1 -0
- package/dist/classes/TransactionBatchExecute.js +466 -0
- package/dist/classes/TransactionBatchExecute2.d.ts +99 -0
- package/dist/classes/TransactionBatchExecute2.d.ts.map +1 -0
- package/dist/classes/TransactionBatchExecute2.js +357 -0
- package/dist/classes/Transactions.d.ts +586 -0
- package/dist/classes/Transactions.d.ts.map +1 -0
- package/dist/classes/Transactions.js +7667 -0
- package/dist/classes/TxGenerator.d.ts +350 -0
- package/dist/classes/TxGenerator.d.ts.map +1 -0
- package/dist/classes/TxGenerator.js +1957 -0
- package/dist/classes/TxGeneratorAutomations.d.ts +186 -0
- package/dist/classes/TxGeneratorAutomations.d.ts.map +1 -0
- package/dist/classes/TxGeneratorAutomations.js +897 -0
- package/dist/classes/Util.d.ts +87 -0
- package/dist/classes/Util.d.ts.map +1 -0
- package/dist/classes/Util.js +148 -0
- package/dist/classes/account-cache/AccountCache.d.ts +54 -0
- package/dist/classes/account-cache/AccountCache.d.ts.map +1 -0
- package/dist/classes/account-cache/AccountCache.js +143 -0
- package/dist/classes/account-cache/MintCache.d.ts +33 -0
- package/dist/classes/account-cache/MintCache.d.ts.map +1 -0
- package/dist/classes/account-cache/MintCache.js +47 -0
- package/dist/classes/account-cache/TokenCache.d.ts +33 -0
- package/dist/classes/account-cache/TokenCache.d.ts.map +1 -0
- package/dist/classes/account-cache/TokenCache.js +47 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +96 -0
- package/dist/functions.d.ts +514 -0
- package/dist/functions.d.ts.map +1 -0
- package/dist/functions.js +1636 -0
- package/dist/hawksight.d.ts +53 -0
- package/dist/hawksight.d.ts.map +1 -0
- package/dist/hawksight.js +328 -0
- package/dist/hsToMeteora.d.ts +31 -0
- package/dist/hsToMeteora.d.ts.map +1 -0
- package/dist/hsToMeteora.js +3175 -0
- package/dist/idl/iyf-extension-idl.d.ts +14583 -0
- package/dist/idl/iyf-extension-idl.d.ts.map +1 -0
- package/dist/idl/iyf-extension-idl.js +14578 -0
- package/dist/idl/iyf-extension-wrapper.d.ts +112 -0
- package/dist/idl/iyf-extension-wrapper.d.ts.map +1 -0
- package/dist/idl/iyf-extension-wrapper.js +2 -0
- package/dist/idl/iyf-main-idl.d.ts +12078 -0
- package/dist/idl/iyf-main-idl.d.ts.map +1 -0
- package/dist/idl/iyf-main-idl.js +12073 -0
- package/dist/idl/iyf-main-wrapper.d.ts +112 -0
- package/dist/idl/iyf-main-wrapper.d.ts.map +1 -0
- package/dist/idl/iyf-main-wrapper.js +2 -0
- package/dist/idl/jupiter-idl.d.ts +3063 -0
- package/dist/idl/jupiter-idl.d.ts.map +1 -0
- package/dist/idl/jupiter-idl.js +3061 -0
- package/dist/idl/meteora-idl.d.ts +7371 -0
- package/dist/idl/meteora-idl.d.ts.map +1 -0
- package/dist/idl/meteora-idl.js +7372 -0
- package/dist/idl/orca-idl.d.ts +3833 -0
- package/dist/idl/orca-idl.d.ts.map +1 -0
- package/dist/idl/orca-idl.js +3834 -0
- package/dist/idl/raydium-idl.d.ts +3054 -0
- package/dist/idl/raydium-idl.d.ts.map +1 -0
- package/dist/idl/raydium-idl.js +3055 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts +126 -0
- package/dist/ixGenerator/IyfExtensionIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/IyfExtensionIxGenerator.js +467 -0
- package/dist/ixGenerator/IyfMainIxGenerator.d.ts +330 -0
- package/dist/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/IyfMainIxGenerator.js +1239 -0
- package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts +685 -0
- package/dist/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/MeteoraDlmmIxGenerator.js +3008 -0
- package/dist/ixGenerator/OrcaIxGenerator.d.ts +119 -0
- package/dist/ixGenerator/OrcaIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/OrcaIxGenerator.js +438 -0
- package/dist/ixGenerator/RaydiumIxGenerator.d.ts +99 -0
- package/dist/ixGenerator/RaydiumIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/RaydiumIxGenerator.js +558 -0
- package/dist/ixGenerator/UtilIxGenerator.d.ts +20 -0
- package/dist/ixGenerator/UtilIxGenerator.d.ts.map +1 -0
- package/dist/ixGenerator/UtilIxGenerator.js +25 -0
- package/dist/meteora/index.d.ts +2 -0
- package/dist/meteora/index.d.ts.map +1 -0
- package/dist/meteora/index.js +17 -0
- package/dist/meteora/liquidityStrategy.d.ts +408 -0
- package/dist/meteora/liquidityStrategy.d.ts.map +1 -0
- package/dist/meteora/liquidityStrategy.js +1325 -0
- package/dist/meteora.d.ts +669 -0
- package/dist/meteora.d.ts.map +1 -0
- package/dist/meteora.js +1932 -0
- package/dist/orca.d.ts +57 -0
- package/dist/orca.d.ts.map +1 -0
- package/dist/orca.js +123 -0
- package/dist/pdaGenerator/HawksightPdaGenerator.d.ts +29 -0
- package/dist/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/HawksightPdaGenerator.js +75 -0
- package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts +76 -0
- package/dist/pdaGenerator/MeteoraPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/MeteoraPdaGenerator.js +166 -0
- package/dist/pdaGenerator/OrcaPdaGenerator.d.ts +23 -0
- package/dist/pdaGenerator/OrcaPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/OrcaPdaGenerator.js +68 -0
- package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts +49 -0
- package/dist/pdaGenerator/RaydiumPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/RaydiumPdaGenerator.js +114 -0
- package/dist/pdaGenerator/UtilPdaGenerator.d.ts +8 -0
- package/dist/pdaGenerator/UtilPdaGenerator.d.ts.map +1 -0
- package/dist/pdaGenerator/UtilPdaGenerator.js +51 -0
- package/dist/types.d.ts +1104 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +95 -0
- package/package.json +6 -5
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
import BN from "bn.js";
|
|
3
|
+
import { TokenType } from "./types";
|
|
4
|
+
export declare function depositMultipleToken(params: {
|
|
5
|
+
connection: web3.Connection;
|
|
6
|
+
payer: web3.PublicKey;
|
|
7
|
+
deposit: {
|
|
8
|
+
mint: web3.PublicKey;
|
|
9
|
+
amount: BN;
|
|
10
|
+
}[];
|
|
11
|
+
}): Promise<web3.TransactionInstruction>;
|
|
12
|
+
export declare function depositMultipleTokenV2(params: {
|
|
13
|
+
connection: web3.Connection;
|
|
14
|
+
payer: web3.PublicKey;
|
|
15
|
+
deposit: {
|
|
16
|
+
mint: web3.PublicKey;
|
|
17
|
+
amount: BN;
|
|
18
|
+
}[];
|
|
19
|
+
pdaTokenType?: TokenType;
|
|
20
|
+
}): Promise<web3.TransactionInstruction>;
|
|
21
|
+
export declare function withdrawMultipleToken(params: {
|
|
22
|
+
connection: web3.Connection;
|
|
23
|
+
payer: web3.PublicKey;
|
|
24
|
+
withdraw: {
|
|
25
|
+
mint: web3.PublicKey;
|
|
26
|
+
}[];
|
|
27
|
+
useSta?: boolean;
|
|
28
|
+
}): Promise<web3.TransactionInstruction>;
|
|
29
|
+
export declare function withdrawMultipleTokenV2(params: {
|
|
30
|
+
connection: web3.Connection;
|
|
31
|
+
payer: web3.PublicKey;
|
|
32
|
+
withdraw: {
|
|
33
|
+
mint: web3.PublicKey;
|
|
34
|
+
amount: BN;
|
|
35
|
+
}[];
|
|
36
|
+
useSta?: boolean;
|
|
37
|
+
pdaTokenType?: TokenType;
|
|
38
|
+
hasAmount?: boolean;
|
|
39
|
+
}): Promise<web3.TransactionInstruction>;
|
|
40
|
+
export type AtomicityContextParams = {
|
|
41
|
+
userWallet: web3.PublicKey;
|
|
42
|
+
};
|
|
43
|
+
export declare function setTransactionSlot({ userWallet }: AtomicityContextParams): Promise<web3.TransactionInstruction>;
|
|
44
|
+
export type VerifyTransactionSlotParams = {
|
|
45
|
+
userWallet: web3.PublicKey;
|
|
46
|
+
};
|
|
47
|
+
export declare function verifyTransactionSlot({ userWallet }: AtomicityContextParams): Promise<web3.TransactionInstruction>;
|
|
48
|
+
export type StoreTokenContextParams = {
|
|
49
|
+
userWallet: web3.PublicKey;
|
|
50
|
+
mint: web3.PublicKey;
|
|
51
|
+
};
|
|
52
|
+
export declare function storeToken(connection: web3.Connection, params: StoreTokenContextParams): Promise<web3.TransactionInstruction>;
|
|
53
|
+
//# sourceMappingURL=hawksight.d.ts.map
|
|
@@ -0,0 +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,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;CACL,wCAkDA;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACnD,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,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,wCA4DA;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;KACtB,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,wCAiDA;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE;IACpD,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;IAC5B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC;IACtB,QAAQ,EAAE;QACR,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,MAAM,EAAE,EAAE,CAAC;KACZ,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,wCA4DA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,wBAAsB,kBAAkB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAUrH;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;CAC5B,CAAC;AACF,wBAAsB,qBAAqB,CAAC,EAAE,UAAU,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAUxH;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAsB,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAoBnI"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.depositMultipleToken = depositMultipleToken;
|
|
46
|
+
exports.depositMultipleTokenV2 = depositMultipleTokenV2;
|
|
47
|
+
exports.withdrawMultipleToken = withdrawMultipleToken;
|
|
48
|
+
exports.withdrawMultipleTokenV2 = withdrawMultipleTokenV2;
|
|
49
|
+
exports.setTransactionSlot = setTransactionSlot;
|
|
50
|
+
exports.verifyTransactionSlot = verifyTransactionSlot;
|
|
51
|
+
exports.storeToken = storeToken;
|
|
52
|
+
const web3 = __importStar(require("@solana/web3.js"));
|
|
53
|
+
const anchor_1 = require("./anchor");
|
|
54
|
+
const addresses_1 = require("./addresses");
|
|
55
|
+
const util = __importStar(require("./functions"));
|
|
56
|
+
const types_1 = require("./types");
|
|
57
|
+
function depositMultipleToken(params) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const farm = addresses_1.USDC_FARM;
|
|
60
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
61
|
+
const amounts = params.deposit.map((d) => d.amount);
|
|
62
|
+
const remainingAccounts = [];
|
|
63
|
+
// Get mint pubkeys
|
|
64
|
+
const mints = params.deposit.map((d) => d.mint);
|
|
65
|
+
// Get and assert one token program for all mints.
|
|
66
|
+
// Throws an error if there are multiple token programs.
|
|
67
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
68
|
+
params.deposit.map((d) => {
|
|
69
|
+
const mint = d.mint;
|
|
70
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
71
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
72
|
+
const userPdaToken = util.generateAta(userPda, d.mint, tokenProgram);
|
|
73
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
74
|
+
remainingAccounts.push({
|
|
75
|
+
pubkey: userToken,
|
|
76
|
+
isSigner: false,
|
|
77
|
+
isWritable: true,
|
|
78
|
+
});
|
|
79
|
+
remainingAccounts.push({
|
|
80
|
+
pubkey: userPdaToken,
|
|
81
|
+
isSigner: false,
|
|
82
|
+
isWritable: true,
|
|
83
|
+
});
|
|
84
|
+
remainingAccounts.push({
|
|
85
|
+
pubkey: ownerFeeToken,
|
|
86
|
+
isSigner: false,
|
|
87
|
+
isWritable: true,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
92
|
+
.depositMultipleToken(amounts)
|
|
93
|
+
.accounts({
|
|
94
|
+
farm,
|
|
95
|
+
userPda,
|
|
96
|
+
payer: params.payer,
|
|
97
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
98
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
99
|
+
tokenProgram,
|
|
100
|
+
systemProgram: web3.SystemProgram.programId,
|
|
101
|
+
})
|
|
102
|
+
.remainingAccounts(remainingAccounts)
|
|
103
|
+
.instruction();
|
|
104
|
+
return ix;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function depositMultipleTokenV2(params) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
const farm = addresses_1.USDC_FARM;
|
|
110
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
111
|
+
const amounts = params.deposit.map((d) => d.amount);
|
|
112
|
+
const remainingAccounts = [];
|
|
113
|
+
// Get mint pubkeys
|
|
114
|
+
const mints = params.deposit.map((d) => d.mint);
|
|
115
|
+
// Get and assert one token program for all mints.
|
|
116
|
+
// Throws an error if there are multiple token programs.
|
|
117
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
118
|
+
let skipIdempotent = false;
|
|
119
|
+
params.deposit.map((d) => {
|
|
120
|
+
const mint = d.mint;
|
|
121
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
122
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
123
|
+
let userPdaToken;
|
|
124
|
+
if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
125
|
+
skipIdempotent = true;
|
|
126
|
+
userPdaToken = util.generateLimitToken(userPda, d.mint);
|
|
127
|
+
}
|
|
128
|
+
else if (params.pdaTokenType === types_1.TokenType.STA) {
|
|
129
|
+
skipIdempotent = true;
|
|
130
|
+
userPdaToken = util.generateUserPdaStorageAccount(userPda, d.mint);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
userPdaToken = util.generateAta(userPda, d.mint, tokenProgram);
|
|
134
|
+
}
|
|
135
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
136
|
+
remainingAccounts.push({
|
|
137
|
+
pubkey: userToken,
|
|
138
|
+
isSigner: false,
|
|
139
|
+
isWritable: true,
|
|
140
|
+
});
|
|
141
|
+
remainingAccounts.push({
|
|
142
|
+
pubkey: userPdaToken,
|
|
143
|
+
isSigner: false,
|
|
144
|
+
isWritable: true,
|
|
145
|
+
});
|
|
146
|
+
remainingAccounts.push({
|
|
147
|
+
pubkey: ownerFeeToken,
|
|
148
|
+
isSigner: false,
|
|
149
|
+
isWritable: true,
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
154
|
+
.depositMultipleTokenV2(amounts, skipIdempotent)
|
|
155
|
+
.accounts({
|
|
156
|
+
farm,
|
|
157
|
+
userPda,
|
|
158
|
+
payer: params.payer,
|
|
159
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
160
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
161
|
+
tokenProgram,
|
|
162
|
+
systemProgram: web3.SystemProgram.programId,
|
|
163
|
+
})
|
|
164
|
+
.remainingAccounts(remainingAccounts)
|
|
165
|
+
.instruction();
|
|
166
|
+
return ix;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function withdrawMultipleToken(params) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
const farm = addresses_1.USDC_FARM;
|
|
172
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
173
|
+
const remainingAccounts = [];
|
|
174
|
+
// Get mint pubkeys
|
|
175
|
+
const mints = params.withdraw.map((d) => d.mint);
|
|
176
|
+
// Get and assert one token program for all mints.
|
|
177
|
+
// Throws an error if there are multiple token programs.
|
|
178
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
179
|
+
params.withdraw.map((d) => {
|
|
180
|
+
const mint = d.mint;
|
|
181
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
182
|
+
const userPdaToken = params.useSta ? util.generateUserPdaStorageAccount(userPda, d.mint) : util.generateAta(userPda, d.mint, tokenProgram);
|
|
183
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
184
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
185
|
+
remainingAccounts.push({
|
|
186
|
+
pubkey: userToken,
|
|
187
|
+
isSigner: false,
|
|
188
|
+
isWritable: true,
|
|
189
|
+
});
|
|
190
|
+
remainingAccounts.push({
|
|
191
|
+
pubkey: userPdaToken,
|
|
192
|
+
isSigner: false,
|
|
193
|
+
isWritable: true,
|
|
194
|
+
});
|
|
195
|
+
remainingAccounts.push({
|
|
196
|
+
pubkey: ownerFeeToken,
|
|
197
|
+
isSigner: false,
|
|
198
|
+
isWritable: true,
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
203
|
+
.withdrawMultipleToken()
|
|
204
|
+
.accounts({
|
|
205
|
+
farm,
|
|
206
|
+
userPda,
|
|
207
|
+
payer: params.payer,
|
|
208
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
209
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
210
|
+
tokenProgram,
|
|
211
|
+
systemProgram: web3.SystemProgram.programId,
|
|
212
|
+
})
|
|
213
|
+
.remainingAccounts(remainingAccounts)
|
|
214
|
+
.instruction();
|
|
215
|
+
return ix;
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
function withdrawMultipleTokenV2(params) {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
const farm = addresses_1.USDC_FARM;
|
|
221
|
+
const userPda = util.generateUserPda(params.payer, farm);
|
|
222
|
+
const remainingAccounts = [];
|
|
223
|
+
const amounts = params.withdraw.map((d) => d.amount);
|
|
224
|
+
// Get mint pubkeys
|
|
225
|
+
const mints = params.withdraw.map((d) => d.mint);
|
|
226
|
+
// Get and assert one token program for all mints.
|
|
227
|
+
// Throws an error if there are multiple token programs.
|
|
228
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
229
|
+
let skipIdempotent = false;
|
|
230
|
+
params.withdraw.map((d) => {
|
|
231
|
+
const mint = d.mint;
|
|
232
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
233
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
234
|
+
let userPdaToken;
|
|
235
|
+
if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
236
|
+
skipIdempotent = true;
|
|
237
|
+
userPdaToken = util.generateLimitToken(userPda, d.mint);
|
|
238
|
+
}
|
|
239
|
+
else if (params.pdaTokenType === types_1.TokenType.STA || params.useSta) {
|
|
240
|
+
skipIdempotent = true;
|
|
241
|
+
userPdaToken = util.generateUserPdaStorageAccount(userPda, d.mint);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
userPdaToken = util.generateAta(userPda, d.mint, tokenProgram);
|
|
245
|
+
}
|
|
246
|
+
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
247
|
+
remainingAccounts.push({
|
|
248
|
+
pubkey: userToken,
|
|
249
|
+
isSigner: false,
|
|
250
|
+
isWritable: true,
|
|
251
|
+
});
|
|
252
|
+
remainingAccounts.push({
|
|
253
|
+
pubkey: userPdaToken,
|
|
254
|
+
isSigner: false,
|
|
255
|
+
isWritable: true,
|
|
256
|
+
});
|
|
257
|
+
remainingAccounts.push({
|
|
258
|
+
pubkey: ownerFeeToken,
|
|
259
|
+
isSigner: false,
|
|
260
|
+
isWritable: true,
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
// @ts-ignore
|
|
264
|
+
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
265
|
+
.withdrawMultipleTokenV2(skipIdempotent, params.hasAmount ? amounts : null)
|
|
266
|
+
.accounts({
|
|
267
|
+
farm,
|
|
268
|
+
userPda,
|
|
269
|
+
payer: params.payer,
|
|
270
|
+
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
271
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
272
|
+
tokenProgram,
|
|
273
|
+
systemProgram: web3.SystemProgram.programId,
|
|
274
|
+
})
|
|
275
|
+
.remainingAccounts(remainingAccounts)
|
|
276
|
+
.instruction();
|
|
277
|
+
return ix;
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function setTransactionSlot(_a) {
|
|
281
|
+
return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
|
|
282
|
+
const ix = yield anchor_1.Anchor
|
|
283
|
+
.instance().iyfMain.methods
|
|
284
|
+
.setTransactionSlot()
|
|
285
|
+
.accounts({
|
|
286
|
+
userPda: util.generateUserPda(userWallet),
|
|
287
|
+
clock: web3.SYSVAR_CLOCK_PUBKEY,
|
|
288
|
+
})
|
|
289
|
+
.instruction();
|
|
290
|
+
return ix;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function verifyTransactionSlot(_a) {
|
|
294
|
+
return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
|
|
295
|
+
const ix = yield anchor_1.Anchor
|
|
296
|
+
.instance().iyfMain.methods
|
|
297
|
+
.verifyTransactionSlot()
|
|
298
|
+
.accounts({
|
|
299
|
+
userPda: util.generateUserPda(userWallet),
|
|
300
|
+
clock: web3.SYSVAR_CLOCK_PUBKEY,
|
|
301
|
+
})
|
|
302
|
+
.instruction();
|
|
303
|
+
return ix;
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function storeToken(connection, params) {
|
|
307
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
308
|
+
const userPda = util.generateUserPda(params.userWallet);
|
|
309
|
+
const tokenProgramMap = yield util.getTokenProgramMapForMints(connection, [params.mint]);
|
|
310
|
+
const tokenProgram = tokenProgramMap[params.mint.toString()];
|
|
311
|
+
const ix = yield anchor_1.Anchor
|
|
312
|
+
.instance().iyfMain.methods
|
|
313
|
+
.storeToken()
|
|
314
|
+
.accounts({
|
|
315
|
+
userPda: userPda,
|
|
316
|
+
authority: params.userWallet,
|
|
317
|
+
mint: params.mint,
|
|
318
|
+
passthroughTokenAccount: util.generateAta(userPda, params.mint),
|
|
319
|
+
storageTokenAccount: util.generateUserPdaStorageAccount(userPda, params.mint),
|
|
320
|
+
rent: web3.SYSVAR_RENT_PUBKEY,
|
|
321
|
+
tokenProgram,
|
|
322
|
+
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
323
|
+
systemProgram: web3.SystemProgram.programId,
|
|
324
|
+
})
|
|
325
|
+
.instruction();
|
|
326
|
+
return ix;
|
|
327
|
+
});
|
|
328
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as web3 from "@solana/web3.js";
|
|
2
|
+
import { LabeledInstruction, MeteoraToHawksightParamsLabeled, MeteoraToHawksightParams } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Convert listed meteora instruction to generalized hawksight meteora cpi
|
|
5
|
+
*
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function meteoraToHawksight({ ixs, userPda, authority, opt }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Convert listed meteora instruction to generalized hawksight meteora cpi (with label)
|
|
12
|
+
*
|
|
13
|
+
* @param params
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare function meteoraToHawksightLabeled({ ixs, userPda, authority, classification, opt }: MeteoraToHawksightParamsLabeled): Promise<LabeledInstruction[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Convert listed meteora instruction to hawksight meteora automation cpi
|
|
19
|
+
*
|
|
20
|
+
* @param params
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function meteoraToHawksightAutomationIxs({ ixs, userPda, authority, opt }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Convert listed meteora instruction to hawksight meteora automation cpi
|
|
26
|
+
*
|
|
27
|
+
* @param params
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export declare function meteoraToHawksightPdaIxs({ ixs, userPda, authority, opt }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
31
|
+
//# sourceMappingURL=hsToMeteora.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../src/hsToMeteora.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,+BAA+B,EAA6B,wBAAwB,EAAa,MAAM,SAAS,CAAC;AAkB9I;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUzI;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAC,EAAE,+BAA+B,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAU9J;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUtJ;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAU/I"}
|