@grvt/sdk 0.0.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +142 -0
- package/client/GrvtBaseClient.d.ts +17 -0
- package/client/GrvtBaseClient.js +51 -0
- package/client/GrvtBaseClient.js.map +1 -0
- package/client/GrvtClient.d.ts +38 -0
- package/client/GrvtClient.js +80 -0
- package/client/GrvtClient.js.map +1 -0
- package/client/GrvtWsClient.d.ts +27 -0
- package/client/GrvtWsClient.js +136 -0
- package/client/GrvtWsClient.js.map +1 -0
- package/config/config.d.ts +13 -0
- package/config/config.js +17 -0
- package/config/config.js.map +1 -0
- package/index.d.ts +6 -0
- package/index.js +24 -0
- package/index.js.map +1 -0
- package/package.json +64 -0
- package/signing/domain.d.ts +3 -0
- package/signing/domain.js +17 -0
- package/signing/domain.js.map +1 -0
- package/signing/signature.d.ts +10 -0
- package/signing/signature.js +16 -0
- package/signing/signature.js.map +1 -0
- package/signing/signer.d.ts +14 -0
- package/signing/signer.js +31 -0
- package/signing/signer.js.map +1 -0
- package/signing/transfer.d.ts +4 -0
- package/signing/transfer.js +37 -0
- package/signing/transfer.js.map +1 -0
- package/signing/types.d.ts +337 -0
- package/signing/types.js +380 -0
- package/signing/types.js.map +1 -0
- package/utils/cookie.d.ts +7 -0
- package/utils/cookie.js +82 -0
- package/utils/cookie.js.map +1 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
export declare const EIP712Domain: {
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
}[];
|
|
5
|
+
export interface EIP712DomainData {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
chainId: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const domain: EIP712DomainData;
|
|
11
|
+
export declare const PrimaryType: Record<string, string>;
|
|
12
|
+
export declare const CreateAccount: {
|
|
13
|
+
primaryType: string;
|
|
14
|
+
domain: EIP712DomainData;
|
|
15
|
+
types: {
|
|
16
|
+
[PrimaryType.CreateAccount]: {
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
}[];
|
|
20
|
+
EIP712Domain: {
|
|
21
|
+
name: string;
|
|
22
|
+
type: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const CreateAccountWithSubAccount: {
|
|
27
|
+
primaryType: string;
|
|
28
|
+
domain: EIP712DomainData;
|
|
29
|
+
types: {
|
|
30
|
+
[PrimaryType.CreateAccountWithSubAccount]: {
|
|
31
|
+
name: string;
|
|
32
|
+
type: string;
|
|
33
|
+
}[];
|
|
34
|
+
EIP712Domain: {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export declare const SetAccountMultiSigThreshold: {
|
|
41
|
+
primaryType: string;
|
|
42
|
+
domain: EIP712DomainData;
|
|
43
|
+
types: {
|
|
44
|
+
[PrimaryType.SetAccountMultiSigThreshold]: {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
}[];
|
|
48
|
+
EIP712Domain: {
|
|
49
|
+
name: string;
|
|
50
|
+
type: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare const AddAccountSigner: {
|
|
55
|
+
primaryType: string;
|
|
56
|
+
domain: EIP712DomainData;
|
|
57
|
+
types: {
|
|
58
|
+
[PrimaryType.AddAccountSigner]: {
|
|
59
|
+
name: string;
|
|
60
|
+
type: string;
|
|
61
|
+
}[];
|
|
62
|
+
EIP712Domain: {
|
|
63
|
+
name: string;
|
|
64
|
+
type: string;
|
|
65
|
+
}[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare const SetAccountSignerPermissions: {
|
|
69
|
+
primaryType: string;
|
|
70
|
+
domain: EIP712DomainData;
|
|
71
|
+
types: {
|
|
72
|
+
[PrimaryType.SetAccountSignerPermissions]: {
|
|
73
|
+
name: string;
|
|
74
|
+
type: string;
|
|
75
|
+
}[];
|
|
76
|
+
EIP712Domain: {
|
|
77
|
+
name: string;
|
|
78
|
+
type: string;
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export declare const RemoveAccountSigner: {
|
|
83
|
+
primaryType: string;
|
|
84
|
+
domain: EIP712DomainData;
|
|
85
|
+
types: {
|
|
86
|
+
[PrimaryType.RemoveAccountSigner]: {
|
|
87
|
+
name: string;
|
|
88
|
+
type: string;
|
|
89
|
+
}[];
|
|
90
|
+
EIP712Domain: {
|
|
91
|
+
name: string;
|
|
92
|
+
type: string;
|
|
93
|
+
}[];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export declare const AddWithdrawalAddress: {
|
|
97
|
+
primaryType: string;
|
|
98
|
+
domain: EIP712DomainData;
|
|
99
|
+
types: {
|
|
100
|
+
[PrimaryType.AddWithdrawalAddress]: {
|
|
101
|
+
name: string;
|
|
102
|
+
type: string;
|
|
103
|
+
}[];
|
|
104
|
+
EIP712Domain: {
|
|
105
|
+
name: string;
|
|
106
|
+
type: string;
|
|
107
|
+
}[];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export declare const RemoveWithdrawalAddress: {
|
|
111
|
+
primaryType: string;
|
|
112
|
+
domain: EIP712DomainData;
|
|
113
|
+
types: {
|
|
114
|
+
[PrimaryType.RemoveWithdrawalAddress]: {
|
|
115
|
+
name: string;
|
|
116
|
+
type: string;
|
|
117
|
+
}[];
|
|
118
|
+
EIP712Domain: {
|
|
119
|
+
name: string;
|
|
120
|
+
type: string;
|
|
121
|
+
}[];
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
export declare const AddTransferAccount: {
|
|
125
|
+
primaryType: string;
|
|
126
|
+
domain: EIP712DomainData;
|
|
127
|
+
types: {
|
|
128
|
+
[PrimaryType.AddTransferAccount]: {
|
|
129
|
+
name: string;
|
|
130
|
+
type: string;
|
|
131
|
+
}[];
|
|
132
|
+
EIP712Domain: {
|
|
133
|
+
name: string;
|
|
134
|
+
type: string;
|
|
135
|
+
}[];
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
export declare const RemoveTransferAccount: {
|
|
139
|
+
primaryType: string;
|
|
140
|
+
domain: EIP712DomainData;
|
|
141
|
+
types: {
|
|
142
|
+
[PrimaryType.RemoveTransferAccount]: {
|
|
143
|
+
name: string;
|
|
144
|
+
type: string;
|
|
145
|
+
}[];
|
|
146
|
+
EIP712Domain: {
|
|
147
|
+
name: string;
|
|
148
|
+
type: string;
|
|
149
|
+
}[];
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export declare const CreateSubAccount: {
|
|
153
|
+
primaryType: string;
|
|
154
|
+
domain: EIP712DomainData;
|
|
155
|
+
types: {
|
|
156
|
+
[PrimaryType.CreateSubAccount]: {
|
|
157
|
+
name: string;
|
|
158
|
+
type: string;
|
|
159
|
+
}[];
|
|
160
|
+
EIP712Domain: {
|
|
161
|
+
name: string;
|
|
162
|
+
type: string;
|
|
163
|
+
}[];
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
export declare const SetSubAccountMarginType: {
|
|
167
|
+
primaryType: string;
|
|
168
|
+
domain: EIP712DomainData;
|
|
169
|
+
types: {
|
|
170
|
+
[PrimaryType.SetSubAccountMarginType]: {
|
|
171
|
+
name: string;
|
|
172
|
+
type: string;
|
|
173
|
+
}[];
|
|
174
|
+
EIP712Domain: {
|
|
175
|
+
name: string;
|
|
176
|
+
type: string;
|
|
177
|
+
}[];
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
export declare const AddSubAccountSigner: {
|
|
181
|
+
primaryType: string;
|
|
182
|
+
domain: EIP712DomainData;
|
|
183
|
+
types: {
|
|
184
|
+
[PrimaryType.AddSubAccountSigner]: {
|
|
185
|
+
name: string;
|
|
186
|
+
type: string;
|
|
187
|
+
}[];
|
|
188
|
+
EIP712Domain: {
|
|
189
|
+
name: string;
|
|
190
|
+
type: string;
|
|
191
|
+
}[];
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
export declare const SetSubAccountSignerPermissions: {
|
|
195
|
+
primaryType: string;
|
|
196
|
+
domain: EIP712DomainData;
|
|
197
|
+
types: {
|
|
198
|
+
[PrimaryType.SetSubAccountSignerPermissions]: {
|
|
199
|
+
name: string;
|
|
200
|
+
type: string;
|
|
201
|
+
}[];
|
|
202
|
+
EIP712Domain: {
|
|
203
|
+
name: string;
|
|
204
|
+
type: string;
|
|
205
|
+
}[];
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
export declare const RemoveSubAccountSigner: {
|
|
209
|
+
primaryType: string;
|
|
210
|
+
domain: EIP712DomainData;
|
|
211
|
+
types: {
|
|
212
|
+
[PrimaryType.RemoveSubAccountSigner]: {
|
|
213
|
+
name: string;
|
|
214
|
+
type: string;
|
|
215
|
+
}[];
|
|
216
|
+
EIP712Domain: {
|
|
217
|
+
name: string;
|
|
218
|
+
type: string;
|
|
219
|
+
}[];
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
export declare const AddRecoveryAddress: {
|
|
223
|
+
primaryType: string;
|
|
224
|
+
domain: EIP712DomainData;
|
|
225
|
+
types: {
|
|
226
|
+
[PrimaryType.AddRecoveryAddress]: {
|
|
227
|
+
name: string;
|
|
228
|
+
type: string;
|
|
229
|
+
}[];
|
|
230
|
+
EIP712Domain: {
|
|
231
|
+
name: string;
|
|
232
|
+
type: string;
|
|
233
|
+
}[];
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
export declare const RemoveRecoveryAddress: {
|
|
237
|
+
primaryType: string;
|
|
238
|
+
domain: EIP712DomainData;
|
|
239
|
+
types: {
|
|
240
|
+
[PrimaryType.RemoveRecoveryAddress]: {
|
|
241
|
+
name: string;
|
|
242
|
+
type: string;
|
|
243
|
+
}[];
|
|
244
|
+
EIP712Domain: {
|
|
245
|
+
name: string;
|
|
246
|
+
type: string;
|
|
247
|
+
}[];
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
export declare const RecoverAddress: {
|
|
251
|
+
primaryType: string;
|
|
252
|
+
domain: EIP712DomainData;
|
|
253
|
+
types: {
|
|
254
|
+
[PrimaryType.RecoverAddress]: {
|
|
255
|
+
name: string;
|
|
256
|
+
type: string;
|
|
257
|
+
}[];
|
|
258
|
+
EIP712Domain: {
|
|
259
|
+
name: string;
|
|
260
|
+
type: string;
|
|
261
|
+
}[];
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
export declare const AddSessionKey: {
|
|
265
|
+
primaryType: string;
|
|
266
|
+
domain: EIP712DomainData;
|
|
267
|
+
types: {
|
|
268
|
+
[PrimaryType.AddSessionKey]: {
|
|
269
|
+
name: string;
|
|
270
|
+
type: string;
|
|
271
|
+
}[];
|
|
272
|
+
EIP712Domain: {
|
|
273
|
+
name: string;
|
|
274
|
+
type: string;
|
|
275
|
+
}[];
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
export declare const Deposit: {
|
|
279
|
+
primaryType: string;
|
|
280
|
+
domain: EIP712DomainData;
|
|
281
|
+
types: {
|
|
282
|
+
[PrimaryType.Deposit]: {
|
|
283
|
+
name: string;
|
|
284
|
+
type: string;
|
|
285
|
+
}[];
|
|
286
|
+
EIP712Domain: {
|
|
287
|
+
name: string;
|
|
288
|
+
type: string;
|
|
289
|
+
}[];
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
export declare const Withdrawal: {
|
|
293
|
+
primaryType: string;
|
|
294
|
+
domain: EIP712DomainData;
|
|
295
|
+
types: {
|
|
296
|
+
[PrimaryType.Withdrawal]: {
|
|
297
|
+
name: string;
|
|
298
|
+
type: string;
|
|
299
|
+
}[];
|
|
300
|
+
EIP712Domain: {
|
|
301
|
+
name: string;
|
|
302
|
+
type: string;
|
|
303
|
+
}[];
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
export declare const Transfer: {
|
|
307
|
+
primaryType: string;
|
|
308
|
+
domain: EIP712DomainData;
|
|
309
|
+
types: {
|
|
310
|
+
[PrimaryType.Transfer]: {
|
|
311
|
+
name: string;
|
|
312
|
+
type: string;
|
|
313
|
+
}[];
|
|
314
|
+
EIP712Domain: {
|
|
315
|
+
name: string;
|
|
316
|
+
type: string;
|
|
317
|
+
}[];
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
export declare const Order: {
|
|
321
|
+
primaryType: string;
|
|
322
|
+
domain: EIP712DomainData;
|
|
323
|
+
types: {
|
|
324
|
+
[PrimaryType.Order]: {
|
|
325
|
+
name: string;
|
|
326
|
+
type: string;
|
|
327
|
+
}[];
|
|
328
|
+
EIP712Domain: {
|
|
329
|
+
name: string;
|
|
330
|
+
type: string;
|
|
331
|
+
}[];
|
|
332
|
+
OrderLeg: {
|
|
333
|
+
name: string;
|
|
334
|
+
type: string;
|
|
335
|
+
}[];
|
|
336
|
+
};
|
|
337
|
+
};
|
package/signing/types.js
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Order = exports.Transfer = exports.Withdrawal = exports.Deposit = exports.AddSessionKey = exports.RecoverAddress = exports.RemoveRecoveryAddress = exports.AddRecoveryAddress = exports.RemoveSubAccountSigner = exports.SetSubAccountSignerPermissions = exports.AddSubAccountSigner = exports.SetSubAccountMarginType = exports.CreateSubAccount = exports.RemoveTransferAccount = exports.AddTransferAccount = exports.RemoveWithdrawalAddress = exports.AddWithdrawalAddress = exports.RemoveAccountSigner = exports.SetAccountSignerPermissions = exports.AddAccountSigner = exports.SetAccountMultiSigThreshold = exports.CreateAccountWithSubAccount = exports.CreateAccount = exports.PrimaryType = exports.domain = exports.EIP712Domain = void 0;
|
|
4
|
+
function keyMirror(originObj) {
|
|
5
|
+
return Object.entries(originObj).reduce((obj, [key, _]) => {
|
|
6
|
+
obj[key] = key;
|
|
7
|
+
return obj;
|
|
8
|
+
}, {});
|
|
9
|
+
}
|
|
10
|
+
exports.EIP712Domain = [
|
|
11
|
+
{ name: 'name', type: 'string' },
|
|
12
|
+
{ name: 'version', type: 'string' },
|
|
13
|
+
{ name: 'chainId', type: 'uint256' },
|
|
14
|
+
];
|
|
15
|
+
// Note: this is the default domain, for each of the environment, we need to construct a proper domain accordingly
|
|
16
|
+
exports.domain = {
|
|
17
|
+
name: 'GRVT Exchange',
|
|
18
|
+
version: '0',
|
|
19
|
+
chainId: 1,
|
|
20
|
+
};
|
|
21
|
+
exports.PrimaryType = keyMirror({
|
|
22
|
+
// Account
|
|
23
|
+
CreateAccount: 0,
|
|
24
|
+
CreateAccountWithSubAccount: 0,
|
|
25
|
+
SetAccountSignerPermissions: 0,
|
|
26
|
+
AddAccountSigner: 0,
|
|
27
|
+
AddTransferAccount: 0,
|
|
28
|
+
AddWithdrawalAddress: 0,
|
|
29
|
+
CreateSubAccount: 0,
|
|
30
|
+
RemoveAccountSigner: 0,
|
|
31
|
+
RemoveTransferAccount: 0,
|
|
32
|
+
RemoveWithdrawalAddress: 0,
|
|
33
|
+
SetAccountMultiSigThreshold: 0,
|
|
34
|
+
// SubAccount
|
|
35
|
+
AddSubAccountSigner: 0,
|
|
36
|
+
RemoveSubAccountSigner: 0,
|
|
37
|
+
SetSubAccountMarginType: 0,
|
|
38
|
+
SetSubAccountSignerPermissions: 0,
|
|
39
|
+
// Wallet Recovery
|
|
40
|
+
AddRecoveryAddress: 0,
|
|
41
|
+
RemoveRecoveryAddress: 0,
|
|
42
|
+
RecoverAddress: 0,
|
|
43
|
+
// Session Key
|
|
44
|
+
AddSessionKey: 0,
|
|
45
|
+
// Transfer
|
|
46
|
+
Deposit: 0,
|
|
47
|
+
Transfer: 0,
|
|
48
|
+
Withdrawal: 0,
|
|
49
|
+
// Trade
|
|
50
|
+
Order: 0,
|
|
51
|
+
});
|
|
52
|
+
// -------------- Account --------------
|
|
53
|
+
exports.CreateAccount = {
|
|
54
|
+
primaryType: exports.PrimaryType.CreateAccount,
|
|
55
|
+
domain: exports.domain,
|
|
56
|
+
types: {
|
|
57
|
+
EIP712Domain: exports.EIP712Domain,
|
|
58
|
+
[exports.PrimaryType.CreateAccount]: [
|
|
59
|
+
{ name: 'accountID', type: 'address' },
|
|
60
|
+
{ name: 'nonce', type: 'uint32' },
|
|
61
|
+
{ name: 'expiration', type: 'int64' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
exports.CreateAccountWithSubAccount = {
|
|
66
|
+
primaryType: exports.PrimaryType.CreateAccountWithSubAccount,
|
|
67
|
+
domain: exports.domain,
|
|
68
|
+
types: {
|
|
69
|
+
EIP712Domain: exports.EIP712Domain,
|
|
70
|
+
[exports.PrimaryType.CreateAccountWithSubAccount]: [
|
|
71
|
+
{ name: 'accountID', type: 'address' },
|
|
72
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
73
|
+
{ name: 'quoteCurrency', type: 'uint8' },
|
|
74
|
+
{ name: 'marginType', type: 'uint8' },
|
|
75
|
+
{ name: 'nonce', type: 'uint32' },
|
|
76
|
+
{ name: 'expiration', type: 'int64' },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
exports.SetAccountMultiSigThreshold = {
|
|
81
|
+
primaryType: exports.PrimaryType.SetAccountMultiSigThreshold,
|
|
82
|
+
domain: exports.domain,
|
|
83
|
+
types: {
|
|
84
|
+
EIP712Domain: exports.EIP712Domain,
|
|
85
|
+
[exports.PrimaryType.SetAccountMultiSigThreshold]: [
|
|
86
|
+
{ name: 'accountID', type: 'address' },
|
|
87
|
+
{ name: 'multiSigThreshold', type: 'uint8' },
|
|
88
|
+
{ name: 'nonce', type: 'uint32' },
|
|
89
|
+
{ name: 'expiration', type: 'int64' },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
exports.AddAccountSigner = {
|
|
94
|
+
primaryType: exports.PrimaryType.AddAccountSigner,
|
|
95
|
+
domain: exports.domain,
|
|
96
|
+
types: {
|
|
97
|
+
EIP712Domain: exports.EIP712Domain,
|
|
98
|
+
[exports.PrimaryType.AddAccountSigner]: [
|
|
99
|
+
{ name: 'accountID', type: 'address' },
|
|
100
|
+
{ name: 'signer', type: 'address' },
|
|
101
|
+
{ name: 'permissions', type: 'uint64' },
|
|
102
|
+
{ name: 'nonce', type: 'uint32' },
|
|
103
|
+
{ name: 'expiration', type: 'int64' },
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
exports.SetAccountSignerPermissions = {
|
|
108
|
+
primaryType: exports.PrimaryType.SetAccountSignerPermissions,
|
|
109
|
+
domain: exports.domain,
|
|
110
|
+
types: {
|
|
111
|
+
EIP712Domain: exports.EIP712Domain,
|
|
112
|
+
[exports.PrimaryType.SetAccountSignerPermissions]: [
|
|
113
|
+
{ name: 'accountID', type: 'address' },
|
|
114
|
+
{ name: 'signer', type: 'address' },
|
|
115
|
+
{ name: 'permissions', type: 'uint64' },
|
|
116
|
+
{ name: 'nonce', type: 'uint32' },
|
|
117
|
+
{ name: 'expiration', type: 'int64' },
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
exports.RemoveAccountSigner = {
|
|
122
|
+
primaryType: exports.PrimaryType.RemoveAccountSigner,
|
|
123
|
+
domain: exports.domain,
|
|
124
|
+
types: {
|
|
125
|
+
EIP712Domain: exports.EIP712Domain,
|
|
126
|
+
[exports.PrimaryType.RemoveAccountSigner]: [
|
|
127
|
+
{ name: 'accountID', type: 'address' },
|
|
128
|
+
{ name: 'signer', type: 'address' },
|
|
129
|
+
{ name: 'nonce', type: 'uint32' },
|
|
130
|
+
{ name: 'expiration', type: 'int64' },
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
exports.AddWithdrawalAddress = {
|
|
135
|
+
primaryType: exports.PrimaryType.AddWithdrawalAddress,
|
|
136
|
+
domain: exports.domain,
|
|
137
|
+
types: {
|
|
138
|
+
EIP712Domain: exports.EIP712Domain,
|
|
139
|
+
[exports.PrimaryType.AddWithdrawalAddress]: [
|
|
140
|
+
{ name: 'accountID', type: 'address' },
|
|
141
|
+
{ name: 'withdrawalAddress', type: 'address' },
|
|
142
|
+
{ name: 'nonce', type: 'uint32' },
|
|
143
|
+
{ name: 'expiration', type: 'int64' },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
exports.RemoveWithdrawalAddress = {
|
|
148
|
+
primaryType: exports.PrimaryType.RemoveWithdrawalAddress,
|
|
149
|
+
domain: exports.domain,
|
|
150
|
+
types: {
|
|
151
|
+
EIP712Domain: exports.EIP712Domain,
|
|
152
|
+
[exports.PrimaryType.RemoveWithdrawalAddress]: [
|
|
153
|
+
{ name: 'accountID', type: 'address' },
|
|
154
|
+
{ name: 'withdrawalAddress', type: 'address' },
|
|
155
|
+
{ name: 'nonce', type: 'uint32' },
|
|
156
|
+
{ name: 'expiration', type: 'int64' },
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
exports.AddTransferAccount = {
|
|
161
|
+
primaryType: exports.PrimaryType.AddTransferAccount,
|
|
162
|
+
domain: exports.domain,
|
|
163
|
+
types: {
|
|
164
|
+
EIP712Domain: exports.EIP712Domain,
|
|
165
|
+
[exports.PrimaryType.AddTransferAccount]: [
|
|
166
|
+
{ name: 'accountID', type: 'address' },
|
|
167
|
+
{ name: 'transferAccountID', type: 'address' },
|
|
168
|
+
{ name: 'nonce', type: 'uint32' },
|
|
169
|
+
{ name: 'expiration', type: 'int64' },
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
exports.RemoveTransferAccount = {
|
|
174
|
+
primaryType: exports.PrimaryType.RemoveTransferAccount,
|
|
175
|
+
domain: exports.domain,
|
|
176
|
+
types: {
|
|
177
|
+
EIP712Domain: exports.EIP712Domain,
|
|
178
|
+
[exports.PrimaryType.RemoveTransferAccount]: [
|
|
179
|
+
{ name: 'accountID', type: 'address' },
|
|
180
|
+
{ name: 'transferAccountID', type: 'address' },
|
|
181
|
+
{ name: 'nonce', type: 'uint32' },
|
|
182
|
+
{ name: 'expiration', type: 'int64' },
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
// -------------- SubAccount --------------
|
|
187
|
+
exports.CreateSubAccount = {
|
|
188
|
+
primaryType: exports.PrimaryType.CreateSubAccount,
|
|
189
|
+
domain: exports.domain,
|
|
190
|
+
types: {
|
|
191
|
+
EIP712Domain: exports.EIP712Domain,
|
|
192
|
+
[exports.PrimaryType.CreateSubAccount]: [
|
|
193
|
+
{ name: 'accountID', type: 'address' },
|
|
194
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
195
|
+
{ name: 'quoteCurrency', type: 'uint8' },
|
|
196
|
+
{ name: 'marginType', type: 'uint8' },
|
|
197
|
+
{ name: 'nonce', type: 'uint32' },
|
|
198
|
+
{ name: 'expiration', type: 'int64' },
|
|
199
|
+
],
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
exports.SetSubAccountMarginType = {
|
|
203
|
+
primaryType: exports.PrimaryType.SetSubAccountMarginType,
|
|
204
|
+
domain: exports.domain,
|
|
205
|
+
types: {
|
|
206
|
+
EIP712Domain: exports.EIP712Domain,
|
|
207
|
+
[exports.PrimaryType.SetSubAccountMarginType]: [
|
|
208
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
209
|
+
{ name: 'marginType', type: 'uint8' },
|
|
210
|
+
{ name: 'nonce', type: 'uint32' },
|
|
211
|
+
{ name: 'expiration', type: 'int64' },
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
exports.AddSubAccountSigner = {
|
|
216
|
+
primaryType: exports.PrimaryType.AddSubAccountSigner,
|
|
217
|
+
domain: exports.domain,
|
|
218
|
+
types: {
|
|
219
|
+
EIP712Domain: exports.EIP712Domain,
|
|
220
|
+
[exports.PrimaryType.AddSubAccountSigner]: [
|
|
221
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
222
|
+
{ name: 'signer', type: 'address' },
|
|
223
|
+
{ name: 'permissions', type: 'uint64' },
|
|
224
|
+
{ name: 'nonce', type: 'uint32' },
|
|
225
|
+
{ name: 'expiration', type: 'int64' },
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
exports.SetSubAccountSignerPermissions = {
|
|
230
|
+
primaryType: exports.PrimaryType.SetSubAccountSignerPermissions,
|
|
231
|
+
domain: exports.domain,
|
|
232
|
+
types: {
|
|
233
|
+
EIP712Domain: exports.EIP712Domain,
|
|
234
|
+
[exports.PrimaryType.SetSubAccountSignerPermissions]: [
|
|
235
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
236
|
+
{ name: 'signer', type: 'address' },
|
|
237
|
+
{ name: 'permissions', type: 'uint64' },
|
|
238
|
+
{ name: 'nonce', type: 'uint32' },
|
|
239
|
+
{ name: 'expiration', type: 'int64' },
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
exports.RemoveSubAccountSigner = {
|
|
244
|
+
primaryType: exports.PrimaryType.RemoveSubAccountSigner,
|
|
245
|
+
domain: exports.domain,
|
|
246
|
+
types: {
|
|
247
|
+
EIP712Domain: exports.EIP712Domain,
|
|
248
|
+
[exports.PrimaryType.RemoveSubAccountSigner]: [
|
|
249
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
250
|
+
{ name: 'signer', type: 'address' },
|
|
251
|
+
{ name: 'nonce', type: 'uint32' },
|
|
252
|
+
{ name: 'expiration', type: 'int64' },
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
// Wallet Recovery
|
|
257
|
+
exports.AddRecoveryAddress = {
|
|
258
|
+
primaryType: exports.PrimaryType.AddRecoveryAddress,
|
|
259
|
+
domain: exports.domain,
|
|
260
|
+
types: {
|
|
261
|
+
EIP712Domain: exports.EIP712Domain,
|
|
262
|
+
[exports.PrimaryType.AddRecoveryAddress]: [
|
|
263
|
+
{ name: 'accountID', type: 'address' },
|
|
264
|
+
{ name: 'recoverySigner', type: 'address' },
|
|
265
|
+
{ name: 'nonce', type: 'uint32' },
|
|
266
|
+
{ name: 'expiration', type: 'int64' },
|
|
267
|
+
],
|
|
268
|
+
},
|
|
269
|
+
};
|
|
270
|
+
exports.RemoveRecoveryAddress = {
|
|
271
|
+
primaryType: exports.PrimaryType.RemoveRecoveryAddress,
|
|
272
|
+
domain: exports.domain,
|
|
273
|
+
types: {
|
|
274
|
+
EIP712Domain: exports.EIP712Domain,
|
|
275
|
+
[exports.PrimaryType.RemoveRecoveryAddress]: [
|
|
276
|
+
{ name: 'accountID', type: 'address' },
|
|
277
|
+
{ name: 'recoverySigner', type: 'address' },
|
|
278
|
+
{ name: 'nonce', type: 'uint32' },
|
|
279
|
+
{ name: 'expiration', type: 'int64' },
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
exports.RecoverAddress = {
|
|
284
|
+
primaryType: exports.PrimaryType.RecoverAddress,
|
|
285
|
+
domain: exports.domain,
|
|
286
|
+
types: {
|
|
287
|
+
EIP712Domain: exports.EIP712Domain,
|
|
288
|
+
[exports.PrimaryType.RecoverAddress]: [
|
|
289
|
+
{ name: 'accountID', type: 'address' },
|
|
290
|
+
{ name: 'oldSigner', type: 'address' },
|
|
291
|
+
{ name: 'newSigner', type: 'address' },
|
|
292
|
+
{ name: 'nonce', type: 'uint32' },
|
|
293
|
+
{ name: 'expiration', type: 'int64' },
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
// -------------- Session Keys --------------
|
|
298
|
+
exports.AddSessionKey = {
|
|
299
|
+
primaryType: exports.PrimaryType.AddSessionKey,
|
|
300
|
+
domain: exports.domain,
|
|
301
|
+
types: {
|
|
302
|
+
EIP712Domain: exports.EIP712Domain,
|
|
303
|
+
[exports.PrimaryType.AddSessionKey]: [
|
|
304
|
+
{ name: 'sessionKey', type: 'address' },
|
|
305
|
+
{ name: 'keyExpiry', type: 'int64' },
|
|
306
|
+
],
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
// -------------- Transfer --------------
|
|
310
|
+
exports.Deposit = {
|
|
311
|
+
primaryType: exports.PrimaryType.Deposit,
|
|
312
|
+
domain: exports.domain,
|
|
313
|
+
types: {
|
|
314
|
+
EIP712Domain: exports.EIP712Domain,
|
|
315
|
+
[exports.PrimaryType.Deposit]: [
|
|
316
|
+
{ name: 'fromEthAddress', type: 'address' },
|
|
317
|
+
{ name: 'toAccount', type: 'address' },
|
|
318
|
+
{ name: 'tokenCurrency', type: 'uint8' },
|
|
319
|
+
{ name: 'numTokens', type: 'uint64' },
|
|
320
|
+
{ name: 'nonce', type: 'uint32' },
|
|
321
|
+
{ name: 'expiration', type: 'int64' },
|
|
322
|
+
],
|
|
323
|
+
},
|
|
324
|
+
};
|
|
325
|
+
exports.Withdrawal = {
|
|
326
|
+
primaryType: exports.PrimaryType.Withdrawal,
|
|
327
|
+
domain: exports.domain,
|
|
328
|
+
types: {
|
|
329
|
+
EIP712Domain: exports.EIP712Domain,
|
|
330
|
+
[exports.PrimaryType.Withdrawal]: [
|
|
331
|
+
{ name: 'fromAccount', type: 'address' },
|
|
332
|
+
{ name: 'toEthAddress', type: 'address' },
|
|
333
|
+
{ name: 'tokenCurrency', type: 'uint8' },
|
|
334
|
+
{ name: 'numTokens', type: 'uint64' },
|
|
335
|
+
{ name: 'nonce', type: 'uint32' },
|
|
336
|
+
{ name: 'expiration', type: 'int64' },
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
exports.Transfer = {
|
|
341
|
+
primaryType: exports.PrimaryType.Transfer,
|
|
342
|
+
domain: exports.domain,
|
|
343
|
+
types: {
|
|
344
|
+
EIP712Domain: exports.EIP712Domain,
|
|
345
|
+
[exports.PrimaryType.Transfer]: [
|
|
346
|
+
{ name: 'fromAccount', type: 'address' },
|
|
347
|
+
{ name: 'fromSubAccount', type: 'uint64' },
|
|
348
|
+
{ name: 'toAccount', type: 'address' },
|
|
349
|
+
{ name: 'toSubAccount', type: 'uint64' },
|
|
350
|
+
{ name: 'tokenCurrency', type: 'uint8' },
|
|
351
|
+
{ name: 'numTokens', type: 'uint64' },
|
|
352
|
+
{ name: 'nonce', type: 'uint32' },
|
|
353
|
+
{ name: 'expiration', type: 'int64' },
|
|
354
|
+
],
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
exports.Order = {
|
|
358
|
+
primaryType: exports.PrimaryType.Order,
|
|
359
|
+
domain: exports.domain,
|
|
360
|
+
types: {
|
|
361
|
+
EIP712Domain: exports.EIP712Domain,
|
|
362
|
+
[exports.PrimaryType.Order]: [
|
|
363
|
+
{ name: 'subAccountID', type: 'uint64' },
|
|
364
|
+
{ name: 'isMarket', type: 'bool' },
|
|
365
|
+
{ name: 'timeInForce', type: 'uint8' },
|
|
366
|
+
{ name: 'postOnly', type: 'bool' },
|
|
367
|
+
{ name: 'reduceOnly', type: 'bool' },
|
|
368
|
+
{ name: 'legs', type: 'OrderLeg[]' },
|
|
369
|
+
{ name: 'nonce', type: 'uint32' },
|
|
370
|
+
{ name: 'expiration', type: 'int64' },
|
|
371
|
+
],
|
|
372
|
+
OrderLeg: [
|
|
373
|
+
{ name: 'assetID', type: 'uint256' },
|
|
374
|
+
{ name: 'contractSize', type: 'uint64' },
|
|
375
|
+
{ name: 'limitPrice', type: 'uint64' },
|
|
376
|
+
{ name: 'isBuyingContract', type: 'bool' },
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
//# sourceMappingURL=types.js.map
|