Skip to content

Commit 7309f3a

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents a2452b5 + 9e59614 commit 7309f3a

File tree

3 files changed

+45
-6
lines changed

3 files changed

+45
-6
lines changed

client/src/client.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,27 @@ pub trait RpcApi: Sized {
493493
fn get_transaction_are_locked(
494494
&self,
495495
tx_ids: &Vec<dashcore::Txid>,
496-
) -> Result<Vec<json::GetTransactionLockedResult>> {
496+
) -> Result<Vec<Option<json::GetTransactionLockedResult>>> {
497497
let transaction_ids_json = tx_ids
498498
.into_iter()
499499
.map(|tx_id| Ok(into_json(tx_id)?))
500500
.collect::<Result<Vec<Value>>>()?;
501501
let args = [transaction_ids_json.into()];
502-
self.call("gettransactionsarelocked", &args)
502+
self.call("gettxchainlocks", &args)
503+
}
504+
505+
/// Returns only Chainlocked or Unknown status if height is provided
506+
fn get_asset_unlock_statuses(
507+
&self,
508+
indices: &[u64],
509+
height: Option<u32>,
510+
) -> Result<Vec<json::AssetUnlockStatusResult>> {
511+
let indices_json = indices
512+
.into_iter()
513+
.map(|index| Ok(into_json(index.to_string())?))
514+
.collect::<Result<Vec<Value>>>()?;
515+
let args = [indices_json.into(), opt_into_json(height)?];
516+
self.call("getassetunlockstatuses", &args)
503517
}
504518

505519
fn list_transactions(

integration_test/src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ fn test_evo_node_endpoints(evo_client: &Client, wallet_client: &Client) {
406406
// test_get_verifychainlock(evo_client);
407407
// TODO: fix - needs real hash
408408
// test_get_verifyislock(evo_client);
409+
410+
test_get_asset_unlock_statuses(&evo_client);
409411
}
410412

411413

@@ -1636,6 +1638,15 @@ fn test_get_verifychainlock(cl: &Client) {
16361638
let _verifychainlock = cl.get_verifychainlock("00000036d5c520be6e9a32d3829efc983a7b5e88052bf138f80a2b3988689a24", "97ec34efd1615b84af62495e54024880752f57790cf450ae974b80002440963592d96826e24f109e6c149411b70bb9a0035443752368590adae60365cf4251464e0423c1263e9c56a33eae9be9e9c79a117151b2173bcee93497008cace8d793", None).unwrap();
16371639
}
16381640

1641+
fn test_get_asset_unlock_statuses(cl: &Client) {
1642+
let indices = vec![0u64, 1, 2];
1643+
let height = Some(100);
1644+
let _statuses = cl.get_asset_unlock_statuses(
1645+
&indices,
1646+
height,
1647+
);
1648+
}
1649+
16391650
fn test_get_verifyislock(cl: &Client) {
16401651
let _verifychainlock = cl.get_verifyislock("d0b1a9c70fdfff6bf7f6cbe3d1fe33a4ca44ceb17059b6381a4ac25d9c9b6495", "8b5174d0e95b5642ebec23c3fe8f0bbf8f6993502f4210322871bba0e818ff3b", "97ec34efd1615b84af62495e54024880752f57790cf450ae974b80002440963592d96826e24f109e6c149411b70bb9a0035443752368590adae60365cf4251464e0423c1263e9c56a33eae9be9e9c79a117151b2173bcee93497008cace8d793", None).unwrap();
16411652
}

json/src/lib.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,24 @@ pub struct WalletTxInfo {
701701

702702
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]
703703
pub struct GetTransactionLockedResult {
704-
#[serde(default, deserialize_with = "deserialize_u32_opt")]
705-
pub height: Option<u32>,
706-
#[serde(rename = "chainlock")]
707-
pub chain_lock: bool,
704+
pub height: i32,
705+
pub chainlock: bool,
706+
pub mempool: bool,
707+
}
708+
709+
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]
710+
#[serde(rename_all = "lowercase")]
711+
pub enum AssetUnlockStatus {
712+
Chainlocked,
713+
Mined,
714+
Mempooled,
715+
Unknown,
716+
}
717+
718+
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]
719+
pub struct AssetUnlockStatusResult {
720+
pub index: u64,
721+
pub status: AssetUnlockStatus,
708722
}
709723

710724
#[derive(Clone, PartialEq, Eq, Debug, Deserialize)]

0 commit comments

Comments
 (0)