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
119
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.39 to 0.0.40

10

dist/src/classes/Transaction.d.ts

@@ -66,2 +66,12 @@ import * as client from "@hawksightco/swagger-client";

* Add priority fee instructions (compute budget)
*
* This method adds priority fee instructions to the transaction based on the specified
* priority level and compute unit limit. It ensures that the total fee does not exceed
* the specified maximum priority fee (in SOL) if provided.
*
* @param connection - The connection to the Solana cluster.
* @param priorityLevel - The priority level for the fee estimation.
* @param computeUnitLimit - The limit on the number of compute units.
* @param maxPriorityFee - The maximum priority fee in SOL (optional).
* @returns An array of transaction instructions.
*/

@@ -68,0 +78,0 @@ addPriorityFeeIx(connection: web3.Connection, priorityLevel: client.PriorityLevel, computeUnitLimit: number, maxPriorityFee?: number): Promise<web3.TransactionInstruction[]>;

20

dist/src/classes/Transaction.js

@@ -153,2 +153,12 @@ "use strict";

* Add priority fee instructions (compute budget)
*
* This method adds priority fee instructions to the transaction based on the specified
* priority level and compute unit limit. It ensures that the total fee does not exceed
* the specified maximum priority fee (in SOL) if provided.
*
* @param connection - The connection to the Solana cluster.
* @param priorityLevel - The priority level for the fee estimation.
* @param computeUnitLimit - The limit on the number of compute units.
* @param maxPriorityFee - The maximum priority fee in SOL (optional).
* @returns An array of transaction instructions.
*/

@@ -161,10 +171,12 @@ addPriorityFeeIx(connection, priorityLevel, computeUnitLimit, maxPriorityFee) {

const estimate = yield (0, functions_1.getFeeEstimate)(this.generalUtility, priorityLevel, this.txMetadataResponse);
// Convert maxPriorityFee from SOL to lamports (1 SOL = 1_000_000_000 lamports)
const maxPriorityFeeLamports = maxPriorityFee !== undefined ? maxPriorityFee * 1000000000 : undefined;
// Calculate the total fee in lamports
let totalPriorityFeeLamports = (new bn_js_1.BN(estimate).mul(new bn_js_1.BN(computeUnitLimit)).div(new bn_js_1.BN(1000000))).toNumber();
let totalPriorityFeeLamports = new bn_js_1.BN(estimate).mul(new bn_js_1.BN(computeUnitLimit)).div(new bn_js_1.BN(1000000)).toNumber();
// If maxPriorityFee is defined and it is less than the total calculated fee, cap it
if (maxPriorityFee !== undefined && maxPriorityFee > 0 && totalPriorityFeeLamports > maxPriorityFee) {
totalPriorityFeeLamports = maxPriorityFee;
if (maxPriorityFeeLamports !== undefined && totalPriorityFeeLamports > maxPriorityFeeLamports) {
totalPriorityFeeLamports = maxPriorityFeeLamports;
}
// Convert the total priority fee back to microLamports per compute unit
const priorityFeePerUnitMicroLamports = (new bn_js_1.BN(totalPriorityFeeLamports).mul(new bn_js_1.BN(1000000)).div(new bn_js_1.BN(computeUnitLimit))).toNumber();
const priorityFeePerUnitMicroLamports = new bn_js_1.BN(totalPriorityFeeLamports).mul(new bn_js_1.BN(1000000)).div(new bn_js_1.BN(computeUnitLimit)).toNumber();
// Create priority fee instructions for transaction

@@ -171,0 +183,0 @@ const priorityFeeIxs = [

2

package.json
{
"name": "@hawksightco/hawk-sdk",
"version": "0.0.39",
"version": "0.0.40",
"description": "Hawksight v2 SDK",

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

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