@haven-fi/solauto-sdk 1.0.235 → 1.0.236
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/transactions/transactionUtils.d.ts.map +1 -1
- package/dist/transactions/transactionUtils.js +0 -4
- package/dist/transactions/transactionsManager.d.ts +1 -2
- package/dist/transactions/transactionsManager.d.ts.map +1 -1
- package/dist/transactions/transactionsManager.js +2 -3
- package/dist/utils/solanaUtils.d.ts +1 -1
- package/dist/utils/solanaUtils.d.ts.map +1 -1
- package/dist/utils/solanaUtils.js +28 -51
- package/package.json +1 -1
- package/src/transactions/transactionUtils.ts +0 -5
- package/src/transactions/transactionsManager.ts +0 -2
- package/src/utils/solanaUtils.ts +28 -54
- package/tests/transactions/solautoMarginfi.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transactionUtils.d.ts","sourceRoot":"","sources":["../../src/transactions/transactionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAClB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,SAAS,EAA8B,MAAM,iBAAiB,CAAC;AAoBxE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAsCzD,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAO7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAqLjD,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,sBAAsB,EAAE,MAAM,EAAE,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAkH7B;AA2LD,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,GACrB,OAAO,CAAC,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CA0BnD;AAED,wBAAsB,8BAA8B,CAAC,MAAM,EAAE,aAAa,oBA2CzE;AAED,wBAAsB,gCAAgC,CACpD,MAAM,EAAE,aAAa,EACrB,2BAA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 -364,10 +364,6 @@ async function buildSolautoRebalanceTransaction(client, targetLiqUtilizationRate
|
|
364
364
|
}
|
365
365
|
const values = (0, rebalanceUtils_1.getRebalanceValues)(client.solautoPositionState, client.solautoPositionSettings(), client.solautoPositionActiveDca(), (0, generalUtils_1.currentUnixSeconds)(), (0, generalUtils_1.safeGetPrice)(client.supplyMint), (0, generalUtils_1.safeGetPrice)(client.debtMint), targetLiqUtilizationRateBps);
|
366
366
|
client.log("Rebalance values: ", values);
|
367
|
-
// Don't perform automated solauto manager boost if the fees are less than the transaction cost
|
368
|
-
if (targetLiqUtilizationRateBps === undefined && values.rebalanceDirection === generated_1.RebalanceDirection.Boost && values.feesUsd < 1) {
|
369
|
-
return undefined;
|
370
|
-
}
|
371
367
|
const swapDetails = (0, rebalanceUtils_1.getJupSwapRebalanceDetails)(client, values, targetLiqUtilizationRateBps, attemptNum);
|
372
368
|
const { jupQuote, lookupTableAddresses, setupInstructions, tokenLedgerIx, swapIx, } = await (0, jupiterUtils_1.getJupSwapTransaction)(client.signer, swapDetails, attemptNum);
|
373
369
|
const flashLoan = (0, rebalanceUtils_1.getFlashLoanDetails)(client, values, jupQuote);
|
@@ -36,10 +36,9 @@ export declare class TransactionsManager {
|
|
36
36
|
private errorsToThrow?;
|
37
37
|
private retries;
|
38
38
|
private retryDelay;
|
39
|
-
private confirmTimeout;
|
40
39
|
private statuses;
|
41
40
|
private lookupTables;
|
42
|
-
constructor(txHandler: SolautoClient | ReferralStateManager, statusCallback?: ((statuses: TransactionManagerStatuses) => void) | undefined, txType?: TransactionRunType | undefined, mustBeAtomic?: boolean | undefined, errorsToThrow?: ErrorsToThrow | undefined, retries?: number, retryDelay?: number
|
41
|
+
constructor(txHandler: SolautoClient | ReferralStateManager, statusCallback?: ((statuses: TransactionManagerStatuses) => void) | undefined, txType?: TransactionRunType | undefined, mustBeAtomic?: boolean | undefined, errorsToThrow?: ErrorsToThrow | undefined, retries?: number, retryDelay?: number);
|
43
42
|
private assembleTransactionSets;
|
44
43
|
private updateStatus;
|
45
44
|
private debugAccounts;
|
@@ -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;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAsC7D,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IAPtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;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;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,YAAY,CAAC;IACrB,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,UAAU;
|
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;AAKzD,OAAO,EACL,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAa,MAAM,YAAY,CAAC;AAsC7D,qBAAa,eAAe;IAKjB,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM;IAPtB,oBAAoB,EAAG,MAAM,EAAE,CAAC;IAChC,EAAE,CAAC,EAAE,kBAAkB,CAAC;gBAGf,OAAO,EAAE,CACd,UAAU,EAAE,MAAM,KACf,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,EACxC,IAAI,CAAC,EAAE,MAAM,YAAA;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;IACzB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,EAAE,CAAC;AAEJ,qBAAa,mBAAmB;IAK5B,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,cAAc,CAAC;IACvB,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,YAAY,CAAC;IACrB,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,YAAY,CAAC,EAAE,OAAO,YAAA,EACtB,aAAa,CAAC,EAAE,aAAa,YAAA,EAC7B,OAAO,GAAE,MAAU,EACnB,UAAU,GAAE,MAAY;YAQpB,uBAAuB;IAwCrC,OAAO,CAAC,YAAY;YA8CN,aAAa;IAoBd,UAAU,CACrB,YAAY,EAAE,eAAe,EAAE,EAC/B,eAAe,CAAC,EAAE,kBAAkB,GACnC,OAAO,CAAC,0BAA0B,CAAC;IAyEzB,IAAI,CACf,KAAK,EAAE,eAAe,EAAE,EACxB,eAAe,CAAC,EAAE,kBAAkB,EACpC,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,0BAA0B,CAAC;YAwGxB,eAAe;CAkD9B"}
|
@@ -119,7 +119,7 @@ var TransactionStatus;
|
|
119
119
|
TransactionStatus["Failed"] = "Failed";
|
120
120
|
})(TransactionStatus || (exports.TransactionStatus = TransactionStatus = {}));
|
121
121
|
class TransactionsManager {
|
122
|
-
constructor(txHandler, statusCallback, txType, mustBeAtomic, errorsToThrow, retries = 4, retryDelay = 150
|
122
|
+
constructor(txHandler, statusCallback, txType, mustBeAtomic, errorsToThrow, retries = 4, retryDelay = 150) {
|
123
123
|
this.txHandler = txHandler;
|
124
124
|
this.statusCallback = statusCallback;
|
125
125
|
this.txType = txType;
|
@@ -127,7 +127,6 @@ class TransactionsManager {
|
|
127
127
|
this.errorsToThrow = errorsToThrow;
|
128
128
|
this.retries = retries;
|
129
129
|
this.retryDelay = retryDelay;
|
130
|
-
this.confirmTimeout = confirmTimeout;
|
131
130
|
this.statuses = [];
|
132
131
|
this.lookupTables = new LookupTables(this.txHandler.defaultLookupTables(), this.txHandler.umi);
|
133
132
|
}
|
@@ -331,7 +330,7 @@ class TransactionsManager {
|
|
331
330
|
async sendTransaction(tx, txName, attemptNum, prioritySetting) {
|
332
331
|
this.updateStatus(txName, TransactionStatus.Processing, attemptNum);
|
333
332
|
try {
|
334
|
-
const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.txType,
|
333
|
+
const txSig = await (0, solanaUtils_1.sendSingleOptimizedTransaction)(this.txHandler.umi, this.txHandler.connection, tx, this.txType, prioritySetting, () => this.updateStatus(txName, TransactionStatus.Processing, attemptNum, undefined, true));
|
335
334
|
this.updateStatus(txName, TransactionStatus.Successful, attemptNum, txSig ? bs58_1.default.encode(txSig) : undefined);
|
336
335
|
}
|
337
336
|
catch (e) {
|
@@ -14,5 +14,5 @@ export declare function splTokenTransferUmiIx(signer: Signer, fromTa: PublicKey,
|
|
14
14
|
export declare function getAddressLookupInputs(umi: Umi, lookupTableAddresses: string[]): Promise<AddressLookupTableInput[]>;
|
15
15
|
export declare function assembleFinalTransaction(signer: Signer, tx: TransactionBuilder, computeUnitPrice?: number, computeUnitLimit?: number): TransactionBuilder;
|
16
16
|
export declare function getComputeUnitPriceEstimate(umi: Umi, tx: TransactionBuilder, prioritySetting: PriorityFeeSetting): Promise<number | undefined>;
|
17
|
-
export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, txType?: TransactionRunType,
|
17
|
+
export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, txType?: TransactionRunType, prioritySetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<Uint8Array | undefined>;
|
18
18
|
//# 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,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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BAAkB,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AA8CD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA+C,EAChE,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA6EjC"}
|
@@ -166,60 +166,37 @@ async function getComputeUnitPriceEstimate(umi, tx, prioritySetting) {
|
|
166
166
|
}
|
167
167
|
return feeEstimate;
|
168
168
|
}
|
169
|
-
async function spamSendTransactionUntilConfirmed(connection, transaction, blockhash,
|
170
|
-
let spamAttempts = 0;
|
169
|
+
async function spamSendTransactionUntilConfirmed(connection, transaction, blockhash, spamInterval = 1000) {
|
171
170
|
let confirmed = false;
|
172
171
|
let transactionSignature = null;
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
});
|
198
|
-
if (value.err) {
|
199
|
-
reject(value.err);
|
200
|
-
}
|
201
|
-
confirmed = true;
|
202
|
-
resolve(transactionSignature);
|
203
|
-
}
|
204
|
-
catch (error) {
|
205
|
-
(0, generalUtils_1.consoleLog)("Error during confirmation:", error);
|
206
|
-
}
|
207
|
-
}
|
208
|
-
if (!confirmed) {
|
209
|
-
setTimeout(confirmTransaction, 1000);
|
210
|
-
}
|
211
|
-
};
|
212
|
-
spamSend();
|
213
|
-
confirmTransaction();
|
214
|
-
setTimeout(() => {
|
215
|
-
if (!confirmed) {
|
216
|
-
confirmed = true;
|
217
|
-
reject(new Error("Failed to confirm transaction within timeout"));
|
218
|
-
}
|
219
|
-
}, confirmTimeout);
|
172
|
+
const sendTx = async () => {
|
173
|
+
try {
|
174
|
+
const txSignature = await connection.sendRawTransaction(Buffer.from(transaction.serialize()), { skipPreflight: true, maxRetries: 0 });
|
175
|
+
transactionSignature = txSignature;
|
176
|
+
(0, generalUtils_1.consoleLog)(`Transaction sent`);
|
177
|
+
}
|
178
|
+
catch (error) {
|
179
|
+
(0, generalUtils_1.consoleLog)("Error sending transaction:", error);
|
180
|
+
}
|
181
|
+
};
|
182
|
+
await sendTx();
|
183
|
+
const sendIntervalId = setInterval(async () => {
|
184
|
+
await sendTx();
|
185
|
+
}, spamInterval);
|
186
|
+
if (!transactionSignature) {
|
187
|
+
throw new Error("Failed to send");
|
188
|
+
}
|
189
|
+
await connection
|
190
|
+
.confirmTransaction({
|
191
|
+
...blockhash,
|
192
|
+
signature: transactionSignature,
|
193
|
+
})
|
194
|
+
.finally(() => {
|
195
|
+
clearInterval(sendIntervalId);
|
220
196
|
});
|
197
|
+
return transactionSignature;
|
221
198
|
}
|
222
|
-
async function sendSingleOptimizedTransaction(umi, connection, tx, txType,
|
199
|
+
async function sendSingleOptimizedTransaction(umi, connection, tx, txType, prioritySetting = types_1.PriorityFeeSetting.Default, onAwaitingSign) {
|
223
200
|
(0, generalUtils_1.consoleLog)("Sending single optimized transaction...");
|
224
201
|
(0, generalUtils_1.consoleLog)("Instructions: ", tx.getInstructions().length);
|
225
202
|
(0, generalUtils_1.consoleLog)("Serialized transaction size: ", tx.getTransactionSize(umi));
|
@@ -259,7 +236,7 @@ async function sendSingleOptimizedTransaction(umi, connection, tx, txType, confi
|
|
259
236
|
const signedTx = await assembleFinalTransaction(umi.identity, tx, cuPrice, computeUnitLimit)
|
260
237
|
.setBlockhash(blockhash)
|
261
238
|
.buildAndSign(umi);
|
262
|
-
const txSig = await spamSendTransactionUntilConfirmed(connection, (0, umi_web3js_adapters_1.toWeb3JsTransaction)(signedTx), blockhash
|
239
|
+
const txSig = await spamSendTransactionUntilConfirmed(connection, (0, umi_web3js_adapters_1.toWeb3JsTransaction)(signedTx), blockhash);
|
263
240
|
(0, generalUtils_1.consoleLog)(`Transaction signature: ${txSig}`);
|
264
241
|
(0, generalUtils_1.consoleLog)(`https://solscan.io/tx/${txSig}`);
|
265
242
|
return bs58_1.default.decode(txSig);
|
package/package.json
CHANGED
@@ -666,11 +666,6 @@ export async function buildSolautoRebalanceTransaction(
|
|
666
666
|
);
|
667
667
|
client.log("Rebalance values: ", values);
|
668
668
|
|
669
|
-
// Don't perform automated solauto manager boost if the fees are less than the transaction cost
|
670
|
-
if (targetLiqUtilizationRateBps === undefined && values.rebalanceDirection === RebalanceDirection.Boost && values.feesUsd < 1) {
|
671
|
-
return undefined;
|
672
|
-
}
|
673
|
-
|
674
669
|
const swapDetails = getJupSwapRebalanceDetails(
|
675
670
|
client,
|
676
671
|
values,
|
@@ -200,7 +200,6 @@ export class TransactionsManager {
|
|
200
200
|
private errorsToThrow?: ErrorsToThrow,
|
201
201
|
private retries: number = 4,
|
202
202
|
private retryDelay: number = 150,
|
203
|
-
private confirmTimeout: number = 15000
|
204
203
|
) {
|
205
204
|
this.lookupTables = new LookupTables(
|
206
205
|
this.txHandler.defaultLookupTables(),
|
@@ -511,7 +510,6 @@ export class TransactionsManager {
|
|
511
510
|
this.txHandler.connection,
|
512
511
|
tx,
|
513
512
|
this.txType,
|
514
|
-
this.confirmTimeout,
|
515
513
|
prioritySetting,
|
516
514
|
() =>
|
517
515
|
this.updateStatus(
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -300,68 +300,44 @@ async function spamSendTransactionUntilConfirmed(
|
|
300
300
|
connection: Connection,
|
301
301
|
transaction: Transaction | VersionedTransaction,
|
302
302
|
blockhash: BlockhashWithExpiryBlockHeight,
|
303
|
-
confirmTimeout: number = 15000,
|
304
303
|
spamInterval: number = 1000
|
305
304
|
): Promise<string> {
|
306
|
-
let spamAttempts = 0;
|
307
305
|
let confirmed = false;
|
308
306
|
let transactionSignature: string | null = null;
|
309
307
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
308
|
+
const sendTx = async () => {
|
309
|
+
try {
|
310
|
+
const txSignature = await connection.sendRawTransaction(
|
311
|
+
Buffer.from(transaction.serialize()),
|
312
|
+
{ skipPreflight: true, maxRetries: 0 }
|
313
|
+
);
|
314
|
+
transactionSignature = txSignature;
|
315
|
+
consoleLog(`Transaction sent`);
|
316
|
+
} catch (error) {
|
317
|
+
consoleLog("Error sending transaction:", error);
|
318
|
+
}
|
319
|
+
};
|
315
320
|
|
316
|
-
|
317
|
-
const txSignature = await connection.sendRawTransaction(
|
318
|
-
Buffer.from(transaction.serialize()),
|
319
|
-
{ skipPreflight: true, maxRetries: 0 }
|
320
|
-
);
|
321
|
-
transactionSignature = txSignature;
|
322
|
-
consoleLog(`Transaction sent`);
|
323
|
-
} catch (error) {
|
324
|
-
consoleLog("Error sending transaction:", error);
|
325
|
-
}
|
321
|
+
await sendTx();
|
326
322
|
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
}
|
331
|
-
};
|
332
|
-
|
333
|
-
const confirmTransaction = async () => {
|
334
|
-
if (transactionSignature) {
|
335
|
-
try {
|
336
|
-
const { value } = await connection.confirmTransaction({
|
337
|
-
...blockhash,
|
338
|
-
signature: transactionSignature,
|
339
|
-
});
|
340
|
-
if (value.err) {
|
341
|
-
reject(value.err);
|
342
|
-
}
|
343
|
-
confirmed = true;
|
344
|
-
resolve(transactionSignature);
|
345
|
-
} catch (error) {
|
346
|
-
consoleLog("Error during confirmation:", error);
|
347
|
-
}
|
348
|
-
}
|
323
|
+
const sendIntervalId = setInterval(async () => {
|
324
|
+
await sendTx();
|
325
|
+
}, spamInterval);
|
349
326
|
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
};
|
327
|
+
if (!transactionSignature) {
|
328
|
+
throw new Error("Failed to send");
|
329
|
+
}
|
354
330
|
|
355
|
-
|
356
|
-
confirmTransaction(
|
331
|
+
await connection
|
332
|
+
.confirmTransaction({
|
333
|
+
...blockhash,
|
334
|
+
signature: transactionSignature,
|
335
|
+
})
|
336
|
+
.finally(() => {
|
337
|
+
clearInterval(sendIntervalId);
|
338
|
+
});
|
357
339
|
|
358
|
-
|
359
|
-
if (!confirmed) {
|
360
|
-
confirmed = true;
|
361
|
-
reject(new Error("Failed to confirm transaction within timeout"));
|
362
|
-
}
|
363
|
-
}, confirmTimeout);
|
364
|
-
});
|
340
|
+
return transactionSignature;
|
365
341
|
}
|
366
342
|
|
367
343
|
export async function sendSingleOptimizedTransaction(
|
@@ -369,7 +345,6 @@ export async function sendSingleOptimizedTransaction(
|
|
369
345
|
connection: Connection,
|
370
346
|
tx: TransactionBuilder,
|
371
347
|
txType?: TransactionRunType,
|
372
|
-
confirmTimeout: number = 15000,
|
373
348
|
prioritySetting: PriorityFeeSetting = PriorityFeeSetting.Default,
|
374
349
|
onAwaitingSign?: () => void
|
375
350
|
): Promise<Uint8Array | undefined> {
|
@@ -441,7 +416,6 @@ export async function sendSingleOptimizedTransaction(
|
|
441
416
|
connection,
|
442
417
|
toWeb3JsTransaction(signedTx),
|
443
418
|
blockhash,
|
444
|
-
confirmTimeout
|
445
419
|
);
|
446
420
|
|
447
421
|
consoleLog(`Transaction signature: ${txSig}`);
|
@@ -142,6 +142,6 @@ describe("Solauto Marginfi tests", async () => {
|
|
142
142
|
undefined,
|
143
143
|
!payForTransactions ? "only-simulate" : "normal",
|
144
144
|
useJitoBundle
|
145
|
-
).clientSend(transactionItems, PriorityFeeSetting.
|
145
|
+
).clientSend(transactionItems, PriorityFeeSetting.Min);
|
146
146
|
});
|
147
147
|
});
|