@haven-fi/solauto-sdk 1.0.20 → 1.0.22
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +1 -3
- package/dist/utils/generalUtils.d.ts.map +1 -1
- package/dist/utils/generalUtils.js +0 -6
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +7 -5
- package/package.json +1 -1
- package/src/transactions/transactionsManager.ts +1 -3
- package/src/utils/generalUtils.ts +0 -6
- package/src/utils/solanaUtils.ts +17 -18
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAqC/B,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;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,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,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;
|
1
|
+
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAqC/B,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;IATd,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,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,EACM,IAAI,CAAC,oBAAQ;IAGhB,UAAU;IAIV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAgFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,UAAU,eAAe;CAC1B;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IATxB,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,YAAY,CAAe;gBAGzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,eAAe,EAAE,EACxB,cAAc,CAAC,6CAA4C,IAAI,aAAA,EAC/D,YAAY,CAAC,qBAAS,EACtB,YAAY,CAAC,qBAAS,EACtB,aAAa,CAAC,2BAAe;YAKzB,uBAAuB;IAsCrC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,EAAE,MAAM;IAgB9D,IAAI;CA8IX"}
|
@@ -128,7 +128,6 @@ class TransactionsManager {
|
|
128
128
|
this.mustBeAtomic = mustBeAtomic;
|
129
129
|
this.errorsToThrow = errorsToThrow;
|
130
130
|
this.statuses = [];
|
131
|
-
console.log(this.errorsToThrow);
|
132
131
|
this.lookupTables = new LookupTables(client);
|
133
132
|
}
|
134
133
|
async assembleTransactionSets(items) {
|
@@ -178,11 +177,10 @@ class TransactionsManager {
|
|
178
177
|
this.statusCallback?.(this.statuses);
|
179
178
|
}
|
180
179
|
async send() {
|
181
|
-
console.log(this.errorsToThrow);
|
182
180
|
const updateLookupTable = await this.client.updateLookupTable();
|
183
181
|
if (updateLookupTable && updateLookupTable?.needsToBeIsolated) {
|
184
182
|
this.updateStatus("update lookup table", TransactionStatus.Processing);
|
185
|
-
await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.client.umi, this.client.connection, updateLookupTable.updateLutTx, this.simulateOnly, attemptNum),
|
183
|
+
await (0, generalUtils_1.retryWithExponentialBackoff)(async (attemptNum) => await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.client.umi, this.client.connection, updateLookupTable.updateLutTx, this.simulateOnly, attemptNum), 3, 150, this.errorsToThrow);
|
186
184
|
this.updateStatus("update lookup table", TransactionStatus.Successful);
|
187
185
|
}
|
188
186
|
for (const item of this.items) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generalUtils.d.ts","sourceRoot":"","sources":["../../src/utils/generalUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAa,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAK3E,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,SAAS,GACZ,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEnE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAU1E;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,SAAS,EA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MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EACtC,OAAO,GAAE,MAAU,EACnB,KAAK,GAAE,MAAY,EACnB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,CAAC,CAAC,CA8BZ"}
|
@@ -88,12 +88,6 @@ function retryWithExponentialBackoff(fn, retries = 5, delay = 150, errorsToThrow
|
|
88
88
|
.then(resolve)
|
89
89
|
.catch((error) => {
|
90
90
|
attemptNum++;
|
91
|
-
console.log(errorsToThrow?.length);
|
92
|
-
if (errorsToThrow) {
|
93
|
-
for (const e of errorsToThrow) {
|
94
|
-
console.log(error instanceof e);
|
95
|
-
}
|
96
|
-
}
|
97
91
|
if (errorsToThrow &&
|
98
92
|
errorsToThrow.some((errorType) => error instanceof errorType)) {
|
99
93
|
reject(error);
|
@@ -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,EACH,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAGL,UAAU,EACV,SAAS,EAIT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAazB,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAQxE;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,sBAAsB,GACzB,kBAAkB,CAMpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAOpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,kBAAkB,CAOpB;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS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AAO,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAmDjC"}
|
@@ -120,7 +120,7 @@ function assembleFinalTransaction(signer, tx, computeUnitPrice, computeUnitLimit
|
|
120
120
|
exports.assembleFinalTransaction = assembleFinalTransaction;
|
121
121
|
async function simulateTransaction(connection, transaction) {
|
122
122
|
const simulationResult = await connection.simulateTransaction(transaction, {
|
123
|
-
sigVerify:
|
123
|
+
sigVerify: false,
|
124
124
|
});
|
125
125
|
if (simulationResult.value.err) {
|
126
126
|
simulationResult.value.logs?.forEach((x) => {
|
@@ -136,7 +136,9 @@ async function getComputeUnitPriceEstimate(umi, tx, attemptNum) {
|
|
136
136
|
const resp = await umi.rpc.call("getPriorityFeeEstimate", [
|
137
137
|
{
|
138
138
|
transaction: serializedTransaction,
|
139
|
-
options: {
|
139
|
+
options: {
|
140
|
+
priorityLevel: attemptNum && attemptNum > 0 ? "VeryHigh" : "High",
|
141
|
+
},
|
140
142
|
},
|
141
143
|
]);
|
142
144
|
const feeEstimate = Math.round(resp.priorityFeeEstimate);
|
@@ -149,17 +151,17 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, simulateOnly,
|
|
149
151
|
console.log("Serialized transaction size: ", tx.getTransactionSize(umi));
|
150
152
|
const feeEstimate = await getComputeUnitPriceEstimate(umi, tx, attemptNum);
|
151
153
|
console.log("Compute unit price: ", feeEstimate);
|
152
|
-
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)).
|
154
|
+
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))));
|
153
155
|
const computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.1);
|
154
156
|
console.log("Compute unit limit: ", computeUnitLimit);
|
155
157
|
if (!simulateOnly) {
|
156
|
-
const result = await
|
158
|
+
const result = await assembleFinalTransaction(umi.identity, tx, feeEstimate, computeUnitLimit).sendAndConfirm(umi, {
|
157
159
|
send: {
|
158
160
|
skipPreflight: true,
|
159
161
|
commitment: "finalized",
|
160
162
|
},
|
161
163
|
confirm: { commitment: "finalized" },
|
162
|
-
})
|
164
|
+
});
|
163
165
|
console.log(`https://solscan.io/tx/${bs58_1.default.encode(result.signature)}`);
|
164
166
|
if (result.result.value.err !== null) {
|
165
167
|
throw new Error(result.result.value.err.toString());
|
package/package.json
CHANGED
@@ -189,7 +189,6 @@ export class TransactionsManager {
|
|
189
189
|
private mustBeAtomic?: boolean,
|
190
190
|
private errorsToThrow?: ErrorsToThrow
|
191
191
|
) {
|
192
|
-
console.log(this.errorsToThrow);
|
193
192
|
this.lookupTables = new LookupTables(client);
|
194
193
|
}
|
195
194
|
|
@@ -248,7 +247,6 @@ export class TransactionsManager {
|
|
248
247
|
}
|
249
248
|
|
250
249
|
async send() {
|
251
|
-
console.log(this.errorsToThrow);
|
252
250
|
const updateLookupTable = await this.client.updateLookupTable();
|
253
251
|
if (updateLookupTable && updateLookupTable?.needsToBeIsolated) {
|
254
252
|
this.updateStatus("update lookup table", TransactionStatus.Processing);
|
@@ -261,7 +259,7 @@ export class TransactionsManager {
|
|
261
259
|
this.simulateOnly,
|
262
260
|
attemptNum
|
263
261
|
),
|
264
|
-
|
262
|
+
3,
|
265
263
|
150,
|
266
264
|
this.errorsToThrow
|
267
265
|
);
|
@@ -111,12 +111,6 @@ export function retryWithExponentialBackoff<T>(
|
|
111
111
|
.catch((error: Error) => {
|
112
112
|
attemptNum++;
|
113
113
|
|
114
|
-
console.log(errorsToThrow?.length);
|
115
|
-
if (errorsToThrow) {
|
116
|
-
for (const e of errorsToThrow) {
|
117
|
-
console.log(error instanceof e);
|
118
|
-
}
|
119
|
-
}
|
120
114
|
if (
|
121
115
|
errorsToThrow &&
|
122
116
|
errorsToThrow.some((errorType) => error instanceof errorType)
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -230,7 +230,7 @@ async function simulateTransaction(
|
|
230
230
|
transaction: VersionedTransaction
|
231
231
|
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {
|
232
232
|
const simulationResult = await connection.simulateTransaction(transaction, {
|
233
|
-
sigVerify:
|
233
|
+
sigVerify: false,
|
234
234
|
});
|
235
235
|
if (simulationResult.value.err) {
|
236
236
|
simulationResult.value.logs?.forEach((x: any) => {
|
@@ -253,7 +253,9 @@ export async function getComputeUnitPriceEstimate(
|
|
253
253
|
const resp = await umi.rpc.call("getPriorityFeeEstimate", [
|
254
254
|
{
|
255
255
|
transaction: serializedTransaction,
|
256
|
-
options: {
|
256
|
+
options: {
|
257
|
+
priorityLevel: attemptNum && attemptNum > 0 ? "VeryHigh" : "High",
|
258
|
+
},
|
257
259
|
},
|
258
260
|
]);
|
259
261
|
const feeEstimate = Math.round((resp as any).priorityFeeEstimate as number);
|
@@ -287,7 +289,7 @@ export async function sendSingleOptimizedTransaction(
|
|
287
289
|
feeEstimate,
|
288
290
|
1_400_000
|
289
291
|
).setLatestBlockhash(umi)
|
290
|
-
).
|
292
|
+
).build(umi)
|
291
293
|
)
|
292
294
|
)
|
293
295
|
);
|
@@ -298,21 +300,18 @@ export async function sendSingleOptimizedTransaction(
|
|
298
300
|
console.log("Compute unit limit: ", computeUnitLimit);
|
299
301
|
|
300
302
|
if (!simulateOnly) {
|
301
|
-
const result = await
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
confirm: { commitment: "finalized" },
|
314
|
-
})
|
315
|
-
);
|
303
|
+
const result = await assembleFinalTransaction(
|
304
|
+
umi.identity,
|
305
|
+
tx,
|
306
|
+
feeEstimate,
|
307
|
+
computeUnitLimit
|
308
|
+
).sendAndConfirm(umi, {
|
309
|
+
send: {
|
310
|
+
skipPreflight: true,
|
311
|
+
commitment: "finalized",
|
312
|
+
},
|
313
|
+
confirm: { commitment: "finalized" },
|
314
|
+
});
|
316
315
|
console.log(`https://solscan.io/tx/${bs58.encode(result.signature)}`);
|
317
316
|
if (result.result.value.err !== null) {
|
318
317
|
throw new Error(result.result.value.err.toString());
|