@haven-fi/solauto-sdk 1.0.236 → 1.0.237
Sign up to get free protection for your applications and to get access to all the features.
@@ -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,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,SAAS,EACtB,QAAQ,EAAE,MAAM,GACf,kBAAkB,CASpB;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACn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M,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA2C,EAC5D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA6EjC"}
|
@@ -167,7 +167,6 @@ async function getComputeUnitPriceEstimate(umi, tx, prioritySetting) {
|
|
167
167
|
return feeEstimate;
|
168
168
|
}
|
169
169
|
async function spamSendTransactionUntilConfirmed(connection, transaction, blockhash, spamInterval = 1000) {
|
170
|
-
let confirmed = false;
|
171
170
|
let transactionSignature = null;
|
172
171
|
const sendTx = async () => {
|
173
172
|
try {
|
@@ -186,7 +185,7 @@ async function spamSendTransactionUntilConfirmed(connection, transaction, blockh
|
|
186
185
|
if (!transactionSignature) {
|
187
186
|
throw new Error("Failed to send");
|
188
187
|
}
|
189
|
-
await connection
|
188
|
+
const resp = await connection
|
190
189
|
.confirmTransaction({
|
191
190
|
...blockhash,
|
192
191
|
signature: transactionSignature,
|
@@ -194,9 +193,12 @@ async function spamSendTransactionUntilConfirmed(connection, transaction, blockh
|
|
194
193
|
.finally(() => {
|
195
194
|
clearInterval(sendIntervalId);
|
196
195
|
});
|
196
|
+
if (resp.value.err) {
|
197
|
+
throw resp.value.err;
|
198
|
+
}
|
197
199
|
return transactionSignature;
|
198
200
|
}
|
199
|
-
async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prioritySetting = types_1.PriorityFeeSetting.
|
201
|
+
async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prioritySetting = types_1.PriorityFeeSetting.Min, onAwaitingSign) {
|
200
202
|
(0, generalUtils_1.consoleLog)("Sending single optimized transaction...");
|
201
203
|
(0, generalUtils_1.consoleLog)("Instructions: ", tx.getInstructions().length);
|
202
204
|
(0, generalUtils_1.consoleLog)("Serialized transaction size: ", tx.getTransactionSize(umi));
|
package/package.json
CHANGED
package/src/utils/solanaUtils.ts
CHANGED
@@ -302,7 +302,6 @@ async function spamSendTransactionUntilConfirmed(
|
|
302
302
|
blockhash: BlockhashWithExpiryBlockHeight,
|
303
303
|
spamInterval: number = 1000
|
304
304
|
): Promise<string> {
|
305
|
-
let confirmed = false;
|
306
305
|
let transactionSignature: string | null = null;
|
307
306
|
|
308
307
|
const sendTx = async () => {
|
@@ -328,7 +327,7 @@ async function spamSendTransactionUntilConfirmed(
|
|
328
327
|
throw new Error("Failed to send");
|
329
328
|
}
|
330
329
|
|
331
|
-
await connection
|
330
|
+
const resp = await connection
|
332
331
|
.confirmTransaction({
|
333
332
|
...blockhash,
|
334
333
|
signature: transactionSignature,
|
@@ -337,6 +336,10 @@ async function spamSendTransactionUntilConfirmed(
|
|
337
336
|
clearInterval(sendIntervalId);
|
338
337
|
});
|
339
338
|
|
339
|
+
if (resp.value.err) {
|
340
|
+
throw resp.value.err;
|
341
|
+
}
|
342
|
+
|
340
343
|
return transactionSignature;
|
341
344
|
}
|
342
345
|
|
@@ -345,7 +348,7 @@ export async function sendSingleOptimizedTransaction(
|
|
345
348
|
connection: Connection,
|
346
349
|
tx: TransactionBuilder,
|
347
350
|
txType?: TransactionRunType,
|
348
|
-
prioritySetting: PriorityFeeSetting = PriorityFeeSetting.
|
351
|
+
prioritySetting: PriorityFeeSetting = PriorityFeeSetting.Min,
|
349
352
|
onAwaitingSign?: () => void
|
350
353
|
): Promise<Uint8Array | undefined> {
|
351
354
|
consoleLog("Sending single optimized transaction...");
|
@@ -415,7 +418,7 @@ export async function sendSingleOptimizedTransaction(
|
|
415
418
|
const txSig = await spamSendTransactionUntilConfirmed(
|
416
419
|
connection,
|
417
420
|
toWeb3JsTransaction(signedTx),
|
418
|
-
blockhash
|
421
|
+
blockhash
|
419
422
|
);
|
420
423
|
|
421
424
|
consoleLog(`Transaction signature: ${txSig}`);
|