pub fn delegate_keylet(
account: &AccountID,
authorize: &AccountID,
) -> Result<KeyletBytes>Expand description
Generates a delegate keylet for a given given account and authorized account.
A delegate keylet is used to reference delegate entries in the XRP Ledger.
§Arguments
account- The AccountID of the account that is delegating permissionsauthorize- The AccountID of the account that is delegated to
§Returns
Result<KeyletBytes>- On success, returns a 32-byte delegate keylet. On failure, returns anErrorwith the corresponding error code.
§Safety
This function makes unsafe FFI calls to the host environment through
the host::delegate_keylet function.
§Example
use xrpl_wasm_stdlib::core::types::account_id::AccountID;
use xrpl_wasm_stdlib::core::keylets::delegate_keylet;
use xrpl_wasm_stdlib::host::trace::{DataRepr, trace_data, trace_num};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let account: AccountID =
AccountID::from(*b"\xd5\xb9\x84VP\x9f \xb5'\x9d\x1eJ.\xe8\xb2\xaa\x82\xaec\xe3");
let authorize: AccountID =
AccountID::from(*b"\xd5\xb9\x84VP\x9f \xb5'\x9d\x1eJ.\xe8\xb2\xaa\x82\xaec\xe3");
match delegate_keylet(&account, &authorize) {
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(())
}