Skip to main content

Module utils

Module utils 

Source
Expand description

Utility helpers for composable (conditional) orders.

Mirrors utils.ts from the @cowprotocol/composable TypeScript SDK: address checks, EIP-712 hash-to-string reversal, ABI validation, and conversion from raw on-chain structs to typed orders.

Functionsยง

balance_to_string
Reverse-map a keccak256-hashed token-balance string back to its name.
create_set_domain_verifier_tx
Encode a setDomainVerifier(bytes32 domain, address verifier) call.
default_token_formatter
Default token formatter: produces "{amount}@{address}".
from_struct_to_order
Decode a raw on-chain GpV2OrderStruct into a typed UnsignedOrder.
get_block_info
Get block information (number and timestamp) for constructing conditional orders.
get_domain_verifier
Alias for get_domain_verifier_calldata.
get_domain_verifier_calldata
Get the domain verifier address for a Safe from the ExtensibleFallbackHandler.
get_is_valid_result
Check whether an IsValidResult represents a valid state.
is_composable_cow
Returns true if address is the canonical ComposableCow factory address.
is_extensible_fallback_handler
Returns true if address is the canonical ExtensibleFallbackHandler contract.
is_valid_abi
Returns true if hex is a plausibly valid ABI-encoded ConditionalOrderParams.
kind_to_string
Reverse-map a keccak256-hashed order-kind string back to its name.
transform_data_to_struct
Transform raw contract data bytes into a ConditionalOrderParams struct.
transform_struct_to_data
Transform a ConditionalOrderParams struct back into ABI-encoded hex.