@evedex/exchange-crypto 1.0.10
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/README.md +1 -0
- package/dist/cjs/index.d.ts +74 -0
- package/dist/cjs/index.js +193 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/utils/constants.d.ts +1 -0
- package/dist/cjs/utils/constants.js +4 -0
- package/dist/cjs/utils/crypto.d.ts +89 -0
- package/dist/cjs/utils/crypto.js +96 -0
- package/dist/cjs/utils/exchange.d.ts +58 -0
- package/dist/cjs/utils/exchange.js +18 -0
- package/dist/cjs/utils/index.d.ts +4 -0
- package/dist/cjs/utils/index.js +20 -0
- package/dist/cjs/utils/numeric.d.ts +2 -0
- package/dist/cjs/utils/numeric.js +11 -0
- package/dist/cjs/utils/validate.d.ts +6 -0
- package/dist/cjs/utils/validate.js +55 -0
- package/dist/mjs/index.d.ts +74 -0
- package/dist/mjs/index.js +173 -0
- package/dist/mjs/package.json +3 -0
- package/dist/mjs/utils/constants.d.ts +1 -0
- package/dist/mjs/utils/constants.js +1 -0
- package/dist/mjs/utils/crypto.d.ts +89 -0
- package/dist/mjs/utils/crypto.js +91 -0
- package/dist/mjs/utils/exchange.d.ts +58 -0
- package/dist/mjs/utils/exchange.js +15 -0
- package/dist/mjs/utils/index.d.ts +4 -0
- package/dist/mjs/utils/index.js +4 -0
- package/dist/mjs/utils/numeric.d.ts +2 -0
- package/dist/mjs/utils/numeric.js +5 -0
- package/dist/mjs/utils/validate.d.ts +6 -0
- package/dist/mjs/utils/validate.js +19 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# exchange-crypto
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Big from "big.js";
|
|
2
|
+
import { SignedPayload, WalletClient, NetworkChain } from "./utils/crypto";
|
|
3
|
+
import { CreateBaseOrder, LimitOrder, MarketOrder, PositionCloseOrder, ReplaceBaseOrder, ReplaceLimitOrder, ReplaceStopLimitOrder, StopLimitOrder, TpSl } from "./utils/exchange";
|
|
4
|
+
export * as utils from "./utils";
|
|
5
|
+
export interface AuthPayload {
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface NormalizeAuthPayload extends AuthPayload {
|
|
9
|
+
address: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SignedAuth extends NormalizeAuthPayload, SignedPayload {
|
|
12
|
+
}
|
|
13
|
+
export declare function signAuth(signer: WalletClient, payload: AuthPayload): Promise<SignedAuth>;
|
|
14
|
+
export interface NormalizeLimitOrder extends CreateBaseOrder, NetworkChain {
|
|
15
|
+
quantity: string;
|
|
16
|
+
limitPrice: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SignedLimitOrder extends NormalizeLimitOrder, SignedPayload {
|
|
19
|
+
quantity: string;
|
|
20
|
+
limitPrice: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function signLimitOrder(signer: WalletClient, order: LimitOrder): Promise<SignedLimitOrder>;
|
|
23
|
+
export interface NormalizeMarketOrder extends CreateBaseOrder, Pick<MarketOrder, "timeInForce">, NetworkChain {
|
|
24
|
+
cashQuantity: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SignedMarketOrder extends NormalizeMarketOrder, SignedPayload {
|
|
27
|
+
}
|
|
28
|
+
export declare function signMarketOrder(signer: WalletClient, order: MarketOrder): Promise<SignedMarketOrder>;
|
|
29
|
+
export interface NormalizeStopLimitOrder extends CreateBaseOrder, NetworkChain {
|
|
30
|
+
quantity: string;
|
|
31
|
+
limitPrice: string;
|
|
32
|
+
stopPrice: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SignedStopLimitOrder extends NormalizeStopLimitOrder, SignedPayload {
|
|
35
|
+
}
|
|
36
|
+
export declare function signStopLimitOrder(signer: WalletClient, order: StopLimitOrder): Promise<SignedStopLimitOrder>;
|
|
37
|
+
export interface NormalizePositionCloseOrder extends Pick<PositionCloseOrder, "instrument" | "leverage" | "id">, NetworkChain {
|
|
38
|
+
quantity: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SignedPositionCloseOrder extends NormalizePositionCloseOrder, SignedPayload {
|
|
41
|
+
}
|
|
42
|
+
export declare function signPositionCloseOrder(signer: WalletClient, order: PositionCloseOrder): Promise<SignedPositionCloseOrder>;
|
|
43
|
+
export interface NormalizeReplaceLimitOrder extends ReplaceBaseOrder {
|
|
44
|
+
quantity: string;
|
|
45
|
+
limitPrice: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SignedReplaceLimitOrder extends NormalizeReplaceLimitOrder, SignedPayload {
|
|
48
|
+
}
|
|
49
|
+
export declare function signReplaceLimitOrder(signer: WalletClient, order: ReplaceLimitOrder): Promise<SignedReplaceLimitOrder>;
|
|
50
|
+
export interface NormalizeReplaceStopLimitOrder extends NormalizeReplaceLimitOrder {
|
|
51
|
+
stopPrice: string;
|
|
52
|
+
}
|
|
53
|
+
export interface SignedReplaceStopLimitOrder extends NormalizeReplaceStopLimitOrder, SignedPayload {
|
|
54
|
+
}
|
|
55
|
+
export declare function signReplaceStopLimitOrder(signer: WalletClient, order: ReplaceStopLimitOrder): Promise<SignedReplaceStopLimitOrder>;
|
|
56
|
+
export interface TradingBalanceWithdraw {
|
|
57
|
+
recipient: string;
|
|
58
|
+
amount: Big.BigSource;
|
|
59
|
+
}
|
|
60
|
+
export interface NormalizeTradingBalanceWithdraw extends Pick<TradingBalanceWithdraw, "recipient"> {
|
|
61
|
+
amount: string;
|
|
62
|
+
}
|
|
63
|
+
export interface SignedTradingBalanceWithdraw extends NormalizeTradingBalanceWithdraw {
|
|
64
|
+
signature: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function signTradingBalanceWithdraw(signer: WalletClient, withdraw: TradingBalanceWithdraw): Promise<SignedTradingBalanceWithdraw>;
|
|
67
|
+
export interface NormalizeTpSl extends Pick<TpSl, "instrument" | "side" | "type" | "order"> {
|
|
68
|
+
quantity: string;
|
|
69
|
+
price: string;
|
|
70
|
+
}
|
|
71
|
+
export interface SignedTpSl extends NormalizeTpSl {
|
|
72
|
+
signature: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function signTpSl(signer: WalletClient, tpsl: TpSl): Promise<SignedTpSl>;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.utils = void 0;
|
|
46
|
+
exports.signAuth = signAuth;
|
|
47
|
+
exports.signLimitOrder = signLimitOrder;
|
|
48
|
+
exports.signMarketOrder = signMarketOrder;
|
|
49
|
+
exports.signStopLimitOrder = signStopLimitOrder;
|
|
50
|
+
exports.signPositionCloseOrder = signPositionCloseOrder;
|
|
51
|
+
exports.signReplaceLimitOrder = signReplaceLimitOrder;
|
|
52
|
+
exports.signReplaceStopLimitOrder = signReplaceStopLimitOrder;
|
|
53
|
+
exports.signTradingBalanceWithdraw = signTradingBalanceWithdraw;
|
|
54
|
+
exports.signTpSl = signTpSl;
|
|
55
|
+
const crypto_1 = require("./utils/crypto");
|
|
56
|
+
const numeric_1 = require("./utils/numeric");
|
|
57
|
+
const validate_1 = require("./utils/validate");
|
|
58
|
+
exports.utils = __importStar(require("./utils"));
|
|
59
|
+
function signAuth(signer, payload) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const address = yield signer.getAddress();
|
|
62
|
+
const signature = yield signer.signMessage(payload.message);
|
|
63
|
+
return {
|
|
64
|
+
address,
|
|
65
|
+
message: payload.message,
|
|
66
|
+
signature,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function signLimitOrder(signer, order) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const chainId = yield signer.getChainId();
|
|
73
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP721Schemas.createLimitOrder);
|
|
74
|
+
const normalize = {
|
|
75
|
+
id: order.id,
|
|
76
|
+
instrument: order.instrument,
|
|
77
|
+
side: order.side,
|
|
78
|
+
leverage: order.leverage,
|
|
79
|
+
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
80
|
+
limitPrice: (0, numeric_1.toMatcherNumber)(order.limitPrice),
|
|
81
|
+
tpsl: order.tpsl,
|
|
82
|
+
chainId,
|
|
83
|
+
};
|
|
84
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP721Schemas.createLimitOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), limitPrice: (0, crypto_1.toEthNumber)(normalize.limitPrice) }));
|
|
85
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function signMarketOrder(signer, order) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const chainId = yield signer.getChainId();
|
|
91
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP721Schemas.createMarketOrder);
|
|
92
|
+
const normalize = {
|
|
93
|
+
id: order.id,
|
|
94
|
+
instrument: order.instrument,
|
|
95
|
+
side: order.side,
|
|
96
|
+
timeInForce: order.timeInForce,
|
|
97
|
+
leverage: order.leverage,
|
|
98
|
+
cashQuantity: (0, numeric_1.toMatcherNumber)(order.cashQuantity),
|
|
99
|
+
tpsl: order.tpsl,
|
|
100
|
+
chainId,
|
|
101
|
+
};
|
|
102
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP721Schemas.createMarketOrder, Object.assign(Object.assign({}, normalize), { cashQuantity: (0, crypto_1.toEthNumber)(normalize.cashQuantity) }));
|
|
103
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function signStopLimitOrder(signer, order) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const chainId = yield signer.getChainId();
|
|
109
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP721Schemas.createStopLimitOrder);
|
|
110
|
+
const normalize = {
|
|
111
|
+
id: order.id,
|
|
112
|
+
instrument: order.instrument,
|
|
113
|
+
side: order.side,
|
|
114
|
+
leverage: order.leverage,
|
|
115
|
+
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
116
|
+
limitPrice: (0, numeric_1.toMatcherNumber)(order.limitPrice),
|
|
117
|
+
stopPrice: (0, numeric_1.toMatcherNumber)(order.stopPrice),
|
|
118
|
+
tpsl: order.tpsl,
|
|
119
|
+
chainId,
|
|
120
|
+
};
|
|
121
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP721Schemas.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) }));
|
|
122
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function signPositionCloseOrder(signer, order) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
const chainId = yield signer.getChainId();
|
|
128
|
+
(0, validate_1.validatePayload)(Object.assign(Object.assign({}, order), { chainId }), crypto_1.EIP721Schemas.createPositionCloseOrder);
|
|
129
|
+
const normalize = {
|
|
130
|
+
id: order.id,
|
|
131
|
+
instrument: order.instrument,
|
|
132
|
+
leverage: order.leverage,
|
|
133
|
+
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
134
|
+
chainId,
|
|
135
|
+
};
|
|
136
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(chainId), crypto_1.EIP721Schemas.createPositionCloseOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity) }));
|
|
137
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function signReplaceLimitOrder(signer, order) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
(0, validate_1.validatePayload)(order, crypto_1.EIP721Schemas.replaceLimitOrder);
|
|
143
|
+
const normalize = {
|
|
144
|
+
orderId: order.orderId,
|
|
145
|
+
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
146
|
+
limitPrice: (0, numeric_1.toMatcherNumber)(order.limitPrice),
|
|
147
|
+
};
|
|
148
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP721Schemas.replaceLimitOrder, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), limitPrice: (0, crypto_1.toEthNumber)(normalize.limitPrice) }));
|
|
149
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function signReplaceStopLimitOrder(signer, order) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
(0, validate_1.validatePayload)(order, crypto_1.EIP721Schemas.replaceStopLimitOrder);
|
|
155
|
+
const normalize = {
|
|
156
|
+
orderId: order.orderId,
|
|
157
|
+
quantity: (0, numeric_1.toMatcherNumber)(order.quantity),
|
|
158
|
+
limitPrice: (0, numeric_1.toMatcherNumber)(order.limitPrice),
|
|
159
|
+
stopPrice: (0, numeric_1.toMatcherNumber)(order.stopPrice),
|
|
160
|
+
};
|
|
161
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP721Schemas.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) }));
|
|
162
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function signTradingBalanceWithdraw(signer, withdraw) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
(0, validate_1.validatePayload)(withdraw, crypto_1.EIP721Schemas.withdraw);
|
|
168
|
+
const normalize = {
|
|
169
|
+
recipient: withdraw.recipient,
|
|
170
|
+
amount: (0, numeric_1.toMatcherNumber)(withdraw.amount),
|
|
171
|
+
};
|
|
172
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP721Schemas.withdraw, {
|
|
173
|
+
recipient: withdraw.recipient,
|
|
174
|
+
amount: (0, crypto_1.toEthNumber)(normalize.amount),
|
|
175
|
+
});
|
|
176
|
+
return Object.assign(Object.assign({}, normalize), { signature });
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function signTpSl(signer, tpsl) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
(0, validate_1.validatePayload)(tpsl, crypto_1.EIP721Schemas.createTpSl);
|
|
182
|
+
const normalize = {
|
|
183
|
+
instrument: tpsl.instrument,
|
|
184
|
+
type: tpsl.type,
|
|
185
|
+
side: tpsl.side,
|
|
186
|
+
quantity: (0, numeric_1.toMatcherNumber)(tpsl.quantity),
|
|
187
|
+
price: (0, numeric_1.toMatcherNumber)(tpsl.price),
|
|
188
|
+
order: tpsl.order,
|
|
189
|
+
};
|
|
190
|
+
const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP721Schemas.createTpSl, Object.assign(Object.assign({}, normalize), { quantity: (0, crypto_1.toEthNumber)(normalize.quantity), price: (0, crypto_1.toEthNumber)(normalize.price) }));
|
|
191
|
+
return Object.assign(Object.assign({}, normalize), { signature: signer.serializeSignature(signature) });
|
|
192
|
+
});
|
|
193
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MATCHER_PRECISION = 8;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import Big from "big.js";
|
|
2
|
+
export declare const EIP721Schemas: {
|
|
3
|
+
domain: {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
salt: string;
|
|
7
|
+
};
|
|
8
|
+
withdraw: {
|
|
9
|
+
Withdraw: {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
createLimitOrder: {
|
|
15
|
+
"New limit order": {
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
createMarketOrder: {
|
|
21
|
+
"New market order": {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
createStopLimitOrder: {
|
|
27
|
+
"New stop-limit order": {
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
createPositionCloseOrder: {
|
|
33
|
+
"Position close order": {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
createTpSl: {
|
|
39
|
+
"New take-profit/stop-loss": {
|
|
40
|
+
name: string;
|
|
41
|
+
type: string;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
replaceLimitOrder: {
|
|
45
|
+
"Replace limit order": {
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
replaceStopLimitOrder: {
|
|
51
|
+
"Replace stop-limit order": {
|
|
52
|
+
name: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare function getDomainData(chainId: string): {
|
|
58
|
+
chainId: string;
|
|
59
|
+
name: string;
|
|
60
|
+
version: string;
|
|
61
|
+
salt: string;
|
|
62
|
+
};
|
|
63
|
+
export declare function toEthNumber(value: Big.BigSource): string;
|
|
64
|
+
export interface SignedPayload {
|
|
65
|
+
signature: string;
|
|
66
|
+
}
|
|
67
|
+
export interface NetworkChain {
|
|
68
|
+
chainId: string;
|
|
69
|
+
}
|
|
70
|
+
export interface TypedDataDomain {
|
|
71
|
+
name?: null | string;
|
|
72
|
+
version?: null | string;
|
|
73
|
+
chainId?: null | string | number | bigint;
|
|
74
|
+
verifyingContract?: null | string;
|
|
75
|
+
salt?: null | string | Uint8Array;
|
|
76
|
+
}
|
|
77
|
+
export interface TypedDataField {
|
|
78
|
+
name: string;
|
|
79
|
+
type: string;
|
|
80
|
+
}
|
|
81
|
+
export interface WalletClient {
|
|
82
|
+
getChainId(): Promise<string> | string;
|
|
83
|
+
getAddress(): Promise<string>;
|
|
84
|
+
solidityPackedKeccak256(types: string[], values: any[]): string;
|
|
85
|
+
getBytes(value: string): Uint8Array;
|
|
86
|
+
serializeSignature(signature: string): string;
|
|
87
|
+
signMessage(message: string | Uint8Array): Promise<string>;
|
|
88
|
+
signTypedData(domain: any, types: Record<string, TypedDataField[]>, value: Record<string, any>): Promise<string>;
|
|
89
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EIP721Schemas = void 0;
|
|
7
|
+
exports.getDomainData = getDomainData;
|
|
8
|
+
exports.toEthNumber = toEthNumber;
|
|
9
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
10
|
+
const constants_1 = require("./constants");
|
|
11
|
+
exports.EIP721Schemas = {
|
|
12
|
+
domain: {
|
|
13
|
+
name: "EVEDEX",
|
|
14
|
+
version: "1",
|
|
15
|
+
salt: "0x5792f7333c35db190e30acc144f049fd15b24f552c0010b8b3e06f9105c37c5a",
|
|
16
|
+
},
|
|
17
|
+
withdraw: {
|
|
18
|
+
Withdraw: [
|
|
19
|
+
{ name: "recipient", type: "address" },
|
|
20
|
+
{ name: "amount", type: "uint256" },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
createLimitOrder: {
|
|
24
|
+
"New limit order": [
|
|
25
|
+
{ name: "id", type: "string" },
|
|
26
|
+
{ name: "instrument", type: "string" },
|
|
27
|
+
{ name: "side", type: "string" },
|
|
28
|
+
{ name: "leverage", type: "uint8" },
|
|
29
|
+
{ name: "quantity", type: "uint96" },
|
|
30
|
+
{ name: "limitPrice", type: "uint80" },
|
|
31
|
+
{ name: "chainId", type: "uint256" },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
createMarketOrder: {
|
|
35
|
+
"New market order": [
|
|
36
|
+
{ name: "id", type: "string" },
|
|
37
|
+
{ name: "instrument", type: "string" },
|
|
38
|
+
{ name: "side", type: "string" },
|
|
39
|
+
{ name: "timeInForce", type: "string" },
|
|
40
|
+
{ name: "leverage", type: "uint8" },
|
|
41
|
+
{ name: "cashQuantity", type: "uint96" },
|
|
42
|
+
{ name: "chainId", type: "uint256" },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
createStopLimitOrder: {
|
|
46
|
+
"New stop-limit order": [
|
|
47
|
+
{ name: "id", type: "string" },
|
|
48
|
+
{ name: "instrument", type: "string" },
|
|
49
|
+
{ name: "side", type: "string" },
|
|
50
|
+
{ name: "leverage", type: "uint8" },
|
|
51
|
+
{ name: "quantity", type: "uint96" },
|
|
52
|
+
{ name: "limitPrice", type: "uint80" },
|
|
53
|
+
{ name: "stopPrice", type: "uint80" },
|
|
54
|
+
{ name: "chainId", type: "uint256" },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
createPositionCloseOrder: {
|
|
58
|
+
"Position close order": [
|
|
59
|
+
{ name: "id", type: "string" },
|
|
60
|
+
{ name: "instrument", type: "string" },
|
|
61
|
+
{ name: "leverage", type: "uint8" },
|
|
62
|
+
{ name: "quantity", type: "uint96" },
|
|
63
|
+
{ name: "chainId", type: "uint256" },
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
createTpSl: {
|
|
67
|
+
"New take-profit/stop-loss": [
|
|
68
|
+
{ name: "instrument", type: "string" },
|
|
69
|
+
{ name: "type", type: "string" },
|
|
70
|
+
{ name: "side", type: "string" },
|
|
71
|
+
{ name: "quantity", type: "uint96" },
|
|
72
|
+
{ name: "price", type: "uint80" },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
replaceLimitOrder: {
|
|
76
|
+
"Replace limit order": [
|
|
77
|
+
{ name: "orderId", type: "string" },
|
|
78
|
+
{ name: "quantity", type: "uint96" },
|
|
79
|
+
{ name: "limitPrice", type: "uint80" },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
replaceStopLimitOrder: {
|
|
83
|
+
"Replace stop-limit order": [
|
|
84
|
+
{ name: "orderId", type: "string" },
|
|
85
|
+
{ name: "quantity", type: "uint96" },
|
|
86
|
+
{ name: "limitPrice", type: "uint80" },
|
|
87
|
+
{ name: "stopPrice", type: "uint80" },
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
function getDomainData(chainId) {
|
|
92
|
+
return Object.assign(Object.assign({}, exports.EIP721Schemas.domain), { chainId });
|
|
93
|
+
}
|
|
94
|
+
function toEthNumber(value) {
|
|
95
|
+
return (0, big_js_1.default)(value).mul(`1e${constants_1.MATCHER_PRECISION}`).toFixed(0);
|
|
96
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare enum Side {
|
|
2
|
+
Buy = "BUY",
|
|
3
|
+
Sell = "SELL"
|
|
4
|
+
}
|
|
5
|
+
export declare enum TimeInForce {
|
|
6
|
+
FOK = "FOK",
|
|
7
|
+
IOC = "IOC"
|
|
8
|
+
}
|
|
9
|
+
export declare enum TpSlType {
|
|
10
|
+
TakeProfit = "take-profit",
|
|
11
|
+
StopLoss = "stop-loss"
|
|
12
|
+
}
|
|
13
|
+
export interface OrderTpSl {
|
|
14
|
+
type: TpSlType;
|
|
15
|
+
side: Side;
|
|
16
|
+
quantity: Big.BigSource;
|
|
17
|
+
price: Big.BigSource;
|
|
18
|
+
}
|
|
19
|
+
export interface TpSl extends OrderTpSl {
|
|
20
|
+
instrument: string;
|
|
21
|
+
order: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateBaseOrder {
|
|
24
|
+
id: string;
|
|
25
|
+
instrument: string;
|
|
26
|
+
side: Side;
|
|
27
|
+
leverage: number;
|
|
28
|
+
tpsl?: OrderTpSl[] | null;
|
|
29
|
+
}
|
|
30
|
+
export interface LimitOrder extends CreateBaseOrder {
|
|
31
|
+
quantity: Big.BigSource;
|
|
32
|
+
limitPrice: Big.BigSource;
|
|
33
|
+
}
|
|
34
|
+
export interface MarketOrder extends CreateBaseOrder {
|
|
35
|
+
timeInForce: TimeInForce;
|
|
36
|
+
cashQuantity: Big.BigSource;
|
|
37
|
+
}
|
|
38
|
+
export interface StopLimitOrder extends CreateBaseOrder {
|
|
39
|
+
quantity: Big.BigSource;
|
|
40
|
+
limitPrice: Big.BigSource;
|
|
41
|
+
stopPrice: Big.BigSource;
|
|
42
|
+
}
|
|
43
|
+
export interface PositionCloseOrder {
|
|
44
|
+
id: string;
|
|
45
|
+
instrument: string;
|
|
46
|
+
leverage: number;
|
|
47
|
+
quantity: Big.BigSource;
|
|
48
|
+
}
|
|
49
|
+
export interface ReplaceBaseOrder {
|
|
50
|
+
orderId: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ReplaceLimitOrder extends ReplaceBaseOrder {
|
|
53
|
+
quantity: Big.BigSource;
|
|
54
|
+
limitPrice: Big.BigSource;
|
|
55
|
+
}
|
|
56
|
+
export interface ReplaceStopLimitOrder extends ReplaceLimitOrder {
|
|
57
|
+
stopPrice: Big.BigSource;
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TpSlType = exports.TimeInForce = exports.Side = void 0;
|
|
4
|
+
var Side;
|
|
5
|
+
(function (Side) {
|
|
6
|
+
Side["Buy"] = "BUY";
|
|
7
|
+
Side["Sell"] = "SELL";
|
|
8
|
+
})(Side || (exports.Side = Side = {}));
|
|
9
|
+
var TimeInForce;
|
|
10
|
+
(function (TimeInForce) {
|
|
11
|
+
TimeInForce["FOK"] = "FOK";
|
|
12
|
+
TimeInForce["IOC"] = "IOC";
|
|
13
|
+
})(TimeInForce || (exports.TimeInForce = TimeInForce = {}));
|
|
14
|
+
var TpSlType;
|
|
15
|
+
(function (TpSlType) {
|
|
16
|
+
TpSlType["TakeProfit"] = "take-profit";
|
|
17
|
+
TpSlType["StopLoss"] = "stop-loss";
|
|
18
|
+
})(TpSlType || (exports.TpSlType = TpSlType = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants"), exports);
|
|
18
|
+
__exportStar(require("./numeric"), exports);
|
|
19
|
+
__exportStar(require("./crypto"), exports);
|
|
20
|
+
__exportStar(require("./exchange"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.toMatcherNumber = toMatcherNumber;
|
|
7
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
function toMatcherNumber(value) {
|
|
10
|
+
return (0, big_js_1.default)(value).round(constants_1.MATCHER_PRECISION, big_js_1.default.roundHalfUp).toString();
|
|
11
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.validatePayload = validatePayload;
|
|
37
|
+
const ethers = __importStar(require("ethers"));
|
|
38
|
+
function validatePayload(payload, schema) {
|
|
39
|
+
if (typeof payload !== "object") {
|
|
40
|
+
throw new Error("Payload must be an object");
|
|
41
|
+
}
|
|
42
|
+
const [schemaFields] = Object.values(schema);
|
|
43
|
+
schemaFields.forEach((field) => {
|
|
44
|
+
if (!payload[field.name]) {
|
|
45
|
+
throw new Error(`Missing field "${field.name}" in payload`);
|
|
46
|
+
}
|
|
47
|
+
if (field.type.includes("uint") &&
|
|
48
|
+
(isNaN(Number(payload[field.name])) || Number(payload[field.name]) < 0)) {
|
|
49
|
+
throw new Error(`Field "${field.name}" incorrect uint type`);
|
|
50
|
+
}
|
|
51
|
+
if (field.type === "address" && !ethers.isAddress(payload[field.name])) {
|
|
52
|
+
throw new Error(`Field "${field.name}" incorrect address type`);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import Big from "big.js";
|
|
2
|
+
import { SignedPayload, WalletClient, NetworkChain } from "./utils/crypto";
|
|
3
|
+
import { CreateBaseOrder, LimitOrder, MarketOrder, PositionCloseOrder, ReplaceBaseOrder, ReplaceLimitOrder, ReplaceStopLimitOrder, StopLimitOrder, TpSl } from "./utils/exchange";
|
|
4
|
+
export * as utils from "./utils";
|
|
5
|
+
export interface AuthPayload {
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface NormalizeAuthPayload extends AuthPayload {
|
|
9
|
+
address: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SignedAuth extends NormalizeAuthPayload, SignedPayload {
|
|
12
|
+
}
|
|
13
|
+
export declare function signAuth(signer: WalletClient, payload: AuthPayload): Promise<SignedAuth>;
|
|
14
|
+
export interface NormalizeLimitOrder extends CreateBaseOrder, NetworkChain {
|
|
15
|
+
quantity: string;
|
|
16
|
+
limitPrice: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SignedLimitOrder extends NormalizeLimitOrder, SignedPayload {
|
|
19
|
+
quantity: string;
|
|
20
|
+
limitPrice: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function signLimitOrder(signer: WalletClient, order: LimitOrder): Promise<SignedLimitOrder>;
|
|
23
|
+
export interface NormalizeMarketOrder extends CreateBaseOrder, Pick<MarketOrder, "timeInForce">, NetworkChain {
|
|
24
|
+
cashQuantity: string;
|
|
25
|
+
}
|
|
26
|
+
export interface SignedMarketOrder extends NormalizeMarketOrder, SignedPayload {
|
|
27
|
+
}
|
|
28
|
+
export declare function signMarketOrder(signer: WalletClient, order: MarketOrder): Promise<SignedMarketOrder>;
|
|
29
|
+
export interface NormalizeStopLimitOrder extends CreateBaseOrder, NetworkChain {
|
|
30
|
+
quantity: string;
|
|
31
|
+
limitPrice: string;
|
|
32
|
+
stopPrice: string;
|
|
33
|
+
}
|
|
34
|
+
export interface SignedStopLimitOrder extends NormalizeStopLimitOrder, SignedPayload {
|
|
35
|
+
}
|
|
36
|
+
export declare function signStopLimitOrder(signer: WalletClient, order: StopLimitOrder): Promise<SignedStopLimitOrder>;
|
|
37
|
+
export interface NormalizePositionCloseOrder extends Pick<PositionCloseOrder, "instrument" | "leverage" | "id">, NetworkChain {
|
|
38
|
+
quantity: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SignedPositionCloseOrder extends NormalizePositionCloseOrder, SignedPayload {
|
|
41
|
+
}
|
|
42
|
+
export declare function signPositionCloseOrder(signer: WalletClient, order: PositionCloseOrder): Promise<SignedPositionCloseOrder>;
|
|
43
|
+
export interface NormalizeReplaceLimitOrder extends ReplaceBaseOrder {
|
|
44
|
+
quantity: string;
|
|
45
|
+
limitPrice: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SignedReplaceLimitOrder extends NormalizeReplaceLimitOrder, SignedPayload {
|
|
48
|
+
}
|
|
49
|
+
export declare function signReplaceLimitOrder(signer: WalletClient, order: ReplaceLimitOrder): Promise<SignedReplaceLimitOrder>;
|
|
50
|
+
export interface NormalizeReplaceStopLimitOrder extends NormalizeReplaceLimitOrder {
|
|
51
|
+
stopPrice: string;
|
|
52
|
+
}
|
|
53
|
+
export interface SignedReplaceStopLimitOrder extends NormalizeReplaceStopLimitOrder, SignedPayload {
|
|
54
|
+
}
|
|
55
|
+
export declare function signReplaceStopLimitOrder(signer: WalletClient, order: ReplaceStopLimitOrder): Promise<SignedReplaceStopLimitOrder>;
|
|
56
|
+
export interface TradingBalanceWithdraw {
|
|
57
|
+
recipient: string;
|
|
58
|
+
amount: Big.BigSource;
|
|
59
|
+
}
|
|
60
|
+
export interface NormalizeTradingBalanceWithdraw extends Pick<TradingBalanceWithdraw, "recipient"> {
|
|
61
|
+
amount: string;
|
|
62
|
+
}
|
|
63
|
+
export interface SignedTradingBalanceWithdraw extends NormalizeTradingBalanceWithdraw {
|
|
64
|
+
signature: string;
|
|
65
|
+
}
|
|
66
|
+
export declare function signTradingBalanceWithdraw(signer: WalletClient, withdraw: TradingBalanceWithdraw): Promise<SignedTradingBalanceWithdraw>;
|
|
67
|
+
export interface NormalizeTpSl extends Pick<TpSl, "instrument" | "side" | "type" | "order"> {
|
|
68
|
+
quantity: string;
|
|
69
|
+
price: string;
|
|
70
|
+
}
|
|
71
|
+
export interface SignedTpSl extends NormalizeTpSl {
|
|
72
|
+
signature: string;
|
|
73
|
+
}
|
|
74
|
+
export declare function signTpSl(signer: WalletClient, tpsl: TpSl): Promise<SignedTpSl>;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { EIP721Schemas, getDomainData, toEthNumber, } from "./utils/crypto";
|
|
2
|
+
import { toMatcherNumber } from "./utils/numeric";
|
|
3
|
+
import { validatePayload } from "./utils/validate";
|
|
4
|
+
export * as utils from "./utils";
|
|
5
|
+
export async function signAuth(signer, payload) {
|
|
6
|
+
const address = await signer.getAddress();
|
|
7
|
+
const signature = await signer.signMessage(payload.message);
|
|
8
|
+
return {
|
|
9
|
+
address,
|
|
10
|
+
message: payload.message,
|
|
11
|
+
signature,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export async function signLimitOrder(signer, order) {
|
|
15
|
+
const chainId = await signer.getChainId();
|
|
16
|
+
validatePayload({ ...order, chainId }, EIP721Schemas.createLimitOrder);
|
|
17
|
+
const normalize = {
|
|
18
|
+
id: order.id,
|
|
19
|
+
instrument: order.instrument,
|
|
20
|
+
side: order.side,
|
|
21
|
+
leverage: order.leverage,
|
|
22
|
+
quantity: toMatcherNumber(order.quantity),
|
|
23
|
+
limitPrice: toMatcherNumber(order.limitPrice),
|
|
24
|
+
tpsl: order.tpsl,
|
|
25
|
+
chainId,
|
|
26
|
+
};
|
|
27
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP721Schemas.createLimitOrder, {
|
|
28
|
+
...normalize,
|
|
29
|
+
quantity: toEthNumber(normalize.quantity),
|
|
30
|
+
limitPrice: toEthNumber(normalize.limitPrice),
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
...normalize,
|
|
34
|
+
signature: signer.serializeSignature(signature),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export async function signMarketOrder(signer, order) {
|
|
38
|
+
const chainId = await signer.getChainId();
|
|
39
|
+
validatePayload({ ...order, chainId }, EIP721Schemas.createMarketOrder);
|
|
40
|
+
const normalize = {
|
|
41
|
+
id: order.id,
|
|
42
|
+
instrument: order.instrument,
|
|
43
|
+
side: order.side,
|
|
44
|
+
timeInForce: order.timeInForce,
|
|
45
|
+
leverage: order.leverage,
|
|
46
|
+
cashQuantity: toMatcherNumber(order.cashQuantity),
|
|
47
|
+
tpsl: order.tpsl,
|
|
48
|
+
chainId,
|
|
49
|
+
};
|
|
50
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP721Schemas.createMarketOrder, {
|
|
51
|
+
...normalize,
|
|
52
|
+
cashQuantity: toEthNumber(normalize.cashQuantity),
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
...normalize,
|
|
56
|
+
signature: signer.serializeSignature(signature),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export async function signStopLimitOrder(signer, order) {
|
|
60
|
+
const chainId = await signer.getChainId();
|
|
61
|
+
validatePayload({ ...order, chainId }, EIP721Schemas.createStopLimitOrder);
|
|
62
|
+
const normalize = {
|
|
63
|
+
id: order.id,
|
|
64
|
+
instrument: order.instrument,
|
|
65
|
+
side: order.side,
|
|
66
|
+
leverage: order.leverage,
|
|
67
|
+
quantity: toMatcherNumber(order.quantity),
|
|
68
|
+
limitPrice: toMatcherNumber(order.limitPrice),
|
|
69
|
+
stopPrice: toMatcherNumber(order.stopPrice),
|
|
70
|
+
tpsl: order.tpsl,
|
|
71
|
+
chainId,
|
|
72
|
+
};
|
|
73
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP721Schemas.createStopLimitOrder, {
|
|
74
|
+
...normalize,
|
|
75
|
+
quantity: toEthNumber(normalize.quantity),
|
|
76
|
+
limitPrice: toEthNumber(normalize.limitPrice),
|
|
77
|
+
stopPrice: toEthNumber(normalize.stopPrice),
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
...normalize,
|
|
81
|
+
signature: signer.serializeSignature(signature),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export async function signPositionCloseOrder(signer, order) {
|
|
85
|
+
const chainId = await signer.getChainId();
|
|
86
|
+
validatePayload({ ...order, chainId }, EIP721Schemas.createPositionCloseOrder);
|
|
87
|
+
const normalize = {
|
|
88
|
+
id: order.id,
|
|
89
|
+
instrument: order.instrument,
|
|
90
|
+
leverage: order.leverage,
|
|
91
|
+
quantity: toMatcherNumber(order.quantity),
|
|
92
|
+
chainId,
|
|
93
|
+
};
|
|
94
|
+
const signature = await signer.signTypedData(getDomainData(chainId), EIP721Schemas.createPositionCloseOrder, {
|
|
95
|
+
...normalize,
|
|
96
|
+
quantity: toEthNumber(normalize.quantity),
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
...normalize,
|
|
100
|
+
signature: signer.serializeSignature(signature),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export async function signReplaceLimitOrder(signer, order) {
|
|
104
|
+
validatePayload(order, EIP721Schemas.replaceLimitOrder);
|
|
105
|
+
const normalize = {
|
|
106
|
+
orderId: order.orderId,
|
|
107
|
+
quantity: toMatcherNumber(order.quantity),
|
|
108
|
+
limitPrice: toMatcherNumber(order.limitPrice),
|
|
109
|
+
};
|
|
110
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP721Schemas.replaceLimitOrder, {
|
|
111
|
+
...normalize,
|
|
112
|
+
quantity: toEthNumber(normalize.quantity),
|
|
113
|
+
limitPrice: toEthNumber(normalize.limitPrice),
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
...normalize,
|
|
117
|
+
signature: signer.serializeSignature(signature),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
export async function signReplaceStopLimitOrder(signer, order) {
|
|
121
|
+
validatePayload(order, EIP721Schemas.replaceStopLimitOrder);
|
|
122
|
+
const normalize = {
|
|
123
|
+
orderId: order.orderId,
|
|
124
|
+
quantity: toMatcherNumber(order.quantity),
|
|
125
|
+
limitPrice: toMatcherNumber(order.limitPrice),
|
|
126
|
+
stopPrice: toMatcherNumber(order.stopPrice),
|
|
127
|
+
};
|
|
128
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP721Schemas.replaceStopLimitOrder, {
|
|
129
|
+
...normalize,
|
|
130
|
+
quantity: toEthNumber(normalize.quantity),
|
|
131
|
+
limitPrice: toEthNumber(normalize.limitPrice),
|
|
132
|
+
stopPrice: toEthNumber(normalize.stopPrice),
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
...normalize,
|
|
136
|
+
signature: signer.serializeSignature(signature),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
export async function signTradingBalanceWithdraw(signer, withdraw) {
|
|
140
|
+
validatePayload(withdraw, EIP721Schemas.withdraw);
|
|
141
|
+
const normalize = {
|
|
142
|
+
recipient: withdraw.recipient,
|
|
143
|
+
amount: toMatcherNumber(withdraw.amount),
|
|
144
|
+
};
|
|
145
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP721Schemas.withdraw, {
|
|
146
|
+
recipient: withdraw.recipient,
|
|
147
|
+
amount: toEthNumber(normalize.amount),
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
...normalize,
|
|
151
|
+
signature,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export async function signTpSl(signer, tpsl) {
|
|
155
|
+
validatePayload(tpsl, EIP721Schemas.createTpSl);
|
|
156
|
+
const normalize = {
|
|
157
|
+
instrument: tpsl.instrument,
|
|
158
|
+
type: tpsl.type,
|
|
159
|
+
side: tpsl.side,
|
|
160
|
+
quantity: toMatcherNumber(tpsl.quantity),
|
|
161
|
+
price: toMatcherNumber(tpsl.price),
|
|
162
|
+
order: tpsl.order,
|
|
163
|
+
};
|
|
164
|
+
const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP721Schemas.createTpSl, {
|
|
165
|
+
...normalize,
|
|
166
|
+
quantity: toEthNumber(normalize.quantity),
|
|
167
|
+
price: toEthNumber(normalize.price),
|
|
168
|
+
});
|
|
169
|
+
return {
|
|
170
|
+
...normalize,
|
|
171
|
+
signature: signer.serializeSignature(signature),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MATCHER_PRECISION = 8;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MATCHER_PRECISION = 8;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import Big from "big.js";
|
|
2
|
+
export declare const EIP721Schemas: {
|
|
3
|
+
domain: {
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
salt: string;
|
|
7
|
+
};
|
|
8
|
+
withdraw: {
|
|
9
|
+
Withdraw: {
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
createLimitOrder: {
|
|
15
|
+
"New limit order": {
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
createMarketOrder: {
|
|
21
|
+
"New market order": {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
26
|
+
createStopLimitOrder: {
|
|
27
|
+
"New stop-limit order": {
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
createPositionCloseOrder: {
|
|
33
|
+
"Position close order": {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
createTpSl: {
|
|
39
|
+
"New take-profit/stop-loss": {
|
|
40
|
+
name: string;
|
|
41
|
+
type: string;
|
|
42
|
+
}[];
|
|
43
|
+
};
|
|
44
|
+
replaceLimitOrder: {
|
|
45
|
+
"Replace limit order": {
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
replaceStopLimitOrder: {
|
|
51
|
+
"Replace stop-limit order": {
|
|
52
|
+
name: string;
|
|
53
|
+
type: string;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare function getDomainData(chainId: string): {
|
|
58
|
+
chainId: string;
|
|
59
|
+
name: string;
|
|
60
|
+
version: string;
|
|
61
|
+
salt: string;
|
|
62
|
+
};
|
|
63
|
+
export declare function toEthNumber(value: Big.BigSource): string;
|
|
64
|
+
export interface SignedPayload {
|
|
65
|
+
signature: string;
|
|
66
|
+
}
|
|
67
|
+
export interface NetworkChain {
|
|
68
|
+
chainId: string;
|
|
69
|
+
}
|
|
70
|
+
export interface TypedDataDomain {
|
|
71
|
+
name?: null | string;
|
|
72
|
+
version?: null | string;
|
|
73
|
+
chainId?: null | string | number | bigint;
|
|
74
|
+
verifyingContract?: null | string;
|
|
75
|
+
salt?: null | string | Uint8Array;
|
|
76
|
+
}
|
|
77
|
+
export interface TypedDataField {
|
|
78
|
+
name: string;
|
|
79
|
+
type: string;
|
|
80
|
+
}
|
|
81
|
+
export interface WalletClient {
|
|
82
|
+
getChainId(): Promise<string> | string;
|
|
83
|
+
getAddress(): Promise<string>;
|
|
84
|
+
solidityPackedKeccak256(types: string[], values: any[]): string;
|
|
85
|
+
getBytes(value: string): Uint8Array;
|
|
86
|
+
serializeSignature(signature: string): string;
|
|
87
|
+
signMessage(message: string | Uint8Array): Promise<string>;
|
|
88
|
+
signTypedData(domain: any, types: Record<string, TypedDataField[]>, value: Record<string, any>): Promise<string>;
|
|
89
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import Big from "big.js";
|
|
2
|
+
import { MATCHER_PRECISION } from "./constants";
|
|
3
|
+
export const EIP721Schemas = {
|
|
4
|
+
domain: {
|
|
5
|
+
name: "EVEDEX",
|
|
6
|
+
version: "1",
|
|
7
|
+
salt: "0x5792f7333c35db190e30acc144f049fd15b24f552c0010b8b3e06f9105c37c5a",
|
|
8
|
+
},
|
|
9
|
+
withdraw: {
|
|
10
|
+
Withdraw: [
|
|
11
|
+
{ name: "recipient", type: "address" },
|
|
12
|
+
{ name: "amount", type: "uint256" },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
createLimitOrder: {
|
|
16
|
+
"New limit order": [
|
|
17
|
+
{ name: "id", type: "string" },
|
|
18
|
+
{ name: "instrument", type: "string" },
|
|
19
|
+
{ name: "side", type: "string" },
|
|
20
|
+
{ name: "leverage", type: "uint8" },
|
|
21
|
+
{ name: "quantity", type: "uint96" },
|
|
22
|
+
{ name: "limitPrice", type: "uint80" },
|
|
23
|
+
{ name: "chainId", type: "uint256" },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
createMarketOrder: {
|
|
27
|
+
"New market order": [
|
|
28
|
+
{ name: "id", type: "string" },
|
|
29
|
+
{ name: "instrument", type: "string" },
|
|
30
|
+
{ name: "side", type: "string" },
|
|
31
|
+
{ name: "timeInForce", type: "string" },
|
|
32
|
+
{ name: "leverage", type: "uint8" },
|
|
33
|
+
{ name: "cashQuantity", type: "uint96" },
|
|
34
|
+
{ name: "chainId", type: "uint256" },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
createStopLimitOrder: {
|
|
38
|
+
"New stop-limit order": [
|
|
39
|
+
{ name: "id", type: "string" },
|
|
40
|
+
{ name: "instrument", type: "string" },
|
|
41
|
+
{ name: "side", type: "string" },
|
|
42
|
+
{ name: "leverage", type: "uint8" },
|
|
43
|
+
{ name: "quantity", type: "uint96" },
|
|
44
|
+
{ name: "limitPrice", type: "uint80" },
|
|
45
|
+
{ name: "stopPrice", type: "uint80" },
|
|
46
|
+
{ name: "chainId", type: "uint256" },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
createPositionCloseOrder: {
|
|
50
|
+
"Position close order": [
|
|
51
|
+
{ name: "id", type: "string" },
|
|
52
|
+
{ name: "instrument", type: "string" },
|
|
53
|
+
{ name: "leverage", type: "uint8" },
|
|
54
|
+
{ name: "quantity", type: "uint96" },
|
|
55
|
+
{ name: "chainId", type: "uint256" },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
createTpSl: {
|
|
59
|
+
"New take-profit/stop-loss": [
|
|
60
|
+
{ name: "instrument", type: "string" },
|
|
61
|
+
{ name: "type", type: "string" },
|
|
62
|
+
{ name: "side", type: "string" },
|
|
63
|
+
{ name: "quantity", type: "uint96" },
|
|
64
|
+
{ name: "price", type: "uint80" },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
replaceLimitOrder: {
|
|
68
|
+
"Replace limit order": [
|
|
69
|
+
{ name: "orderId", type: "string" },
|
|
70
|
+
{ name: "quantity", type: "uint96" },
|
|
71
|
+
{ name: "limitPrice", type: "uint80" },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
replaceStopLimitOrder: {
|
|
75
|
+
"Replace stop-limit order": [
|
|
76
|
+
{ name: "orderId", type: "string" },
|
|
77
|
+
{ name: "quantity", type: "uint96" },
|
|
78
|
+
{ name: "limitPrice", type: "uint80" },
|
|
79
|
+
{ name: "stopPrice", type: "uint80" },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
export function getDomainData(chainId) {
|
|
84
|
+
return {
|
|
85
|
+
...EIP721Schemas.domain,
|
|
86
|
+
chainId,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function toEthNumber(value) {
|
|
90
|
+
return Big(value).mul(`1e${MATCHER_PRECISION}`).toFixed(0);
|
|
91
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare enum Side {
|
|
2
|
+
Buy = "BUY",
|
|
3
|
+
Sell = "SELL"
|
|
4
|
+
}
|
|
5
|
+
export declare enum TimeInForce {
|
|
6
|
+
FOK = "FOK",
|
|
7
|
+
IOC = "IOC"
|
|
8
|
+
}
|
|
9
|
+
export declare enum TpSlType {
|
|
10
|
+
TakeProfit = "take-profit",
|
|
11
|
+
StopLoss = "stop-loss"
|
|
12
|
+
}
|
|
13
|
+
export interface OrderTpSl {
|
|
14
|
+
type: TpSlType;
|
|
15
|
+
side: Side;
|
|
16
|
+
quantity: Big.BigSource;
|
|
17
|
+
price: Big.BigSource;
|
|
18
|
+
}
|
|
19
|
+
export interface TpSl extends OrderTpSl {
|
|
20
|
+
instrument: string;
|
|
21
|
+
order: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateBaseOrder {
|
|
24
|
+
id: string;
|
|
25
|
+
instrument: string;
|
|
26
|
+
side: Side;
|
|
27
|
+
leverage: number;
|
|
28
|
+
tpsl?: OrderTpSl[] | null;
|
|
29
|
+
}
|
|
30
|
+
export interface LimitOrder extends CreateBaseOrder {
|
|
31
|
+
quantity: Big.BigSource;
|
|
32
|
+
limitPrice: Big.BigSource;
|
|
33
|
+
}
|
|
34
|
+
export interface MarketOrder extends CreateBaseOrder {
|
|
35
|
+
timeInForce: TimeInForce;
|
|
36
|
+
cashQuantity: Big.BigSource;
|
|
37
|
+
}
|
|
38
|
+
export interface StopLimitOrder extends CreateBaseOrder {
|
|
39
|
+
quantity: Big.BigSource;
|
|
40
|
+
limitPrice: Big.BigSource;
|
|
41
|
+
stopPrice: Big.BigSource;
|
|
42
|
+
}
|
|
43
|
+
export interface PositionCloseOrder {
|
|
44
|
+
id: string;
|
|
45
|
+
instrument: string;
|
|
46
|
+
leverage: number;
|
|
47
|
+
quantity: Big.BigSource;
|
|
48
|
+
}
|
|
49
|
+
export interface ReplaceBaseOrder {
|
|
50
|
+
orderId: string;
|
|
51
|
+
}
|
|
52
|
+
export interface ReplaceLimitOrder extends ReplaceBaseOrder {
|
|
53
|
+
quantity: Big.BigSource;
|
|
54
|
+
limitPrice: Big.BigSource;
|
|
55
|
+
}
|
|
56
|
+
export interface ReplaceStopLimitOrder extends ReplaceLimitOrder {
|
|
57
|
+
stopPrice: Big.BigSource;
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export var Side;
|
|
2
|
+
(function (Side) {
|
|
3
|
+
Side["Buy"] = "BUY";
|
|
4
|
+
Side["Sell"] = "SELL";
|
|
5
|
+
})(Side || (Side = {}));
|
|
6
|
+
export var TimeInForce;
|
|
7
|
+
(function (TimeInForce) {
|
|
8
|
+
TimeInForce["FOK"] = "FOK";
|
|
9
|
+
TimeInForce["IOC"] = "IOC";
|
|
10
|
+
})(TimeInForce || (TimeInForce = {}));
|
|
11
|
+
export var TpSlType;
|
|
12
|
+
(function (TpSlType) {
|
|
13
|
+
TpSlType["TakeProfit"] = "take-profit";
|
|
14
|
+
TpSlType["StopLoss"] = "stop-loss";
|
|
15
|
+
})(TpSlType || (TpSlType = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as ethers from "ethers";
|
|
2
|
+
export function validatePayload(payload, schema) {
|
|
3
|
+
if (typeof payload !== "object") {
|
|
4
|
+
throw new Error("Payload must be an object");
|
|
5
|
+
}
|
|
6
|
+
const [schemaFields] = Object.values(schema);
|
|
7
|
+
schemaFields.forEach((field) => {
|
|
8
|
+
if (!payload[field.name]) {
|
|
9
|
+
throw new Error(`Missing field "${field.name}" in payload`);
|
|
10
|
+
}
|
|
11
|
+
if (field.type.includes("uint") &&
|
|
12
|
+
(isNaN(Number(payload[field.name])) || Number(payload[field.name]) < 0)) {
|
|
13
|
+
throw new Error(`Field "${field.name}" incorrect uint type`);
|
|
14
|
+
}
|
|
15
|
+
if (field.type === "address" && !ethers.isAddress(payload[field.name])) {
|
|
16
|
+
throw new Error(`Field "${field.name}" incorrect address type`);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@evedex/exchange-crypto",
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/mjs/index.js",
|
|
7
|
+
"types": "dist/mjs/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/mjs/index.js",
|
|
11
|
+
"require": "./dist/cjs/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"prebuild": "npm run lint",
|
|
19
|
+
"_clear": "rimraf dist/*",
|
|
20
|
+
"lint": "eslint --fix src/**/*.ts",
|
|
21
|
+
"format": "prettier --log-level warn --write \"src/**/*.ts\"",
|
|
22
|
+
"test": "./scripts/test-unit.sh",
|
|
23
|
+
"build": "npm run _clear && npm run build:cjs && npm run build:esm && /bin/bash ./fixup",
|
|
24
|
+
"build:cjs": "tsc -p tsconfig-cjs.json",
|
|
25
|
+
"build:esm": "tsc -p tsconfig.json",
|
|
26
|
+
"prepare": "husky"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@semantic-release/git": "^10.0.1",
|
|
30
|
+
"@semantic-release/gitlab": "^13.1.0",
|
|
31
|
+
"@semantic-release/npm": "^12.0.1",
|
|
32
|
+
"@types/big.js": "^6.2.2",
|
|
33
|
+
"@types/chai": "^5.2.1",
|
|
34
|
+
"@types/mocha": "^10.0.10",
|
|
35
|
+
"@types/node": "^20.14.5",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
37
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
38
|
+
"chai": "^4.4.1",
|
|
39
|
+
"eslint": "^8.57.0",
|
|
40
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
41
|
+
"eslint-config-prettier": "^9.1.0",
|
|
42
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
43
|
+
"eslint-plugin-import": "^2.29.1",
|
|
44
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
45
|
+
"eslint-plugin-typescript": "^0.14.0",
|
|
46
|
+
"husky": "^9.0.11",
|
|
47
|
+
"mocha": "^11.1.0",
|
|
48
|
+
"prettier": "^3.3.2",
|
|
49
|
+
"rimraf": "^5.0.7",
|
|
50
|
+
"semantic-release": "^24.0.0",
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
52
|
+
"tsconfig-paths": "^4.2.0",
|
|
53
|
+
"typescript": "^5.4.5"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [],
|
|
56
|
+
"author": "",
|
|
57
|
+
"license": "ISC",
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"big.js": "^6.2.2",
|
|
60
|
+
"ethers": "^6.13.5"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public",
|
|
64
|
+
"registry": "https://registry.npmjs.org/",
|
|
65
|
+
"tag": "latest"
|
|
66
|
+
}
|
|
67
|
+
}
|