This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 3737 solana_remote_wallet:: remote_wallet:: RemoteWalletManager ,
3838 solana_sdk:: {
3939 commitment_config:: CommitmentConfig ,
40+ compute_budget:: ComputeBudgetInstruction ,
4041 hash:: Hash ,
4142 message:: Message ,
4243 native_token:: { self , Sol } ,
@@ -193,8 +194,26 @@ fn checked_transaction_with_signers_and_additional_fee<T: Signers>(
193194 additional_fee : u64 ,
194195) -> Result < Transaction , Error > {
195196 let recent_blockhash = get_latest_blockhash ( & config. rpc_client ) ?;
197+ let mut instructions = instructions. to_vec ( ) ;
198+ if let Some ( compute_unit_price) = config. compute_unit_price {
199+ instructions. push ( ComputeBudgetInstruction :: set_compute_unit_price (
200+ compute_unit_price,
201+ ) ) ;
202+ }
203+ if let Some ( compute_unit_limit) = config. compute_unit_limit {
204+ instructions. push ( ComputeBudgetInstruction :: set_compute_unit_limit (
205+ compute_unit_limit,
206+ ) ) ;
207+ } else {
208+ add_compute_unit_limit_from_simulation (
209+ & config. rpc_client ,
210+ & mut instructions,
211+ & config. fee_payer . pubkey ( ) ,
212+ & recent_blockhash,
213+ ) ?;
214+ }
196215 let message = Message :: new_with_blockhash (
197- instructions,
216+ & instructions,
198217 Some ( & config. fee_payer . pubkey ( ) ) ,
199218 & recent_blockhash,
200219 ) ;
You can’t perform that action at this time.
0 commit comments