Skip to content

Commit e54c27d

Browse files
committed
update
1 parent 2cf26ad commit e54c27d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/lib/solana/transaction-manager.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class SvmTransactionManager {
7373
})
7474

7575
// 4. Build transaction message using Kit's pipeline
76-
const message = await pipe(
76+
const message = pipe(
7777
createTransactionMessage({ version: 0 }),
7878
(tx) => setTransactionMessageFeePayerSigner(feePayer, tx),
7979
(tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx),
@@ -126,7 +126,7 @@ export class SvmTransactionManager {
126126
.getLatestBlockhash({ commitment: this.ctx.commitment })
127127
.send()
128128

129-
const retryMessage = await pipe(
129+
const retryMessage = pipe(
130130
createTransactionMessage({ version: 0 }),
131131
(tx) => setTransactionMessageFeePayerSigner(feePayer, tx),
132132
(tx) => setTransactionMessageLifetimeUsingBlockhash(freshBlockhash, tx),
@@ -147,7 +147,11 @@ export class SvmTransactionManager {
147147
} else {
148148
// Without subscriptions: manual send + poll
149149
const wireTx = getBase64EncodedWireTransaction(signedTransaction)
150-
await this.ctx.rpc.sendTransaction(wireTx).send()
150+
await this.ctx.rpc
151+
.sendTransaction(wireTx, {
152+
// preflightCommitment: this.ctx.commitment, // optional
153+
})
154+
.send()
151155

152156
// Poll signature status until desired commitment
153157
const target = this.ctx.commitment
@@ -176,7 +180,7 @@ export class SvmTransactionManager {
176180
}
177181
// Continue polling for network errors
178182
}
179-
await new Promise((resolve) => setTimeout(resolve, 1000))
183+
await new Promise((resolve) => setTimeout(resolve, Math.min(1000 * (i + 1), 5000)))
180184
}
181185
if (!confirmed) {
182186
throw new Error(`Transaction not confirmed within timeout: ${signature}`)
@@ -247,7 +251,7 @@ export class SvmTransactionManager {
247251
const computeBudgetInstructions = buildComputeBudgetInstructions(budgetConfig, requestId)
248252
const allInstructions = [...computeBudgetInstructions, ...instructions]
249253

250-
const message = await pipe(
254+
const message = pipe(
251255
createTransactionMessage({ version: 0 }),
252256
(tx) => setTransactionMessageFeePayerSigner(feePayer, tx),
253257
(tx) => setTransactionMessageLifetimeUsingBlockhash(latestBlockhash, tx),

0 commit comments

Comments
 (0)