rust client: add a CU estimate for token withdrawal (#934)

This commit is contained in:
Serge Farny 2024-04-08 12:43:40 +02:00 committed by GitHub
parent e38798ed0c
commit 55105e085f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -691,7 +691,7 @@ impl MangoClient {
}),
},
],
self.instruction_cu(health_cu),
self.instruction_cu(health_cu) + self.context.compute_estimates.cu_per_associated_token_account_creation,
);
Ok(ixs)
}

View File

@ -123,6 +123,7 @@ pub struct ComputeEstimates {
pub cu_per_charge_collateral_fees: u32,
pub cu_per_charge_collateral_fees_token: u32,
pub cu_for_sequence_check: u32,
pub cu_per_associated_token_account_creation: u32,
}
impl Default for ComputeEstimates {
@ -148,6 +149,7 @@ impl Default for ComputeEstimates {
cu_per_charge_collateral_fees_token: 15_000,
// measured around 8k, see test_basics
cu_for_sequence_check: 10_000,
cu_per_associated_token_account_creation: 21_000,
}
}
}