@hawksightco/hawk-sdk
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -12,3 +12,3 @@ import * as client from "@hawksightco/swagger-client"; | ||
readonly payerKey: web3.PublicKey; | ||
private _recentBlockhash; | ||
private latestBlockhash; | ||
readonly alts: web3.AddressLookupTableAccount[]; | ||
@@ -32,2 +32,4 @@ private generalUtility; | ||
get instructions(): web3.TransactionInstruction[]; | ||
/** last valid block height */ | ||
get lastValidBlockHeight(): number; | ||
/** | ||
@@ -41,3 +43,3 @@ * Constructs a new Transaction object. | ||
*/ | ||
constructor(txMetadataResponse: TransactionMetadataResponse, payerKey: web3.PublicKey, _recentBlockhash: string, alts: web3.AddressLookupTableAccount[], generalUtility: GeneralUtility); | ||
constructor(txMetadataResponse: TransactionMetadataResponse, payerKey: web3.PublicKey, latestBlockhash: web3.BlockhashWithExpiryBlockHeight, alts: web3.AddressLookupTableAccount[], generalUtility: GeneralUtility); | ||
/** | ||
@@ -71,3 +73,3 @@ * Signs the transaction with provided signers. | ||
*/ | ||
buildTransaction(recentBlockhash: string): [web3.TransactionMessage, web3.VersionedTransaction]; | ||
buildTransaction(latestBlockhash: web3.BlockhashWithExpiryBlockHeight): [web3.TransactionMessage, web3.VersionedTransaction]; | ||
/** | ||
@@ -74,0 +76,0 @@ * Gathers the public keys of all parties required to sign the transaction. |
@@ -48,4 +48,6 @@ "use strict"; | ||
/** The blockhash of a recent ledger entry */ | ||
get recentBlockhash() { return this._recentBlockhash; } | ||
get recentBlockhash() { return this.latestBlockhash.blockhash; } | ||
get instructions() { return this._instructions; } | ||
/** last valid block height */ | ||
get lastValidBlockHeight() { return this.latestBlockhash.lastValidBlockHeight; } | ||
/** | ||
@@ -59,3 +61,3 @@ * Constructs a new Transaction object. | ||
*/ | ||
constructor(txMetadataResponse, payerKey, _recentBlockhash, alts, generalUtility) { | ||
constructor(txMetadataResponse, payerKey, latestBlockhash, alts, generalUtility) { | ||
// // Construct compute instructions | ||
@@ -73,3 +75,3 @@ // const computeIxs = txMetadataResponse.computeBudgetInstructions.map(ix => { | ||
this.payerKey = payerKey; | ||
this._recentBlockhash = _recentBlockhash; | ||
this.latestBlockhash = latestBlockhash; | ||
this.alts = alts; | ||
@@ -90,3 +92,3 @@ this.generalUtility = generalUtility; | ||
this._instructions = [...mainIxs]; | ||
const [txMessage, versionedTransaction] = this.buildTransaction(_recentBlockhash); | ||
const [txMessage, versionedTransaction] = this.buildTransaction(latestBlockhash); | ||
this._txMessage = txMessage; | ||
@@ -158,3 +160,3 @@ this._versionedTransaction = versionedTransaction; | ||
// Rebuild versioned transaction | ||
const { blockhash } = yield connection.getLatestBlockhash(); | ||
const blockhash = yield connection.getLatestBlockhash(); | ||
this.buildTransaction(blockhash); | ||
@@ -200,7 +202,8 @@ return priorityFeeIxs; | ||
*/ | ||
buildTransaction(recentBlockhash) { | ||
buildTransaction(latestBlockhash) { | ||
this.latestBlockhash = latestBlockhash; | ||
this._txMessage = new web3.TransactionMessage({ | ||
payerKey: this.payerKey, | ||
instructions: this.instructions, | ||
recentBlockhash, | ||
recentBlockhash: this.recentBlockhash, | ||
}); | ||
@@ -207,0 +210,0 @@ this._versionedTransaction = new web3.VersionedTransaction(this.txMessage.compileToV0Message(this.alts)); |
@@ -63,5 +63,5 @@ "use strict"; | ||
// Get the recent blockhash | ||
const { blockhash: recentBlockhash } = yield connection.getLatestBlockhash(); | ||
const latestBlockhash = yield connection.getLatestBlockhash(); | ||
// Create initial transaction instance | ||
const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), recentBlockhash, alts, generalUtility); | ||
const transaction = new Transaction_1.Transaction(data, new web3.PublicKey(payer), latestBlockhash, alts, generalUtility); | ||
// // Simulate transaction to get consumed units | ||
@@ -68,0 +68,0 @@ // const simulation = await transaction.simulateTransaction(connection); |
{ | ||
"name": "@hawksightco/hawk-sdk", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
114908
2015
0