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