@hawksightco/hawk-sdk 1.1.2 → 1.1.4-8.2
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 +2 -0
- package/dist/src/addresses.d.ts.map +1 -1
- package/dist/src/addresses.js +3 -1
- 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/Atomicity.d.ts +35 -0
- package/dist/src/classes/Atomicity.d.ts.map +1 -0
- package/dist/src/classes/Atomicity.js +110 -0
- package/dist/src/classes/CreateTxMetadata.d.ts +16 -0
- package/dist/src/classes/CreateTxMetadata.d.ts.map +1 -1
- package/dist/src/classes/CreateTxMetadata.js +115 -6
- package/dist/src/classes/General.d.ts +16 -0
- package/dist/src/classes/General.d.ts.map +1 -1
- package/dist/src/classes/General.js +32 -0
- package/dist/src/classes/HawkAPI.d.ts +29 -0
- package/dist/src/classes/HawkAPI.d.ts.map +1 -1
- package/dist/src/classes/HawkAPI.js +35 -0
- package/dist/src/classes/JupiterAlts.d.ts +38 -0
- package/dist/src/classes/JupiterAlts.d.ts.map +1 -0
- package/dist/src/classes/JupiterAlts.js +104 -0
- package/dist/src/classes/JupiterSwap.d.ts +20 -0
- package/dist/src/classes/JupiterSwap.d.ts.map +1 -0
- package/dist/src/classes/JupiterSwap.js +37 -0
- package/dist/src/classes/Logging.d.ts +13 -0
- package/dist/src/classes/Logging.d.ts.map +1 -0
- package/dist/src/classes/Logging.js +51 -0
- package/dist/src/classes/MultiTransaction.d.ts +76 -0
- package/dist/src/classes/MultiTransaction.d.ts.map +1 -0
- package/dist/src/classes/MultiTransaction.js +286 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts +24 -0
- package/dist/src/classes/SimpleIxGenerator.d.ts.map +1 -0
- package/dist/src/classes/SimpleIxGenerator.js +29 -0
- package/dist/src/classes/Transaction.d.ts +42 -12
- package/dist/src/classes/Transaction.d.ts.map +1 -1
- package/dist/src/classes/Transaction.js +37 -15
- package/dist/src/classes/Transaction2.d.ts +108 -0
- package/dist/src/classes/Transaction2.d.ts.map +1 -0
- package/dist/src/classes/Transaction2.js +239 -0
- package/dist/src/classes/Transaction3.d.ts +166 -0
- package/dist/src/classes/Transaction3.d.ts.map +1 -0
- package/dist/src/classes/Transaction3.js +406 -0
- package/dist/src/classes/TransactionBatchExecute.d.ts +164 -0
- package/dist/src/classes/TransactionBatchExecute.d.ts.map +1 -0
- package/dist/src/classes/TransactionBatchExecute.js +456 -0
- package/dist/src/classes/TransactionBatchExecute2.d.ts +100 -0
- package/dist/src/classes/TransactionBatchExecute2.d.ts.map +1 -0
- package/dist/src/classes/TransactionBatchExecute2.js +347 -0
- package/dist/src/classes/Transactions.d.ts +51 -1
- package/dist/src/classes/Transactions.d.ts.map +1 -1
- package/dist/src/classes/Transactions.js +318 -54
- package/dist/src/classes/TxGenerator.d.ts +29 -1
- package/dist/src/classes/TxGenerator.d.ts.map +1 -1
- package/dist/src/classes/TxGenerator.js +123 -5
- 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 +72 -0
- package/dist/src/classes/Util.d.ts +22 -0
- package/dist/src/classes/Util.d.ts.map +1 -1
- package/dist/src/classes/Util.js +33 -0
- package/dist/src/functions.d.ts +61 -3
- package/dist/src/functions.d.ts.map +1 -1
- package/dist/src/functions.js +237 -3
- package/dist/src/hawksight.d.ts +8 -0
- package/dist/src/hawksight.d.ts.map +1 -1
- package/dist/src/hawksight.js +29 -1
- package/dist/src/hsToMeteora.d.ts +7 -0
- package/dist/src/hsToMeteora.d.ts.map +1 -1
- package/dist/src/hsToMeteora.js +541 -30
- package/dist/src/idl/iyf-extension-idl.d.ts +6620 -4193
- package/dist/src/idl/iyf-extension-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-extension-idl.js +6614 -4193
- package/dist/src/idl/iyf-main-idl.d.ts +244 -5
- package/dist/src/idl/iyf-main-idl.d.ts.map +1 -1
- package/dist/src/idl/iyf-main-idl.js +244 -5
- 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/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts +27 -0
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/IyfExtensionIxGenerator.js +71 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts +64 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/IyfMainIxGenerator.js +203 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts +50 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.d.ts.map +1 -0
- package/dist/src/ixGenerator/MeteoraDlmmIxGenerator.js +271 -0
- package/dist/src/meteora.d.ts +230 -1
- package/dist/src/meteora.d.ts.map +1 -1
- package/dist/src/meteora.js +708 -15
- package/dist/src/types.d.ts +40 -14
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +3 -0
- package/package.json +3 -3
package/dist/src/functions.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
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.generateAta = exports.generateUserPda = exports.createTransactionMeta = exports.getMeteoraPool = exports.getFeeEstimate = exports.resultOrError = exports.createTxMetadata = exports.METEORA_API_URL = void 0;
|
|
38
|
+
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.generateAta = exports.generateUserPda = exports.createTransactionMeta = exports.getMeteoraPool = exports.getFeeEstimate = exports.resultOrError = exports.createTxMetadata2 = exports.createTxMetadata = exports.METEORA_API_URL = void 0;
|
|
39
39
|
const client = __importStar(require("@hawksightco/swagger-client"));
|
|
40
40
|
const web3 = __importStar(require("@solana/web3.js"));
|
|
41
41
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -46,6 +46,8 @@ const lodash_1 = require("lodash");
|
|
|
46
46
|
const js_sha256_1 = require("js-sha256");
|
|
47
47
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
48
48
|
const spl_token_1 = require("@solana/spl-token");
|
|
49
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
50
|
+
const Logging_1 = require("./classes/Logging");
|
|
49
51
|
exports.METEORA_API_URL = "https://dlmm-api.meteora.ag";
|
|
50
52
|
/**
|
|
51
53
|
* Asynchronously creates transaction metadata based on the provided transaction parameters and network state.
|
|
@@ -68,6 +70,12 @@ function createTxMetadata(generalUtility, connection, payer, data) {
|
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
exports.createTxMetadata = createTxMetadata;
|
|
73
|
+
function createTxMetadata2(generalUtility, connection, payer, data) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
return yield CreateTxMetadata_1.CreateTxMetadata.instance().createTxMetadata2(generalUtility, connection, payer, data);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
exports.createTxMetadata2 = createTxMetadata2;
|
|
71
79
|
/**
|
|
72
80
|
* Wraps the result of an API call or operation in an object containing status information.
|
|
73
81
|
* If the result status is 200, applies a success function to the data.
|
|
@@ -345,7 +353,7 @@ exports.parseTokenAccountData = parseTokenAccountData;
|
|
|
345
353
|
* { payer: anotherPayerPublicKey, owner: anotherOwnerPublicKey, mint: anotherMintPublicKey }
|
|
346
354
|
* ];
|
|
347
355
|
* const instructions = createAtaIdempotent({ accounts });
|
|
348
|
-
*
|
|
356
|
+
* Log(instructions); // Logs an array of TransactionInstruction objects.
|
|
349
357
|
*/
|
|
350
358
|
function createAtaIdempotentIxs({ accounts, }) {
|
|
351
359
|
const result = [];
|
|
@@ -378,7 +386,7 @@ exports.createAtaIdempotentIxs = createAtaIdempotentIxs;
|
|
|
378
386
|
* }
|
|
379
387
|
* };
|
|
380
388
|
* const mints = getMintsFromInstruction({ instructions, find: findCriteria });
|
|
381
|
-
*
|
|
389
|
+
* Log(mints); // Logs an array of unique PublicKey objects.
|
|
382
390
|
*/
|
|
383
391
|
function getMintsFromInstruction({ instructions, find, }) {
|
|
384
392
|
const mints = {};
|
|
@@ -526,3 +534,229 @@ function inputTokenExists(connection, userWallet, mints) {
|
|
|
526
534
|
});
|
|
527
535
|
}
|
|
528
536
|
exports.inputTokenExists = inputTokenExists;
|
|
537
|
+
/**
|
|
538
|
+
* Get Jupiter route ix parameters
|
|
539
|
+
*
|
|
540
|
+
* @param data
|
|
541
|
+
*/
|
|
542
|
+
function getJupiterRouteIxParams(data) {
|
|
543
|
+
const boolIndices = [8, 17, 18, 21, 23, 58];
|
|
544
|
+
const sideIndices = [12, 15, 16, 24, 27, 28, 39];
|
|
545
|
+
const vecSize = new bn_js_1.default(data.subarray(8, 12), 10, 'le').toNumber();
|
|
546
|
+
let lastIndex = 0;
|
|
547
|
+
for (let i = 0; i < vecSize; i++) {
|
|
548
|
+
if (lastIndex === 0)
|
|
549
|
+
lastIndex = 12;
|
|
550
|
+
const swapEnumId = data[lastIndex];
|
|
551
|
+
if (boolIndices.includes(swapEnumId) || sideIndices.includes(swapEnumId))
|
|
552
|
+
lastIndex += 4 + 1;
|
|
553
|
+
// Swap is "Symmetry"
|
|
554
|
+
else if (swapEnumId == 29)
|
|
555
|
+
lastIndex += 4 + 16;
|
|
556
|
+
// Swap is "StakeDexSwapViaStake" or "StakeDexPrefundWithdrawStakeAndDepositStake"
|
|
557
|
+
else if (swapEnumId == 33 || swapEnumId == 41)
|
|
558
|
+
lastIndex += 4 + 4;
|
|
559
|
+
// Swap is "Clone"
|
|
560
|
+
else if (swapEnumId == 42)
|
|
561
|
+
lastIndex += 4 + 3;
|
|
562
|
+
// Swap is "SanctumS"
|
|
563
|
+
else if (swapEnumId == 43)
|
|
564
|
+
lastIndex += 4 + 10;
|
|
565
|
+
// Swap is "SanctumSAddLiquidity" or "SanctumSRemoveLiquidity"
|
|
566
|
+
else if (swapEnumId == 44 || swapEnumId == 45)
|
|
567
|
+
lastIndex += 4 + 5;
|
|
568
|
+
// Swap is "WhirlpoolSwapV2"
|
|
569
|
+
else if (swapEnumId == 47) {
|
|
570
|
+
lastIndex += 2;
|
|
571
|
+
if (data[lastIndex] !== 0) {
|
|
572
|
+
lastIndex += 1;
|
|
573
|
+
const vecSize = new bn_js_1.default(data.subarray(lastIndex, lastIndex + 4), 10, 'le').toNumber();
|
|
574
|
+
lastIndex += 4 + (vecSize * 2);
|
|
575
|
+
}
|
|
576
|
+
// Rest of the swaps have the standard 4-bytes
|
|
577
|
+
}
|
|
578
|
+
else
|
|
579
|
+
lastIndex += 4;
|
|
580
|
+
}
|
|
581
|
+
const routePlan = data.subarray(8, lastIndex);
|
|
582
|
+
const quotedOutAmount = new bn_js_1.default(data.subarray(lastIndex + 8, lastIndex + 16), 10, 'le');
|
|
583
|
+
const slippageBps = new bn_js_1.default(data.subarray(lastIndex + 16, lastIndex + 18), 10, 'le').toNumber();
|
|
584
|
+
const platformFeeBps = data[lastIndex + 18];
|
|
585
|
+
return {
|
|
586
|
+
routePlan,
|
|
587
|
+
quotedOutAmount,
|
|
588
|
+
slippageBps,
|
|
589
|
+
platformFeeBps,
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
exports.getJupiterRouteIxParams = getJupiterRouteIxParams;
|
|
593
|
+
/**
|
|
594
|
+
* Converts tx metadata to versioned transaction
|
|
595
|
+
*
|
|
596
|
+
* @param txMessage
|
|
597
|
+
*/
|
|
598
|
+
function toVersionedTransaction(connection, txMessage) {
|
|
599
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
600
|
+
const alts = yield stringToAlt(connection, txMessage.addressLookupTableAddresses);
|
|
601
|
+
const result = new web3.VersionedTransaction(new web3.TransactionMessage({
|
|
602
|
+
instructions: txMessage.mainInstructions.map((ix) => ixStrToWeb3Ix(ix)),
|
|
603
|
+
payerKey: new web3.PublicKey(txMessage.payer),
|
|
604
|
+
recentBlockhash: web3.PublicKey.default.toString(),
|
|
605
|
+
}).compileToV0Message(alts));
|
|
606
|
+
return result;
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
exports.toVersionedTransaction = toVersionedTransaction;
|
|
610
|
+
function ixStrToWeb3Ix(ix) {
|
|
611
|
+
return {
|
|
612
|
+
keys: ix.accounts.map((account) => {
|
|
613
|
+
return {
|
|
614
|
+
isSigner: account.isSigner,
|
|
615
|
+
isWritable: account.isWritable,
|
|
616
|
+
pubkey: new web3.PublicKey(account.pubkey),
|
|
617
|
+
};
|
|
618
|
+
}),
|
|
619
|
+
data: Buffer.from(ix.data, "base64"),
|
|
620
|
+
programId: new web3.PublicKey(ix.programId),
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
exports.ixStrToWeb3Ix = ixStrToWeb3Ix;
|
|
624
|
+
function stringToAlt(connection, alts) {
|
|
625
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
626
|
+
const c = CreateTxMetadata_1.CreateTxMetadata.instance();
|
|
627
|
+
c.setConnection(connection);
|
|
628
|
+
return yield c.stringToAlt(alts);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
exports.stringToAlt = stringToAlt;
|
|
632
|
+
let previousHeliusFeeLevels = {
|
|
633
|
+
priorityFeeLevels: {
|
|
634
|
+
high: 9327508,
|
|
635
|
+
low: 500000,
|
|
636
|
+
medium: 2675228,
|
|
637
|
+
min: 500000,
|
|
638
|
+
unsafeMax: 2368000000,
|
|
639
|
+
veryHigh: 28631588,
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
function getPriorityFeeEstimate(priorityLevel, transaction, rpcUrl) {
|
|
643
|
+
const tx = bs58_1.default.encode(transaction.serialize());
|
|
644
|
+
const heliusFeeLevels = getPriorityFeeEstimate2(tx, { includeAllPriorityFeeLevels: true }, rpcUrl);
|
|
645
|
+
heliusFeeLevels.then(feeLevels => {
|
|
646
|
+
previousHeliusFeeLevels = feeLevels;
|
|
647
|
+
});
|
|
648
|
+
const m = {
|
|
649
|
+
Min: "min",
|
|
650
|
+
Low: "low",
|
|
651
|
+
Default: "medium",
|
|
652
|
+
Medium: "medium",
|
|
653
|
+
High: "high",
|
|
654
|
+
VeryHigh: "veryHigh",
|
|
655
|
+
UnsafeMax: "unsafeMax",
|
|
656
|
+
};
|
|
657
|
+
const feeLevels = {
|
|
658
|
+
low: previousHeliusFeeLevels.priorityFeeLevels.medium * 2,
|
|
659
|
+
default: mid(previousHeliusFeeLevels.priorityFeeLevels.medium, previousHeliusFeeLevels.priorityFeeLevels.high),
|
|
660
|
+
high: previousHeliusFeeLevels.priorityFeeLevels.high,
|
|
661
|
+
veryHigh: previousHeliusFeeLevels.priorityFeeLevels.veryHigh,
|
|
662
|
+
};
|
|
663
|
+
return {
|
|
664
|
+
priorityFeeEstimate: previousHeliusFeeLevels.priorityFeeLevels[m[priorityLevel]],
|
|
665
|
+
feeLevels,
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
exports.getPriorityFeeEstimate = getPriorityFeeEstimate;
|
|
669
|
+
function getPriorityFeeEstimate2(transaction, options, url) {
|
|
670
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
671
|
+
const response = yield fetch(url, {
|
|
672
|
+
method: "POST",
|
|
673
|
+
headers: { "Content-Type": "application/json" },
|
|
674
|
+
body: JSON.stringify({
|
|
675
|
+
jsonrpc: "2.0",
|
|
676
|
+
id: "1",
|
|
677
|
+
method: "getPriorityFeeEstimate",
|
|
678
|
+
params: [
|
|
679
|
+
{
|
|
680
|
+
transaction,
|
|
681
|
+
options,
|
|
682
|
+
},
|
|
683
|
+
],
|
|
684
|
+
}),
|
|
685
|
+
});
|
|
686
|
+
const data = yield response.json();
|
|
687
|
+
return data.result;
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
exports.getPriorityFeeEstimate2 = getPriorityFeeEstimate2;
|
|
691
|
+
function mid(min, max) {
|
|
692
|
+
return min + (max - min) / 2;
|
|
693
|
+
}
|
|
694
|
+
exports.mid = mid;
|
|
695
|
+
/**
|
|
696
|
+
* Find all nonce pubkey owned by given owner and index
|
|
697
|
+
*
|
|
698
|
+
* @param owner
|
|
699
|
+
*/
|
|
700
|
+
function generateNonceAddressFromIndex(owner, index) {
|
|
701
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
702
|
+
return yield web3.PublicKey.createWithSeed(owner, `hs-nonce-${index}`, web3.SystemProgram.programId);
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
exports.generateNonceAddressFromIndex = generateNonceAddressFromIndex;
|
|
706
|
+
/**
|
|
707
|
+
* Find all nonce pubkey owned by given owner
|
|
708
|
+
*
|
|
709
|
+
* @param owner
|
|
710
|
+
*/
|
|
711
|
+
function generateNonceAddressesOwnedBy(owner, count) {
|
|
712
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
713
|
+
const nonceAddresses = [];
|
|
714
|
+
for (let i = 0; i < count; i++) {
|
|
715
|
+
nonceAddresses.push(yield generateNonceAddressFromIndex(owner, i));
|
|
716
|
+
}
|
|
717
|
+
return nonceAddresses;
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
exports.generateNonceAddressesOwnedBy = generateNonceAddressesOwnedBy;
|
|
721
|
+
/**
|
|
722
|
+
* Find all nonce pubkey owned by given owner
|
|
723
|
+
*
|
|
724
|
+
* TODO: Put this into a class and the class must serve as cache of nonce accounts (so that we don't query nonce account multiple times)
|
|
725
|
+
*
|
|
726
|
+
* @param owner
|
|
727
|
+
*/
|
|
728
|
+
function findNonceOwnedBy(connection, owner, count) {
|
|
729
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
730
|
+
const nonceAddresses = yield generateNonceAddressesOwnedBy(owner, count);
|
|
731
|
+
const infos = yield connection.getMultipleAccountsInfo(nonceAddresses);
|
|
732
|
+
const result = infos.filter(info => info !== null).map(info => {
|
|
733
|
+
const result = {
|
|
734
|
+
/** `true` if this account's data contains a loaded program */
|
|
735
|
+
executable: info.executable,
|
|
736
|
+
/** Identifier of the program that owns the account */
|
|
737
|
+
owner: info.owner,
|
|
738
|
+
/** Number of lamports assigned to the account */
|
|
739
|
+
lamports: info.lamports,
|
|
740
|
+
/** Optional data assigned to the account */
|
|
741
|
+
data: web3.NonceAccount.fromAccountData(info.data),
|
|
742
|
+
/** Optional rent epoch info for account */
|
|
743
|
+
rentEpoch: info.rentEpoch,
|
|
744
|
+
};
|
|
745
|
+
return result;
|
|
746
|
+
});
|
|
747
|
+
return result;
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
exports.findNonceOwnedBy = findNonceOwnedBy;
|
|
751
|
+
exports.benchmark = (() => {
|
|
752
|
+
let startTime;
|
|
753
|
+
return ({ end, name, msg }) => {
|
|
754
|
+
if (end) {
|
|
755
|
+
(0, Logging_1.Log)(`${name}: ${msg} elapsed time: ${new Date().getTime() / 1000 - startTime}`);
|
|
756
|
+
}
|
|
757
|
+
else {
|
|
758
|
+
startTime = new Date().getTime() / 1000;
|
|
759
|
+
(0, Logging_1.Log)(`${name}: Benchmarking ${msg}`);
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
})();
|
package/dist/src/hawksight.d.ts
CHANGED
|
@@ -14,4 +14,12 @@ export declare function withdrawMultipleToken(params: {
|
|
|
14
14
|
mint: web3.PublicKey;
|
|
15
15
|
}[];
|
|
16
16
|
}): Promise<web3.TransactionInstruction>;
|
|
17
|
+
export type AtomicityContextParams = {
|
|
18
|
+
userWallet: web3.PublicKey;
|
|
19
|
+
};
|
|
20
|
+
export declare function setTransactionSlot({ userWallet }: AtomicityContextParams): Promise<web3.TransactionInstruction>;
|
|
21
|
+
export type VerifyTransactionSlotParams = {
|
|
22
|
+
userWallet: web3.PublicKey;
|
|
23
|
+
};
|
|
24
|
+
export declare function verifyTransactionSlot({ userWallet }: AtomicityContextParams): Promise<web3.TransactionInstruction>;
|
|
17
25
|
//# sourceMappingURL=hawksight.d.ts.map
|
|
@@ -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;AAUvB,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,wCAyCA;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;CACL,wCAwCA"}
|
|
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;AAUvB,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,wCAyCA;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;CACL,wCAwCA;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"}
|
package/dist/src/hawksight.js
CHANGED
|
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.withdrawMultipleToken = exports.depositMultipleToken = void 0;
|
|
35
|
+
exports.verifyTransactionSlot = exports.setTransactionSlot = exports.withdrawMultipleToken = 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");
|
|
@@ -126,3 +126,31 @@ function withdrawMultipleToken(params) {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
exports.withdrawMultipleToken = withdrawMultipleToken;
|
|
129
|
+
function setTransactionSlot(_a) {
|
|
130
|
+
return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
|
|
131
|
+
const ix = yield anchor_1.Anchor
|
|
132
|
+
.instance().iyfMain.methods
|
|
133
|
+
.setTransactionSlot()
|
|
134
|
+
.accounts({
|
|
135
|
+
userPda: util.generateUserPda(userWallet),
|
|
136
|
+
clock: web3.SYSVAR_CLOCK_PUBKEY,
|
|
137
|
+
})
|
|
138
|
+
.instruction();
|
|
139
|
+
return ix;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
exports.setTransactionSlot = setTransactionSlot;
|
|
143
|
+
function verifyTransactionSlot(_a) {
|
|
144
|
+
return __awaiter(this, arguments, void 0, function* ({ userWallet }) {
|
|
145
|
+
const ix = yield anchor_1.Anchor
|
|
146
|
+
.instance().iyfMain.methods
|
|
147
|
+
.verifyTransactionSlot()
|
|
148
|
+
.accounts({
|
|
149
|
+
userPda: util.generateUserPda(userWallet),
|
|
150
|
+
clock: web3.SYSVAR_CLOCK_PUBKEY,
|
|
151
|
+
})
|
|
152
|
+
.instruction();
|
|
153
|
+
return ix;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
exports.verifyTransactionSlot = verifyTransactionSlot;
|
|
@@ -15,4 +15,11 @@ export declare function meteoraToHawksight({ ixs, userPda, authority }: MeteoraT
|
|
|
15
15
|
* @returns
|
|
16
16
|
*/
|
|
17
17
|
export declare function meteoraToHawksightAutomationIxs({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Convert listed meteora instruction to hawksight meteora automation cpi
|
|
20
|
+
*
|
|
21
|
+
* @param params
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
export declare function meteoraToHawksightPdaIxs({ ixs, userPda, authority }: MeteoraToHawksightParams): Promise<web3.TransactionInstruction[]>;
|
|
18
25
|
//# sourceMappingURL=hsToMeteora.d.ts.map
|
|
@@ -1 +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,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAcnD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"hsToMeteora.d.ts","sourceRoot":"","sources":["../../src/hsToMeteora.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAcnD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUpI;AAED;;;;;GAKG;AACH,wBAAsB,+BAA+B,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAUjJ;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAU1I"}
|