@evedex/exchange-crypto 1.0.19 → 1.0.20
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/dist/cjs/index.js +18 -18
- package/dist/cjs/utils/crypto.d.ts +1 -1
- package/dist/cjs/utils/crypto.js +3 -3
- package/dist/mjs/index.js +19 -19
- package/dist/mjs/utils/crypto.d.ts +1 -1
- package/dist/mjs/utils/crypto.js +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -107,7 +107,7 @@ function signAuth(signer, payload) {
|
|
|
107
107
|
function signLimitOrder(signer, order) {
|
|
108
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
109
109
|
const chainId = yield signer.getChainId();
|
|
110
|
-
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.
|
|
110
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP712Schemas.createLimitOrder);
|
|
111
111
|
const normalize = {
|
|
112
112
|
id: order.id,
|
|
113
113
|
instrument: order.instrument,
|
|
@@ -118,14 +118,14 @@ function signLimitOrder(signer, order) {
|
|
|
118
118
|
tpsl: order.tpsl,
|
|
119
119
|
chainId,
|
|
120
120
|
};
|
|
121
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.
|
|
121
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP712Schemas.createLimitOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), limitPrice: (0, crypto_1.toEthNumber)(normalize.limitPrice) }));
|
|
122
122
|
return Object.assign(Object.assign(Object.assign({}, normalize), (order.postOnly && { postOnly: "yes" })), { signature: signer.serializeSignature(signature) });
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
function signMarketOrder(signer, order) {
|
|
126
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
127
|
const chainId = yield signer.getChainId();
|
|
128
|
-
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.
|
|
128
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP712Schemas.createMarketOrder);
|
|
129
129
|
const normalize = {
|
|
130
130
|
id: order.id,
|
|
131
131
|
instrument: order.instrument,
|
|
@@ -136,14 +136,14 @@ function signMarketOrder(signer, order) {
|
|
|
136
136
|
tpsl: order.tpsl,
|
|
137
137
|
chainId,
|
|
138
138
|
};
|
|
139
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.
|
|
139
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP712Schemas.createMarketOrder, Object.assign(Object.assign({}, normalize), { cashQuantity: (0, crypto_1.toEthNumber)(normalize.cashQuantity) }));
|
|
140
140
|
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
function signStopLimitOrder(signer, order) {
|
|
144
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
145
|
const chainId = yield signer.getChainId();
|
|
146
|
-
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.
|
|
146
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP712Schemas.createStopLimitOrder);
|
|
147
147
|
const normalize = {
|
|
148
148
|
id: order.id,
|
|
149
149
|
instrument: order.instrument,
|
|
@@ -155,14 +155,14 @@ function signStopLimitOrder(signer, order) {
|
|
|
155
155
|
tpsl: order.tpsl,
|
|
156
156
|
chainId,
|
|
157
157
|
};
|
|
158
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.
|
|
158
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP712Schemas.createStopLimitOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), limitPrice: (0, crypto_1.toEthNumber)(normalize.limitPrice), stopPrice: (0, crypto_1.toEthNumber)(normalize.stopPrice) }));
|
|
159
159
|
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
function signPositionCloseOrder(signer, order) {
|
|
163
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
164
|
const chainId = yield signer.getChainId();
|
|
165
|
-
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.
|
|
165
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP712Schemas.createPositionCloseOrder);
|
|
166
166
|
const normalize = {
|
|
167
167
|
id: order.id,
|
|
168
168
|
instrument: order.instrument,
|
|
@@ -170,43 +170,43 @@ function signPositionCloseOrder(signer, order) {
|
|
|
170
170
|
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
171
171
|
chainId,
|
|
172
172
|
};
|
|
173
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.
|
|
173
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP712Schemas.createPositionCloseOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity) }));
|
|
174
174
|
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
function signReplaceLimitOrder(signer, order) {
|
|
178
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
-
(0, validate_1.validatePayload)(order, crypto_1.
|
|
179
|
+
(0, validate_1.validatePayload)(order, crypto_1.EIP712Schemas.replaceLimitOrder);
|
|
180
180
|
const normalize = {
|
|
181
181
|
orderId: order.orderId,
|
|
182
182
|
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
183
183
|
limitPrice: (0, numeric_1.toMatcherNumber)(order.limitPrice),
|
|
184
184
|
};
|
|
185
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.
|
|
185
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP712Schemas.replaceLimitOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), limitPrice: (0, crypto_1.toEthNumber)(normalize.limitPrice) }));
|
|
186
186
|
return Object.assign(Object.assign(Object.assign({}, normalize), (order.postOnly && { postOnly: "yes" })), { signature: signer.serializeSignature(signature) });
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
function signReplaceStopLimitOrder(signer, order) {
|
|
190
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
-
(0, validate_1.validatePayload)(order, crypto_1.
|
|
191
|
+
(0, validate_1.validatePayload)(order, crypto_1.EIP712Schemas.replaceStopLimitOrder);
|
|
192
192
|
const normalize = {
|
|
193
193
|
orderId: order.orderId,
|
|
194
194
|
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
195
195
|
limitPrice: (0, numeric_1.toMatcherNumber)(order.limitPrice),
|
|
196
196
|
stopPrice: (0, numeric_1.toMatcherNumber)(order.stopPrice),
|
|
197
197
|
};
|
|
198
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.
|
|
198
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP712Schemas.replaceStopLimitOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), limitPrice: (0, crypto_1.toEthNumber)(normalize.limitPrice), stopPrice: (0, crypto_1.toEthNumber)(normalize.stopPrice) }));
|
|
199
199
|
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
function signTradingBalanceWithdraw(signer, withdraw) {
|
|
203
203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
204
|
-
(0, validate_1.validatePayload)(withdraw, crypto_1.
|
|
204
|
+
(0, validate_1.validatePayload)(withdraw, crypto_1.EIP712Schemas.withdraw);
|
|
205
205
|
const normalize = {
|
|
206
206
|
recipient: withdraw.recipient,
|
|
207
207
|
amount: (0, big_js_1.default)(withdraw.amount).round(utils_1.MATCHER_PRECISION, big_js_1.default.roundDown).toString(),
|
|
208
208
|
};
|
|
209
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.
|
|
209
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP712Schemas.withdraw, {
|
|
210
210
|
recipient: withdraw.recipient,
|
|
211
211
|
amount: (0, crypto_1.toEthNumber)(normalize.amount),
|
|
212
212
|
});
|
|
@@ -215,7 +215,7 @@ function signTradingBalanceWithdraw(signer, withdraw) {
|
|
|
215
215
|
}
|
|
216
216
|
function signTpSl(signer, tpsl) {
|
|
217
217
|
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
-
(0, validate_1.validatePayload)(tpsl, crypto_1.
|
|
218
|
+
(0, validate_1.validatePayload)(tpsl, crypto_1.EIP712Schemas.createTpSl);
|
|
219
219
|
const normalize = {
|
|
220
220
|
instrument: tpsl.instrument,
|
|
221
221
|
type: tpsl.type,
|
|
@@ -224,15 +224,15 @@ function signTpSl(signer, tpsl) {
|
|
|
224
224
|
price: (0, numeric_1.toMatcherNumber)(tpsl.price),
|
|
225
225
|
order: tpsl.order,
|
|
226
226
|
};
|
|
227
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.
|
|
227
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP712Schemas.createTpSl, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), price: (0, crypto_1.toEthNumber)(normalize.price) }));
|
|
228
228
|
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
229
229
|
});
|
|
230
230
|
}
|
|
231
231
|
function signOauthConsentTequest(signer, payload) {
|
|
232
232
|
return __awaiter(this, void 0, void 0, function* () {
|
|
233
233
|
const { oauthRequestId } = payload;
|
|
234
|
-
(0, validate_1.validatePayload)({ oauthRequestId }, crypto_1.
|
|
235
|
-
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.
|
|
234
|
+
(0, validate_1.validatePayload)({ oauthRequestId }, crypto_1.EIP712Schemas.oauthConsent);
|
|
235
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP712Schemas.oauthConsent, {
|
|
236
236
|
oauthRequestId,
|
|
237
237
|
});
|
|
238
238
|
return Object.assign(Object.assign({}, payload), { signature });
|
package/dist/cjs/utils/crypto.js
CHANGED
|
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.EIP712Schemas = void 0;
|
|
7
7
|
exports.getDomainData = getDomainData;
|
|
8
8
|
exports.toEthNumber = toEthNumber;
|
|
9
9
|
const big_js_1 = __importDefault(require("big.js"));
|
|
10
10
|
const constants_1 = require("./constants");
|
|
11
|
-
exports.
|
|
11
|
+
exports.EIP712Schemas = {
|
|
12
12
|
domain: {
|
|
13
13
|
name: "EVEDEX",
|
|
14
14
|
version: "2",
|
|
@@ -92,7 +92,7 @@ exports.EIP721Schemas = {
|
|
|
92
92
|
},
|
|
93
93
|
};
|
|
94
94
|
function getDomainData(chainId) {
|
|
95
|
-
return Object.assign(Object.assign({}, exports.
|
|
95
|
+
return Object.assign(Object.assign({}, exports.EIP712Schemas.domain), { chainId });
|
|
96
96
|
}
|
|
97
97
|
function toEthNumber(value) {
|
|
98
98
|
return (0, big_js_1.default)(value).mul(`1e${constants_1.MATCHER_PRECISION}`).toFixed(0);
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Big from "big.js";
|
|
2
2
|
import { SiweMessage } from "siwe";
|
|
3
|
-
import {
|
|
3
|
+
import { EIP712Schemas, getDomainData, toEthNumber, } from "./utils/crypto";
|
|
4
4
|
import { toMatcherNumber } from "./utils/numeric";
|
|
5
5
|
import { validatePayload } from "./utils/validate";
|
|
6
6
|
import { MATCHER_PRECISION } from "./utils";
|
|
@@ -42,7 +42,7 @@ export async function signAuth(signer, payload) {
|
|
|
42
42
|
}
|
|
43
43
|
export async function signLimitOrder(signer, order) {
|
|
44
44
|
const chainId = await signer.getChainId();
|
|
45
|
-
validatePayload({ ...order, chainId },
|
|
45
|
+
validatePayload({ ...order, chainId }, EIP712Schemas.createLimitOrder);
|
|
46
46
|
const normalize = {
|
|
47
47
|
id: order.id,
|
|
48
48
|
instrument: order.instrument,
|
|
@@ -53,7 +53,7 @@ export async function signLimitOrder(signer, order) {
|
|
|
53
53
|
tpsl: order.tpsl,
|
|
54
54
|
chainId,
|
|
55
55
|
};
|
|
56
|
-
const signature = await signer.signTypedData(getDomainData(chainId),
|
|
56
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP712Schemas.createLimitOrder, {
|
|
57
57
|
...normalize,
|
|
58
58
|
quantity: toEthNumber(normalize.quantity),
|
|
59
59
|
limitPrice: toEthNumber(normalize.limitPrice),
|
|
@@ -66,7 +66,7 @@ export async function signLimitOrder(signer, order) {
|
|
|
66
66
|
}
|
|
67
67
|
export async function signMarketOrder(signer, order) {
|
|
68
68
|
const chainId = await signer.getChainId();
|
|
69
|
-
validatePayload({ ...order, chainId },
|
|
69
|
+
validatePayload({ ...order, chainId }, EIP712Schemas.createMarketOrder);
|
|
70
70
|
const normalize = {
|
|
71
71
|
id: order.id,
|
|
72
72
|
instrument: order.instrument,
|
|
@@ -77,7 +77,7 @@ export async function signMarketOrder(signer, order) {
|
|
|
77
77
|
tpsl: order.tpsl,
|
|
78
78
|
chainId,
|
|
79
79
|
};
|
|
80
|
-
const signature = await signer.signTypedData(getDomainData(chainId),
|
|
80
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP712Schemas.createMarketOrder, {
|
|
81
81
|
...normalize,
|
|
82
82
|
cashQuantity: toEthNumber(normalize.cashQuantity),
|
|
83
83
|
});
|
|
@@ -88,7 +88,7 @@ export async function signMarketOrder(signer, order) {
|
|
|
88
88
|
}
|
|
89
89
|
export async function signStopLimitOrder(signer, order) {
|
|
90
90
|
const chainId = await signer.getChainId();
|
|
91
|
-
validatePayload({ ...order, chainId },
|
|
91
|
+
validatePayload({ ...order, chainId }, EIP712Schemas.createStopLimitOrder);
|
|
92
92
|
const normalize = {
|
|
93
93
|
id: order.id,
|
|
94
94
|
instrument: order.instrument,
|
|
@@ -100,7 +100,7 @@ export async function signStopLimitOrder(signer, order) {
|
|
|
100
100
|
tpsl: order.tpsl,
|
|
101
101
|
chainId,
|
|
102
102
|
};
|
|
103
|
-
const signature = await signer.signTypedData(getDomainData(chainId),
|
|
103
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP712Schemas.createStopLimitOrder, {
|
|
104
104
|
...normalize,
|
|
105
105
|
quantity: toEthNumber(normalize.quantity),
|
|
106
106
|
limitPrice: toEthNumber(normalize.limitPrice),
|
|
@@ -113,7 +113,7 @@ export async function signStopLimitOrder(signer, order) {
|
|
|
113
113
|
}
|
|
114
114
|
export async function signPositionCloseOrder(signer, order) {
|
|
115
115
|
const chainId = await signer.getChainId();
|
|
116
|
-
validatePayload({ ...order, chainId },
|
|
116
|
+
validatePayload({ ...order, chainId }, EIP712Schemas.createPositionCloseOrder);
|
|
117
117
|
const normalize = {
|
|
118
118
|
id: order.id,
|
|
119
119
|
instrument: order.instrument,
|
|
@@ -121,7 +121,7 @@ export async function signPositionCloseOrder(signer, order) {
|
|
|
121
121
|
quantity: toMatcherNumber(order.quantity),
|
|
122
122
|
chainId,
|
|
123
123
|
};
|
|
124
|
-
const signature = await signer.signTypedData(getDomainData(chainId),
|
|
124
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP712Schemas.createPositionCloseOrder, {
|
|
125
125
|
...normalize,
|
|
126
126
|
quantity: toEthNumber(normalize.quantity),
|
|
127
127
|
});
|
|
@@ -131,13 +131,13 @@ export async function signPositionCloseOrder(signer, order) {
|
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
export async function signReplaceLimitOrder(signer, order) {
|
|
134
|
-
validatePayload(order,
|
|
134
|
+
validatePayload(order, EIP712Schemas.replaceLimitOrder);
|
|
135
135
|
const normalize = {
|
|
136
136
|
orderId: order.orderId,
|
|
137
137
|
quantity: toMatcherNumber(order.quantity),
|
|
138
138
|
limitPrice: toMatcherNumber(order.limitPrice),
|
|
139
139
|
};
|
|
140
|
-
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()),
|
|
140
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP712Schemas.replaceLimitOrder, {
|
|
141
141
|
...normalize,
|
|
142
142
|
quantity: toEthNumber(normalize.quantity),
|
|
143
143
|
limitPrice: toEthNumber(normalize.limitPrice),
|
|
@@ -149,14 +149,14 @@ export async function signReplaceLimitOrder(signer, order) {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
export async function signReplaceStopLimitOrder(signer, order) {
|
|
152
|
-
validatePayload(order,
|
|
152
|
+
validatePayload(order, EIP712Schemas.replaceStopLimitOrder);
|
|
153
153
|
const normalize = {
|
|
154
154
|
orderId: order.orderId,
|
|
155
155
|
quantity: toMatcherNumber(order.quantity),
|
|
156
156
|
limitPrice: toMatcherNumber(order.limitPrice),
|
|
157
157
|
stopPrice: toMatcherNumber(order.stopPrice),
|
|
158
158
|
};
|
|
159
|
-
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()),
|
|
159
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP712Schemas.replaceStopLimitOrder, {
|
|
160
160
|
...normalize,
|
|
161
161
|
quantity: toEthNumber(normalize.quantity),
|
|
162
162
|
limitPrice: toEthNumber(normalize.limitPrice),
|
|
@@ -168,12 +168,12 @@ export async function signReplaceStopLimitOrder(signer, order) {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
export async function signTradingBalanceWithdraw(signer, withdraw) {
|
|
171
|
-
validatePayload(withdraw,
|
|
171
|
+
validatePayload(withdraw, EIP712Schemas.withdraw);
|
|
172
172
|
const normalize = {
|
|
173
173
|
recipient: withdraw.recipient,
|
|
174
174
|
amount: Big(withdraw.amount).round(MATCHER_PRECISION, Big.roundDown).toString(),
|
|
175
175
|
};
|
|
176
|
-
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()),
|
|
176
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP712Schemas.withdraw, {
|
|
177
177
|
recipient: withdraw.recipient,
|
|
178
178
|
amount: toEthNumber(normalize.amount),
|
|
179
179
|
});
|
|
@@ -183,7 +183,7 @@ export async function signTradingBalanceWithdraw(signer, withdraw) {
|
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
export async function signTpSl(signer, tpsl) {
|
|
186
|
-
validatePayload(tpsl,
|
|
186
|
+
validatePayload(tpsl, EIP712Schemas.createTpSl);
|
|
187
187
|
const normalize = {
|
|
188
188
|
instrument: tpsl.instrument,
|
|
189
189
|
type: tpsl.type,
|
|
@@ -192,7 +192,7 @@ export async function signTpSl(signer, tpsl) {
|
|
|
192
192
|
price: toMatcherNumber(tpsl.price),
|
|
193
193
|
order: tpsl.order,
|
|
194
194
|
};
|
|
195
|
-
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()),
|
|
195
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP712Schemas.createTpSl, {
|
|
196
196
|
...normalize,
|
|
197
197
|
quantity: toEthNumber(normalize.quantity),
|
|
198
198
|
price: toEthNumber(normalize.price),
|
|
@@ -204,8 +204,8 @@ export async function signTpSl(signer, tpsl) {
|
|
|
204
204
|
}
|
|
205
205
|
export async function signOauthConsentTequest(signer, payload) {
|
|
206
206
|
const { oauthRequestId } = payload;
|
|
207
|
-
validatePayload({ oauthRequestId },
|
|
208
|
-
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()),
|
|
207
|
+
validatePayload({ oauthRequestId }, EIP712Schemas.oauthConsent);
|
|
208
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP712Schemas.oauthConsent, {
|
|
209
209
|
oauthRequestId,
|
|
210
210
|
});
|
|
211
211
|
return {
|
package/dist/mjs/utils/crypto.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Big from "big.js";
|
|
2
2
|
import { MATCHER_PRECISION } from "./constants";
|
|
3
|
-
export const
|
|
3
|
+
export const EIP712Schemas = {
|
|
4
4
|
domain: {
|
|
5
5
|
name: "EVEDEX",
|
|
6
6
|
version: "2",
|
|
@@ -85,7 +85,7 @@ export const EIP721Schemas = {
|
|
|
85
85
|
};
|
|
86
86
|
export function getDomainData(chainId) {
|
|
87
87
|
return {
|
|
88
|
-
...
|
|
88
|
+
...EIP712Schemas.domain,
|
|
89
89
|
chainId,
|
|
90
90
|
};
|
|
91
91
|
}
|