@hawksightco/hawk-sdk
Advanced tools
Comparing version 0.0.20 to 0.0.21
@@ -208,5 +208,13 @@ "use strict"; | ||
const testInstructions = [ | ||
web3.ComputeBudgetProgram.setComputeUnitLimit({ units: 1400000 }), | ||
...this.instructions, | ||
]; | ||
if (this.findSetComputeUnitLimitIndex(testInstructions) === -1) { | ||
testInstructions.unshift(web3.ComputeBudgetProgram.setComputeUnitLimit({ units: 1400000 })); | ||
} | ||
if (this.findSetComputeUnitPriceIndex(testInstructions) === -1) { | ||
testInstructions.unshift(web3.ComputeBudgetProgram.setComputeUnitPrice({ | ||
// CU * CU PRICE -> 1400000 * feeEstimate.priorityFeeEstimate | ||
microLamports: 100000, | ||
})); | ||
} | ||
const testVersionedTxn = new web3.VersionedTransaction(new web3.TransactionMessage({ | ||
@@ -262,4 +270,11 @@ instructions: testInstructions, | ||
*/ | ||
findSetComputeUnitLimitIndex() { | ||
return this.instructions.findIndex((ix) => { | ||
findSetComputeUnitLimitIndex(instructions) { | ||
let _instructions = []; | ||
if (instructions !== undefined) { | ||
_instructions = instructions; | ||
} | ||
else { | ||
_instructions = this.instructions; | ||
} | ||
return _instructions.findIndex((ix) => { | ||
const isComputeBudgetProgram = ix.programId.toString() === | ||
@@ -274,4 +289,11 @@ "ComputeBudget111111111111111111111111111111"; | ||
*/ | ||
findSetComputeUnitPriceIndex() { | ||
return this.instructions.findIndex((ix) => { | ||
findSetComputeUnitPriceIndex(instructions) { | ||
let _instructions = []; | ||
if (instructions !== undefined) { | ||
_instructions = instructions; | ||
} | ||
else { | ||
_instructions = this.instructions; | ||
} | ||
return _instructions.findIndex((ix) => { | ||
const isComputeBudgetProgram = ix.programId.toString() === | ||
@@ -278,0 +300,0 @@ "ComputeBudget111111111111111111111111111111"; |
{ | ||
"name": "@hawksightco/hawk-sdk", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Hawksight v2 SDK", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117358
2087