Class: ConditionalOrder<D, S>
An abstract base class from which all conditional orders should inherit.
This class provides some basic functionality to help with handling conditional orders, such as:
- Validating the conditional order
- Creating a human-readable string representation of the conditional order
- Serializing the conditional order for use with the
IConditionalOrder
struct - Getting any dependencies for the conditional order
- Getting the off-chain input for the conditional order
NOTE: Instances of conditional orders have an id
property that is a keccak256
hash of
the serialized conditional order.
Type parameters
Name |
---|
D |
S |
Hierarchy
-
ConditionalOrder
↳
Twap
Constructors
constructor
• new ConditionalOrder<D
, S
>(params
): ConditionalOrder
<D
, S
>
A constructor that provides some basic validation for the conditional order.
This constructor MUST be called by any class that inherits from ConditionalOrder
.
NOTE: The salt is optional and will be randomly generated if not provided.
Type parameters
Name |
---|
D |
S |
Parameters
Name | Type |
---|---|
params | ConditionalOrderArguments <D > |
Returns
ConditionalOrder
<D
, S
>
Throws
If the handler is not a valid ethereum address.
Throws
If the salt is not a valid 32-byte string.
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:54
Properties
data
• Readonly
data: D
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:37
handler
• Readonly
handler: string
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:35
hasOffChainInput
• Readonly
hasOffChainInput: boolean
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:39
salt
• Readonly
salt: string
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:36
staticInput
• Readonly
staticInput: S
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:38
Accessors
context
• get
context(): undefined
| ContextFactory
Get the context dependency for the conditional order.
This is used when calling createWithContext
or setRootWithContext
on a ComposableCoW-enabled Safe.
Returns
undefined
| ContextFactory
The context dependency.
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:91
createCalldata
• get
createCalldata(): string
Get the calldata for creating the conditional order.
This will automatically determine whether or not to use create
or createWithContext
based on the
order type's context dependency.
NOTE: By default, this will cause the create to emit the ConditionalOrderCreated
event.
Returns
string
The calldata for creating the conditional order.
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:113
ctx
• get
ctx(): string
The context key of the order (bytes32(0) if a merkle tree is used, otherwise H(params)) with which to lookup the cabinet
The context, relates to the 'ctx' in the contract: https://github.com/cowprotocol/composable-cow/blob/c7fb85ab10c05e28a1632ba97a1749fb261fcdfb/src/interfaces/IConditionalOrder.sol#L38
Returns
string
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:166
id
• get
id(): string
Calculate the id of the conditional order (which also happens to be the key used for ctx
in the ComposableCoW contract).
This is a keccak256
hash of the serialized conditional order.
Returns
string
The id of the conditional order.
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:157
isSingleOrder
• get
isSingleOrder(): boolean
Returns
boolean
Defined in
external/cow-sdk/src/composable/ConditionalOrder.ts:76
leaf
• get
leaf(): ConditionalOrderParams
Get the leaf
of the conditional order. This is the data that is used to create the merkle tree.
For the purposes of this library, the leaf
is the ConditionalOrderParams
struct.