Skip to content

Commit

Permalink
Merge pull request #9 from DeFiCh/bush/account-history
Browse files Browse the repository at this point in the history
Account history updates
  • Loading branch information
Jouzo authored Jun 18, 2024
2 parents 90b5058 + 8ccd87f commit 5ef5ffa
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
target
Cargo.lock
.vscode
.vscode
.idea

38 changes: 35 additions & 3 deletions json/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ pub struct BalanceTransferAccountOptions {
utxos: Option<Vec<UTXO>>,
}

#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct AccountHistory {
pub owner: String,
block_height: u64,
block_hash: Option<String>,
block_time: Option<u64>,
r#type: String,
txn: u64,
txid: String,
txn: Option<u64>,
txid: Option<String>,
pub amounts: Vec<String>,
}

Expand All @@ -112,17 +112,49 @@ pub struct AccountHistory {
pub struct AccountHistoryOptions {
max_block_height: Option<u64>,
depth: Option<u64>,
#[serde(rename = "no_rewards")]
no_rewards: Option<bool>,
token: Option<String>,
txtype: Option<char>,
txtypes: Option<Vec<char>>,
limit: Option<u64>,
start: Option<u64>,
#[serde(rename = "including_start")]
including_start: Option<bool>,
txn: Option<u64>,
format: Option<Format>,
}

impl AccountHistoryOptions {
pub fn new(
max_block_height: Option<u64>,
depth: Option<u64>,
no_rewards: Option<bool>,
token: Option<String>,
txtype: Option<char>,
txtypes: Option<Vec<char>>,
limit: Option<u64>,
start: Option<u64>,
including_start: Option<bool>,
txn: Option<u64>,
format: Option<crate::account::Format>,
) -> Self {
Self {
max_block_height,
depth,
no_rewards,
token,
txtype,
txtypes,
limit,
start,
including_start,
txn,
format,
}
}
}

#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AccountHistoryCountOptions {
Expand Down

0 comments on commit 5ef5ffa

Please sign in to comment.