@1inch/fusion-sdk 1.0.1-rc.8 → 1.0.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/dist/api/orders/order-api.spec.js +5 -5
- package/dist/api/orders/orders.api.d.ts +1 -0
- package/dist/api/orders/orders.api.js +4 -3
- package/dist/api/orders/orders.api.js.map +1 -1
- package/dist/api/orders/types.d.ts +2 -0
- package/dist/api/orders/types.js.map +1 -1
- package/dist/api/quoter/quote/order-params.d.ts +1 -0
- package/dist/api/quoter/quote/order-params.js +1 -0
- package/dist/api/quoter/quote/order-params.js.map +1 -1
- package/dist/api/quoter/quote/quote.d.ts +1 -1
- package/dist/api/quoter/quote/quote.js +17 -10
- package/dist/api/quoter/quote/quote.js.map +1 -1
- package/dist/api/quoter/quote/types.d.ts +1 -0
- package/dist/api/quoter/quoter.api.d.ts +1 -0
- package/dist/api/quoter/quoter.api.js +3 -2
- package/dist/api/quoter/quoter.api.js.map +1 -1
- package/dist/api/quoter/quoter.api.spec.js +21 -6
- package/dist/api/quoter/quoter.api.spec.js.map +1 -1
- package/dist/api/quoter/quoter.request.d.ts +1 -0
- package/dist/api/quoter/quoter.request.js +3 -1
- package/dist/api/quoter/quoter.request.js.map +1 -1
- package/dist/api/quoter/types.d.ts +4 -3
- package/dist/api/quoter/types.js.map +1 -1
- package/dist/api/relayer/relayer.api.d.ts +1 -0
- package/dist/api/relayer/relayer.api.js +3 -2
- package/dist/api/relayer/relayer.api.js.map +1 -1
- package/dist/api/relayer/relayer.api.spec.js +8 -5
- package/dist/api/relayer/relayer.api.spec.js.map +1 -1
- package/dist/api/relayer/relayer.request.d.ts +1 -0
- package/dist/api/relayer/relayer.request.js +3 -1
- package/dist/api/relayer/relayer.request.js.map +1 -1
- package/dist/api/relayer/types.d.ts +1 -0
- package/dist/auction-calculator/auction-calculator.d.ts +15 -10
- package/dist/auction-calculator/auction-calculator.js +31 -5
- package/dist/auction-calculator/auction-calculator.js.map +1 -1
- package/dist/fusion-order/auction-details/auction-details.d.ts +2 -0
- package/dist/fusion-order/auction-details/auction-details.js +3 -0
- package/dist/fusion-order/auction-details/auction-details.js.map +1 -1
- package/dist/fusion-order/fusion-extension.d.ts +12 -4
- package/dist/fusion-order/fusion-extension.js +37 -9
- package/dist/fusion-order/fusion-extension.js.map +1 -1
- package/dist/fusion-order/fusion-extension.spec.d.ts +1 -0
- package/dist/fusion-order/fusion-extension.spec.js +75 -0
- package/dist/fusion-order/fusion-extension.spec.js.map +1 -0
- package/dist/fusion-order/fusion-order.d.ts +41 -3
- package/dist/fusion-order/fusion-order.js +90 -21
- package/dist/fusion-order/fusion-order.js.map +1 -1
- package/dist/fusion-order/fusion-order.spec.js +64 -1
- package/dist/fusion-order/fusion-order.spec.js.map +1 -1
- package/dist/fusion-order/settlement-post-interaction-data/settlement-post-interaction-data.d.ts +6 -2
- package/dist/fusion-order/settlement-post-interaction-data/settlement-post-interaction-data.js +46 -35
- package/dist/fusion-order/settlement-post-interaction-data/settlement-post-interaction-data.js.map +1 -1
- package/dist/fusion-order/settlement-post-interaction-data/settlement-post-interaction-data.spec.js +39 -4
- package/dist/fusion-order/settlement-post-interaction-data/settlement-post-interaction-data.spec.js.map +1 -1
- package/dist/fusion-order/settlement-post-interaction-data/types.d.ts +1 -0
- package/dist/fusion-order/source-track.d.ts +1 -0
- package/dist/fusion-order/source-track.js +16 -0
- package/dist/fusion-order/source-track.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/sdk/sdk.js +12 -10
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/types.d.ts +3 -0
- package/dist/sdk/utils.js +5 -2
- package/dist/sdk/utils.js.map +1 -1
- package/dist/utils/amounts.d.ts +1 -1
- package/dist/utils/amounts.js +3 -3
- package/dist/utils/amounts.js.map +1 -1
- package/dist/ws-api/ws-api.d.ts +1 -0
- package/dist/ws-api/ws-api.js +2 -1
- package/dist/ws-api/ws-api.js.map +1 -1
- package/dist/ws-api/ws.spec.js +8 -8
- package/package.json +22 -22
package/dist/utils/amounts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calcMakingAmount = exports.calcTakingAmount = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Calculates taker amount by linear proportion
|
|
6
6
|
* Note: use for minReturn only, because other amounts calculated based on auction curve
|
|
@@ -22,8 +22,8 @@ exports.calcTakingAmount = calcTakingAmount;
|
|
|
22
22
|
* @return Floored maker amount
|
|
23
23
|
* @see https://github.com/1inch/limit-order-protocol/blob/23d655844191dea7960a186652307604a1ed480a/contracts/libraries/AmountCalculatorLib.sol#L6
|
|
24
24
|
*/
|
|
25
|
-
function
|
|
25
|
+
function calcMakingAmount(swapTakerAmount, orderMakerAmount, orderTakerAmount) {
|
|
26
26
|
return (swapTakerAmount * orderMakerAmount) / orderTakerAmount;
|
|
27
27
|
}
|
|
28
|
-
exports.
|
|
28
|
+
exports.calcMakingAmount = calcMakingAmount;
|
|
29
29
|
//# sourceMappingURL=amounts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amounts.js","sourceRoot":"","sources":["../../src/utils/amounts.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC5B,eAAuB,EACvB,gBAAwB,EACxB,gBAAwB;IAExB,OAAO,CACH,CAAC,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,EAAE,CAAC;QAC5D,gBAAgB,CACnB,CAAA;AACL,CAAC;AATD,4CASC;AAED;;;;;;;GAOG;AACH,SAAgB,
|
|
1
|
+
{"version":3,"file":"amounts.js","sourceRoot":"","sources":["../../src/utils/amounts.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC5B,eAAuB,EACvB,gBAAwB,EACxB,gBAAwB;IAExB,OAAO,CACH,CAAC,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,EAAE,CAAC;QAC5D,gBAAgB,CACnB,CAAA;AACL,CAAC;AATD,4CASC;AAED;;;;;;;GAOG;AACH,SAAgB,gBAAgB,CAC5B,eAAuB,EACvB,gBAAwB,EACxB,gBAAwB;IAExB,OAAO,CAAC,eAAe,GAAG,gBAAgB,CAAC,GAAG,gBAAgB,CAAA;AAClE,CAAC;AAND,4CAMC"}
|
package/dist/ws-api/ws-api.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { RpcWebsocketApi } from './rpc-websocket-api';
|
|
|
3
3
|
import { WsApiConfigWithNetwork } from './types';
|
|
4
4
|
import { AnyFunction, AnyFunctionWithThis, OnMessageCb, WsProviderConnector } from '../connector/ws';
|
|
5
5
|
export declare class WebSocketApi {
|
|
6
|
+
private static Version;
|
|
6
7
|
readonly rpc: RpcWebsocketApi;
|
|
7
8
|
readonly order: ActiveOrdersWebSocketApi;
|
|
8
9
|
readonly provider: WsProviderConnector;
|
package/dist/ws-api/ws-api.js
CHANGED
|
@@ -9,7 +9,7 @@ class WebSocketApi {
|
|
|
9
9
|
constructor(configOrProvider) {
|
|
10
10
|
if (instanceOfWsApiConfigWithNetwork(configOrProvider)) {
|
|
11
11
|
const url = (0, url_1.castUrl)(configOrProvider.url);
|
|
12
|
-
const urlWithNetwork = `${url}
|
|
12
|
+
const urlWithNetwork = `${url}/${WebSocketApi.Version}/${configOrProvider.network}`;
|
|
13
13
|
const configWithUrl = { ...configOrProvider, url: urlWithNetwork };
|
|
14
14
|
const provider = new ws_1.WebsocketClient(configWithUrl);
|
|
15
15
|
this.provider = provider;
|
|
@@ -53,6 +53,7 @@ class WebSocketApi {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
exports.WebSocketApi = WebSocketApi;
|
|
56
|
+
WebSocketApi.Version = 'v2.0';
|
|
56
57
|
function instanceOfWsApiConfigWithNetwork(val) {
|
|
57
58
|
return 'url' in val && 'network' in val;
|
|
58
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-api.js","sourceRoot":"","sources":["../../src/ws-api/ws-api.ts"],"names":[],"mappings":";;;AAAA,+EAAsE;AACtE,2DAAmD;AAEnD,+BAA6B;AAC7B,wCAMwB;AAExB,MAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"ws-api.js","sourceRoot":"","sources":["../../src/ws-api/ws-api.ts"],"names":[],"mappings":";;;AAAA,+EAAsE;AACtE,2DAAmD;AAEnD,+BAA6B;AAC7B,wCAMwB;AAExB,MAAa,YAAY;IASrB,YACI,gBAA8D;QAE9D,IAAI,gCAAgC,CAAC,gBAAgB,CAAC,EAAE;YACpD,MAAM,GAAG,GAAG,IAAA,aAAO,EAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;YACzC,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,YAAY,CAAC,OAAO,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAA;YACnF,MAAM,aAAa,GAAG,EAAC,GAAG,gBAAgB,EAAE,GAAG,EAAE,cAAc,EAAC,CAAA;YAChE,MAAM,QAAQ,GAAG,IAAI,oBAAe,CAAC,aAAa,CAAC,CAAA;YAEnD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;YACxB,IAAI,CAAC,GAAG,GAAG,IAAI,mCAAe,CAAC,QAAQ,CAAC,CAAA;YACxC,IAAI,CAAC,KAAK,GAAG,IAAI,sDAAwB,CAAC,QAAQ,CAAC,CAAA;YAEnD,OAAM;SACT;QAED,IAAI,CAAC,QAAQ,GAAG,gBAAgB,CAAA;QAChC,IAAI,CAAC,GAAG,GAAG,IAAI,mCAAe,CAAC,gBAAgB,CAAC,CAAA;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,sDAAwB,CAAC,gBAAgB,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,CAAC,GAAG,CACN,gBAA8D;QAE9D,OAAO,IAAI,YAAY,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|
71
|
-
const wss = new ws_1.WebSocketServer({ port, path: '/ws/
|
|
71
|
+
const wss = new ws_1.WebSocketServer({ port, path: '/ws/v2.0/1' });
|
|
72
72
|
wss.on('connection', (ws) => {
|
|
73
73
|
for (const m of [message]) {
|
|
74
74
|
ws.send(JSON.stringify(m));
|
|
@@ -102,7 +102,7 @@ describe(__filename, () => {
|
|
|
102
102
|
const message = { id: 1 };
|
|
103
103
|
const port = 8080;
|
|
104
104
|
const url = `ws://localhost:${port}/ws`;
|
|
105
|
-
const wss = new ws_1.WebSocketServer({ port, path: '/ws/
|
|
105
|
+
const wss = new ws_1.WebSocketServer({ port, path: '/ws/v2.0/1' });
|
|
106
106
|
wss.on('connection', (ws) => {
|
|
107
107
|
for (const m of [message]) {
|
|
108
108
|
ws.send(JSON.stringify(m));
|
|
@@ -125,14 +125,14 @@ describe(__filename, () => {
|
|
|
125
125
|
const message = { id: 1 };
|
|
126
126
|
const port = 8080;
|
|
127
127
|
const url = `ws://localhost:${port}/ws`;
|
|
128
|
-
const wss = new ws_1.WebSocketServer({ port, path: '/ws/
|
|
128
|
+
const wss = new ws_1.WebSocketServer({ port, path: '/ws/v2.0/1' });
|
|
129
129
|
wss.on('connection', (ws) => {
|
|
130
130
|
for (const m of [message]) {
|
|
131
131
|
ws.send(JSON.stringify(m));
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
const castedUrl = (0, url_1.castUrl)(url);
|
|
135
|
-
const urlWithNetwork = `${castedUrl}/
|
|
135
|
+
const urlWithNetwork = `${castedUrl}/v2.0/1`;
|
|
136
136
|
const provider = new connector_1.WebsocketClient({ url: urlWithNetwork });
|
|
137
137
|
const wsSdk = new ws_api_1.WebSocketApi(provider);
|
|
138
138
|
expect(wsSdk.rpc).toBeDefined();
|
|
@@ -149,14 +149,14 @@ describe(__filename, () => {
|
|
|
149
149
|
const message = { id: 1 };
|
|
150
150
|
const port = 8080;
|
|
151
151
|
const url = `ws://localhost:${port}/ws`;
|
|
152
|
-
const wss = new ws_1.WebSocketServer({ port, path: '/ws/
|
|
152
|
+
const wss = new ws_1.WebSocketServer({ port, path: '/ws/v2.0/1' });
|
|
153
153
|
wss.on('connection', (ws) => {
|
|
154
154
|
for (const m of [message]) {
|
|
155
155
|
ws.send(JSON.stringify(m));
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
const castedUrl = (0, url_1.castUrl)(url);
|
|
159
|
-
const urlWithNetwork = `${castedUrl}/
|
|
159
|
+
const urlWithNetwork = `${castedUrl}/v2.0/1`;
|
|
160
160
|
const provider = new connector_1.WebsocketClient({
|
|
161
161
|
url: urlWithNetwork,
|
|
162
162
|
authKey: ''
|
|
@@ -668,7 +668,7 @@ describe(__filename, () => {
|
|
|
668
668
|
function createWebsocketRpcServerMock(cb) {
|
|
669
669
|
const port = 8080;
|
|
670
670
|
const returnUrl = `ws://localhost:${port}/ws`;
|
|
671
|
-
const wss = new ws_1.WebSocketServer({ port, path: '/ws/
|
|
671
|
+
const wss = new ws_1.WebSocketServer({ port, path: '/ws/v2.0/1' });
|
|
672
672
|
wss.on('connection', (ws) => {
|
|
673
673
|
ws.on('message', (data) => cb(ws, data));
|
|
674
674
|
});
|
|
@@ -677,7 +677,7 @@ function createWebsocketRpcServerMock(cb) {
|
|
|
677
677
|
function createWebsocketServerMock(messages) {
|
|
678
678
|
const port = 8080;
|
|
679
679
|
const returnUrl = `ws://localhost:${port}/ws`;
|
|
680
|
-
const wss = new ws_1.WebSocketServer({ port, path: '/ws/
|
|
680
|
+
const wss = new ws_1.WebSocketServer({ port, path: '/ws/v2.0/1' });
|
|
681
681
|
wss.on('connection', (ws) => {
|
|
682
682
|
for (const message of messages) {
|
|
683
683
|
ws.send(JSON.stringify(message));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1inch/fusion-sdk",
|
|
3
|
-
"version": "1.0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "1inch Fusion Mode SDK",
|
|
5
5
|
"author": "@1inch",
|
|
6
6
|
"private": false,
|
|
@@ -17,40 +17,40 @@
|
|
|
17
17
|
"url": "ssh://git@github.com:1inch/fusion-sdk.git"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@1inch/byte-utils": "2.1
|
|
21
|
-
"@1inch/limit-order-sdk": "4.
|
|
22
|
-
"@metamask/eth-sig-util": "^5.0
|
|
20
|
+
"@1inch/byte-utils": "2.2.1",
|
|
21
|
+
"@1inch/limit-order-sdk": "^4.8.7",
|
|
22
|
+
"@metamask/eth-sig-util": "^5.1.0",
|
|
23
23
|
"bn.js": "^5.2.1",
|
|
24
24
|
"ethers": "6.11.0",
|
|
25
|
-
"tslib": "^2.2
|
|
26
|
-
"ws": "^8.
|
|
25
|
+
"tslib": "^2.6.2",
|
|
26
|
+
"ws": "^8.16.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@1inch/eslint-config": "1.4.3",
|
|
30
30
|
"@1inch/tsconfig": "1.0.7",
|
|
31
31
|
"@swc/core": "1.3.66",
|
|
32
32
|
"@swc/jest": "0.2.26",
|
|
33
|
-
"@types/jest": "^26.0.
|
|
34
|
-
"@types/prompts": "^2.
|
|
35
|
-
"@types/ws": "^8.5.
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "5.59",
|
|
37
|
-
"@typescript-eslint/parser": "5.51",
|
|
38
|
-
"axios": "^1.6.
|
|
33
|
+
"@types/jest": "^26.0.24",
|
|
34
|
+
"@types/prompts": "^2.4.9",
|
|
35
|
+
"@types/ws": "^8.5.10",
|
|
36
|
+
"@typescript-eslint/eslint-plugin": "~5.59.11",
|
|
37
|
+
"@typescript-eslint/parser": "~5.51.0",
|
|
38
|
+
"axios": "^1.6.8",
|
|
39
39
|
"eslint": "8.41.0",
|
|
40
|
-
"eslint-config-prettier": "8.3",
|
|
41
|
-
"eslint-config-standard": "17",
|
|
40
|
+
"eslint-config-prettier": "~8.3.0",
|
|
41
|
+
"eslint-config-standard": "^17.1.0",
|
|
42
42
|
"eslint-import-resolver-typescript": "3.5.5",
|
|
43
|
-
"eslint-plugin-import": "2.26",
|
|
44
|
-
"eslint-plugin-n": "16",
|
|
45
|
-
"eslint-plugin-prettier": "4",
|
|
46
|
-
"eslint-plugin-promise": "6",
|
|
47
|
-
"eslint-plugin-unused-imports": "2",
|
|
43
|
+
"eslint-plugin-import": "~2.26.0",
|
|
44
|
+
"eslint-plugin-n": "^16.6.2",
|
|
45
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
46
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
47
|
+
"eslint-plugin-unused-imports": "^2.0.0",
|
|
48
48
|
"generate-changelog": "^1.8.0",
|
|
49
49
|
"jest": "^26.6.3",
|
|
50
|
-
"prettier": "^2.
|
|
51
|
-
"ts-loader": "^9.
|
|
50
|
+
"prettier": "^2.8.8",
|
|
51
|
+
"ts-loader": "^9.5.1",
|
|
52
52
|
"ts-mockito": "^2.6.1",
|
|
53
|
-
"ts-node": "^10.
|
|
53
|
+
"ts-node": "^10.9.2",
|
|
54
54
|
"typescript": "4.9.4"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|