Types
Order
Gnosis Protocol v2 order data structure.The ERC20 token address to sell.
The ERC20 token address to buy. Use
BUY_ETH_ADDRESS to buy native Ether.An optional address to receive the proceeds instead of the order owner. Defaults to order signer if not specified.
The order sell amount. For sell orders, this is the exact amount to sell. For buy orders, this is the maximum amount to sell. For partial fill orders, this is part of the limit price.
The order buy amount. For sell orders, this is the minimum amount to buy. For buy orders, this is the exact amount to buy. For partial fill orders, this is part of the limit price.
The Unix timestamp (in seconds) or Date object when this order expires.
32-byte application specific data. Can be a number or bytes. Used to ensure order uniqueness and store metadata.
Fee amount in sell token to give to the protocol.
The order kind:
OrderKind.SELL or OrderKind.BUY.Whether the order can be partially filled over multiple settlements.
How the sell token balance will be withdrawn. Defaults to
OrderBalance.ERC20.How the buy token balance will be paid. Defaults to
OrderBalance.ERC20.OrderKind
Enum specifying the order type.SELL: Sell order (exact sell amount, minimum buy amount)BUY: Buy order (exact buy amount, maximum sell amount)
OrderBalance
Enum for balance withdrawal/payment configuration.ERC20: Use standard ERC20 token balances (default)EXTERNAL: Use Balancer Vault external balances (sell only)INTERNAL: Use Balancer Vault internal balances
OrderCancellations
Order cancellation data.Array of unique order identifiers to cancel.
OrderUidParams
Parameters for computing order unique identifiers.The EIP-712 order struct hash (32 bytes).
The address of the order owner.
The timestamp when the order expires.
Functions
normalizeOrder
Normalizes an order for hashing and signing operations.The order to normalize.
A normalized order with all optional fields filled and values converted to standard formats.
hashOrder
Computes the 32-byte EIP-712 signing hash for an order.The EIP-712 domain separator.
The order to hash.
Hex-encoded 32-byte order digest.
computeOrderUid
Computes the unique order identifier for an order and owner.The EIP-712 domain separator.
The order to compute the UID for.
The address of the order owner.
A 56-byte hex string uniquely identifying the order.
packOrderUidParams
Packs order UID parameters into a 56-byte order UID.The order UID parameters to pack.
A 56-byte hex string containing the packed orderDigest (32 bytes), owner (20 bytes), and validTo (4 bytes).
extractOrderUidParams
Extracts order UID parameters from a 56-byte order UID.The 56-byte hex-encoded order UID.
The extracted order digest, owner address, and validTo timestamp.
timestamp
Normalizes a timestamp value to a Unix timestamp (seconds since epoch).A number (Unix timestamp) or Date object.
Unix timestamp in seconds.
hashify
Normalizes an app data value to a 32-byte hash.A hash-like value (BytesLike or number) to normalize.
A 32-byte hash encoded as a hex string.
normalizeBuyTokenBalance
Normalizes the balance configuration for a buy token.The balance configuration to normalize.
The normalized balance configuration.
EXTERNAL is converted to ERC20.Constants
BUY_ETH_ADDRESS
Marker address to indicate an order is buying native Ether.This address only has special meaning in the
buyToken field. Using it as sellToken will cause the settlement to revert.