@@ -35,6 +35,7 @@ import { PublicKey } from "@solana/web3.js";
35
35
import { Transaction } from "@solana/web3.js" ;
36
36
import { ComputeBudgetProgram } from "@solana/web3.js" ;
37
37
import type { RawL2Output } from "./types" ;
38
+ import { MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS } from "../../constants" ;
38
39
39
40
export async function initClients (
40
41
agent : SolanaAgentKit ,
@@ -68,7 +69,7 @@ export async function initClients(
68
69
activeSubAccountId : params ?. activeSubAccountId ,
69
70
subAccountIds : params ?. subAccountIds ,
70
71
txParams : {
71
- computeUnitsPrice : 0.000001 * 1000000 * 1000000 ,
72
+ computeUnitsPrice : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS ,
72
73
} ,
73
74
txSender : new FastSingleTxSender ( {
74
75
connection : agent . connection ,
@@ -212,7 +213,7 @@ export async function depositToDriftUserAccount(
212
213
213
214
const tx = new Transaction ( ) . add ( ...depInstruction ) . add (
214
215
ComputeBudgetProgram . setComputeUnitPrice ( {
215
- microLamports : 0.000001 * 1000000 * 1000000 ,
216
+ microLamports : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS ,
216
217
} ) ,
217
218
) ;
218
219
tx . recentBlockhash = latestBlockhash . blockhash ;
@@ -277,7 +278,7 @@ export async function withdrawFromDriftUserAccount(
277
278
278
279
const tx = new Transaction ( ) . add ( ...withdrawInstruction ) . add (
279
280
ComputeBudgetProgram . setComputeUnitPrice ( {
280
- microLamports : 0.000003 * 1000000 * 1000000 ,
281
+ microLamports : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS ,
281
282
} ) ,
282
283
) ;
283
284
tx . recentBlockhash = latestBlockhash . blockhash ;
@@ -384,7 +385,7 @@ export async function driftPerpTrade(
384
385
marketIndex : market . marketIndex ,
385
386
} ) ,
386
387
{
387
- computeUnitsPrice : 0.000001 * 1000000 * 1000000 ,
388
+ computeUnitsPrice : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS ,
388
389
} ,
389
390
) ;
390
391
}
@@ -552,7 +553,7 @@ export async function stakeToDriftInsuranceFund(
552
553
) ,
553
554
initializeStakeAccount : shouldCreateAccount ,
554
555
txParams : {
555
- computeUnitsPrice : 0.000002 * 1000000 * 1000000 ,
556
+ computeUnitsPrice : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS ,
556
557
} ,
557
558
} ) ;
558
559
@@ -592,7 +593,7 @@ export async function requestUnstakeFromDriftInsuranceFund(
592
593
const signature = await driftClient . requestRemoveInsuranceFundStake (
593
594
token . marketIndex ,
594
595
numberToSafeBN ( amount , token . precision ) ,
595
- { computeUnitsPrice : 0.000002 * 1000000 * 1000000 } ,
596
+ { computeUnitsPrice : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS } ,
596
597
) ;
597
598
598
599
await cleanUp ( ) ;
@@ -630,7 +631,7 @@ export async function unstakeFromDriftInsuranceFund(
630
631
token . marketIndex ,
631
632
getAssociatedTokenAddressSync ( token . mint , agent . wallet . publicKey ) ,
632
633
{
633
- computeUnitsPrice : 0.000002 * 1000000 * 1000000 ,
634
+ computeUnitsPrice : MINIMUM_COMPUTE_PRICE_FOR_COMPLEX_ACTIONS ,
634
635
} ,
635
636
) ;
636
637
0 commit comments