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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
import { AssetBuyer, BigNumber } from '@0x/asset-buyer';
import { AssetProxyId, ObjectMap, SignedOrder } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
// Reusable
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type Maybe<T> = T | undefined;
export enum AsyncProcessState {
None = 'NONE',
Pending = 'PENDING',
Success = 'SUCCESS',
Failure = 'FAILURE',
}
export enum OrderProcessState {
None = 'NONE',
Validating = 'VALIDATING',
Processing = 'PROCESSING',
Success = 'SUCCESS',
Failure = 'FAILURE',
}
export enum QuoteFetchOrigin {
Manual = 'Manual',
Heartbeat = 'Heartbeat',
}
export interface SimulatedProgress {
startTimeUnix: number;
expectedEndTimeUnix: number;
}
interface OrderStatePreTx {
processState: OrderProcessState.None | OrderProcessState.Validating;
}
interface OrderStatePostTx {
processState: OrderProcessState.Processing | OrderProcessState.Success | OrderProcessState.Failure;
txHash: string;
progress: SimulatedProgress;
}
export type OrderState = OrderStatePreTx | OrderStatePostTx;
export enum DisplayStatus {
Present,
Hidden,
}
export type FunctionType = (...args: any[]) => any;
export type ActionCreatorsMapObject = ObjectMap<FunctionType>;
export type ActionsUnion<A extends ActionCreatorsMapObject> = ReturnType<A[keyof A]>;
export interface ERC20AssetMetaData {
assetProxyId: AssetProxyId.ERC20;
decimals: number;
primaryColor?: string;
symbol: string;
name: string;
iconUrl?: string;
}
export interface ERC721AssetMetaData {
assetProxyId: AssetProxyId.ERC721;
name: string;
imageUrl?: string;
primaryColor?: string;
}
export type AssetMetaData = ERC20AssetMetaData | ERC721AssetMetaData;
export interface ERC20Asset {
assetData: string;
metaData: ERC20AssetMetaData;
}
export interface ERC721Asset {
assetData: string;
metaData: ERC721AssetMetaData;
}
export interface Asset {
assetData: string;
metaData: AssetMetaData;
}
export enum Network {
Kovan = 42,
Mainnet = 1,
}
export enum ZeroExInstantError {
AssetMetaDataNotAvailable = 'ASSET_META_DATA_NOT_AVAILABLE',
InsufficientETH = 'INSUFFICIENT_ETH',
}
export type SimpleHandler = () => void;
export interface AffiliateInfo {
feeRecipient: string;
feePercentage: number;
}
export interface ProviderState {
name: string;
displayName: string;
provider: Provider;
assetBuyer: AssetBuyer;
web3Wrapper: Web3Wrapper;
account: Account;
}
export enum AccountState {
None = 'NONE,',
Loading = 'LOADING',
Ready = 'READY',
Locked = 'LOCKED',
}
export interface AccountReady {
state: AccountState.Ready;
address: string;
ethBalanceInWei?: BigNumber;
}
export interface AccountNotReady {
state: AccountState.None | AccountState.Loading | AccountState.Locked;
}
export type Account = AccountReady | AccountNotReady;
export type OrderSource = string | SignedOrder[];
export interface AddressAndEthBalanceInWei {
address: string;
ethBalanceInWei: BigNumber;
}
export type SlideAnimationState = 'slidIn' | 'slidOut' | 'none';
export enum StandardSlidingPanelContent {
None = 'NONE',
InstallWallet = 'INSTALL_WALLET',
}
export interface StandardSlidingPanelSettings {
animationState: SlideAnimationState;
content: StandardSlidingPanelContent;
}
export enum Browser {
Chrome = 'CHROME',
Firefox = 'FIREFOX',
Opera = 'OPERA',
Safari = 'SAFARI',
Edge = 'EDGE',
Other = 'OTHER',
}
export enum WalletSuggestion {
CoinbaseWallet = 'Coinbase Wallet',
MetaMask = 'MetaMask',
}
export enum OperatingSystem {
Android = 'ANDROID',
iOS = 'IOS',
Mac = 'MAC',
Windows = 'WINDOWS',
WindowsPhone = 'WINDOWS_PHONE',
Linux = 'LINUX',
Other = 'OTHER',
}
export enum ProviderType {
Parity = 'PARITY',
MetaMask = 'META_MASK',
Mist = 'MIST',
CoinbaseWallet = 'COINBASE_WALLET',
Cipher = 'CIPHER',
TrustWallet = 'TRUST_WALLET',
Fallback = 'FALLBACK',
}
export interface ZeroExInstantRequiredBaseConfig {
orderSource: OrderSource;
}
export interface ZeroExInstantOptionalBaseConfig {
provider: Provider;
walletDisplayName: string;
availableAssetDatas: string[];
defaultAssetBuyAmount: number;
defaultSelectedAssetData: string;
additionalAssetMetaDataMap: ObjectMap<AssetMetaData>;
networkId: Network;
affiliateInfo: AffiliateInfo;
shouldDisableAnalyticsTracking: boolean;
}
export type ZeroExInstantBaseConfig = ZeroExInstantRequiredBaseConfig & Partial<ZeroExInstantOptionalBaseConfig>;
|