Add get_minimum_balance_for_rent_excemption to Client (#14048)
This commit is contained in:
parent
5ea80e673f
commit
7abd8084b6
|
@ -399,6 +399,12 @@ impl SyncClient for ThinClient {
|
||||||
.map(|r| r.value)
|
.map(|r| r.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> TransportResult<u64> {
|
||||||
|
self.rpc_client()
|
||||||
|
.get_minimum_balance_for_rent_exemption(data_len)
|
||||||
|
.map_err(|e| e.into())
|
||||||
|
}
|
||||||
|
|
||||||
fn get_recent_blockhash(&self) -> TransportResult<(Hash, FeeCalculator)> {
|
fn get_recent_blockhash(&self) -> TransportResult<(Hash, FeeCalculator)> {
|
||||||
let (blockhash, fee_calculator, _last_valid_slot) =
|
let (blockhash, fee_calculator, _last_valid_slot) =
|
||||||
self.get_recent_blockhash_with_commitment(CommitmentConfig::default())?;
|
self.get_recent_blockhash_with_commitment(CommitmentConfig::default())?;
|
||||||
|
|
|
@ -140,6 +140,10 @@ impl SyncClient for BankClient {
|
||||||
Ok(self.bank.get_balance(pubkey))
|
Ok(self.bank.get_balance(pubkey))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> Result<u64> {
|
||||||
|
Ok(self.bank.get_minimum_balance_for_rent_exemption(data_len))
|
||||||
|
}
|
||||||
|
|
||||||
fn get_recent_blockhash(&self) -> Result<(Hash, FeeCalculator)> {
|
fn get_recent_blockhash(&self) -> Result<(Hash, FeeCalculator)> {
|
||||||
Ok(self.bank.last_blockhash_with_fee_calculator())
|
Ok(self.bank.last_blockhash_with_fee_calculator())
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,8 @@ pub trait SyncClient {
|
||||||
commitment_config: CommitmentConfig,
|
commitment_config: CommitmentConfig,
|
||||||
) -> Result<u64>;
|
) -> Result<u64>;
|
||||||
|
|
||||||
|
fn get_minimum_balance_for_rent_exemption(&self, data_len: usize) -> Result<u64>;
|
||||||
|
|
||||||
/// Get recent blockhash
|
/// Get recent blockhash
|
||||||
fn get_recent_blockhash(&self) -> Result<(Hash, FeeCalculator)>;
|
fn get_recent_blockhash(&self) -> Result<(Hash, FeeCalculator)>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue