Exporting intermediate structs, but RewardEstimationResponse fails to calculate import path

This commit is contained in:
Jędrzej Stuczyński
2022-04-13 10:55:51 +01:00
parent 8bf3efcef7
commit bf9ae009ee
9 changed files with 41 additions and 26 deletions
@@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::fmt::Display;
#[cfg_attr(test, derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(
test,
all(feature = "ts-rs", test),
ts(export, export_to = "../../../nym-wallet/src/types/rust/gateway.ts")
)]
#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize, JsonSchema)]
@@ -14,9 +14,9 @@ use serde_repr::{Deserialize_repr, Serialize_repr};
use std::cmp::Ordering;
use std::fmt::Display;
#[cfg_attr(test, derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(
test,
all(feature = "ts-rs", test),
ts(
export,
export_to = "../../../nym-wallet/src/types/rust/rewardedsetnodestatus.ts"
@@ -109,9 +109,9 @@ impl PendingUndelegate {
}
}
#[cfg_attr(test, derive(ts_rs::TS))]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(
test,
all(feature = "ts-rs", test),
ts(export, export_to = "../../../nym-wallet/src/types/rust/mixnode.ts")
)]
#[derive(Clone, Debug, Deserialize, PartialEq, PartialOrd, Serialize, JsonSchema)]
@@ -97,6 +97,13 @@ impl NodeEpochRewards {
#[derive(Debug, Clone, JsonSchema, PartialEq, Serialize, Deserialize, Copy)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(
all(feature = "ts-rs", test),
ts(
export,
export_to = "../../../nym-wallet/src/types/rust/epochrewardparams.ts"
)
)]
pub struct EpochRewardParams {
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
epoch_reward_pool: Uint128,
@@ -166,6 +173,13 @@ impl EpochRewardParams {
#[derive(Debug, Clone, JsonSchema, PartialEq, Serialize, Deserialize, Copy)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(
all(feature = "ts-rs", test),
ts(
export,
export_to = "../../../nym-wallet/src/types/rust/noderewardparams.ts"
)
)]
pub struct NodeRewardParams {
reward_blockstamp: u64,
#[cfg_attr(feature = "ts-rs", ts(type = "string"))]
@@ -197,6 +211,13 @@ impl NodeRewardParams {
#[derive(Debug, Clone, JsonSchema, PartialEq, Serialize, Deserialize, Copy)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(
all(feature = "ts-rs", test),
ts(
export,
export_to = "../../../nym-wallet/src/types/rust/rewardparams.ts"
)
)]
pub struct RewardParams {
pub epoch: EpochRewardParams,
pub node: NodeRewardParams,
@@ -0,0 +1,2 @@
export interface EpochRewardParams { epoch_reward_pool: string, rewarded_set_size: string, active_set_size: string, circulating_supply: string, sybil_resistance_percent: number, active_set_work_factor: number, }
+2 -9
View File
@@ -1,9 +1,2 @@
export interface Gateway {
host: string;
mix_port: number;
clients_port: number;
location: string;
sphinx_key: string;
identity_key: string;
version: string;
}
export interface Gateway { host: string, mix_port: number, clients_port: number, location: string, sphinx_key: string, identity_key: string, version: string, }
+2 -10
View File
@@ -1,10 +1,2 @@
export interface MixNode {
host: string;
mix_port: number;
verloc_port: number;
http_api_port: number;
sphinx_key: string;
identity_key: string;
version: string;
profit_margin_percent: number;
}
export interface MixNode { host: string, mix_port: number, verloc_port: number, http_api_port: number, sphinx_key: string, identity_key: string, version: string, profit_margin_percent: number, }
@@ -0,0 +1,2 @@
export interface NodeRewardParams { reward_blockstamp: bigint, uptime: string, in_active_set: boolean, }
@@ -1 +1,2 @@
export type RewardedSetNodeStatus = 'Active' | 'Standby';
export type RewardedSetNodeStatus = "Active" | "Standby";
@@ -0,0 +1,4 @@
import type { EpochRewardParams } from "./epochrewardparams";
import type { NodeRewardParams } from "./noderewardparams";
export interface RewardParams { epoch: EpochRewardParams, node: NodeRewardParams, }