Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account history updates #9

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading