OZTransactionOperations

public final class OZTransactionOperations : OZManagerHelpers, @unchecked Sendable

Transaction-pipeline operations for OpenZeppelin Smart Accounts.

Builds, signs, and submits transactions for a connected smart account wallet. Drives the full simulate / sign / re-simulate / submit pipeline, including WebAuthn auth-entry signing, relayer-vs-RPC submission selection, and transaction-result polling.

When a relayer is configured, submission mode is auto-selected: Mode 1 (host function + auth entries, envelope unsigned) when all auth entries use Address credentials; Mode 2 (signed envelope XDR forwarded to the relayer) when any auth entry carries sourceAccount credentials. The forceMethod parameter overrides auto-detection per call.

The transaction is re-simulated after the signing pass so that resource fees reflect the real WebAuthn signature payload size.

Instances are constructed by OZSmartAccountKit and accessed through kit.transactionOperations.

Initialization

Static helpers

  • Converts a positive decimal amount string to its base-units representation scaled by decimals decimal places.

    Rejects scientific notation, empty or non-numeric strings, values less than or equal to zero, and values carrying more fractional digits than decimals allows. Accepted shape: ^[0-9]+(\.[0-9]+)?$ with at most decimals fractional digits and a result greater than zero.

    Throws

    InvalidAmount when the input is invalid or out of the i128 representable range.

    Declaration

    Swift

    public static func amountToBaseUnits(_ amount: String, decimals: Int) throws -> String

    Parameters

    amount

    Positive decimal string (for example "10" or "100.5").

    decimals

    The token’s decimal scale. Must be in 0...maxTokenDecimals. A value of 0 accepts only integer amounts and rejects any fractional digit.

    Return Value

    The base-units amount as a non-negative decimal integer string with no leading zeros (except the single digit "0").