diff --git a/client/src/traits/account.rs b/client/src/traits/account.rs index 9fdf72a..6b7d766 100644 --- a/client/src/traits/account.rs +++ b/client/src/traits/account.rs @@ -54,7 +54,7 @@ pub trait AccountRPC: RpcApi { verbose: Option, indexed_amounts: Option, is_mine_only: Option, - ) -> Result>>; + ) -> Result>; async fn list_burn_history(&self, options: BurnHistoryOptions) -> Result>; async fn list_community_balances(&self) -> Result; async fn list_pending_dusd_swaps(&self) -> Result>; @@ -163,7 +163,7 @@ impl AccountRPC for Client { verbose: Option, indexed_amounts: Option, is_mine_only: Option, - ) -> Result>> { + ) -> Result> { self.call( "listaccounts", &[ diff --git a/json/src/account.rs b/json/src/account.rs index d8d4af9..b1b6ec9 100644 --- a/json/src/account.rs +++ b/json/src/account.rs @@ -54,25 +54,40 @@ pub struct GetAccountPagination { limit: Option, } -#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] -pub struct AccountsResult { +#[derive(Debug, Serialize, Deserialize, PartialEq)] +pub struct AccountsResult { key: String, - owner: T, - amount: U, + owner: AccountsResultOwner, + amount: AccountsResultAmount, } -#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] -#[serde(rename_all = "camelCase")] -pub struct AccountsResultOwner { - asm: String, - hex: String, - req_sigs: Option, - r#type: String, - addresses: Option>, +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] +#[serde(untagged)] +pub enum AccountsResultOwner { + #[serde(rename_all = "camelCase")] + Detailed { + asm: String, + hex: String, + req_sigs: Option, + r#type: String, + addresses: Option>, + }, + Simple(String), } -#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] -pub struct AccountAmount(pub Vec); +#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[serde(untagged)] +pub enum AccountsResultAmount { + Map(HashMap), + String(String), +} + +#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[serde(untagged)] +pub enum AccountAmount { + List(Vec), + Map(HashMap), +} #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -104,6 +119,9 @@ pub struct AccountHistory { block_hash: Option, block_time: Option, r#type: String, + reward_type: Option, + #[serde(rename = "poolID")] + pool_id: Option, txn: Option, txid: Option, pub amounts: Vec,