Update to latest set of selection chance buckets (#1626)
* Update to latest set of selection chance buckets * Fixup after rebase * Lock file update * storybook update * update storybook Co-authored-by: Gala <calero.vg@gmail.com>
This commit is contained in:
@@ -32,17 +32,10 @@ const row: EconomicsInfoRowWithIndex = {
|
||||
},
|
||||
};
|
||||
|
||||
const rowVeryHighProbabilitySelection: EconomicsInfoRowWithIndex = {
|
||||
const rowGoodProbabilitySelection: EconomicsInfoRowWithIndex = {
|
||||
...row,
|
||||
selectionChance: {
|
||||
value: 'Very High',
|
||||
},
|
||||
};
|
||||
|
||||
const rowModerateProbabilitySelection: EconomicsInfoRowWithIndex = {
|
||||
...row,
|
||||
selectionChance: {
|
||||
value: 'Moderate',
|
||||
value: 'Good',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -53,13 +46,6 @@ const rowLowProbabilitySelection: EconomicsInfoRowWithIndex = {
|
||||
},
|
||||
};
|
||||
|
||||
const rowVeryLowProbabilitySelection: EconomicsInfoRowWithIndex = {
|
||||
...row,
|
||||
selectionChance: {
|
||||
value: 'Very Low',
|
||||
},
|
||||
};
|
||||
|
||||
const emptyRow: EconomicsInfoRowWithIndex = {
|
||||
id: 1,
|
||||
selectionChance: {
|
||||
@@ -93,13 +79,6 @@ Empty.args = {
|
||||
tableName: 'storybook',
|
||||
};
|
||||
|
||||
export const selectionChanceVeryHigh = Template.bind({});
|
||||
selectionChanceVeryHigh.args = {
|
||||
rows: [rowVeryHighProbabilitySelection],
|
||||
columnsData: EconomicsInfoColumns,
|
||||
tableName: 'storybook',
|
||||
};
|
||||
|
||||
export const selectionChanceHigh = Template.bind({});
|
||||
selectionChanceHigh.args = {
|
||||
rows: [row],
|
||||
@@ -107,9 +86,9 @@ selectionChanceHigh.args = {
|
||||
tableName: 'storybook',
|
||||
};
|
||||
|
||||
export const selectionChanceModerate = Template.bind({});
|
||||
selectionChanceModerate.args = {
|
||||
rows: [rowModerateProbabilitySelection],
|
||||
export const selectionChanceGood = Template.bind({});
|
||||
selectionChanceGood.args = {
|
||||
rows: [rowGoodProbabilitySelection],
|
||||
columnsData: EconomicsInfoColumns,
|
||||
tableName: 'storybook',
|
||||
};
|
||||
@@ -120,10 +99,3 @@ selectionChanceLow.args = {
|
||||
columnsData: EconomicsInfoColumns,
|
||||
tableName: 'storybook',
|
||||
};
|
||||
|
||||
export const selectionChanceVeryLow = Template.bind({});
|
||||
selectionChanceVeryLow.args = {
|
||||
rows: [rowVeryLowProbabilitySelection],
|
||||
columnsData: EconomicsInfoColumns,
|
||||
tableName: 'storybook',
|
||||
};
|
||||
|
||||
@@ -7,13 +7,9 @@ const selectionChance = (economicDynamicsStats: ApiState<MixNodeEconomicDynamics
|
||||
const inclusionProbability = economicDynamicsStats?.data?.active_set_inclusion_probability;
|
||||
switch (inclusionProbability) {
|
||||
case 'High':
|
||||
case 'Moderate':
|
||||
case 'Good':
|
||||
case 'Low':
|
||||
return inclusionProbability;
|
||||
case 'VeryHigh':
|
||||
return 'Very High';
|
||||
case 'VeryLow':
|
||||
return 'Very Low';
|
||||
default:
|
||||
return '-';
|
||||
}
|
||||
|
||||
@@ -21,12 +21,10 @@ const textColour = (value: EconomicsRowsType, field: string, theme: Theme) => {
|
||||
if (field === 'selectionChance') {
|
||||
switch (fieldValue) {
|
||||
case 'High':
|
||||
case 'Very High':
|
||||
return theme.palette.nym.networkExplorer.selectionChance.overModerate;
|
||||
case 'Moderate':
|
||||
case 'Good':
|
||||
return theme.palette.nym.networkExplorer.selectionChance.moderate;
|
||||
case 'Low':
|
||||
case 'Very Low':
|
||||
return theme.palette.nym.networkExplorer.selectionChance.underModerate;
|
||||
default:
|
||||
return theme.palette.nym.wallet.fee;
|
||||
|
||||
@@ -215,8 +215,8 @@ export type UptimeStoryResponse = {
|
||||
|
||||
export type MixNodeEconomicDynamicsStatsResponse = {
|
||||
stake_saturation: number;
|
||||
active_set_inclusion_probability: 'VeryHigh' | 'High' | 'Moderate' | 'Low' | 'VeryLow';
|
||||
reserve_set_inclusion_probability: 'VeryHigh' | 'High' | 'Moderate' | 'Low' | 'VeryLow';
|
||||
active_set_inclusion_probability: 'High' | 'Good' | 'Low';
|
||||
reserve_set_inclusion_probability: 'High' | 'Good' | 'Low';
|
||||
estimated_total_node_reward: number;
|
||||
estimated_operator_reward: number;
|
||||
estimated_delegators_reward: number;
|
||||
|
||||
Generated
+5
-31
@@ -207,12 +207,6 @@ version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "az"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973"
|
||||
|
||||
[[package]]
|
||||
name = "base16ct"
|
||||
version = "0.1.1"
|
||||
@@ -744,6 +738,7 @@ name = "contracts-common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cosmwasm-std",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1589,19 +1584,6 @@ dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixed"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0371cd413fb63f8ec1b9eb4dff47fa2c88b21abc681771234c84808b9920991"
|
||||
dependencies = [
|
||||
"az",
|
||||
"bytemuck",
|
||||
"half",
|
||||
"serde",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fixed-hash"
|
||||
version = "0.7.0"
|
||||
@@ -2250,15 +2232,6 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "half"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad6a9459c9c30b177b925162351f97e7d967c7ea8bab3b8352805327daf45554"
|
||||
dependencies = [
|
||||
"crunchy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "handlebars"
|
||||
version = "3.5.5"
|
||||
@@ -3129,13 +3102,13 @@ dependencies = [
|
||||
name = "mixnet-contract-common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"az",
|
||||
"bs58",
|
||||
"contracts-common",
|
||||
"cosmwasm-std",
|
||||
"fixed",
|
||||
"log",
|
||||
"schemars",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_repr",
|
||||
"thiserror",
|
||||
"time 0.3.14",
|
||||
@@ -6311,6 +6284,7 @@ dependencies = [
|
||||
"bs58",
|
||||
"coconut-interface",
|
||||
"cosmrs",
|
||||
"cosmwasm-std",
|
||||
"getset",
|
||||
"mixnet-contract-common",
|
||||
"schemars",
|
||||
@@ -6408,7 +6382,7 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "vesting-contract"
|
||||
version = "1.0.2"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"cosmwasm-std",
|
||||
"cw-storage-plus",
|
||||
|
||||
@@ -31,19 +31,15 @@ const DataField = ({ title, info, Indicator }: { title: string; info: string; In
|
||||
);
|
||||
|
||||
const colorMap: { [key in SelectionChance]: string } = {
|
||||
VeryLow: 'error.main',
|
||||
Low: 'error.main',
|
||||
Moderate: 'warning.main',
|
||||
High: 'success.main',
|
||||
VeryHigh: 'success.main',
|
||||
Low: 'error.main',
|
||||
Good: 'warning.main',
|
||||
High: 'success.main',
|
||||
};
|
||||
|
||||
const textMap: { [key in SelectionChance]: string } = {
|
||||
VeryLow: 'VeryLow',
|
||||
Low: 'Low',
|
||||
Moderate: 'Moderate',
|
||||
High: 'High',
|
||||
VeryHigh: 'Very high',
|
||||
Low: 'Low',
|
||||
Good: 'Good',
|
||||
High: 'High',
|
||||
};
|
||||
|
||||
const InclusionProbability = ({ probability }: { probability: SelectionChance }) => (
|
||||
|
||||
@@ -1 +1 @@
|
||||
export type SelectionChance = 'VeryHigh' | 'High' | 'Moderate' | 'Low' | 'VeryLow';
|
||||
export type SelectionChance = 'High' | 'Good' | 'Low';
|
||||
|
||||
@@ -141,21 +141,17 @@ pub type StakeSaturation = Decimal;
|
||||
ts(export_to = "ts-packages/types/src/types/rust/SelectionChance.ts")
|
||||
)]
|
||||
pub enum SelectionChance {
|
||||
VeryHigh,
|
||||
High,
|
||||
Moderate,
|
||||
Good,
|
||||
Low,
|
||||
VeryLow,
|
||||
}
|
||||
|
||||
impl From<f64> for SelectionChance {
|
||||
fn from(p: f64) -> SelectionChance {
|
||||
match p {
|
||||
p if p > 0.98 => SelectionChance::VeryHigh,
|
||||
p if p > 0.9 => SelectionChance::High,
|
||||
p if p > 0.7 => SelectionChance::Moderate,
|
||||
p if p > 0.5 => SelectionChance::Low,
|
||||
_ => SelectionChance::VeryLow,
|
||||
p if p >= 0.7 => SelectionChance::High,
|
||||
p if p >= 0.3 => SelectionChance::Good,
|
||||
_ => SelectionChance::Low,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,8 +159,8 @@ impl From<f64> for SelectionChance {
|
||||
impl From<Decimal> for SelectionChance {
|
||||
fn from(p: Decimal) -> Self {
|
||||
match p {
|
||||
p if p >= Decimal::from_ratio(15u32, 100u32) => SelectionChance::VeryHigh,
|
||||
p if p > Decimal::from_ratio(5u32, 100u32) => SelectionChance::Moderate,
|
||||
p if p >= Decimal::from_ratio(70u32, 100u32) => SelectionChance::High,
|
||||
p if p >= Decimal::from_ratio(30u32, 100u32) => SelectionChance::Good,
|
||||
_ => SelectionChance::Low,
|
||||
}
|
||||
}
|
||||
@@ -173,11 +169,9 @@ impl From<Decimal> for SelectionChance {
|
||||
impl fmt::Display for SelectionChance {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
SelectionChance::VeryHigh => write!(f, "VeryHigh"),
|
||||
SelectionChance::High => write!(f, "High"),
|
||||
SelectionChance::Moderate => write!(f, "Moderate"),
|
||||
SelectionChance::Good => write!(f, "Good"),
|
||||
SelectionChance::Low => write!(f, "Low"),
|
||||
SelectionChance::VeryLow => write!(f, "VeryLow"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user