@haven-fi/solauto-sdk 1.0.112 → 1.0.113
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/transactions/transactionsManager.d.ts +1 -0
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +2 -1
- package/dist/utils/solanaUtils.d.ts +1 -1
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +4 -3
- package/package.json +1 -1
- package/src/transactions/transactionsManager.ts +3 -1
- package/src/utils/solanaUtils.ts +16 -6
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EAEvB,kBAAkB,EAClB,GAAG,EACJ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG7D,cAAM,YAAY;IAGG,WAAW,EAAE,MAAM,EAAE;IAAE,OAAO,CAAC,GAAG;IAFrD,KAAK,EAAE,uBAAuB,EAAE,CAAM;gBAEnB,WAAW,EAAE,MAAM,EAAE,EAAU,GAAG,EAAE,GAAG;IAGpD,YAAY,CAChB,mBAAmB,EAAE,MAAM,EAAE,GAC5B,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAoBtC;AAED,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CACV;QAAE,EAAE,EAAE,kBAAkB,CAAC;QAAC,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,SAAS,CACxE;IACM,IAAI,CAAC,EAAE,MAAM;IATtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IA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;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IARxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,SAAS,EAAE,aAAa,GAAG,oBAAoB,EAC/C,cAAc,CAAC,GAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,aAAA,EAC/D,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,aAAa,CAAC,EAAE,aAAa,YAAA;YAKzB,uBAAuB;IAsCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAiB9D,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,kBAAkB;IAkB7D,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,eAAe,CAAC,EAAE,kBAAkB;IAkEzE,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,eAAe,CAAC,EAAE,kBAAkB,EAAE,WAAW,CAAC,EAAE,OAAO;CA0GjG"}
|
@@ -114,6 +114,7 @@ var TransactionStatus;
|
|
114
114
|
(function (TransactionStatus) {
|
115
115
|
TransactionStatus["Skipped"] = "Skipped";
|
116
116
|
TransactionStatus["Processing"] = "Processing";
|
117
|
+
TransactionStatus["AwaitingSignature"] = "AwaitingSig";
|
117
118
|
TransactionStatus["Queued"] = "Queued";
|
118
119
|
TransactionStatus["Successful"] = "Successful";
|
119
120
|
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
@@ -291,7 +292,7 @@ class TransactionsManager {
|
|
291
292
|
if (this.txHandler.localTest) {
|
292
293
|
await this.debugAccounts(itemSet, tx);
|
293
294
|
}
|
294
|
-
const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.simulateOnly, attemptNum, prioritySetting);
|
295
|
+
const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.simulateOnly, attemptNum, prioritySetting, () => this.updateStatus(itemSet.name(), TransactionStatus.AwaitingSignature));
|
295
296
|
this.updateStatus(itemSet.name(), TransactionStatus.Successful, txSig ? bs58_1.default.encode(txSig) : undefined);
|
296
297
|
}
|
297
298
|
}, 4, 150, this.errorsToThrow);
|
@@ -13,5 +13,5 @@ export declare function splTokenTransferUmiIx(signer: Signer, fromTa: PublicKey,
|
|
13
13
|
export declare function getAdressLookupInputs(umi: Umi, lookupTableAddresses: string[]): Promise<AddressLookupTableInput[]>;
|
14
14
|
export declare function assembleFinalTransaction(signer: Signer, tx: TransactionBuilder, computeUnitPrice: number, computeUnitLimit?: number): TransactionBuilder;
|
15
15
|
export declare function getComputeUnitPriceEstimate(umi: Umi, tx: TransactionBuilder, prioritySetting: PriorityFeeSetting): Promise<number>;
|
16
|
-
export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, simulateOnly?: boolean, attemptNum?: number, prioritySetting?: PriorityFeeSetting): Promise<Uint8Array | undefined>;
|
16
|
+
export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, simulateOnly?: boolean, attemptNum?: number, prioritySetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<Uint8Array | undefined>;
|
17
17
|
//# sourceMappingURL=solanaUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,GAAG,E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M,EACd,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAKpB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,kBAAkB,CAKpB;AAED,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,GAAG,EACR,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,kBAAkB,EACtB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,sBA4D1B;AAmBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,YAAY,CAAC,EAAE,OAAO,EACtB,UAAU,CAAC,EAAE,MAAM,EACnB,eAAe,GAAE,kBAA+C,EAChE,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAyDjC"}
|
@@ -130,7 +130,7 @@ function assembleFinalTransaction(signer, tx, computeUnitPrice, computeUnitLimit
|
|
130
130
|
async function simulateTransaction(connection, transaction) {
|
131
131
|
const simulationResult = await connection.simulateTransaction(transaction, {
|
132
132
|
sigVerify: false,
|
133
|
-
commitment: "processed"
|
133
|
+
commitment: "processed",
|
134
134
|
});
|
135
135
|
if (simulationResult.value.err) {
|
136
136
|
simulationResult.value.logs?.forEach((x) => {
|
@@ -154,16 +154,17 @@ async function getComputeUnitPriceEstimate(umi, tx, prioritySetting) {
|
|
154
154
|
const feeEstimate = Math.round(resp.priorityFeeEstimate);
|
155
155
|
return feeEstimate;
|
156
156
|
}
|
157
|
-
async function sendSingleOptimizedTransaction(umi, connection, tx, simulateOnly, attemptNum, prioritySetting = types_1.PriorityFeeSetting.Default) {
|
157
|
+
async function sendSingleOptimizedTransaction(umi, connection, tx, simulateOnly, attemptNum, prioritySetting = types_1.PriorityFeeSetting.Default, onAwaitingSign) {
|
158
158
|
console.log("Sending single optimized transaction...");
|
159
159
|
console.log("Instructions: ", tx.getInstructions().length);
|
160
160
|
console.log("Serialized transaction size: ", tx.getTransactionSize(umi));
|
161
161
|
const feeEstimate = await getComputeUnitPriceEstimate(umi, tx, prioritySetting);
|
162
162
|
console.log("Compute unit price: ", feeEstimate);
|
163
|
-
const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(connection, (0, umi_web3js_adapters_1.toWeb3JsTransaction)(await (await assembleFinalTransaction(umi.identity, tx, feeEstimate, 1400000).setLatestBlockhash(umi)).build(umi))));
|
163
|
+
const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(connection, (0, umi_web3js_adapters_1.toWeb3JsTransaction)(await (await assembleFinalTransaction(umi.identity, tx, feeEstimate, 1400000).setLatestBlockhash(umi)).build(umi))), 3);
|
164
164
|
const computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.1);
|
165
165
|
console.log("Compute unit limit: ", computeUnitLimit);
|
166
166
|
if (!simulateOnly) {
|
167
|
+
onAwaitingSign?.();
|
167
168
|
const result = await assembleFinalTransaction(umi.identity, tx, feeEstimate, 800000).sendAndConfirm(umi, {
|
168
169
|
send: {
|
169
170
|
skipPreflight: true,
|
package/package.json
CHANGED
@@ -167,6 +167,7 @@ class TransactionSet {
|
|
167
167
|
export enum TransactionStatus {
|
168
168
|
Skipped = "Skipped",
|
169
169
|
Processing = "Processing",
|
170
|
+
AwaitingSignature = "AwaitingSig",
|
170
171
|
Queued = "Queued",
|
171
172
|
Successful = "Successful",
|
172
173
|
}
|
@@ -419,7 +420,8 @@ export class TransactionsManager {
|
|
419
420
|
tx,
|
420
421
|
this.simulateOnly,
|
421
422
|
attemptNum,
|
422
|
-
prioritySetting
|
423
|
+
prioritySetting,
|
424
|
+
() => this.updateStatus(itemSet!.name(), TransactionStatus.AwaitingSignature)
|
423
425
|
);
|
424
426
|
this.updateStatus(
|
425
427
|
itemSet.name(),
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -38,7 +38,9 @@ import {
|
|
38
38
|
} from "../marginfi-sdk";
|
39
39
|
import { PriorityFeeSetting } from "../types";
|
40
40
|
|
41
|
-
export function getSolanaRpcConnection(
|
41
|
+
export function getSolanaRpcConnection(
|
42
|
+
heliusApiKey: string
|
43
|
+
): [Connection, Umi] {
|
42
44
|
const connection = new Connection(
|
43
45
|
`https://mainnet.helius-rpc.com/?api-key=${heliusApiKey}`,
|
44
46
|
"finalized"
|
@@ -242,7 +244,7 @@ async function simulateTransaction(
|
|
242
244
|
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {
|
243
245
|
const simulationResult = await connection.simulateTransaction(transaction, {
|
244
246
|
sigVerify: false,
|
245
|
-
commitment: "processed"
|
247
|
+
commitment: "processed",
|
246
248
|
});
|
247
249
|
if (simulationResult.value.err) {
|
248
250
|
simulationResult.value.logs?.forEach((x: any) => {
|
@@ -256,7 +258,7 @@ async function simulateTransaction(
|
|
256
258
|
export async function getComputeUnitPriceEstimate(
|
257
259
|
umi: Umi,
|
258
260
|
tx: TransactionBuilder,
|
259
|
-
prioritySetting: PriorityFeeSetting
|
261
|
+
prioritySetting: PriorityFeeSetting
|
260
262
|
): Promise<number> {
|
261
263
|
const web3Transaction = toWeb3JsTransaction(
|
262
264
|
(await tx.setLatestBlockhash(umi, { commitment: "finalized" })).build(umi)
|
@@ -281,15 +283,21 @@ export async function sendSingleOptimizedTransaction(
|
|
281
283
|
tx: TransactionBuilder,
|
282
284
|
simulateOnly?: boolean,
|
283
285
|
attemptNum?: number,
|
284
|
-
prioritySetting: PriorityFeeSetting = PriorityFeeSetting.Default
|
286
|
+
prioritySetting: PriorityFeeSetting = PriorityFeeSetting.Default,
|
287
|
+
onAwaitingSign?: () => void
|
285
288
|
): Promise<Uint8Array | undefined> {
|
286
289
|
console.log("Sending single optimized transaction...");
|
287
290
|
console.log("Instructions: ", tx.getInstructions().length);
|
288
291
|
console.log("Serialized transaction size: ", tx.getTransactionSize(umi));
|
289
292
|
|
290
|
-
const feeEstimate = await getComputeUnitPriceEstimate(
|
293
|
+
const feeEstimate = await getComputeUnitPriceEstimate(
|
294
|
+
umi,
|
295
|
+
tx,
|
296
|
+
prioritySetting
|
297
|
+
);
|
291
298
|
console.log("Compute unit price: ", feeEstimate);
|
292
299
|
|
300
|
+
// TODO: we should only retry simulation if it's not a solauto error
|
293
301
|
const simulationResult = await retryWithExponentialBackoff(
|
294
302
|
async () =>
|
295
303
|
await simulateTransaction(
|
@@ -304,7 +312,8 @@ export async function sendSingleOptimizedTransaction(
|
|
304
312
|
).setLatestBlockhash(umi)
|
305
313
|
).build(umi)
|
306
314
|
)
|
307
|
-
)
|
315
|
+
),
|
316
|
+
3
|
308
317
|
);
|
309
318
|
|
310
319
|
const computeUnitLimit = Math.round(
|
@@ -313,6 +322,7 @@ export async function sendSingleOptimizedTransaction(
|
|
313
322
|
console.log("Compute unit limit: ", computeUnitLimit);
|
314
323
|
|
315
324
|
if (!simulateOnly) {
|
325
|
+
onAwaitingSign?.();
|
316
326
|
const result = await assembleFinalTransaction(
|
317
327
|
umi.identity,
|
318
328
|
tx,
|