Skip to content

Commit 0f92c10

Browse files
s1naaxic
authored andcommitted
Add is_account_empty as experimental method
1 parent da8faef commit 0f92c10

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/experimental.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//! Experimental methods.
2+
3+
use super::*;
4+
5+
mod native {
6+
extern "C" {
7+
pub fn experimental_isAccountEmpty(addressOffset: *const u32) -> u32;
8+
}
9+
}
10+
11+
pub fn is_account_empty(address: &Address) -> bool {
12+
let ret = unsafe { native::experimental_isAccountEmpty(address.bytes.as_ptr() as *const u32) };
13+
if ret != 0 && ret != 1 {
14+
panic!();
15+
}
16+
17+
ret == 1
18+
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub mod debug;
3333

3434
#[cfg(feature = "experimental")]
3535
pub mod bignum;
36+
pub mod experimental;
3637

3738
#[cfg(not(feature = "std"))]
3839
pub mod convert;

0 commit comments

Comments
 (0)