@@ -84,9 +84,7 @@ export const getSimulationComputeUnits = async (
84
84
const simulationInstructions = [ ...instructions ] ;
85
85
86
86
// Replace or add compute limit instruction
87
- const computeLimitIndex = simulationInstructions . findIndex (
88
- isSetComputeLimitInstruction ,
89
- ) ;
87
+ const computeLimitIndex = simulationInstructions . findIndex ( isSetComputeLimitInstruction ) ;
90
88
const simulationLimitIx = ComputeBudgetProgram . setComputeUnitLimit ( {
91
89
units : 1_400_000 ,
92
90
} ) ;
@@ -116,8 +114,7 @@ export const getSimulationComputeUnits = async (
116
114
if ( rpcResponse ?. value ?. err ) {
117
115
const logs = rpcResponse . value . logs ?. join ( "\n • " ) || "No logs available" ;
118
116
throw new Error (
119
- `Transaction simulation failed:\n •${ logs } ` +
120
- JSON . stringify ( rpcResponse ?. value ?. err ) ,
117
+ `Transaction simulation failed:\n •${ logs } ` + JSON . stringify ( rpcResponse ?. value ?. err ) ,
121
118
) ;
122
119
}
123
120
@@ -173,9 +170,7 @@ export type ComputeUnitBuffer = {
173
170
/**
174
171
* Default configuration values for transaction sending
175
172
*/
176
- export const DEFAULT_SEND_OPTIONS : Required <
177
- Omit < SendTransactionOptions , "onStatusUpdate" >
178
- > = {
173
+ export const DEFAULT_SEND_OPTIONS : Required < Omit < SendTransactionOptions , "onStatusUpdate" > > = {
179
174
maxRetries : MAX_RETRIES ,
180
175
initialDelayMs : RETRY_INTERVAL_MS ,
181
176
commitment : "confirmed" ,
@@ -239,7 +234,7 @@ export async function sendTransaction(
239
234
// Skip compute preparation if transaction is already signed or has compute instructions
240
235
if ( transaction . signatures . length > 0 ) {
241
236
console . log ( "Transaction already signed, skipping compute preparation" ) ;
242
- return sendRawTransactionWithRetry ( connection , transaction . serialize ( ) , {
237
+ return sendRawTransactionWithRetry ( connection , transaction . serialize ( ) as Uint8Array , {
243
238
commitment,
244
239
...sendOptions ,
245
240
} ) ;
@@ -256,7 +251,7 @@ export async function sendTransaction(
256
251
) ;
257
252
258
253
transaction . sign ( ...signers ) ;
259
- return sendRawTransactionWithRetry ( connection , transaction . serialize ( ) , {
254
+ return sendRawTransactionWithRetry ( connection , transaction . serialize ( ) as Uint8Array , {
260
255
commitment,
261
256
...sendOptions ,
262
257
} ) ;
@@ -318,8 +313,7 @@ export async function sendVersionedTransaction(
318
313
...sendOptions
319
314
} = options ;
320
315
321
- const hasComputeLimitInstructions =
322
- hasSetComputeLimitInstruction ( instructions ) ;
316
+ const hasComputeLimitInstructions = hasSetComputeLimitInstruction ( instructions ) ;
323
317
324
318
if ( ! hasComputeLimitInstructions ) {
325
319
const computeUnitBuffer = userComputeBuffer ?? { multiplier : 1.1 } ;
@@ -336,20 +330,15 @@ export async function sendVersionedTransaction(
336
330
337
331
const messageV0 = new TransactionMessage ( {
338
332
payerKey : signers [ 0 ] . publicKey ,
339
- recentBlockhash : ( await connection . getLatestBlockhash ( commitment ) )
340
- . blockhash ,
333
+ recentBlockhash : ( await connection . getLatestBlockhash ( commitment ) ) . blockhash ,
341
334
instructions,
342
335
} ) . compileToV0Message ( lookupTables ) ;
343
336
344
337
const transaction = new VersionedTransaction ( messageV0 ) ;
345
338
346
339
transaction . sign ( signers ) ;
347
340
348
- return await sendRawTransactionWithRetry (
349
- connection ,
350
- transaction . serialize ( ) ,
351
- sendOptions ,
352
- ) ;
341
+ return await sendRawTransactionWithRetry ( connection , transaction . serialize ( ) , sendOptions ) ;
353
342
}
354
343
355
344
/**
@@ -399,9 +388,7 @@ export async function addComputeInstructions(
399
388
// Apply buffer to compute units
400
389
let finalComputeUnits = simulatedCompute ;
401
390
if ( computeUnitBuffer . multiplier ) {
402
- finalComputeUnits = Math . floor (
403
- finalComputeUnits * computeUnitBuffer . multiplier ,
404
- ) ;
391
+ finalComputeUnits = Math . floor ( finalComputeUnits * computeUnitBuffer . multiplier ) ;
405
392
}
406
393
if ( computeUnitBuffer . fixed ) {
407
394
finalComputeUnits += computeUnitBuffer . fixed ;
@@ -541,12 +528,11 @@ export async function createLookupTable(
541
528
) : Promise < [ PublicKey , AddressLookupTableAccount ] > {
542
529
const slot = await connection . getSlot ( ) ;
543
530
544
- const [ lookupTableInst , lookupTableAddress ] =
545
- AddressLookupTableProgram . createLookupTable ( {
546
- authority : sender . publicKey ,
547
- payer : sender . publicKey ,
548
- recentSlot : slot ,
549
- } ) ;
531
+ const [ lookupTableInst , lookupTableAddress ] = AddressLookupTableProgram . createLookupTable ( {
532
+ authority : sender . publicKey ,
533
+ payer : sender . publicKey ,
534
+ recentSlot : slot ,
535
+ } ) ;
550
536
551
537
const extendInstruction = AddressLookupTableProgram . extendLookupTable ( {
552
538
payer : sender . publicKey ,
@@ -565,16 +551,9 @@ export async function createLookupTable(
565
551
) ;
566
552
567
553
// Need to wait until the lookup table is active
568
- await confirmTransaction (
569
- connection ,
570
- lookupTableInstructionsSignature ,
571
- "finalized" ,
572
- ) ;
554
+ await confirmTransaction ( connection , lookupTableInstructionsSignature , "finalized" ) ;
573
555
574
- console . log (
575
- "Lookup table instructions signature" ,
576
- lookupTableInstructionsSignature ,
577
- ) ;
556
+ console . log ( "Lookup table instructions signature" , lookupTableInstructionsSignature ) ;
578
557
579
558
const lookupTableAccount = (
580
559
await connection . getAddressLookupTable ( lookupTableAddress , {
0 commit comments