Check account API

This commit is contained in:
Hanh 2023-03-08 13:46:54 +10:00
parent 2940d8f8da
commit 56b8113084
3 changed files with 13 additions and 0 deletions

View File

@ -273,6 +273,8 @@ void truncate_data(void);
void truncate_sync_data(void);
bool check_account(uint8_t coin, uint32_t account);
void delete_account(uint8_t coin, uint32_t account);
struct CResult_____c_char make_payment_uri(uint8_t coin,

View File

@ -25,6 +25,12 @@ use zcash_client_backend::keys::UnifiedFullViewingKey;
use zcash_primitives::consensus::Parameters;
use zcash_primitives::zip32::DiversifierIndex;
pub fn check_account(coin: u8, account: u32) -> bool {
let c = CoinConfig::get(coin);
let db = c.db().unwrap();
db.get_account_info(account).is_ok()
}
/// Create a new account
/// # Arguments
///

View File

@ -683,6 +683,11 @@ pub unsafe extern "C" fn truncate_sync_data() {
log_error(res)
}
#[no_mangle]
pub unsafe extern "C" fn check_account(coin: u8, account: u32) -> bool {
crate::api::account::check_account(coin, account)
}
#[no_mangle]
pub unsafe extern "C" fn delete_account(coin: u8, account: u32) {
let res = crate::api::account::delete_account(coin, account);