Skip to content

Commit 50873fa

Browse files
author
allthatjazzleo
committed
Add CosmosEvmDynamicFee option to ExtensionOption
1 parent b5fa07f commit 50873fa

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

crates/relayer/src/config.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ pub fn parse_gas_prices(prices: String) -> Vec<GasPrice> {
121121
)]
122122
pub enum ExtensionOption {
123123
EthermintDynamicFee(String),
124+
CosmosEvmDynamicFee(String),
124125
}
125126

126127
impl ExtensionOption {
@@ -129,7 +130,11 @@ impl ExtensionOption {
129130
Self::EthermintDynamicFee(max_priority_price) => ExtensionOptionDynamicFeeTx {
130131
max_priority_price: max_priority_price.into(),
131132
}
132-
.to_any(),
133+
.to_any("/ethermint.types.v1.ExtensionOptionDynamicFeeTx"),
134+
Self::CosmosEvmDynamicFee(max_priority_price) => ExtensionOptionDynamicFeeTx {
135+
max_priority_price: max_priority_price.into(),
136+
}
137+
.to_any("/cosmos.evm.types.v1.ExtensionOptionDynamicFeeTx"),
133138
}
134139
}
135140
}
@@ -143,6 +148,12 @@ impl Display for ExtensionOption {
143148
"EthermintDynamicFee(max_priority_price: {max_priority_price})"
144149
)
145150
}
151+
Self::CosmosEvmDynamicFee(max_priority_price) => {
152+
write!(
153+
f,
154+
"CosmosEvmDynamicFee(max_priority_price: {max_priority_price})"
155+
)
156+
}
146157
}
147158
}
148159
}

crates/relayer/src/extension_options.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ use serde_derive::{Deserialize, Serialize};
44

55
use crate::error::Error;
66

7-
// ExtensionOptionDynamicFeeTx is an extension option used with ethermint dynamic fee tx.
7+
// ExtensionOptionDynamicFeeTx is an extension option used with ethermint dynamic fee tx and cosmos evm dynamic fee tx.
88
// protobuf message: https://github.com/evmos/ethermint/blob/main/proto/ethermint/types/v1/dynamic_fee.proto
9+
// protobuf message: https://github.com/cosmos/evm/blob/main/proto/cosmos/evm/types/v1/dynamic_fee.proto
910
#[derive(Clone, PartialEq, Eq, Message, Serialize, Deserialize)]
1011
pub struct ExtensionOptionDynamicFeeTx {
1112
#[prost(string, tag = "1")]
1213
pub max_priority_price: String,
1314
}
1415

1516
impl ExtensionOptionDynamicFeeTx {
16-
pub fn to_any(&self) -> Result<Any, Error> {
17+
pub fn to_any(&self, type_url: &str) -> Result<Any, Error> {
1718
let mut buf = Vec::new();
1819
Message::encode(self, &mut buf)
1920
.map_err(|e| Error::protobuf_encode("ExtensionOptionDynamicFeeTx".into(), e))?;
2021
Ok(Any {
21-
type_url: "/ethermint.types.v1.ExtensionOptionDynamicFeeTx".to_string(),
22+
type_url: type_url.to_string(),
2223
value: buf,
2324
})
2425
}

0 commit comments

Comments
 (0)