@@ -214,6 +214,11 @@ func (s *transactionServer) Swap(streamer transactionpb.Transaction_SwapServer)
214
214
// Section: Transaction construction
215
215
//
216
216
217
+ computeUnitLimit , _ := compute_budget .DecompileSetComputeUnitLimitIxnData (jupiterSwapIxns .ComputeBudgetInstructions [0 ].Data )
218
+
219
+ computeUnitPrice , _ := compute_budget .DecompileSetComputeUnitPriceIxnData (jupiterSwapIxns .ComputeBudgetInstructions [1 ].Data )
220
+ computeUnitPrice = uint64 (s .conf .swapPriorityFeeMultiple .Get (ctx ) * float64 (computeUnitPrice ))
221
+
217
222
swapNonce , err := common .NewRandomAccount ()
218
223
if err != nil {
219
224
log .WithError (err ).Warn ("failure generating swap nonce" )
@@ -272,11 +277,14 @@ func (s *transactionServer) Swap(streamer transactionpb.Transaction_SwapServer)
272
277
},
273
278
).ToLegacyInstruction ()
274
279
275
- var ixns []solana.Instruction
276
- ixns = append (ixns , jupiterSwapIxns .ComputeBudgetInstructions ... )
277
- ixns = append (ixns , preSwapIxn , jupiterSwapIxns .SwapInstruction , postSwapIxn )
278
-
279
- txn := solana .NewTransaction (s .swapSubsidizer .PublicKey ().ToBytes (), ixns ... )
280
+ txn := solana .NewTransaction (
281
+ s .swapSubsidizer .PublicKey ().ToBytes (),
282
+ compute_budget .SetComputeUnitLimit (computeUnitLimit ),
283
+ compute_budget .SetComputeUnitPrice (computeUnitPrice ),
284
+ preSwapIxn ,
285
+ jupiterSwapIxns .SwapInstruction ,
286
+ postSwapIxn ,
287
+ )
280
288
281
289
blockhash , err := s .data .GetBlockchainLatestBlockhash (ctx )
282
290
if err != nil {
@@ -289,11 +297,6 @@ func (s *transactionServer) Swap(streamer transactionpb.Transaction_SwapServer)
289
297
// Section: Server parameters
290
298
//
291
299
292
- computeUnitLimit , _ := compute_budget .DecompileSetComputeUnitLimitIxnData (jupiterSwapIxns .ComputeBudgetInstructions [0 ].Data )
293
-
294
- computeUnitPrice , _ := compute_budget .DecompileSetComputeUnitPriceIxnData (jupiterSwapIxns .ComputeBudgetInstructions [1 ].Data )
295
- computeUnitPrice = uint64 (s .conf .swapPriorityFeeMultiple .Get (ctx ) * float64 (computeUnitPrice ))
296
-
297
300
var protoSwapIxnAccounts []* commonpb.InstructionAccount
298
301
for _ , ixnAccount := range jupiterSwapIxns .SwapInstruction .Accounts {
299
302
protoSwapIxnAccounts = append (protoSwapIxnAccounts , & commonpb.InstructionAccount {
0 commit comments