@hawksightco/hawk-sdk 1.1.44-hotfix-3 → 1.1.44-hotfix-5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CreateTxMetadata.d.ts","sourceRoot":"","sources":["../../../src/classes/CreateTxMetadata.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD;;;GAGG;AACH,qBAAa,gBAAgB;IAE3B,OAAO;IAEP,OAAO,CAAC,UAAU,CAAC,CAAkB;IAErC;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU;IAEzC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAmB;IAE3C;;;;OAIG;IACH,MAAM,CAAC,QAAQ,IAAI,gBAAgB;IAOnC,OAAO,CAAC,IAAI,CAaV;IAEF;;OAEG;IACG,IAAI;IAIV;;OAEG;IACG,UAAU;IAUhB;;;;;;;OAOG;IACG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,CAAC;IAcvG;;;;;OAKG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,yBAAyB,GAAG,IAAI,CAAC;IAIzE;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,yBAAyB;IAI7D;;;;;;OAMG;IACG,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IA4B5C;;;;;;;;;;;;;;;OAeG;IACG,gBAAgB,CACpB,c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AAyB;IAI7D;;;;;;OAMG;IACG,WAAW,CACf,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC;IA4B5C;;;;;;;;;;;;;;;OAeG;IACG,gBAAgB,CACpB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,CAAC;IA8DzB,iBAAiB,CACrB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAuElC"}
@@ -223,7 +223,12 @@ class CreateTxMetadata {
223
223
  alts.push(_alt);
224
224
  }
225
225
  else {
226
- alts.push(yield this.loadSingleAlt(alt, connection));
226
+ try {
227
+ alts.push(yield this.loadSingleAlt(alt, connection));
228
+ }
229
+ catch (_a) {
230
+ console.error(`The ALT from Jupiter: ${alt} does not exist onchain. Skipping.`);
231
+ }
227
232
  }
228
233
  }
229
234
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../../src/classes/Transactions.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAiBxC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,EACf,+BAA+B,EAC/B,cAAc,EACd,0BAA0B,EAC1B,gBAAgB,EAChB,eAAe,EACf,QAAQ,EAER,WAAW,EACX,6BAA6B,EAC7B,2BAA2B,EAC3B,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,iBAAiB,EAClB,MAAM,UAAU,CAAC;AA8BlB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,E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BAAsB,CAAC,EAC3B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,iBAAiB,CAAC;IAiFjC;;;;;;OAMG;IACG,8BAA8B,CAAC,EACnC,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,6BAA6B,CAAC,GAAG,OAAO,CACrD,2BAA2B,GAAG,EAAE,CACjC;IAgEK,sBAAsB,CAAC,EAC3B,UAAU,EACV,MAAM,GACP,EAAE,WAAW,CAAC,2BAA2B,CAAC;IA+H3C,OAAO,CAAC,0BAA0B;IAkClC;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA2DnH;;;;;;;OAOG;IACG,iBAAiB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,iBAAiB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAkDrH;;;;;;;OAOG;IACG,WAAW,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAgIzG;;;;;;;OAOG;IACG,YAAY,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAyF3G;;;;;;;OAOG;IACG,gBAAgB,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAqGpH;AAED,eAAO,MAAM,KAAK,cAA6B,CAAC"}
@@ -871,9 +871,11 @@ class Transactions {
871
871
  const positionTokenAccount = (0, functions_1.generateAta)(userPda, params.positionMint);
872
872
  let positionData;
873
873
  if (params.newPosition) {
874
- positionData.whirlpool = params.newPosition.whirlpool;
875
- positionData.tickLowerIndex = params.newPosition.tickLowerIndex;
876
- positionData.tickUpperIndex = params.newPosition.tickUpperIndex;
874
+ positionData = {
875
+ whirlpool: params.newPosition.whirlpool,
876
+ tickLowerIndex: params.newPosition.tickLowerIndex,
877
+ tickUpperIndex: params.newPosition.tickUpperIndex,
878
+ };
877
879
  }
878
880
  else {
879
881
  positionData = yield anchor_1.Anchor.instance().orcaProgram.account.position.fetch(position);
@@ -1 +1 @@
1
- {"version":3,"file":"TxGenerator.d.ts","sourceRoot":"","sources":["../../../src/classes/TxGenerator.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAkE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACtO,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;GAIG;AACH,qBAAa,WAAW;IAQpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc;IAPnD;;;;OAIG;gBAEgB,MAAM,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc;IAGnD;;;;;;;OAOG;IACG,+BAA+B,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAqCnL;;;;;;;OAOG;IACG,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,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AAC,CAAC;IAkC3K;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAmC9I;;;;;;;OAOG;IACG,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAgChJ;;;;;;;OAOG;IACG,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAmCpI;;;;;;;OAOG;IACG,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAiCtI;;;;;;;OAOG;IACG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;CA+B/I"}
@@ -431,6 +431,7 @@ class TxGenerator {
431
431
  positionMint: params.positionMint,
432
432
  totalXAmount: params.totalXAmount,
433
433
  totalYAmount: params.totalYAmount,
434
+ newPosition: params.newPosition,
434
435
  }
435
436
  });
436
437
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawksightco/hawk-sdk",
3
- "version": "1.1.44-hotfix-3",
3
+ "version": "1.1.44-hotfix-5",
4
4
  "description": "Hawksight v2 SDK",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": "https://github.com/ghabxph/hawk-api-client.git",
@@ -1,162 +0,0 @@
1
- /// <reference types="@meteora-ag/dlmm/node_modules/@solana/web3.js" />
2
- import * as client from "@hawksightco/swagger-client";
3
- import * as web3 from "@solana/web3.js";
4
- import { SimulatedTransactionResponse, TransactionMetadataResponse } from "../types";
5
- import { GeneralUtility } from "./GeneralUtility";
6
- /**
7
- * Represents a transaction object in Solana using the web3.js library.
8
- * This class encapsulates the logic for creating, signing, and verifying signatures of transactions.
9
- */
10
- export declare class Transaction {
11
- readonly txMetadataResponse: TransactionMetadataResponse;
12
- readonly payerKey: web3.PublicKey;
13
- private latestBlockhash;
14
- readonly alts: web3.AddressLookupTableAccount[];
15
- private generalUtility;
16
- /** Compiled TransactionMessage which includes payer, instructions, and recent blockhash */
17
- private _txMessage;
18
- get txMessage(): web3.TransactionMessage;
19
- /** Versioned transaction built from the transaction message */
20
- private _versionedTransaction;
21
- get versionedTransaction(): web3.VersionedTransaction;
22
- /** A map indicating whether each required signer has signed the transaction */
23
- readonly requiredSigners: Record<string, boolean>;
24
- /** Estimated fee in SOL for priority fee when addPriorityFee() method is called. */
25
- private _priorityFeeEstimate;
26
- get priorityFeeEstimate(): string;
27
- /** The blockhash of a recent ledger entry */
28
- get recentBlockhash(): string;
29
- /** Array of TransactionInstruction to be executed in this transaction */
30
- private _instructions;
31
- get instructions(): web3.TransactionInstruction[];
32
- /** last valid block height */
33
- get lastValidBlockHeight(): number;
34
- /**
35
- * Whether transaction has nonce advance instruction
36
- */
37
- readonly hasNonceAdvanceIx: boolean;
38
- /**
39
- * Blockhash from nonce account
40
- */
41
- private blockhashFromNonce;
42
- /**
43
- * Constructs a new Transaction object.
44
- *
45
- * @param payerKey PublicKey of the transaction payer
46
- * @param instructions Array of TransactionInstruction to be executed in this transaction
47
- * @param recentBlockhash The blockhash of a recent ledger entry
48
- * @param alts Address lookup tables that optimize account address storage
49
- */
50
- constructor(txMetadataResponse: TransactionMetadataResponse, payerKey: web3.PublicKey, latestBlockhash: web3.BlockhashWithExpiryBlockHeight, alts: web3.AddressLookupTableAccount[], generalUtility: GeneralUtility, _mainIxs?: web3.TransactionInstruction[]);
51
- /**
52
- * Generate nonde advance instruction (dummy instruction)
53
- */
54
- private nonceAdvanceIx;
55
- /**
56
- * Replace nonce pubkey
57
- */
58
- replaceNoncePubkey(noncePubkey: web3.PublicKey): void;
59
- /**
60
- * Get nonce index
61
- *
62
- * @returns
63
- */
64
- private getNonceIndex;
65
- /**
66
- * Get blockhash from nonce pubkey
67
- */
68
- private getBlockhashFromNonce;
69
- /**
70
- * Signs the transaction with provided signers.
71
- *
72
- * @param signers Array of Signer objects whose private keys will be used to sign the transaction.
73
- * @param idempotent Boolean indicating whether signing should be idempotent (default is false).
74
- * @throws Error if a signer is not required or has already signed the transaction when not idempotent.
75
- */
76
- sign(signers: web3.Signer[], idempotent?: boolean): void;
77
- /**
78
- * Add a signature on the transaction with provided signature.
79
- *
80
- * @param publicKey The public key of the signer
81
- * @param signature A signature of the signed transaction
82
- * @throws Error if a signer is not required or has already signed the transaction.
83
- */
84
- addSignature(publicKey: web3.PublicKey, signature: Uint8Array): void;
85
- /**
86
- * Checks if all required signers have signed the transaction.
87
- *
88
- * @returns Boolean indicating whether all required signers have signed.
89
- */
90
- isSignedByRequiredSigners(): boolean;
91
- /**
92
- * Add priority fee instructions (compute budget) with a fixed priority fee.
93
- *
94
- * This method adds priority fee instructions to the transaction based on a fixed priority fee.
95
- *
96
- * @param connection - The connection to the Solana cluster.
97
- * @param computeUnitLimit - The limit on the number of compute units.
98
- * @param fixedPriority - Set to true to indicate a fixed priority fee.
99
- * @param fixedPriorityFee - The fixed priority fee in lamports.
100
- * @returns An array of transaction instructions.
101
- */
102
- addPriorityFeeIx(connection: web3.Connection, computeUnitLimit: number, fixedPriority: true, fixedPriorityFee: number): Promise<web3.TransactionInstruction[]>;
103
- /**
104
- * Add priority fee instructions (compute budget) with a variable priority defined by Helius.
105
- *
106
- * This method adds priority fee instructions to the transaction based on the specified
107
- * priority level and compute unit limit. It ensures that the total fee does not exceed
108
- * the specified maximum priority fee (in SOL) if provided.
109
- *
110
- * @param connection - The connection to the Solana cluster.
111
- * @param computeUnitLimit - The limit on the number of compute units.
112
- * @param fixedPriority - Set to false to indicate a variable priority fee.
113
- * @param priorityLevel - The priority level for the fee estimation.
114
- * @param maxPriorityFee - The maximum priority fee in SOL (optional).
115
- * @returns An array of transaction instructions.
116
- */
117
- addPriorityFeeIx(connection: web3.Connection, computeUnitLimit: number, fixedPriority: false, priorityLevel: client.PriorityLevel, maxPriorityFee?: number): Promise<web3.TransactionInstruction[]>;
118
- /**
119
- * Gets the compute unit limit from a transaction simulation.
120
- *
121
- * This function simulates a transaction and calculates the compute unit limit
122
- * based on the simulation results. If an additional compute limit is provided,
123
- * it is added to the units consumed in the simulation. Otherwise, the units
124
- * consumed are increased by 10%.
125
- *
126
- * @param {web3.Connection} connection - The connection object to the Solana cluster.
127
- * @param {number} [additionalComputeLimit] - Optional additional compute limit to add to the units consumed.
128
- * @returns {Promise<number>} - A promise that resolves to the total compute unit limit.
129
- * @throws {Error} - Throws an error if the transaction simulation fails.
130
- */
131
- getComputeUnitLimit(connection: web3.Connection, additionalComputeLimit?: number): Promise<number>;
132
- /**
133
- * Simulate transaction
134
- *
135
- * @param connection
136
- * @returns
137
- */
138
- simulateTransaction(connection: web3.Connection, signers?: web3.Keypair[]): Promise<SimulatedTransactionResponse>;
139
- /**
140
- * Builds transaction object
141
- */
142
- buildTransaction(latestBlockhash: web3.BlockhashWithExpiryBlockHeight): [web3.TransactionMessage, web3.VersionedTransaction];
143
- /**
144
- * Gathers the public keys of all parties required to sign the transaction.
145
- *
146
- * @returns A record of signer public keys mapped to a boolean indicating whether they have signed.
147
- */
148
- private getRequiredSigners;
149
- /**
150
- * Find setComputeUnitLimit index within the instructions
151
- */
152
- private findSetComputeUnitLimitIndex;
153
- /**
154
- * Find setComputeUnitPrice index within the instructions
155
- */
156
- private findSetComputeUnitPriceIndex;
157
- /**
158
- * Remove priority fee instructions
159
- */
160
- private removePriorityFeeIxs;
161
- }
162
- //# sourceMappingURL=Transaction%20copy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Transaction copy.d.ts","sourceRoot":"","sources":["../../../src/classes/Transaction copy.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAGxC,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;GAGG;AACH,qBAAa,WAAW;IAyDpB,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B;IACxD,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS;IACjC,OAAO,CAAC,eAAe;IACvB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,yBAAyB,EAAE;IAC/C,OAAO,CAAC,cAAc;IA5DxB,2FAA2F;IAC3F,OAAO,CAAC,UAAU,CAA0B;IAC5C,IAAI,SAAS,IAAI,IAAI,CAAC,kBAAkB,CAEvC;IAED,+DAA+D;IAC/D,OAAO,CAAC,qBAAqB,CAA4B;IACzD,IAAI,oBAAoB,IAAI,IAAI,CAAC,oBAAoB,CAEpD;IAED,+EAA+E;IAC/E,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElD,oFAAoF;IACpF,OAAO,CAAC,oBAAoB,CAAc;IAC1C,IAAI,mBAAmB,IAAI,MAAM,CAEhC;IAED,6CAA6C;IAC7C,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,yEAAyE;IACzE,OAAO,CAAC,aAAa,CAAgC;IACrD,IAAI,YAAY,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAEhD;IAED,8BAA8B;IAC9B,IAAI,oBAAoB,IAAI,MAAM,CAEjC;IAED;;OAEG;IACH,QAAQ,CAAC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B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,sBAAsB,CAAC,EAAE,MAAM,GAC9B,OAAO,CAAC,MAAM,CAAC;IAiBlB;;;;;OAKG;IACG,mBAAmB,CACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,OAAO,GAAE,IAAI,CAAC,OAAO,EAAO,GAC3B,OAAO,CAAC,4BAA4B,CAAC;IAyCxC;;OAEG;IACH,gBAAgB,CACd,eAAe,EAAE,IAAI,CAAC,8BAA8B,GACnD,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,oBAAoB,CAAC;IAcvD;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAgBpC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAgBpC;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAW7B"}
@@ -1,458 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.Transaction = void 0;
36
- const client = __importStar(require("@hawksightco/swagger-client"));
37
- const web3 = __importStar(require("@solana/web3.js"));
38
- const bn_js_1 = require("bn.js");
39
- const functions_1 = require("../functions");
40
- const Logging_1 = require("./Logging");
41
- /**
42
- * Represents a transaction object in Solana using the web3.js library.
43
- * This class encapsulates the logic for creating, signing, and verifying signatures of transactions.
44
- */
45
- class Transaction {
46
- get txMessage() {
47
- return this._txMessage;
48
- }
49
- get versionedTransaction() {
50
- return this._versionedTransaction;
51
- }
52
- get priorityFeeEstimate() {
53
- return this._priorityFeeEstimate;
54
- }
55
- /** The blockhash of a recent ledger entry */
56
- get recentBlockhash() {
57
- return this.latestBlockhash.blockhash;
58
- }
59
- get instructions() {
60
- return this._instructions;
61
- }
62
- /** last valid block height */
63
- get lastValidBlockHeight() {
64
- return this.latestBlockhash.lastValidBlockHeight;
65
- }
66
- /**
67
- * Constructs a new Transaction object.
68
- *
69
- * @param payerKey PublicKey of the transaction payer
70
- * @param instructions Array of TransactionInstruction to be executed in this transaction
71
- * @param recentBlockhash The blockhash of a recent ledger entry
72
- * @param alts Address lookup tables that optimize account address storage
73
- */
74
- constructor(txMetadataResponse, payerKey, latestBlockhash, alts, generalUtility, _mainIxs = []) {
75
- this.txMetadataResponse = txMetadataResponse;
76
- this.payerKey = payerKey;
77
- this.latestBlockhash = latestBlockhash;
78
- this.alts = alts;
79
- this.generalUtility = generalUtility;
80
- /** Estimated fee in SOL for priority fee when addPriorityFee() method is called. */
81
- this._priorityFeeEstimate = "";
82
- /**
83
- * Blockhash from nonce account
84
- */
85
- this.blockhashFromNonce = '';
86
- let mainIxs;
87
- if (_mainIxs.length > 0) {
88
- mainIxs = _mainIxs;
89
- txMetadataResponse.mainInstructions = mainIxs.map(ix => {
90
- const accounts = ix.keys.map(meta => {
91
- return {
92
- pubkey: meta.pubkey.toString(),
93
- isSigner: meta.isSigner,
94
- isWritable: meta.isWritable,
95
- };
96
- });
97
- return {
98
- accounts,
99
- programId: ix.programId.toString(),
100
- data: ix.data.toString('base64'),
101
- };
102
- });
103
- }
104
- else {
105
- // Construct main instructions
106
- mainIxs = txMetadataResponse.mainInstructions.map((ix) => {
107
- return new web3.TransactionInstruction({
108
- keys: ix.accounts.map((meta) => {
109
- return {
110
- pubkey: new web3.PublicKey(meta.pubkey),
111
- isSigner: meta.isSigner,
112
- isWritable: meta.isWritable,
113
- };
114
- }),
115
- programId: new web3.PublicKey(ix.programId),
116
- data: Buffer.from(ix.data, "base64"),
117
- });
118
- });
119
- }
120
- this._instructions = [...mainIxs];
121
- const index = this.getNonceIndex();
122
- this.hasNonceAdvanceIx = index > -1;
123
- const [txMessage, versionedTransaction] = this.buildTransaction(latestBlockhash);
124
- this._txMessage = txMessage;
125
- this._versionedTransaction = versionedTransaction;
126
- this.requiredSigners = this.getRequiredSigners();
127
- }
128
- /**
129
- * Generate nonde advance instruction (dummy instruction)
130
- */
131
- nonceAdvanceIx(noncePubkey) {
132
- // Generate dummy nonce ix
133
- return web3.SystemProgram.nonceAdvance({
134
- /** Nonce account */
135
- noncePubkey,
136
- /** Public key of the nonce authority */
137
- authorizedPubkey: this.payerKey,
138
- });
139
- }
140
- /**
141
- * Replace nonce pubkey
142
- */
143
- replaceNoncePubkey(noncePubkey) {
144
- if (this.hasNonceAdvanceIx) {
145
- const nonceAdvanceIx = this.nonceAdvanceIx(noncePubkey);
146
- const index = this.getNonceIndex();
147
- this._instructions[index] = nonceAdvanceIx;
148
- }
149
- }
150
- /**
151
- * Get nonce index
152
- *
153
- * @returns
154
- */
155
- getNonceIndex() {
156
- const referenceIx = this.nonceAdvanceIx(web3.Keypair.generate().publicKey);
157
- const index = this._instructions.findIndex(ix => {
158
- const isNonceAdvanceIx = ix.data.toString("base64") == referenceIx.data.toString("base64") &&
159
- ix.programId.toString() == referenceIx.programId.toString();
160
- return isNonceAdvanceIx;
161
- });
162
- return index;
163
- }
164
- /**
165
- * Get blockhash from nonce pubkey
166
- */
167
- getBlockhashFromNonce(connection) {
168
- return __awaiter(this, void 0, void 0, function* () {
169
- if (this.blockhashFromNonce !== '') {
170
- return this.blockhashFromNonce;
171
- }
172
- const index = this.getNonceIndex();
173
- const noncePubkey = this._instructions[index].keys[0].pubkey;
174
- const accountInfo = yield connection.getAccountInfo(noncePubkey);
175
- const nonceAccount = web3.NonceAccount.fromAccountData(accountInfo.data);
176
- this.blockhashFromNonce = nonceAccount.nonce;
177
- return nonceAccount.nonce;
178
- });
179
- }
180
- /**
181
- * Signs the transaction with provided signers.
182
- *
183
- * @param signers Array of Signer objects whose private keys will be used to sign the transaction.
184
- * @param idempotent Boolean indicating whether signing should be idempotent (default is false).
185
- * @throws Error if a signer is not required or has already signed the transaction when not idempotent.
186
- */
187
- sign(signers, idempotent = false) {
188
- // First validate all signers
189
- signers.forEach((signer) => {
190
- const key = signer.publicKey.toString();
191
- if (typeof this.requiredSigners[key] !== "boolean") {
192
- throw new Error(`Key ${key} is not a required signer!`);
193
- }
194
- if (!idempotent && this.requiredSigners[key]) {
195
- throw new Error(`Key ${key} has already been signed by required signer!`);
196
- }
197
- });
198
- // If all signers are valid and the process is idempotent or they haven't signed yet, update and sign
199
- signers.forEach((signer) => {
200
- const key = signer.publicKey.toString();
201
- this.requiredSigners[key] = true;
202
- });
203
- this.versionedTransaction.sign(signers);
204
- }
205
- /**
206
- * Add a signature on the transaction with provided signature.
207
- *
208
- * @param publicKey The public key of the signer
209
- * @param signature A signature of the signed transaction
210
- * @throws Error if a signer is not required or has already signed the transaction.
211
- */
212
- addSignature(publicKey, signature) {
213
- const key = publicKey.toBase58();
214
- if (typeof this.requiredSigners[key] !== "boolean") {
215
- throw new Error(`Key ${key} is not a required signer!`);
216
- }
217
- if (this.requiredSigners[key]) {
218
- throw new Error(`Key ${key} has already been signed by required signer!`);
219
- }
220
- this.requiredSigners[key] = true;
221
- this.versionedTransaction.addSignature(publicKey, signature);
222
- }
223
- /**
224
- * Checks if all required signers have signed the transaction.
225
- *
226
- * @returns Boolean indicating whether all required signers have signed.
227
- */
228
- isSignedByRequiredSigners() {
229
- return Object.values(this.requiredSigners).every((isSigned) => isSigned);
230
- }
231
- /**
232
- * Add priority fee instructions (compute budget)
233
- *
234
- * This method adds priority fee instructions to the transaction based on the specified
235
- * priority level and compute unit limit. It ensures that the total fee does not exceed
236
- * the specified maximum priority fee (in SOL) if provided.
237
- *
238
- * @param connection - The connection to the Solana cluster.
239
- * @param computeUnitLimit - The limit on the number of compute units.
240
- * @param fixedPriority - If true, a fixed priority fee is used; if false, the fee is based on priority level.
241
- * @param priorityLevelOrPriorityFee - The priority level for the fee estimation or the fixed priority fee.
242
- * @param maxPriorityFee - The maximum priority fee in SOL (optional, only applicable when fixedPriority is false).
243
- * @returns An array of transaction instructions.
244
- */
245
- addPriorityFeeIx(connection_1, computeUnitLimit_1) {
246
- return __awaiter(this, arguments, void 0, function* (connection, computeUnitLimit, fixedPriority = false, priorityLevelOrPriorityFee, maxPriorityFee) {
247
- (0, Logging_1.Log)(`addPriorityFeeIx`);
248
- // First, remove any existing priority fee instructions
249
- this.removePriorityFeeIxs();
250
- let totalPriorityFeeLamports;
251
- if (fixedPriority && typeof priorityLevelOrPriorityFee === 'number') {
252
- // For fixed priority, directly use the provided fixed priority fee
253
- totalPriorityFeeLamports = priorityLevelOrPriorityFee - 5000;
254
- }
255
- else if (typeof priorityLevelOrPriorityFee === 'string') {
256
- // Convert maxPriorityFee from SOL to lamports (1 SOL = 1_000_000_000 lamports)
257
- const maxPriorityFeeLamports = maxPriorityFee !== undefined ? maxPriorityFee * 1000000000 : undefined;
258
- // Get fee estimate by simulating the transaction
259
- const startTime = new Date().getTime() / 1000;
260
- (0, Logging_1.Log)(`addPriorityFeeIx: Starting getFeeEstimate function`);
261
- let estimate = yield (0, functions_1.getFeeEstimate)(this.generalUtility, priorityLevelOrPriorityFee, this.txMetadataResponse);
262
- (0, Logging_1.Log)(`addPriorityFeeIx: Starting getFeeEstimate function: Elapsed Time: ${(new Date().getTime() / 1000) - startTime}`);
263
- // If priority is set to default or medium, we multiply estimate by 2 to increase its chance on blockchain.
264
- if (priorityLevelOrPriorityFee === client.PriorityLevel.Default || priorityLevelOrPriorityFee === client.PriorityLevel.Medium) {
265
- estimate = estimate * 2;
266
- }
267
- // Calculate the total fee in lamports
268
- totalPriorityFeeLamports = new bn_js_1.BN(estimate).mul(new bn_js_1.BN(computeUnitLimit)).div(new bn_js_1.BN(1000000)).toNumber();
269
- // If maxPriorityFee is defined and it is less than the total calculated fee, cap it
270
- if (maxPriorityFeeLamports !== undefined && totalPriorityFeeLamports > maxPriorityFeeLamports) {
271
- totalPriorityFeeLamports = maxPriorityFeeLamports - 5000;
272
- }
273
- }
274
- else {
275
- throw new Error('Invalid parameters');
276
- }
277
- // Convert the total priority fee back to microLamports per compute unit
278
- const priorityFeePerUnitMicroLamports = new bn_js_1.BN(totalPriorityFeeLamports).mul(new bn_js_1.BN(1000000)).div(new bn_js_1.BN(computeUnitLimit)).toNumber();
279
- // Create priority fee instructions for the transaction
280
- const priorityFeeIxs = [
281
- web3.ComputeBudgetProgram.setComputeUnitLimit({
282
- units: computeUnitLimit,
283
- }),
284
- web3.ComputeBudgetProgram.setComputeUnitPrice({
285
- microLamports: priorityFeePerUnitMicroLamports,
286
- }),
287
- ];
288
- // Store the total priority fee in lamports
289
- this._priorityFeeEstimate = totalPriorityFeeLamports.toString();
290
- // Append priority fee instructions at the beginning
291
- this._instructions.unshift(...priorityFeeIxs);
292
- // Rebuild versioned transaction with the latest blockhash
293
- const result = yield connection.getLatestBlockhash();
294
- const blockhash = {
295
- blockhash: result.blockhash,
296
- lastValidBlockHeight: result.lastValidBlockHeight,
297
- };
298
- if (this.hasNonceAdvanceIx) {
299
- blockhash.blockhash = yield this.getBlockhashFromNonce(connection);
300
- }
301
- this.buildTransaction(blockhash);
302
- return priorityFeeIxs;
303
- });
304
- }
305
- /**
306
- * Gets the compute unit limit from a transaction simulation.
307
- *
308
- * This function simulates a transaction and calculates the compute unit limit
309
- * based on the simulation results. If an additional compute limit is provided,
310
- * it is added to the units consumed in the simulation. Otherwise, the units
311
- * consumed are increased by 10%.
312
- *
313
- * @param {web3.Connection} connection - The connection object to the Solana cluster.
314
- * @param {number} [additionalComputeLimit] - Optional additional compute limit to add to the units consumed.
315
- * @returns {Promise<number>} - A promise that resolves to the total compute unit limit.
316
- * @throws {Error} - Throws an error if the transaction simulation fails.
317
- */
318
- getComputeUnitLimit(connection, additionalComputeLimit) {
319
- return __awaiter(this, void 0, void 0, function* () {
320
- const simulation = yield this.simulateTransaction(connection);
321
- if (simulation.err !== null) {
322
- if (simulation.logs === null) {
323
- (0, Logging_1.Log)(simulation.err);
324
- }
325
- else {
326
- for (const log of simulation.logs) {
327
- (0, Logging_1.Log)(log);
328
- }
329
- }
330
- throw new Error(`Transaction simulation error. See logs above.`);
331
- }
332
- const totalUnitLimit = additionalComputeLimit ? simulation.unitsConsumed + additionalComputeLimit : Math.round(simulation.unitsConsumed * 1.1);
333
- return totalUnitLimit;
334
- });
335
- }
336
- /**
337
- * Simulate transaction
338
- *
339
- * @param connection
340
- * @returns
341
- */
342
- simulateTransaction(connection_1) {
343
- return __awaiter(this, arguments, void 0, function* (connection, signers = []) {
344
- const testInstructions = [
345
- ...this.instructions,
346
- ];
347
- if (this.findSetComputeUnitLimitIndex(testInstructions) === -1) {
348
- testInstructions.unshift(web3.ComputeBudgetProgram.setComputeUnitLimit({ units: 1400000 }));
349
- }
350
- if (this.findSetComputeUnitPriceIndex(testInstructions) === -1) {
351
- testInstructions.unshift(web3.ComputeBudgetProgram.setComputeUnitPrice({
352
- // CU * CU PRICE -> 1400000 * feeEstimate.priorityFeeEstimate
353
- microLamports: 100000,
354
- }));
355
- }
356
- const testVersionedTxn = new web3.VersionedTransaction(new web3.TransactionMessage({
357
- instructions: testInstructions,
358
- payerKey: this.payerKey,
359
- recentBlockhash: web3.PublicKey.default.toString(),
360
- }).compileToV0Message(this.alts));
361
- if (signers.length > 0) {
362
- testVersionedTxn.sign(signers);
363
- }
364
- const simulation = yield connection.simulateTransaction(testVersionedTxn, {
365
- replaceRecentBlockhash: true,
366
- sigVerify: false,
367
- });
368
- if (simulation.value.unitsConsumed === undefined) {
369
- throw new Error("Unable to calculate compute budget.");
370
- }
371
- return {
372
- err: simulation.value.err,
373
- logs: simulation.value.logs,
374
- accounts: simulation.value.accounts,
375
- unitsConsumed: simulation.value.unitsConsumed,
376
- returnData: simulation.value.returnData,
377
- };
378
- });
379
- }
380
- /**
381
- * Builds transaction object
382
- */
383
- buildTransaction(latestBlockhash) {
384
- this.latestBlockhash = latestBlockhash;
385
- this._txMessage = new web3.TransactionMessage({
386
- payerKey: this.payerKey,
387
- instructions: this.instructions,
388
- recentBlockhash: this.recentBlockhash,
389
- });
390
- this._versionedTransaction = new web3.VersionedTransaction(this.txMessage.compileToV0Message(this.alts));
391
- return [this._txMessage, this._versionedTransaction];
392
- }
393
- /**
394
- * Gathers the public keys of all parties required to sign the transaction.
395
- *
396
- * @returns A record of signer public keys mapped to a boolean indicating whether they have signed.
397
- */
398
- getRequiredSigners() {
399
- const signerKeys = this.instructions.flatMap((ix) => ix.keys
400
- .filter((meta) => meta.isSigner)
401
- .map((meta) => meta.pubkey.toString()));
402
- const result = {};
403
- signerKeys.forEach((key) => (result[key] = false));
404
- return result;
405
- }
406
- /**
407
- * Find setComputeUnitLimit index within the instructions
408
- */
409
- findSetComputeUnitLimitIndex(instructions) {
410
- let _instructions = [];
411
- if (instructions !== undefined) {
412
- _instructions = instructions;
413
- }
414
- else {
415
- _instructions = this.instructions;
416
- }
417
- return _instructions.findIndex((ix) => {
418
- const isComputeBudgetProgram = ix.programId.toString() ===
419
- "ComputeBudget111111111111111111111111111111";
420
- const isSetComputeLimitIx = ix.data[0] === 2;
421
- return isComputeBudgetProgram && isSetComputeLimitIx;
422
- });
423
- }
424
- /**
425
- * Find setComputeUnitPrice index within the instructions
426
- */
427
- findSetComputeUnitPriceIndex(instructions) {
428
- let _instructions = [];
429
- if (instructions !== undefined) {
430
- _instructions = instructions;
431
- }
432
- else {
433
- _instructions = this.instructions;
434
- }
435
- return _instructions.findIndex((ix) => {
436
- const isComputeBudgetProgram = ix.programId.toString() ===
437
- "ComputeBudget111111111111111111111111111111";
438
- const isSetComputeUnitPriceIx = ix.data[0] === 3;
439
- return isComputeBudgetProgram && isSetComputeUnitPriceIx;
440
- });
441
- }
442
- /**
443
- * Remove priority fee instructions
444
- */
445
- removePriorityFeeIxs() {
446
- while (true) {
447
- const setComputeUnitLimitIxIndex = this.findSetComputeUnitLimitIndex();
448
- const setComputeUnitPriceIxIndex = this.findSetComputeUnitPriceIndex();
449
- if (setComputeUnitLimitIxIndex !== -1)
450
- this._instructions.splice(setComputeUnitLimitIxIndex, 1);
451
- if (setComputeUnitPriceIxIndex !== -1)
452
- this._instructions.splice(setComputeUnitPriceIxIndex, 1);
453
- if (setComputeUnitLimitIxIndex && setComputeUnitPriceIxIndex)
454
- break;
455
- }
456
- }
457
- }
458
- exports.Transaction = Transaction;