@haven-fi/solauto-sdk 1.0.277 → 1.0.279
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 +0 -9
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +6 -3
- package/package.json +1 -1
- package/src/transactions/transactionsManager.ts +0 -12
- package/src/utils/solanaUtils.ts +19 -15
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionsManager.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAEnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAElB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAO7D,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAqCD,qBAAa,eAAe;IAMjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IARtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;IACjB,WAAW,EAAE,OAAO,CAAS;gBAG3B,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;IAGhB,UAAU;IAKV,OAAO,CAAC,UAAU,EAAE,MAAM;IAMhC,cAAc,IAAI,MAAM,EAAE;CAY3B;AAoFD,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,UAAU,eAAe;IAC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C1B,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;IAVpB,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,MAAM,CAAC,EAAE,kBAAkB,YAAA,EAC3B,kBAAkB,GAAE,kBAA2C,EAC/D,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA6CN,aAAa;IAoB3B,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,mBAAmB;YAMb,SAAS;IAgBV,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,GAC9B,OAAO,CAAC,0BAA0B,CAAC;IA+DzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,GACvB,OAAO,CAAC,0BAA0B,CAAC;YA+BxB,qBAAqB;YAuDrB,cAAc;YAqCd,eAAe;CAoD9B"}
|
@@ -264,9 +264,6 @@ class TransactionsManager {
|
|
264
264
|
.map((x) => x.tx)));
|
265
265
|
if (updateLookupTable && !updateLookupTable?.new) {
|
266
266
|
choresBefore = choresBefore.prepend(updateLookupTable.tx);
|
267
|
-
this.txHandler.log(updateLookupTable.tx
|
268
|
-
.getInstructions()
|
269
|
-
.map((x) => x.programId.toString()));
|
270
267
|
}
|
271
268
|
if (choresBefore.getInstructions().length > 0) {
|
272
269
|
const chore = new TransactionItem(async () => ({ tx: choresBefore }), CHORES_TX_NAME);
|
@@ -301,12 +298,6 @@ class TransactionsManager {
|
|
301
298
|
const itemSets = await this.assembleTransactionSets(items);
|
302
299
|
this.updateStatusForSets(itemSets);
|
303
300
|
this.txHandler.log("Initial item sets:", itemSets.length);
|
304
|
-
for (const itemSet of itemSets) {
|
305
|
-
const programs = (await itemSet.getSingleTransaction())
|
306
|
-
.getInstructions()
|
307
|
-
.map((x) => x.programId);
|
308
|
-
this.txHandler.log(programs.map((x) => x.toString()));
|
309
|
-
}
|
310
301
|
if (this.txType === "only-simulate" && itemSets.length > 1) {
|
311
302
|
this.txHandler.log("Only simulate and more than 1 transaction. Skipping...");
|
312
303
|
return [];
|
@@ -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;AAOlC,OAAO,EAKL,UAAU,EACV,SAAS,EAKT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAIlE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,UAErD;AAED,wBAAgB,oBAAoB,CAAC,eAAe,EAAE,MAAM,UAE3D;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAAgC,GAC1C,CAAC,UAAU,EAAE,GAAG,CAAC,CAQnB;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,GACd,kBAAkB,CAUpB;AAED,wBAAgB,mBAAmB,CACjC,M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gB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBA2D1B;AA0BD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AAiDD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA2C,EAC5D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA0DjC"}
|
@@ -138,8 +138,11 @@ function assembleFinalTransaction(signer, transaction, computeUnitPrice, compute
|
|
138
138
|
}
|
139
139
|
return tx;
|
140
140
|
}
|
141
|
-
async function simulateTransaction(connection, transaction) {
|
142
|
-
const
|
141
|
+
async function simulateTransaction(umi, connection, transaction) {
|
142
|
+
const txData = transaction.build(umi).serializedMessage;
|
143
|
+
(0, generalUtils_1.consoleLog)(txData.length);
|
144
|
+
(0, generalUtils_1.consoleLog)(txData);
|
145
|
+
const simulationResult = await connection.simulateTransaction(web3_js_1.VersionedTransaction.deserialize(txData), {
|
143
146
|
sigVerify: false,
|
144
147
|
commitment: "processed",
|
145
148
|
});
|
@@ -217,7 +220,7 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prior
|
|
217
220
|
}
|
218
221
|
let computeUnitLimit = undefined;
|
219
222
|
if (txType !== "skip-simulation") {
|
220
|
-
const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(
|
223
|
+
const simulationResult = await (0, generalUtils_1.retryWithExponentialBackoff)(async () => await simulateTransaction(umi, connection, await assembleFinalTransaction(umi.identity, tx, cuPrice, 1400000).setLatestBlockhash(umi)), 3);
|
221
224
|
simulationResult.value.err;
|
222
225
|
computeUnitLimit = Math.round(simulationResult.value.unitsConsumed * 1.1);
|
223
226
|
(0, generalUtils_1.consoleLog)("Compute unit limit: ", computeUnitLimit);
|
package/package.json
CHANGED
@@ -391,11 +391,6 @@ export class TransactionsManager {
|
|
391
391
|
);
|
392
392
|
if (updateLookupTable && !updateLookupTable?.new) {
|
393
393
|
choresBefore = choresBefore.prepend(updateLookupTable.tx);
|
394
|
-
this.txHandler.log(
|
395
|
-
updateLookupTable.tx
|
396
|
-
.getInstructions()
|
397
|
-
.map((x) => x.programId.toString())
|
398
|
-
);
|
399
394
|
}
|
400
395
|
if (choresBefore.getInstructions().length > 0) {
|
401
396
|
const chore = new TransactionItem(
|
@@ -451,13 +446,6 @@ export class TransactionsManager {
|
|
451
446
|
this.updateStatusForSets(itemSets);
|
452
447
|
this.txHandler.log("Initial item sets:", itemSets.length);
|
453
448
|
|
454
|
-
for (const itemSet of itemSets) {
|
455
|
-
const programs = (await itemSet.getSingleTransaction())
|
456
|
-
.getInstructions()
|
457
|
-
.map((x) => x.programId);
|
458
|
-
this.txHandler.log(programs.map((x) => x.toString()));
|
459
|
-
}
|
460
|
-
|
461
449
|
if (this.txType === "only-simulate" && itemSets.length > 1) {
|
462
450
|
this.txHandler.log(
|
463
451
|
"Only simulate and more than 1 transaction. Skipping..."
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -267,13 +267,20 @@ export function assembleFinalTransaction(
|
|
267
267
|
}
|
268
268
|
|
269
269
|
async function simulateTransaction(
|
270
|
+
umi: Umi,
|
270
271
|
connection: Connection,
|
271
|
-
transaction:
|
272
|
+
transaction: TransactionBuilder
|
272
273
|
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {
|
273
|
-
const
|
274
|
-
|
275
|
-
|
276
|
-
|
274
|
+
const txData = transaction.build(umi).serializedMessage;
|
275
|
+
consoleLog(txData.length);
|
276
|
+
consoleLog(txData);
|
277
|
+
const simulationResult = await connection.simulateTransaction(
|
278
|
+
VersionedTransaction.deserialize(txData),
|
279
|
+
{
|
280
|
+
sigVerify: false,
|
281
|
+
commitment: "processed",
|
282
|
+
}
|
283
|
+
);
|
277
284
|
if (simulationResult.value.err) {
|
278
285
|
simulationResult.value.logs?.forEach((x: any) => {
|
279
286
|
consoleLog(x);
|
@@ -384,17 +391,14 @@ export async function sendSingleOptimizedTransaction(
|
|
384
391
|
const simulationResult = await retryWithExponentialBackoff(
|
385
392
|
async () =>
|
386
393
|
await simulateTransaction(
|
394
|
+
umi,
|
387
395
|
connection,
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
1_400_000
|
395
|
-
).setLatestBlockhash(umi)
|
396
|
-
).build(umi)
|
397
|
-
)
|
396
|
+
await assembleFinalTransaction(
|
397
|
+
umi.identity,
|
398
|
+
tx,
|
399
|
+
cuPrice,
|
400
|
+
1_400_000
|
401
|
+
).setLatestBlockhash(umi)
|
398
402
|
),
|
399
403
|
3
|
400
404
|
);
|