Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hawksightco/hawk-sdk

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hawksightco/hawk-sdk - npm Package Compare versions

Comparing version 0.0.54 to 0.0.55

2

dist/src/classes/General.js

@@ -130,3 +130,3 @@ "use strict";

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -133,0 +133,0 @@ }

@@ -15,10 +15,2 @@ import * as web3 from "@solana/web3.js";

/**
* The current priority level of transactions generated by this instance.
*/
protected priorityLevel: _client.PriorityLevel;
/**
* The maximum priority fee in lamports that can be added to transactions for faster processing.
*/
protected maxPriorityFee: number;
/**
* Initializes a new instance of the TxGenerator class with a specified client.

@@ -30,14 +22,2 @@ *

/**
* Sets the priority level of the transaction.
*
* @param priorityLevel The desired transaction priority level.
*/
setPriorityLevel(priorityLevel: _client.PriorityLevel): void;
/**
* Sets the maximum priority fee for the transaction.
*
* @param maxPriorityFee The maximum priority fee in lamports.
*/
setMaxPriorityFee(maxPriorityFee: number): void;
/**
* Creates meteora instruction that creates new position and deposit.

@@ -44,0 +24,0 @@ *

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -36,3 +13,2 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

exports.TxGenerator = void 0;
const _client = __importStar(require("@hawksightco/swagger-client"));
const functions_1 = require("../functions");

@@ -53,22 +29,4 @@ /**

this.generalUtility = generalUtility;
this.priorityLevel = _client.PriorityLevel.Default;
this.maxPriorityFee = 500000; // Default max priority fee in lamports
}
/**
* Sets the priority level of the transaction.
*
* @param priorityLevel The desired transaction priority level.
*/
setPriorityLevel(priorityLevel) {
this.priorityLevel = priorityLevel;
}
/**
* Sets the maximum priority fee for the transaction.
*
* @param maxPriorityFee The maximum priority fee in lamports.
*/
setMaxPriorityFee(maxPriorityFee) {
this.maxPriorityFee = maxPriorityFee;
}
/**
* Creates meteora instruction that creates new position and deposit.

@@ -87,3 +45,3 @@ *

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -105,3 +63,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -123,3 +81,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -141,3 +99,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -159,3 +117,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -177,3 +135,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -195,3 +153,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -213,3 +171,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -231,3 +189,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -249,3 +207,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -252,0 +210,0 @@ }

@@ -73,3 +73,3 @@ "use strict";

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -93,3 +93,3 @@ }

data: result.data,
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data, this.priorityLevel, this.maxPriorityFee); }));
}, (data) => __awaiter(this, void 0, void 0, function* () { return yield (0, functions_1.createTxMetadata)(this.generalUtility, connection, payer, data); }));
});

@@ -96,0 +96,0 @@ }

@@ -16,4 +16,2 @@ import * as client from "@hawksightco/swagger-client";

* - estimatedFeeInSOL: Estimated fee in SOL units.
* @param priorityLevel An enum representing the priority level of the transaction which might influence the fee.
* @param maxPriorityFee The maximum priority fee willing to be paid on top of the base fee for faster processing (in lamports)
* @returns A promise resolving to an object containing the transaction metadata including the description,

@@ -23,3 +21,3 @@ * estimated fee, and the transaction object itself.

*/
export declare function createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse, priorityLevel: client.PriorityLevel, maxPriorityFee: number): Promise<TransactionMetadata>;
export declare function createTxMetadata(generalUtility: GeneralUtility, connection: web3.Connection, payer: string, data: TransactionMetadataResponse): Promise<TransactionMetadata>;
/**

@@ -26,0 +24,0 @@ * Wraps the result of an API call or operation in an object containing status information.

@@ -50,4 +50,2 @@ "use strict";

* - estimatedFeeInSOL: Estimated fee in SOL units.
* @param priorityLevel An enum representing the priority level of the transaction which might influence the fee.
* @param maxPriorityFee The maximum priority fee willing to be paid on top of the base fee for faster processing (in lamports)
* @returns A promise resolving to an object containing the transaction metadata including the description,

@@ -57,6 +55,8 @@ * estimated fee, and the transaction object itself.

*/
function createTxMetadata(generalUtility, connection, payer, data, priorityLevel, maxPriorityFee) {
function createTxMetadata(generalUtility, connection, payer, data) {
return __awaiter(this, void 0, void 0, function* () {
// Retrieve address lookup table accounts
const alts = [];
console.log(`createTxMetadata`);
const startTime = new Date().getTime() / 1000;
// Find jup alts

@@ -66,2 +66,3 @@ const jupAlts = yield generalUtility.findAltWithTxPost({

});
console.log(`createTxMetadata: Checkpoint: (jupAlts) ${(new Date().getTime() / 1000) - startTime}`);
for (const alt of data.addressLookupTableAddresses) {

@@ -78,18 +79,9 @@ alts.push((yield connection.getAddressLookupTable(new web3.PublicKey(alt))).value);

}
console.log(`createTxMetadata: Checkpoint: (jupAlts after loop) ${(new Date().getTime() / 1000) - startTime}`);
// Get the recent blockhash
const latestBlockhash = yield connection.getLatestBlockhash();
console.log(`createTxMetadata: Checkpoint: (latestBlockhash) ${(new Date().getTime() / 1000) - startTime}`);
// Create initial transaction instance
const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), latestBlockhash, alts, generalUtility);
// // Simulate transaction to get consumed units
// const simulation = await transaction.simulateTransaction(connection);
// // Check if there's error in transaction
// if (simulation.err !== null) {
// console.log(`Transaction Error: ${simulation.err}`);
// for (const log of simulation.logs as string[]) {
// console.log(log);
// }
// // throw new Error(simulation.err.toString());
// }
// // Include priority fee instructions generated via Helius (assuming we use Helius as RPC)
// transaction.addPriorityFeeIx(connection, priorityLevel, simulation.unitsConsumed, maxPriorityFee);
console.log(`createTxMetadata: Elapsed time: ${(new Date().getTime() / 1000) - startTime}`);
// Return transaction metadatauni

@@ -96,0 +88,0 @@ return {

{
"name": "@hawksightco/hawk-sdk",
"version": "0.0.54",
"version": "0.0.55",
"description": "Hawksight v2 SDK",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc