pub fn line_keylet(
account1: &AccountID,
account2: &AccountID,
currency: &Currency,
) -> Result<KeyletBytes>Expand description
Generates a trustline keylet for a given pair of accounts and currency code.
A trustline keylet is used to reference trustline entries in the XRP Ledger.
§Arguments
account- The first AccountID in the trustline relationshipaccount2- The second AccountID in the trustline relationshipcurrency- The Currency for the trustline
§Returns
Result<KeyletBytes>- On success, returns a 32-byte trustline keylet. On failure, returns anErrorwith the corresponding error code.
§Safety
This function makes unsafe FFI calls to the host environment through
the host::line_keylet function.
§Example
use xrpl_wasm_stdlib::core::types::account_id::AccountID;
use xrpl_wasm_stdlib::core::types::currency::Currency;
use xrpl_wasm_stdlib::core::keylets::line_keylet;
use xrpl_wasm_stdlib::host::trace::{DataRepr, trace_data, trace_num};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let account1: AccountID =
AccountID::from(*b"\xd5\xb9\x84VP\x9f \xb5'\x9d\x1eJ.\xe8\xb2\xaa\x82\xaec\xe3");
let account2: AccountID =
AccountID::from(*b"\xd5\xb9\x84VP\x9f \xb5'\x9d\x1eJ.\xe8\xb2\xaa\x82\xaec\xe3");
let currency = b"RLUSD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; // RLUSD currency code
let currency: Currency = Currency::from(*currency);
match line_keylet(&account1, &account2, ¤cy) {
xrpl_wasm_stdlib::host::Result::Ok(keylet) => {
let _ = trace_data("Generated keylet", &keylet, DataRepr::AsHex);
}
xrpl_wasm_stdlib::host::Result::Err(e) => {
let _ = trace_num("Error assembling keylet", e.code() as i64);
}
}
Ok(())
}