Skip to content

Commit

Permalink
Add is_account_empty as experimental method
Browse files Browse the repository at this point in the history
  • Loading branch information
s1na authored and axic committed May 28, 2019
1 parent da8faef commit 0f92c10
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/experimental.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Experimental methods.

use super::*;

mod native {
extern "C" {
pub fn experimental_isAccountEmpty(addressOffset: *const u32) -> u32;
}
}

pub fn is_account_empty(address: &Address) -> bool {
let ret = unsafe { native::experimental_isAccountEmpty(address.bytes.as_ptr() as *const u32) };
if ret != 0 && ret != 1 {
panic!();
}

ret == 1
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub mod debug;

#[cfg(feature = "experimental")]
pub mod bignum;
pub mod experimental;

#[cfg(not(feature = "std"))]
pub mod convert;
Expand Down

0 comments on commit 0f92c10

Please sign in to comment.