@hawksightco/hawk-sdk 1.2.120 → 1.3.0
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/addresses.d.ts +1 -0
- package/dist/src/addresses.d.ts.map +1 -1
- package/dist/src/addresses.js +2 -1
- package/dist/src/anchor.d.ts +2 -112
- package/dist/src/anchor.d.ts.map +1 -1
- package/dist/src/anchor.js +21 -3
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +63 -43
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +2 -0
- package/dist/src/functions.d.ts +18 -1
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +115 -13
- package/dist/src/hawksight.d.ts +4 -0
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +38 -17
- package/dist/src/idl/iyf-extension-idl.d.ts +0 -45
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +45 -90
- package/dist/src/idl/iyf-extension-wrapper.d.ts +112 -0
- package/dist/src/idl/iyf-extension-wrapper.d.ts.map +1 -0
- package/dist/src/idl/iyf-extension-wrapper.js +2 -0
- package/dist/src/idl/iyf-main-idl.d.ts +7275 -5865
- package/dist/src/idl/iyf-main-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-main-idl.js +7449 -6045
- package/dist/src/idl/iyf-main-wrapper.d.ts +112 -0
- package/dist/src/idl/iyf-main-wrapper.d.ts.map +1 -0
- package/dist/src/idl/iyf-main-wrapper.js +2 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +24 -8
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -1
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +152 -12
- package/dist/src/meteora.d.ts +6 -5
- package/dist/src/meteora.d.ts.map +1 -1
- package/dist/src/meteora.js +30 -18
- package/dist/src/pdaGenerator/HawksightPdaGenerator.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/src/functions.d.ts
CHANGED
|
@@ -90,7 +90,15 @@ export declare function generateUserPda(userWallet: web3.PublicKey, farm?: web3.
|
|
|
90
90
|
* @returns
|
|
91
91
|
*/
|
|
92
92
|
export declare function generateUserPdaLamport(userWallet: web3.PublicKey, farm?: web3.PublicKey): web3.PublicKey;
|
|
93
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Generate ATA
|
|
95
|
+
*
|
|
96
|
+
* @param owner Owner of the ATA
|
|
97
|
+
* @param mint Mint of the ATA
|
|
98
|
+
* @param programId Defaults to Token Program. Program ID is used to support token 2022
|
|
99
|
+
* @returns ATA address
|
|
100
|
+
*/
|
|
101
|
+
export declare function generateAta(owner: web3.PublicKey, mint: web3.PublicKey, programId?: web3.PublicKey): web3.PublicKey;
|
|
94
102
|
export declare function generateLimitToken(userPda: web3.PublicKey, mint: web3.PublicKey): web3.PublicKey;
|
|
95
103
|
export declare function generateFuelAccount(userWallet: web3.PublicKey): web3.PublicKey;
|
|
96
104
|
export declare function generateAta2022(owner: web3.PublicKey, mint: web3.PublicKey): web3.PublicKey;
|
|
@@ -380,5 +388,14 @@ export declare function findUserAlts(userWallet: web3.PublicKey, connection: web
|
|
|
380
388
|
* @returns List of pubkeys that are in the alt
|
|
381
389
|
*/
|
|
382
390
|
export declare function pubkeysInAlt(pubkeys: string[], alt: web3.AddressLookupTableAccount): string[];
|
|
391
|
+
/**
|
|
392
|
+
* The goal of this function is to batch 100 accounts at a time as it is the max number of accounts that can be fetched at once.
|
|
393
|
+
* @param pubkeys - The accounts to fetch.
|
|
394
|
+
* @returns - A promise that resolves to an array of TokenAccountInfo objects.
|
|
395
|
+
*/
|
|
396
|
+
export declare function getBatchedMultipleAccountsInfo(connection: web3.Connection, pubkeys: web3.PublicKey[], commitment?: web3.Commitment): Promise<(web3.AccountInfo<Buffer> | null)[]>;
|
|
397
|
+
export declare function getTokenProgramForMints2(connection: web3.Connection, mints: web3.PublicKey[], targetTokenProgram?: web3.PublicKey): Promise<void>;
|
|
398
|
+
export declare function getTokenProgramForMints(connection: web3.Connection, mints: web3.PublicKey[]): Promise<web3.PublicKey>;
|
|
399
|
+
export declare function getTokenProgramMapForMints(connection: web3.Connection, mints: web3.PublicKey[]): Promise<Record<string, web3.PublicKey>>;
|
|
383
400
|
export {};
|
|
384
401
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,6BAA6B,EAC7B,WAAW,EACX,mBAAmB,EACnB,SAAS,EACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../src/functions.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,yBAAyB,EACzB,6BAA6B,EAC7B,WAAW,EACX,mBAAmB,EACnB,SAAS,EACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAc1D,OAAO,EAAE,MAAM,OAAO,CAAC;AAMvB,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,cAAc,EAC9B,UAA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AAU,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,UAAU,GAAE,IAAI,CAAC,UAAwB,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAQpM;AAED,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,EACvB,kBAAkB,GAAE,IAAI,CAAC,SAA4B,iBAgBtD;AAED,wBAAsB,uBAAuB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAmC3H;AAED,wBAAsB,0BAA0B,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CA2B9I"}
|
package/dist/src/functions.js
CHANGED
|
@@ -36,14 +36,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.simulateTransaction = exports.extractPrimitives = exports.resolveDefined = exports.resolveArray = exports.resolveVec = exports.resolveOption = exports.resolveEnum = exports.resolveStruct = exports.extractValue = exports.deserializeParametersFromIDL = exports.tokenizer = exports.benchmark = exports.findNonceOwnedBy = exports.generateNonceAddressesOwnedBy = exports.generateNonceAddressFromIndex = exports.mid = exports.getPriorityFeeEstimate2 = exports.getPriorityFeeEstimate = exports.stringToAlt = exports.ixStrToWeb3Ix = exports.toVersionedTransaction = exports.getJupiterRouteIxParams = exports.inputTokenExists = exports.unwrapWsolToSol = exports.unwrapSolIfMintIsWsol = exports.wrapSolToWsol = exports.wrapSolIfMintIsWsol = exports.getMintsFromInstruction = exports.createAtaIdempotentIxs = exports.parseTokenAccountData = exports.tokenAccountExists = exports.sighash = exports.sighashMatch = exports.getIxs = exports.generateUserPdaStorageAccount = exports.generateOrcaPositionPDA = exports.generateAta2022 = exports.generateFuelAccount = exports.generateLimitToken = exports.generateAta = exports.generateUserPdaLamport = exports.generateUserPda = exports.legacyTxMetadata = exports.createTransactionMeta = exports.getMeteoraPool = exports.getFeeEstimate = exports.resultOrError = exports.createTxMetadata2 = exports.createTxMetadata = exports.METEORA_API_URL = void 0;
|
|
39
|
-
exports.pubkeysInAlt = exports.findUserAlts = exports.i32ToBeBuffer = exports.raydiumStartTickIndex = exports.createAssociatedTokenAccountIdempotentInstruction = void 0;
|
|
39
|
+
exports.getTokenProgramMapForMints = exports.getTokenProgramForMints = exports.getTokenProgramForMints2 = exports.getBatchedMultipleAccountsInfo = exports.pubkeysInAlt = exports.findUserAlts = exports.i32ToBeBuffer = exports.raydiumStartTickIndex = exports.createAssociatedTokenAccountIdempotentInstruction = void 0;
|
|
40
40
|
const client = __importStar(require("@hawksightco/swagger-client"));
|
|
41
41
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
42
42
|
const axios_1 = __importDefault(require("axios"));
|
|
43
43
|
const types_1 = require("./types");
|
|
44
44
|
const CreateTxMetadata_1 = require("./classes/CreateTxMetadata");
|
|
45
45
|
const addresses_1 = require("./addresses");
|
|
46
|
-
const addresses_2 = require("./addresses");
|
|
47
46
|
const errors_1 = require("./errors");
|
|
48
47
|
const lodash_1 = require("lodash");
|
|
49
48
|
const js_sha256_1 = require("js-sha256");
|
|
@@ -240,10 +239,18 @@ function generateUserPdaLamport(userWallet, farm = new web3.PublicKey("7jLQhREMx
|
|
|
240
239
|
return pda;
|
|
241
240
|
}
|
|
242
241
|
exports.generateUserPdaLamport = generateUserPdaLamport;
|
|
243
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Generate ATA
|
|
244
|
+
*
|
|
245
|
+
* @param owner Owner of the ATA
|
|
246
|
+
* @param mint Mint of the ATA
|
|
247
|
+
* @param programId Defaults to Token Program. Program ID is used to support token 2022
|
|
248
|
+
* @returns ATA address
|
|
249
|
+
*/
|
|
250
|
+
function generateAta(owner, mint, programId = addresses_1.TOKEN_PROGRAM_ID) {
|
|
244
251
|
const [pda] = web3.PublicKey.findProgramAddressSync([
|
|
245
252
|
owner.toBuffer(),
|
|
246
|
-
|
|
253
|
+
programId.toBuffer(),
|
|
247
254
|
mint.toBuffer(),
|
|
248
255
|
], new web3.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"));
|
|
249
256
|
return pda;
|
|
@@ -269,7 +276,7 @@ exports.generateFuelAccount = generateFuelAccount;
|
|
|
269
276
|
function generateAta2022(owner, mint) {
|
|
270
277
|
const [pda] = web3.PublicKey.findProgramAddressSync([
|
|
271
278
|
owner.toBuffer(),
|
|
272
|
-
|
|
279
|
+
addresses_1.TOKEN_2022.toBuffer(),
|
|
273
280
|
mint.toBuffer(),
|
|
274
281
|
], new web3.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"));
|
|
275
282
|
return pda;
|
|
@@ -283,7 +290,7 @@ exports.generateAta2022 = generateAta2022;
|
|
|
283
290
|
* @returns
|
|
284
291
|
*/
|
|
285
292
|
function generateOrcaPositionPDA(positionMint) {
|
|
286
|
-
const [pda] = web3.PublicKey.findProgramAddressSync([Buffer.from("position", "utf-8"), positionMint.toBuffer()],
|
|
293
|
+
const [pda] = web3.PublicKey.findProgramAddressSync([Buffer.from("position", "utf-8"), positionMint.toBuffer()], addresses_1.ORCA_WHIRLPOOL_PROGRAM);
|
|
287
294
|
return pda;
|
|
288
295
|
}
|
|
289
296
|
exports.generateOrcaPositionPDA = generateOrcaPositionPDA;
|
|
@@ -295,7 +302,7 @@ exports.generateOrcaPositionPDA = generateOrcaPositionPDA;
|
|
|
295
302
|
* @returns Storage Account owned by the user pda
|
|
296
303
|
*/
|
|
297
304
|
function generateUserPdaStorageAccount(userPda, mint) {
|
|
298
|
-
const [storageAccount] = web3.PublicKey.findProgramAddressSync([Buffer.from("storage-token"), mint.toBuffer(), userPda.toBuffer()],
|
|
305
|
+
const [storageAccount] = web3.PublicKey.findProgramAddressSync([Buffer.from("storage-token"), mint.toBuffer(), userPda.toBuffer()], addresses_1.IYF_MAIN);
|
|
299
306
|
return storageAccount;
|
|
300
307
|
}
|
|
301
308
|
exports.generateUserPdaStorageAccount = generateUserPdaStorageAccount;
|
|
@@ -381,7 +388,7 @@ function tokenAccountExists(connection, params) {
|
|
|
381
388
|
return {
|
|
382
389
|
mint: params[index].mint,
|
|
383
390
|
tokenKey: tokenKeys[index],
|
|
384
|
-
exists: accountInfo.owner.equals(
|
|
391
|
+
exists: accountInfo.owner.equals(addresses_1.TOKEN_PROGRAM_ID),
|
|
385
392
|
};
|
|
386
393
|
});
|
|
387
394
|
return result;
|
|
@@ -510,9 +517,9 @@ function wrapSolIfMintIsWsol(userWallet, payer, params) {
|
|
|
510
517
|
}
|
|
511
518
|
exports.wrapSolIfMintIsWsol = wrapSolIfMintIsWsol;
|
|
512
519
|
function wrapSolToWsol({ payer, owner, amount, }) {
|
|
513
|
-
const wSolAccount = generateAta(owner,
|
|
520
|
+
const wSolAccount = generateAta(owner, addresses_1.WSOL_MINT);
|
|
514
521
|
// Step 1: Create ATA account IX
|
|
515
|
-
const ataIx = createAssociatedTokenAccountIdempotentInstruction(payer, wSolAccount, owner,
|
|
522
|
+
const ataIx = createAssociatedTokenAccountIdempotentInstruction(payer, wSolAccount, owner, addresses_1.WSOL_MINT);
|
|
516
523
|
if (amount !== undefined) {
|
|
517
524
|
// Step 1: Transfer lamports from authority to wSolAccount
|
|
518
525
|
const transferIx = web3.SystemProgram.transfer({
|
|
@@ -555,7 +562,7 @@ function unwrapSolIfMintIsWsol(userWallet, mints) {
|
|
|
555
562
|
}
|
|
556
563
|
exports.unwrapSolIfMintIsWsol = unwrapSolIfMintIsWsol;
|
|
557
564
|
function unwrapWsolToSol({ authority, }) {
|
|
558
|
-
const wSolAccount = generateAta(authority,
|
|
565
|
+
const wSolAccount = generateAta(authority, addresses_1.WSOL_MINT);
|
|
559
566
|
// account: PublicKey,
|
|
560
567
|
// destination: PublicKey,
|
|
561
568
|
// authority: PublicKey,
|
|
@@ -1024,11 +1031,11 @@ exports.simulateTransaction = simulateTransaction;
|
|
|
1024
1031
|
*
|
|
1025
1032
|
* @return Instruction to add to a transaction
|
|
1026
1033
|
*/
|
|
1027
|
-
function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId =
|
|
1034
|
+
function createAssociatedTokenAccountIdempotentInstruction(payer, associatedToken, owner, mint, programId = addresses_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = addresses_1.ASSOCIATED_TOKEN_PROGRAM) {
|
|
1028
1035
|
return buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, Buffer.from([1]), programId, associatedTokenProgramId);
|
|
1029
1036
|
}
|
|
1030
1037
|
exports.createAssociatedTokenAccountIdempotentInstruction = createAssociatedTokenAccountIdempotentInstruction;
|
|
1031
|
-
function buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, instructionData, programId =
|
|
1038
|
+
function buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, mint, instructionData, programId = addresses_1.TOKEN_PROGRAM_ID, associatedTokenProgramId = addresses_1.ASSOCIATED_TOKEN_PROGRAM) {
|
|
1032
1039
|
const keys = [
|
|
1033
1040
|
{ pubkey: payer, isSigner: true, isWritable: true },
|
|
1034
1041
|
{ pubkey: associatedToken, isSigner: false, isWritable: true },
|
|
@@ -1126,3 +1133,98 @@ function pubkeysInAlt(pubkeys, alt) {
|
|
|
1126
1133
|
return pubkeysInAlt;
|
|
1127
1134
|
}
|
|
1128
1135
|
exports.pubkeysInAlt = pubkeysInAlt;
|
|
1136
|
+
/**
|
|
1137
|
+
* The goal of this function is to batch 100 accounts at a time as it is the max number of accounts that can be fetched at once.
|
|
1138
|
+
* @param pubkeys - The accounts to fetch.
|
|
1139
|
+
* @returns - A promise that resolves to an array of TokenAccountInfo objects.
|
|
1140
|
+
*/
|
|
1141
|
+
function getBatchedMultipleAccountsInfo(connection_1, pubkeys_1) {
|
|
1142
|
+
return __awaiter(this, arguments, void 0, function* (connection, pubkeys, commitment = "confirmed") {
|
|
1143
|
+
const batchSize = 100;
|
|
1144
|
+
const batches = [];
|
|
1145
|
+
for (let i = 0; i < pubkeys.length; i += batchSize) {
|
|
1146
|
+
batches.push(pubkeys.slice(i, i + batchSize));
|
|
1147
|
+
}
|
|
1148
|
+
const batch = yield Promise.all(batches.map(batch => connection.getMultipleAccountsInfo(batch, commitment)));
|
|
1149
|
+
return batch.flat();
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
exports.getBatchedMultipleAccountsInfo = getBatchedMultipleAccountsInfo;
|
|
1153
|
+
function getTokenProgramForMints2(connection_1, mints_1) {
|
|
1154
|
+
return __awaiter(this, arguments, void 0, function* (connection, mints, targetTokenProgram = addresses_1.TOKEN_PROGRAM_ID) {
|
|
1155
|
+
const mintAccounts = yield getBatchedMultipleAccountsInfo(connection, mints);
|
|
1156
|
+
for (let i = 0; i < mintAccounts.length; i++) {
|
|
1157
|
+
const mintAccount = mintAccounts[i];
|
|
1158
|
+
const pubkey = mints[i];
|
|
1159
|
+
if (mintAccount === null) {
|
|
1160
|
+
throw new Error(`Mint account not found for mint: ${pubkey}`);
|
|
1161
|
+
}
|
|
1162
|
+
const _tokenProgram = mintAccount.owner;
|
|
1163
|
+
if (_tokenProgram !== targetTokenProgram) {
|
|
1164
|
+
throw new Error(`Token program mismatch for mint: ${pubkey}. It should be owned by program: ${targetTokenProgram}`);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
exports.getTokenProgramForMints2 = getTokenProgramForMints2;
|
|
1170
|
+
function getTokenProgramForMints(connection, mints) {
|
|
1171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1172
|
+
const mintAccounts = yield getBatchedMultipleAccountsInfo(connection, mints);
|
|
1173
|
+
let tokenProgram = null;
|
|
1174
|
+
for (let i = 0; i < mintAccounts.length; i++) {
|
|
1175
|
+
const mintAccount = mintAccounts[i];
|
|
1176
|
+
const pubkey = mints[i];
|
|
1177
|
+
if (mintAccount === null) {
|
|
1178
|
+
throw new Error(`Mint account not found for mint: ${pubkey}`);
|
|
1179
|
+
}
|
|
1180
|
+
const _tokenProgram = mintAccount.owner;
|
|
1181
|
+
// Make sure that all tokens are owned by the same program.
|
|
1182
|
+
if (tokenProgram === null) {
|
|
1183
|
+
// Make sure that token program is either Token or Token2022.
|
|
1184
|
+
if (_tokenProgram === addresses_1.TOKEN_PROGRAM_ID || _tokenProgram === addresses_1.TOKEN_2022) {
|
|
1185
|
+
tokenProgram = _tokenProgram;
|
|
1186
|
+
}
|
|
1187
|
+
else {
|
|
1188
|
+
throw new Error(`Token program mismatch for mint: ${pubkey}. It should be either a Token (${addresses_1.TOKEN_PROGRAM_ID}) or Token2022 (${addresses_1.TOKEN_2022})`);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
else {
|
|
1192
|
+
// Make sure that all tokens are owned by the same program.
|
|
1193
|
+
if (_tokenProgram !== tokenProgram) {
|
|
1194
|
+
throw new Error(`Token program mismatch for mint: ${pubkey}. It should be owned by program: ${tokenProgram}`);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
if (tokenProgram === null) {
|
|
1199
|
+
throw new Error(`No mints were passed in the parameter.`);
|
|
1200
|
+
}
|
|
1201
|
+
return tokenProgram;
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
exports.getTokenProgramForMints = getTokenProgramForMints;
|
|
1205
|
+
function getTokenProgramMapForMints(connection, mints) {
|
|
1206
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1207
|
+
const mintAccounts = yield getBatchedMultipleAccountsInfo(connection, mints);
|
|
1208
|
+
let tokenProgramMap = {};
|
|
1209
|
+
for (let i = 0; i < mintAccounts.length; i++) {
|
|
1210
|
+
const mintAccount = mintAccounts[i];
|
|
1211
|
+
const pubkey = mints[i];
|
|
1212
|
+
if (mintAccount === null) {
|
|
1213
|
+
throw new Error(`Mint account not found for mint: ${pubkey}`);
|
|
1214
|
+
}
|
|
1215
|
+
const _tokenProgram = mintAccount.owner;
|
|
1216
|
+
// Make sure that token program is either Token or Token2022.
|
|
1217
|
+
if (_tokenProgram === addresses_1.TOKEN_PROGRAM_ID || _tokenProgram === addresses_1.TOKEN_2022) {
|
|
1218
|
+
tokenProgramMap[pubkey.toString()] = _tokenProgram;
|
|
1219
|
+
}
|
|
1220
|
+
else {
|
|
1221
|
+
throw new Error(`Token program mismatch for mint: ${pubkey}. It should be either a Token (${addresses_1.TOKEN_PROGRAM_ID}) or Token2022 (${addresses_1.TOKEN_2022})`);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
if (mintAccounts.length === 0) {
|
|
1225
|
+
throw new Error(`No mints were passed in the parameter.`);
|
|
1226
|
+
}
|
|
1227
|
+
return tokenProgramMap;
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
exports.getTokenProgramMapForMints = getTokenProgramMapForMints;
|
package/dist/src/hawksight.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as web3 from "@solana/web3.js";
|
|
|
2
2
|
import BN from "bn.js";
|
|
3
3
|
import { TokenType } from "./types";
|
|
4
4
|
export declare function depositMultipleToken(params: {
|
|
5
|
+
connection: web3.Connection;
|
|
5
6
|
payer: web3.PublicKey;
|
|
6
7
|
deposit: {
|
|
7
8
|
mint: web3.PublicKey;
|
|
@@ -9,6 +10,7 @@ export declare function depositMultipleToken(params: {
|
|
|
9
10
|
}[];
|
|
10
11
|
}): Promise<web3.TransactionInstruction>;
|
|
11
12
|
export declare function depositMultipleTokenV2(params: {
|
|
13
|
+
connection: web3.Connection;
|
|
12
14
|
payer: web3.PublicKey;
|
|
13
15
|
deposit: {
|
|
14
16
|
mint: web3.PublicKey;
|
|
@@ -17,6 +19,7 @@ export declare function depositMultipleTokenV2(params: {
|
|
|
17
19
|
pdaTokenType?: TokenType;
|
|
18
20
|
}): Promise<web3.TransactionInstruction>;
|
|
19
21
|
export declare function withdrawMultipleToken(params: {
|
|
22
|
+
connection: web3.Connection;
|
|
20
23
|
payer: web3.PublicKey;
|
|
21
24
|
withdraw: {
|
|
22
25
|
mint: web3.PublicKey;
|
|
@@ -24,6 +27,7 @@ export declare function withdrawMultipleToken(params: {
|
|
|
24
27
|
useSta?: boolean;
|
|
25
28
|
}): Promise<web3.TransactionInstruction>;
|
|
26
29
|
export declare function withdrawMultipleTokenV2(params: {
|
|
30
|
+
connection: web3.Connection;
|
|
27
31
|
payer: web3.PublicKey;
|
|
28
32
|
withdraw: {
|
|
29
33
|
mint: web3.PublicKey;
|
|
@@ -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;CACL,
|
|
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,E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AAE,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,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAkBtG"}
|
package/dist/src/hawksight.js
CHANGED
|
@@ -44,11 +44,16 @@ function depositMultipleToken(params) {
|
|
|
44
44
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
45
45
|
const amounts = params.deposit.map((d) => d.amount);
|
|
46
46
|
const remainingAccounts = [];
|
|
47
|
+
// Get mint pubkeys
|
|
48
|
+
const mints = params.deposit.map((d) => d.mint);
|
|
49
|
+
// Get and assert one token program for all mints.
|
|
50
|
+
// Throws an error if there are multiple token programs.
|
|
51
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
47
52
|
params.deposit.map((d) => {
|
|
48
53
|
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);
|
|
54
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
55
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
56
|
+
const userPdaToken = util.generateAta(userPda, d.mint, tokenProgram);
|
|
52
57
|
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
53
58
|
remainingAccounts.push({
|
|
54
59
|
pubkey: userToken,
|
|
@@ -66,6 +71,7 @@ function depositMultipleToken(params) {
|
|
|
66
71
|
isWritable: true,
|
|
67
72
|
});
|
|
68
73
|
});
|
|
74
|
+
// @ts-ignore
|
|
69
75
|
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
70
76
|
.depositMultipleToken(amounts)
|
|
71
77
|
.accounts({
|
|
@@ -74,7 +80,7 @@ function depositMultipleToken(params) {
|
|
|
74
80
|
payer: params.payer,
|
|
75
81
|
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
76
82
|
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
77
|
-
tokenProgram
|
|
83
|
+
tokenProgram,
|
|
78
84
|
systemProgram: web3.SystemProgram.programId,
|
|
79
85
|
})
|
|
80
86
|
.remainingAccounts(remainingAccounts)
|
|
@@ -89,11 +95,16 @@ function depositMultipleTokenV2(params) {
|
|
|
89
95
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
90
96
|
const amounts = params.deposit.map((d) => d.amount);
|
|
91
97
|
const remainingAccounts = [];
|
|
98
|
+
// Get mint pubkeys
|
|
99
|
+
const mints = params.deposit.map((d) => d.mint);
|
|
100
|
+
// Get and assert one token program for all mints.
|
|
101
|
+
// Throws an error if there are multiple token programs.
|
|
102
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
92
103
|
let skipIdempotent = false;
|
|
93
104
|
params.deposit.map((d) => {
|
|
94
105
|
const mint = d.mint;
|
|
95
|
-
const userToken = util.generateAta(params.payer, d.mint);
|
|
96
|
-
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
106
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
107
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
97
108
|
let userPdaToken;
|
|
98
109
|
if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
99
110
|
skipIdempotent = true;
|
|
@@ -104,7 +115,7 @@ function depositMultipleTokenV2(params) {
|
|
|
104
115
|
userPdaToken = util.generateUserPdaStorageAccount(userPda, d.mint);
|
|
105
116
|
}
|
|
106
117
|
else {
|
|
107
|
-
userPdaToken = util.generateAta(userPda, d.mint);
|
|
118
|
+
userPdaToken = util.generateAta(userPda, d.mint, tokenProgram);
|
|
108
119
|
}
|
|
109
120
|
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
110
121
|
remainingAccounts.push({
|
|
@@ -123,6 +134,7 @@ function depositMultipleTokenV2(params) {
|
|
|
123
134
|
isWritable: true,
|
|
124
135
|
});
|
|
125
136
|
});
|
|
137
|
+
// @ts-ignore
|
|
126
138
|
const ix = yield anchor_1.Anchor.instance().iyfMain.methods
|
|
127
139
|
.depositMultipleTokenV2(amounts, skipIdempotent)
|
|
128
140
|
.accounts({
|
|
@@ -131,7 +143,7 @@ function depositMultipleTokenV2(params) {
|
|
|
131
143
|
payer: params.payer,
|
|
132
144
|
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
133
145
|
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
134
|
-
tokenProgram
|
|
146
|
+
tokenProgram,
|
|
135
147
|
systemProgram: web3.SystemProgram.programId,
|
|
136
148
|
})
|
|
137
149
|
.remainingAccounts(remainingAccounts)
|
|
@@ -145,12 +157,16 @@ function withdrawMultipleToken(params) {
|
|
|
145
157
|
const farm = addresses_1.USDC_FARM;
|
|
146
158
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
147
159
|
const remainingAccounts = [];
|
|
148
|
-
|
|
160
|
+
// Get mint pubkeys
|
|
161
|
+
const mints = params.withdraw.map((d) => d.mint);
|
|
162
|
+
// Get and assert one token program for all mints.
|
|
163
|
+
// Throws an error if there are multiple token programs.
|
|
164
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
149
165
|
params.withdraw.map((d) => {
|
|
150
166
|
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);
|
|
167
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
168
|
+
const userPdaToken = params.useSta ? util.generateUserPdaStorageAccount(userPda, d.mint) : util.generateAta(userPda, d.mint, tokenProgram);
|
|
169
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
154
170
|
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
155
171
|
remainingAccounts.push({
|
|
156
172
|
pubkey: userToken,
|
|
@@ -176,7 +192,7 @@ function withdrawMultipleToken(params) {
|
|
|
176
192
|
payer: params.payer,
|
|
177
193
|
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
178
194
|
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
179
|
-
tokenProgram
|
|
195
|
+
tokenProgram,
|
|
180
196
|
systemProgram: web3.SystemProgram.programId,
|
|
181
197
|
})
|
|
182
198
|
.remainingAccounts(remainingAccounts)
|
|
@@ -191,11 +207,16 @@ function withdrawMultipleTokenV2(params) {
|
|
|
191
207
|
const userPda = util.generateUserPda(params.payer, farm);
|
|
192
208
|
const remainingAccounts = [];
|
|
193
209
|
const amounts = params.withdraw.map((d) => d.amount);
|
|
210
|
+
// Get mint pubkeys
|
|
211
|
+
const mints = params.withdraw.map((d) => d.mint);
|
|
212
|
+
// Get and assert one token program for all mints.
|
|
213
|
+
// Throws an error if there are multiple token programs.
|
|
214
|
+
const tokenProgram = yield util.getTokenProgramForMints(params.connection, mints);
|
|
194
215
|
let skipIdempotent = false;
|
|
195
216
|
params.withdraw.map((d) => {
|
|
196
217
|
const mint = d.mint;
|
|
197
|
-
const userToken = util.generateAta(params.payer, d.mint);
|
|
198
|
-
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint);
|
|
218
|
+
const userToken = util.generateAta(params.payer, d.mint, tokenProgram);
|
|
219
|
+
const ownerFeeToken = util.generateAta(addresses_1.SITE_FEE_OWNER, d.mint, tokenProgram);
|
|
199
220
|
let userPdaToken;
|
|
200
221
|
if (params.pdaTokenType === types_1.TokenType.LTA) {
|
|
201
222
|
skipIdempotent = true;
|
|
@@ -206,7 +227,7 @@ function withdrawMultipleTokenV2(params) {
|
|
|
206
227
|
userPdaToken = util.generateUserPdaStorageAccount(userPda, d.mint);
|
|
207
228
|
}
|
|
208
229
|
else {
|
|
209
|
-
userPdaToken = util.generateAta(userPda, d.mint);
|
|
230
|
+
userPdaToken = util.generateAta(userPda, d.mint, tokenProgram);
|
|
210
231
|
}
|
|
211
232
|
remainingAccounts.push({ pubkey: mint, isSigner: false, isWritable: true });
|
|
212
233
|
remainingAccounts.push({
|
|
@@ -233,7 +254,7 @@ function withdrawMultipleTokenV2(params) {
|
|
|
233
254
|
payer: params.payer,
|
|
234
255
|
hsFeeOwner: addresses_1.SITE_FEE_OWNER,
|
|
235
256
|
associatedTokenProgram: addresses_1.ASSOCIATED_TOKEN_PROGRAM,
|
|
236
|
-
tokenProgram
|
|
257
|
+
tokenProgram,
|
|
237
258
|
systemProgram: web3.SystemProgram.programId,
|
|
238
259
|
})
|
|
239
260
|
.remainingAccounts(remainingAccounts)
|