aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src/types.ts
blob: 8a9a4cafe1907603eedc2ef8f1a1d0f21878d5e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { BigNumber } from '@0xproject/utils';

export enum OrderError {
    InvalidSignature = 'INVALID_SIGNATURE',
}

export enum TradeSide {
    Maker = 'maker',
    Taker = 'taker',
}

export enum TransferType {
    Trade = 'trade',
    Fee = 'fee',
}

export interface EIP712Parameter {
    name: string;
    type: EIP712Types;
}

export interface EIP712Schema {
    name: string;
    parameters: EIP712Parameter[];
}

export enum EIP712Types {
    Address = 'address',
    Bytes = 'bytes',
    Bytes32 = 'bytes32',
    String = 'string',
    Uint256 = 'uint256',
}

export interface CreateOrderOpts {
    takerAddress?: string;
    senderAddress?: string;
    makerFee?: BigNumber;
    takerFee?: BigNumber;
    feeRecipientAddress?: string;
    salt?: BigNumber;
    expirationTimeSeconds?: BigNumber;
}

/**
 * remainingFillableMakerAssetAmount: An array of BigNumbers corresponding to the `signedOrders` parameter.
 * You can use `OrderStateUtils` `@0xproject/order-utils` to perform blockchain lookups for these values.
 * Defaults to `makerAssetAmount` values from the signedOrders param.
 * slippageBufferAmount: An additional amount of makerAsset to be covered by the result in case of trade collisions or partial fills.
 * Defaults to 0
 */
export interface FindOrdersThatCoverMakerAssetFillAmountOpts {
    remainingFillableMakerAssetAmounts?: BigNumber[];
    slippageBufferAmount?: BigNumber;
}

/**
 * remainingFillableMakerAssetAmount: An array of BigNumbers corresponding to the `signedOrders` parameter.
 * You can use `OrderStateUtils` `@0xproject/order-utils` to perform blockchain lookups for these values.
 * Defaults to `makerAssetAmount` values from the signedOrders param.
 * remainingFillableFeeAmounts: An array of BigNumbers corresponding to the signedFeeOrders parameter.
 * You can use OrderStateUtils @0xproject/order-utils to perform blockchain lookups for these values.
 * Defaults to `makerAssetAmount` values from the signedFeeOrders param.
 * slippageBufferAmount: An additional amount of fee to be covered by the result in case of trade collisions or partial fills.
 * Defaults to 0
 */
export interface FindFeeOrdersThatCoverFeesForTargetOrdersOpts {
    remainingFillableMakerAssetAmounts?: BigNumber[];
    remainingFillableFeeAmounts?: BigNumber[];
    slippageBufferAmount?: BigNumber;
}