cosmos: add serde arbitrary precision for i128
This commit is contained in:
parent
b91a55b93d
commit
5c9b5533d6
|
@ -8,7 +8,7 @@ bon = "3.3.2"
|
|||
cosmrs = { version = "0.21.0", features = ["rpc", "tokio"] }
|
||||
icepick-module = { version = "0.1.0", path = "../../icepick-module" }
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
serde_json = { workspace = true, features = ["arbitrary_precision"] }
|
||||
thiserror = "2.0.9"
|
||||
tokio = { version = "1.43.0", features = ["rt"] }
|
||||
|
||||
|
|
|
@ -50,6 +50,17 @@ impl Bech32Config {
|
|||
consensus_node_public_prefix: consensus_node_public_prefix.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
fn with_similar_prefix(prefix: &'static str) -> Self {
|
||||
Self {
|
||||
account_address_prefix: format!("{prefix}"),
|
||||
account_address_public_prefix: format!("{prefix}pub"),
|
||||
validator_operator_prefix: format!("{prefix}valoper"),
|
||||
validator_operator_public_prefix: format!("{prefix}valoperpub"),
|
||||
consensus_node_prefix: format!("{prefix}valcons"),
|
||||
consensus_node_public_prefix: format!("{prefix}valconspub"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, Builder)]
|
||||
|
@ -152,7 +163,46 @@ impl Blockchain {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn default_chains() -> Vec<Blockchain> {
|
||||
fn seda_chains() -> Vec<Blockchain> {
|
||||
let mut chains = vec![];
|
||||
|
||||
let aseda = Currency::builder()
|
||||
.coin_denom("seda")
|
||||
.coin_minimal_denom("aseda")
|
||||
.coin_decimals(18)
|
||||
.coin_gecko_id("ID")
|
||||
.build();
|
||||
|
||||
let aseda_gas = GasPriceStep::builder()
|
||||
.low(5000000000.)
|
||||
.average(10000000000.)
|
||||
.high(15000000000.)
|
||||
.build();
|
||||
|
||||
chains.push(
|
||||
Blockchain::builder()
|
||||
.chain_id("seda-1-devnet")
|
||||
// NOTE: Officially, this is just "devnet", but otherwise this would conflict.
|
||||
// We'll override it in our config.
|
||||
.chain_name("seda-devnet")
|
||||
.rpc_url("https://rpc.devnet.seda.xyz")
|
||||
.rest_url("https://lcd.devnet.seda.xyz")
|
||||
.explorer_url_format("https://devnet.explorer.seda.xyz/txs/%s")
|
||||
.bip44_config(Bip44Config::builder().coin_type(118).build())
|
||||
.bech32_config(Bech32Config::with_similar_prefix("seda"))
|
||||
.currencies(&[aseda.clone()])
|
||||
.fee_currencies(&[CurrencyWithGas::builder()
|
||||
.currency(aseda.clone())
|
||||
.gas_price_step(aseda_gas.clone()).build()])
|
||||
.gas_price_step(aseda_gas)
|
||||
.stake_currency(aseda)
|
||||
.build(),
|
||||
);
|
||||
|
||||
chains
|
||||
}
|
||||
|
||||
fn kyve_chains() -> Vec<Blockchain> {
|
||||
let mut chains = vec![];
|
||||
|
||||
let tkyve = Currency::builder()
|
||||
|
@ -175,16 +225,7 @@ pub fn default_chains() -> Vec<Blockchain> {
|
|||
.rest_url("https://api.korellia.kyve.network")
|
||||
.explorer_url_format("https://explorer.kyve.network/korellia/tx/%s")
|
||||
.bip44_config(Bip44Config::builder().coin_type(118).build())
|
||||
.bech32_config(
|
||||
Bech32Config::builder()
|
||||
.account_address_prefix("kyve")
|
||||
.account_address_public_prefix("kyvepub")
|
||||
.validator_operator_prefix("kyvevaloper")
|
||||
.validator_operator_public_prefix("kyvevaloperpub")
|
||||
.consensus_node_prefix("kyvevalcons")
|
||||
.consensus_node_public_prefix("kyvevalconspub")
|
||||
.build(),
|
||||
)
|
||||
.bech32_config(Bech32Config::with_similar_prefix("kyve"))
|
||||
.currencies(&[tkyve.clone()])
|
||||
.fee_currencies(&[CurrencyWithGas::builder()
|
||||
.currency(tkyve.clone())
|
||||
|
@ -194,5 +235,15 @@ pub fn default_chains() -> Vec<Blockchain> {
|
|||
.stake_currency(tkyve.clone())
|
||||
.build(),
|
||||
);
|
||||
|
||||
chains
|
||||
}
|
||||
|
||||
pub fn default_chains() -> Vec<Blockchain> {
|
||||
let mut chains = vec![];
|
||||
|
||||
chains.extend(kyve_chains());
|
||||
chains.extend(seda_chains());
|
||||
|
||||
chains
|
||||
}
|
||||
|
|
|
@ -682,6 +682,7 @@ impl Module for Cosmos {
|
|||
}
|
||||
});
|
||||
let cosmrs::proto::cosmos::base::v1beta1::Coin { denom, amount } = coin;
|
||||
|
||||
Ok(serde_json::json!({
|
||||
"blob": {
|
||||
"balance": {
|
||||
|
|
|
@ -13,7 +13,7 @@ keyforkd-client = { version = "0.2.1", registry = "distrust" }
|
|||
keyforkd-models = { version = "0.2.0", registry = "distrust" }
|
||||
miniquorum = { version = "0.1.0", path = "../miniquorum", default-features = false }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json.workspace = true
|
||||
serde_json = { workspace = true, features = ["arbitrary_precision"] }
|
||||
serde_yaml = "0.9.34"
|
||||
thiserror = "2.0.3"
|
||||
toml = "0.8.19"
|
||||
|
|
Loading…
Reference in New Issue