Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Commit 4d6a67d

Browse files
authored
rename function from ready to finish (#17)
1 parent 6391f78 commit 4d6a67d

File tree

3 files changed

+25
-37
lines changed

3 files changed

+25
-37
lines changed

projects/ledger_sqn/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[no_mangle]
2-
pub fn ready() -> bool {
2+
pub fn finish() -> bool {
33
unsafe { host_lib::getLedgerSqn() >= 5 }
44
}
55

projects/notary/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ use xrpl_std::get_tx_account_id;
55
const NOTARY_ACCOUNT: &str = "rPPLRQwB3KGvpfDMABZucA8ifJJcvQhHD3"; // Account 2 (example)
66

77
#[no_mangle]
8-
pub fn ready() -> bool {
8+
pub fn finish() -> bool {
99
unsafe {
1010
let tx_account = get_tx_account_id();
11-
11+
1212
// Convert account bytes to string for comparison
1313
let tx_account_str = match str::from_utf8(&tx_account) {
1414
Ok(s) => s,
15-
Err(_) => return false
15+
Err(_) => return false,
1616
};
17-
17+
1818
tx_account_str == NOTARY_ACCOUNT
1919
}
20-
}
20+
}
Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
#![no_std]
22
#![allow(unused_imports)]
3-
use xrpl_std::{get_account_balance, get_current_escrow_account_id, get_current_escrow_destination, get_current_escrow_finish_after, get_tx_account_id, host_lib};
43
use xrpl_std::locator::LocatorPacker;
54
use xrpl_std::sfield::{SignerEntries, SignerEntry, SignerWeight};
5+
use xrpl_std::{
6+
get_account_balance, get_current_escrow_account_id, get_current_escrow_destination,
7+
get_current_escrow_finish_after, get_tx_account_id, host_lib,
8+
};
69

710
#[no_mangle]
8-
pub extern "C" fn finish() -> i32 {
9-
{
10-
// let account_id_tx = match get_tx_account_id() {
11-
// Some(v) => v,
12-
// None => return -1,
13-
// };
14-
// println!("wasm finish {:?}", account_id_tx);
15-
//
16-
// let account_id_clo = match get_current_escrow_account_id() {
17-
// Some(v) => v,
18-
// None => return -2,
19-
// };
20-
//
21-
// let destination = match get_current_escrow_destination() {
22-
// Some(v) => v,
23-
// None => return -3,
24-
// };
25-
// if account_id_clo != account_id_tx {
26-
// return -6;
27-
// }
28-
// if destination == account_id_tx {
29-
// return -7;
30-
// }
11+
pub extern "C" fn finish() -> bool {
12+
unsafe {
13+
let sender = get_tx_account_id();
14+
let account_keylet = account_keylet(&sender);
15+
16+
print_data(&account_keylet);
17+
18+
true
3119
}
3220
{
3321
// let finish_after = match get_current_escrow_finish_after() {
@@ -65,32 +53,32 @@ pub extern "C" fn finish() -> i32 {
6553
// let s = "342F9E0D242EDB43A0FBFC672B302CC8BB904993172E57FBFF4C5D4A1EB85AB9";
6654
// let keylet = hex::decode(s).unwrap();
6755
// println!("wasm finish keylet {:?}", keylet);
68-
//
56+
//
6957
// let slot = unsafe { host_lib::ledger_slot_set(keylet.as_ptr(), keylet.len(), 0) };
70-
//
58+
//
7159
// println!("wasm finish slot {:?}", slot);
72-
//
60+
//
7361
// let mut locator = LocatorPacker::new();
7462
// locator.pack(SignerEntries);
7563
// let array_len = unsafe {
7664
// host_lib::get_ledger_obj_nested_array_len(slot, locator.get_addr(), locator.num_packed_bytes())
7765
// };
7866
// println!("wasm finish array_len {:?}", array_len);
79-
//
67+
//
8068
// locator.pack(0);
8169
// locator.pack(SignerEntry);
8270
// locator.pack(SignerWeight);
83-
//
71+
//
8472
// let mut weight = 0i32;
8573
// let nfr = unsafe {
8674
// host_lib::get_ledger_obj_nested_field(
8775
// slot, locator.get_addr(), locator.num_packed_bytes(),
8876
// (&mut weight) as *mut i32 as *mut u8, 4
8977
// )
9078
// };
91-
//
79+
//
9280
// println!("wasm finish get_ledger_obj_nested_field {:?} {}", nfr, weight);
9381
}
94-
82+
9583
1
9684
}

0 commit comments

Comments
 (0)