Update fee api to use blockhash (#21054)

This commit is contained in:
Jack May
2021-10-29 13:52:59 -07:00
committed by GitHub
parent aea3c66fa8
commit bced07a099
16 changed files with 142 additions and 93 deletions

View File

@ -245,6 +245,14 @@ impl Message {
}
pub fn new(instructions: &[Instruction], payer: Option<&Pubkey>) -> Self {
Self::new_with_blockhash(instructions, payer, &Hash::default())
}
pub fn new_with_blockhash(
instructions: &[Instruction],
payer: Option<&Pubkey>,
blockhash: &Hash,
) -> Self {
let InstructionKeys {
mut signed_keys,
unsigned_keys,
@ -259,7 +267,7 @@ impl Message {
num_readonly_signed_accounts,
num_readonly_unsigned_accounts,
signed_keys,
Hash::default(),
*blockhash,
instructions,
)
}

View File

@ -87,7 +87,7 @@ pub trait SyncClient {
/// Get recent blockhash. Uses explicit commitment configuration.
#[deprecated(
since = "1.9.0",
note = "Please use `get_latest_blockhash_with_commitment` and `get_fee_for_message` instead"
note = "Please use `get_latest_blockhash_with_commitment` and `get_latest_blockhash_with_commitment` instead"
)]
fn get_recent_blockhash_with_commitment(
&self,
@ -151,7 +151,7 @@ pub trait SyncClient {
#[deprecated(
since = "1.9.0",
note = "Please use `get_new_latest_blockhash` instead"
note = "Please do not use, will no longer be available in the future"
)]
fn get_new_blockhash(&self, blockhash: &Hash) -> Result<(Hash, FeeCalculator)>;
@ -169,9 +169,6 @@ pub trait SyncClient {
/// Calculate the fee for a `Message`
fn get_fee_for_message(&self, message: &Message) -> Result<u64>;
/// Get a new blockhash after the one specified
fn get_new_latest_blockhash(&self, blockhash: &Hash) -> Result<Hash>;
}
pub trait AsyncClient {