Skip to main content

deposit_preauth_id

Function deposit_preauth_id 

Source
pub fn deposit_preauth_id(
    account: &AccountID,
    authorize: &AccountID,
) -> Result<LedgerEntryIdBytes>
Expand description

Generates a deposit preauth ledger entry ID for a given account and authorized account.

A deposit preauth ledger entry ID is used to reference deposit preauth entries in the XRP Ledger.

§Arguments

  • account - The AccountID of the account that is doing the pre-authorizing
  • authorize - The AccountID of the account that is pre-authorizing

§Returns

  • Result<LedgerEntryIdBytes> - On success, returns a 32-byte deposit preauth ledger entry ID. On failure, returns an Error with the corresponding error code.

§Safety

This function makes unsafe FFI calls to the host environment through the host::deposit_preauth_id function.

§Example

use xrpl_common_stdlib::types::account_id::AccountID;
use xrpl_common_stdlib::ledger_entry_ids::deposit_preauth_id;
use xrpl_common_stdlib::host::trace::{ trace_hex, 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 deposit_preauth_id(&account, &authorize) {
      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(())
}