Skip to content

Commit

Permalink
bigint values in TransactionRecord (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
aspect authored Jun 14, 2024
1 parent a01f400 commit 95c1749
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion wallet/core/src/storage/transaction/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,12 @@ pub struct TransactionRecord {
#[serde(rename = "unixtimeMsec")]
#[wasm_bindgen(js_name = unixtimeMsec)]
pub unixtime_msec: Option<u64>,
#[wasm_bindgen(skip)]
pub value: u64,
#[wasm_bindgen(skip)]
pub binding: Binding,
#[serde(rename = "blockDaaScore")]
#[wasm_bindgen(js_name = blockDaaScore)]
#[wasm_bindgen(skip)]
pub block_daa_score: u64,
#[serde(rename = "network")]
#[wasm_bindgen(js_name = network)]
Expand Down Expand Up @@ -786,6 +787,16 @@ impl TransactionRecord {

#[wasm_bindgen]
impl TransactionRecord {
#[wasm_bindgen(getter)]
pub fn value_as_js_bigint(&self) -> BigInt {
self.value.into()
}

#[wasm_bindgen(getter, js_name = "blockDaaScore")]
pub fn block_daa_score_as_js_bigint(&self) -> BigInt {
self.block_daa_score.into()
}

#[wasm_bindgen(getter, js_name = "binding")]
pub fn binding_as_js_value(&self) -> BindingT {
serde_wasm_bindgen::to_value(&self.binding).unwrap().unchecked_into()
Expand Down

0 comments on commit 95c1749

Please sign in to comment.