Skip to main content

Module host

Module host 

Source
Expand description

Host bindings and utilities exposed to WASM smart contracts.

This module exposes the low-level host ABI plus typed primitives (Result, Error, helpers). Most users should prefer the safe, high-level APIs in crate::fields and crate::objects, which wrap these bindings.

§Float Operations for Fungible Tokens (IOUs)

The host provides float arithmetic functions for XRPL’s fungible token amounts. These operations use rippled’s Number class via FFI to ensure exact consensus compatibility:

  • float_from_int / float_from_uint / float_from_mant_exp - Convert values to float format
  • float_from_stamount / float_from_stnumber - Convert XRP ledger types to float format
  • float_to_int / float_to_mant_exp - Convert float to integer or decomposed form
  • float_add / float_sub / float_mult / float_div - Arithmetic
  • float_pow - Mathematical functions
  • float_cmp - Comparison operations

All operations support explicit rounding modes; see RoundingMode.

See the host_bindings documentation for detailed function signatures.

Modules§

chain
error_codes
host_bindings_trait
trace

Structs§

MockGuard

Enums§

Error
Possible errors returned by XRPL Programmability APIs.
Result
Result is a type that represents either a success (Ok) or failure (Err) result from the host.
RoundingMode
Rounding mode for float operations, matching rippled’s Number::RoundingMode.

Functions§

accountroot_id
amendment_enabled
amm_id
apply_default_expectations
Applies the same default .returning(...) wiring as create_default_mock onto an existing mock instead of constructing a new one.
base_fee
cache_le
check_id
check_sig
clear_mock_host_bindings
create_default_mock
credential_id
delegate_id
deposit_preauth_id
did_id
escrow_id
float_add
float_cmp
float_div
float_from_int
float_from_mant_exp
float_from_stamount
float_from_stnumber
float_from_uint
float_mult
float_pow
float_sub
float_to_int
float_to_mant_exp
home_le_arr_len
home_le_field
home_le_inner
home_le_inner_arr_len
ldgr_index
le_arr_len
le_field
le_inner
le_inner_arr_len
mpt_issuance_id
mptoken_id
nft_flags
nft_issuer
nft_offer_id
nft_serial
nft_taxon
nft_uri
nft_xfer_fee
offer_id
oracle_id
parent_ldgr_hash
parent_ldgr_time
paychan_id
permissioned_domain_id
set_data
set_mock_host_bindings
setup_mock
sha512_half
signers_id
ticket_id
trace
trustline_id
tx_arr_len
tx_field
tx_inner
tx_inner_arr_len
vault_id