-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add dynamic priority fees to forester (#1481)
* use elements from helius-sdk for send logic rm helius error rm unused code add get_priority_fee_estimate wip fmt, use forester_epoch_derivation pubkey 10_000 localhost prio fee response remove deadcode * add debug stack trace to forester tests * add light slot timeout, optimze configs * adjust intervals * extend test for capped-prio-fee * clean * add doc * add doc
- Loading branch information
1 parent
79321b3
commit 8b38899
Showing
16 changed files
with
834 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// adapted from https://github.com/helius-labs/helius-rust-sdk/blob/dev/src/types/types.rs | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
pub enum PriorityLevel { | ||
Min, | ||
Low, | ||
Medium, | ||
High, | ||
VeryHigh, | ||
UnsafeMax, | ||
Default, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
pub enum UiTransactionEncoding { | ||
Binary, | ||
Base64, | ||
Base58, | ||
Json, | ||
JsonParsed, | ||
} | ||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)] | ||
pub struct RpcRequest<T> { | ||
pub jsonrpc: String, | ||
pub id: String, | ||
pub method: String, | ||
#[serde(rename = "params")] | ||
pub parameters: T, | ||
} | ||
|
||
impl<T> RpcRequest<T> { | ||
pub fn new(method: String, parameters: T) -> Self { | ||
Self { | ||
jsonrpc: "2.0".to_string(), | ||
id: "1".to_string(), | ||
method, | ||
parameters, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)] | ||
pub struct RpcResponse<T> { | ||
pub jsonrpc: String, | ||
pub id: String, | ||
pub result: T, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Default)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct GetPriorityFeeEstimateOptions { | ||
pub priority_level: Option<PriorityLevel>, | ||
pub include_all_priority_fee_levels: Option<bool>, | ||
pub transaction_encoding: Option<UiTransactionEncoding>, | ||
pub lookback_slots: Option<u8>, | ||
pub recommended: Option<bool>, | ||
pub include_vote: Option<bool>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Default)] | ||
pub struct GetPriorityFeeEstimateRequest { | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub transaction: Option<String>, | ||
#[serde(rename = "accountKeys", skip_serializing_if = "Option::is_none")] | ||
pub account_keys: Option<Vec<String>>, | ||
pub options: Option<GetPriorityFeeEstimateOptions>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Debug, Default)] | ||
pub struct GetPriorityFeeEstimateResponse { | ||
#[serde(rename = "priorityFeeEstimate")] | ||
pub priority_fee_estimate: Option<f64>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.