|
1 | 1 | #![no_std] |
2 | 2 | #![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}; |
4 | 3 | use xrpl_std::locator::LocatorPacker; |
5 | 4 | 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 | +}; |
6 | 9 |
|
7 | 10 | #[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 |
31 | 19 | } |
32 | 20 | { |
33 | 21 | // let finish_after = match get_current_escrow_finish_after() { |
@@ -65,32 +53,32 @@ pub extern "C" fn finish() -> i32 { |
65 | 53 | // let s = "342F9E0D242EDB43A0FBFC672B302CC8BB904993172E57FBFF4C5D4A1EB85AB9"; |
66 | 54 | // let keylet = hex::decode(s).unwrap(); |
67 | 55 | // println!("wasm finish keylet {:?}", keylet); |
68 | | - // |
| 56 | + // |
69 | 57 | // let slot = unsafe { host_lib::ledger_slot_set(keylet.as_ptr(), keylet.len(), 0) }; |
70 | | - // |
| 58 | + // |
71 | 59 | // println!("wasm finish slot {:?}", slot); |
72 | | - // |
| 60 | + // |
73 | 61 | // let mut locator = LocatorPacker::new(); |
74 | 62 | // locator.pack(SignerEntries); |
75 | 63 | // let array_len = unsafe { |
76 | 64 | // host_lib::get_ledger_obj_nested_array_len(slot, locator.get_addr(), locator.num_packed_bytes()) |
77 | 65 | // }; |
78 | 66 | // println!("wasm finish array_len {:?}", array_len); |
79 | | - // |
| 67 | + // |
80 | 68 | // locator.pack(0); |
81 | 69 | // locator.pack(SignerEntry); |
82 | 70 | // locator.pack(SignerWeight); |
83 | | - // |
| 71 | + // |
84 | 72 | // let mut weight = 0i32; |
85 | 73 | // let nfr = unsafe { |
86 | 74 | // host_lib::get_ledger_obj_nested_field( |
87 | 75 | // slot, locator.get_addr(), locator.num_packed_bytes(), |
88 | 76 | // (&mut weight) as *mut i32 as *mut u8, 4 |
89 | 77 | // ) |
90 | 78 | // }; |
91 | | - // |
| 79 | + // |
92 | 80 | // println!("wasm finish get_ledger_obj_nested_field {:?} {}", nfr, weight); |
93 | 81 | } |
94 | | - |
| 82 | + |
95 | 83 | 1 |
96 | 84 | } |
0 commit comments