pub fn mptoken_id(
mptid: &MptId,
holder: &AccountID,
) -> Result<LedgerEntryIdBytes>Expand description
Generates an MPToken ledger entry ID for a given MPT ID and holder.
An MPToken ledger entry ID 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<LedgerEntryIdBytes>- On success, returns a 32-byte MPToken ledger entry ID. On failure, returns anErrorwith the corresponding error code.
§Safety
This function makes unsafe FFI calls to the host environment through
the host::mptoken_id function.
§Example
use xrpl_common_stdlib::types::account_id::AccountID;
use xrpl_common_stdlib::types::mpt_id::MptId;
use xrpl_common_stdlib::ledger_entry_ids::mptoken_id;
use xrpl_common_stdlib::host::trace::{ trace_hex, 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_id(&mptid, &holder) {
xrpl_common_stdlib::host::Result::Ok(id) => {
trace_hex("Generated ledger entry ID", &id);
}
xrpl_common_stdlib::host::Result::Err(e) => {
trace_num("Error assembling ledger entry ID", e.code() as i64);
}
}
Ok(())
}