@1inch/fusion-sdk 0.0.6 → 0.0.7
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 +4 -0
- package/api/fusion-api.d.ts +16 -25
- package/api/fusion-api.js +26 -36
- package/api/index.d.ts +4 -4
- package/api/index.js +8 -8
- package/api/orders/index.d.ts +3 -3
- package/api/orders/index.js +7 -7
- package/api/orders/order-api.spec.d.ts +1 -1
- package/api/orders/order-api.spec.js +397 -479
- package/api/orders/orders.api.d.ts +10 -24
- package/api/orders/orders.api.js +28 -30
- package/api/orders/orders.request.d.ts +18 -22
- package/api/orders/orders.request.js +31 -40
- package/api/orders/types.d.ts +58 -59
- package/api/orders/types.js +16 -17
- package/api/pagination.d.ts +7 -7
- package/api/pagination.js +10 -10
- package/api/pagination.spec.d.ts +1 -1
- package/api/pagination.spec.js +21 -28
- package/api/params.d.ts +1 -3
- package/api/params.js +19 -25
- package/api/quoter/index.d.ts +5 -5
- package/api/quoter/index.js +9 -9
- package/api/quoter/preset.d.ts +13 -13
- package/api/quoter/preset.js +17 -19
- package/api/quoter/quote/index.d.ts +3 -3
- package/api/quoter/quote/index.js +7 -7
- package/api/quoter/quote/order-params.d.ts +7 -6
- package/api/quoter/quote/order-params.js +13 -12
- package/api/quoter/quote/order-params.js.map +1 -1
- package/api/quoter/quote/quote.d.ts +22 -26
- package/api/quoter/quote/quote.js +59 -84
- package/api/quoter/quote/quote.js.map +1 -1
- package/api/quoter/quote/types.d.ts +5 -4
- package/api/quoter/quote/types.js +3 -3
- package/api/quoter/quoter.api.d.ts +9 -12
- package/api/quoter/quoter.api.js +19 -19
- package/api/quoter/quoter.api.spec.d.ts +1 -1
- package/api/quoter/quoter.api.spec.js +24 -30
- package/api/quoter/quoter.api.spec.js.map +1 -1
- package/api/quoter/quoter.request.d.ts +11 -11
- package/api/quoter/quoter.request.js +26 -28
- package/api/quoter/types.d.ts +45 -45
- package/api/quoter/types.js +10 -10
- package/api/relayer/index.d.ts +3 -3
- package/api/relayer/index.js +7 -7
- package/api/relayer/relayer.api.d.ts +9 -12
- package/api/relayer/relayer.api.js +13 -13
- package/api/relayer/relayer.api.spec.d.ts +1 -1
- package/api/relayer/relayer.api.spec.js +79 -96
- package/api/relayer/relayer.request.d.ts +8 -8
- package/api/relayer/relayer.request.js +10 -10
- package/api/relayer/types.d.ts +9 -9
- package/api/relayer/types.js +3 -3
- package/api/types.d.ts +15 -17
- package/api/types.js +3 -3
- package/auction-calculator/auction-calculator.d.ts +13 -22
- package/auction-calculator/auction-calculator.js +45 -70
- package/auction-calculator/auction-calculator.spec.d.ts +1 -1
- package/auction-calculator/auction-calculator.spec.js +32 -45
- package/auction-calculator/calc.d.ts +2 -8
- package/auction-calculator/calc.js +12 -12
- package/auction-calculator/constants.d.ts +1 -1
- package/auction-calculator/constants.js +5 -5
- package/auction-calculator/index.d.ts +3 -3
- package/auction-calculator/index.js +7 -7
- package/auction-salt/auction-salt.d.ts +9 -9
- package/auction-salt/auction-salt.js +23 -34
- package/auction-salt/auction.salt.spec.d.ts +1 -1
- package/auction-salt/auction.salt.spec.js +27 -38
- package/auction-salt/index.d.ts +3 -3
- package/auction-salt/index.js +7 -7
- package/auction-salt/parser/constants.d.ts +9 -9
- package/auction-salt/parser/constants.js +14 -33
- package/auction-salt/parser/index.d.ts +2 -2
- package/auction-salt/parser/index.js +6 -6
- package/auction-salt/parser/parser.d.ts +6 -6
- package/auction-salt/parser/parser.js +22 -33
- package/auction-salt/types.d.ts +6 -6
- package/auction-salt/types.js +3 -3
- package/auction-suffix/auction-suffix.d.ts +9 -9
- package/auction-suffix/auction-suffix.js +23 -36
- package/auction-suffix/auction-suffix.spec.d.ts +1 -1
- package/auction-suffix/auction-suffix.spec.js +15 -20
- package/auction-suffix/constants.d.ts +1 -1
- package/auction-suffix/constants.js +5 -5
- package/auction-suffix/encoder.d.ts +6 -15
- package/auction-suffix/encoder.js +28 -45
- package/auction-suffix/index.d.ts +5 -5
- package/auction-suffix/index.js +9 -9
- package/auction-suffix/parser/constants.d.ts +13 -13
- package/auction-suffix/parser/constants.js +17 -30
- package/auction-suffix/parser/errors.d.ts +2 -1
- package/auction-suffix/parser/errors.js +7 -6
- package/auction-suffix/parser/index.d.ts +4 -4
- package/auction-suffix/parser/index.js +8 -8
- package/auction-suffix/parser/parser.d.ts +8 -28
- package/auction-suffix/parser/parser.js +81 -162
- package/auction-suffix/parser/types.d.ts +22 -22
- package/auction-suffix/parser/types.js +3 -3
- package/auction-suffix/types.d.ts +12 -12
- package/auction-suffix/types.js +3 -3
- package/connector/blockchain/blockchain-provider.connector.d.ts +3 -6
- package/connector/blockchain/blockchain-provider.connector.js +3 -3
- package/connector/blockchain/index.d.ts +3 -3
- package/connector/blockchain/index.js +7 -7
- package/connector/blockchain/private-key-provider.connector.d.ts +10 -15
- package/connector/blockchain/private-key-provider.connector.js +12 -12
- package/connector/blockchain/private-key-provider.connector.spec.d.ts +1 -1
- package/connector/blockchain/private-key-provider.connector.spec.js +23 -36
- package/connector/blockchain/web3-provider-connector.d.ts +8 -13
- package/connector/blockchain/web3-provider-connector.js +9 -12
- package/connector/blockchain/web3-provider.connector.spec.d.ts +1 -1
- package/connector/blockchain/web3-provider.connector.spec.js +26 -37
- package/connector/http/axios-provider.connector.d.ts +3 -3
- package/connector/http/axios-provider.connector.js +13 -13
- package/connector/http/axios-provider.connector.spec.d.ts +1 -1
- package/connector/http/axios-provider.connector.spec.js +31 -37
- package/connector/http/http-provider.connector.d.ts +2 -2
- package/connector/http/http-provider.connector.js +3 -3
- package/connector/http/index.d.ts +2 -2
- package/connector/http/index.js +6 -6
- package/connector/index.d.ts +2 -2
- package/connector/index.js +6 -6
- package/constants.d.ts +6 -10
- package/constants.js +16 -23
- package/fusion-order/fusion-order.d.ts +7 -17
- package/fusion-order/fusion-order.js +12 -14
- package/fusion-order/fusion-order.spec.d.ts +1 -1
- package/fusion-order/fusion-order.spec.js +22 -27
- package/fusion-order/index.d.ts +1 -1
- package/fusion-order/index.js +5 -5
- package/index.d.ts +11 -11
- package/index.js +15 -15
- package/limit-order/eip712/domain.d.ts +9 -10
- package/limit-order/eip712/domain.js +23 -28
- package/limit-order/eip712/eip712.types.d.ts +15 -19
- package/limit-order/eip712/eip712.types.js +3 -3
- package/limit-order/eip712/index.d.ts +3 -3
- package/limit-order/eip712/index.js +7 -7
- package/limit-order/eip712/order-typed-data-builder.d.ts +6 -17
- package/limit-order/eip712/order-typed-data-builder.js +19 -34
- package/limit-order/index.d.ts +4 -4
- package/limit-order/index.js +8 -8
- package/limit-order/interactions-factory.d.ts +1 -1
- package/limit-order/interactions-factory.js +6 -6
- package/limit-order/limit-order.d.ts +25 -31
- package/limit-order/limit-order.js +50 -103
- package/limit-order/limit-order.spec.d.ts +1 -1
- package/limit-order/limit-order.spec.js +51 -75
- package/limit-order/parser/constants.d.ts +9 -9
- package/limit-order/parser/constants.js +5 -5
- package/limit-order/parser/index.d.ts +3 -3
- package/limit-order/parser/index.js +7 -7
- package/limit-order/parser/parser.d.ts +2 -5
- package/limit-order/parser/parser.js +18 -23
- package/limit-order/parser/types.d.ts +3 -3
- package/limit-order/parser/types.js +3 -3
- package/limit-order/predicate-factory.d.ts +5 -9
- package/limit-order/predicate-factory.js +24 -40
- package/limit-order/predicate-factory.spec.d.ts +1 -1
- package/limit-order/predicate-factory.spec.js +29 -44
- package/limit-order/types.d.ts +29 -29
- package/limit-order/types.js +3 -3
- package/limit-order/utils.d.ts +1 -1
- package/limit-order/utils.js +6 -6
- package/package.json +1 -1
- package/sdk/index.d.ts +2 -2
- package/sdk/index.js +6 -6
- package/sdk/sdk.d.ts +11 -29
- package/sdk/sdk.js +40 -49
- package/sdk/sdk.js.map +1 -1
- package/sdk/types.d.ts +27 -27
- package/sdk/types.js +3 -3
- package/settlement/encoders/constants.d.ts +1 -1
- package/settlement/encoders/constants.js +5 -5
- package/settlement/encoders/fill-order.encoder.d.ts +2 -2
- package/settlement/encoders/fill-order.encoder.js +12 -26
- package/settlement/encoders/index.d.ts +3 -3
- package/settlement/encoders/index.js +7 -7
- package/settlement/encoders/settlement.encoder.d.ts +4 -13
- package/settlement/encoders/settlement.encoder.js +19 -41
- package/settlement/index.d.ts +4 -4
- package/settlement/index.js +8 -8
- package/settlement/settlement.d.ts +5 -8
- package/settlement/settlement.js +14 -28
- package/settlement/settlement.spec.d.ts +1 -1
- package/settlement/settlement.spec.js +35 -45
- package/settlement/signature-patcher.d.ts +1 -1
- package/settlement/signature-patcher.js +16 -19
- package/settlement/types.d.ts +13 -13
- package/settlement/types.js +3 -3
- package/utils.d.ts +6 -6
- package/utils.js +23 -29
- package/validations.d.ts +2 -2
- package/validations.js +15 -14
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import {AxiosProviderConnector, HttpProviderConnector} from '../../connector'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
OrdersByMakerRequest,
|
|
5
|
-
OrderStatusRequest
|
|
6
|
-
} from './orders.request'
|
|
7
|
-
import {
|
|
8
|
-
ActiveOrdersResponse,
|
|
9
|
-
OrdersApiConfig,
|
|
10
|
-
OrdersByMakerResponse,
|
|
11
|
-
OrderStatusResponse
|
|
12
|
-
} from './types'
|
|
1
|
+
import { AxiosProviderConnector, HttpProviderConnector } from '../../connector';
|
|
2
|
+
import { ActiveOrdersRequest, OrdersByMakerRequest, OrderStatusRequest } from './orders.request';
|
|
3
|
+
import { ActiveOrdersResponse, OrdersApiConfig, OrdersByMakerResponse, OrderStatusResponse } from './types';
|
|
13
4
|
export declare class OrdersApi {
|
|
14
|
-
private readonly config
|
|
15
|
-
private readonly httpClient
|
|
16
|
-
constructor(config: OrdersApiConfig, httpClient: HttpProviderConnector)
|
|
17
|
-
static new(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
):
|
|
21
|
-
getActiveOrders(params: ActiveOrdersRequest): Promise<ActiveOrdersResponse>
|
|
22
|
-
getOrderStatus(params: OrderStatusRequest): Promise<OrderStatusResponse>
|
|
23
|
-
getOrdersByMaker(
|
|
24
|
-
params: OrdersByMakerRequest
|
|
25
|
-
): Promise<OrdersByMakerResponse>
|
|
5
|
+
private readonly config;
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(config: OrdersApiConfig, httpClient: HttpProviderConnector);
|
|
8
|
+
static new(config: OrdersApiConfig, httpClient?: AxiosProviderConnector): OrdersApi;
|
|
9
|
+
getActiveOrders(params: ActiveOrdersRequest): Promise<ActiveOrdersResponse>;
|
|
10
|
+
getOrderStatus(params: OrderStatusRequest): Promise<OrderStatusResponse>;
|
|
11
|
+
getOrdersByMaker(params: OrdersByMakerRequest): Promise<OrdersByMakerResponse>;
|
|
26
12
|
}
|
package/api/orders/orders.api.js
CHANGED
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.OrdersApi = void 0
|
|
4
|
-
const tslib_1 = require(
|
|
5
|
-
const connector_1 = require(
|
|
6
|
-
const params_1 = require(
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrdersApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const connector_1 = require("../../connector");
|
|
6
|
+
const params_1 = require("../params");
|
|
7
7
|
class OrdersApi {
|
|
8
8
|
constructor(config, httpClient) {
|
|
9
|
-
this.config = config
|
|
10
|
-
this.httpClient = httpClient
|
|
9
|
+
this.config = config;
|
|
10
|
+
this.httpClient = httpClient;
|
|
11
11
|
}
|
|
12
12
|
static new(config, httpClient = new connector_1.AxiosProviderConnector()) {
|
|
13
|
-
return new OrdersApi(config, httpClient)
|
|
13
|
+
return new OrdersApi(config, httpClient);
|
|
14
14
|
}
|
|
15
15
|
getActiveOrders(params) {
|
|
16
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const err = params.validate()
|
|
17
|
+
const err = params.validate();
|
|
18
18
|
if (err) {
|
|
19
|
-
throw new Error(err)
|
|
19
|
+
throw new Error(err);
|
|
20
20
|
}
|
|
21
|
-
const queryParams = (0, params_1.concatQueryParams)(params.build())
|
|
22
|
-
const url = `${this.config.url}/v1.0/${this.config.network}/order/active/${queryParams}
|
|
23
|
-
return this.httpClient.get(url)
|
|
24
|
-
})
|
|
21
|
+
const queryParams = (0, params_1.concatQueryParams)(params.build());
|
|
22
|
+
const url = `${this.config.url}/v1.0/${this.config.network}/order/active/${queryParams}`;
|
|
23
|
+
return this.httpClient.get(url);
|
|
24
|
+
});
|
|
25
25
|
}
|
|
26
26
|
getOrderStatus(params) {
|
|
27
27
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const err = params.validate()
|
|
28
|
+
const err = params.validate();
|
|
29
29
|
if (err) {
|
|
30
|
-
throw new Error(err)
|
|
30
|
+
throw new Error(err);
|
|
31
31
|
}
|
|
32
|
-
const url = `${this.config.url}/v1.0/${this.config.network}/order/status/${params.orderHash}
|
|
33
|
-
return this.httpClient.get(url)
|
|
34
|
-
})
|
|
32
|
+
const url = `${this.config.url}/v1.0/${this.config.network}/order/status/${params.orderHash}`;
|
|
33
|
+
return this.httpClient.get(url);
|
|
34
|
+
});
|
|
35
35
|
}
|
|
36
36
|
getOrdersByMaker(params) {
|
|
37
37
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const err = params.validate()
|
|
38
|
+
const err = params.validate();
|
|
39
39
|
if (err) {
|
|
40
|
-
throw new Error(err)
|
|
40
|
+
throw new Error(err);
|
|
41
41
|
}
|
|
42
|
-
const queryParams = (0, params_1.concatQueryParams)(
|
|
43
|
-
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
return this.httpClient.get(url)
|
|
47
|
-
})
|
|
42
|
+
const queryParams = (0, params_1.concatQueryParams)(params.buildQueryParams());
|
|
43
|
+
const url = `${this.config.url}/v1.0/${this.config.network}/order/maker/${params.address}/${queryParams}`;
|
|
44
|
+
return this.httpClient.get(url);
|
|
45
|
+
});
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
|
-
exports.OrdersApi = OrdersApi
|
|
51
|
-
//# sourceMappingURL=orders.api.js.map
|
|
48
|
+
exports.OrdersApi = OrdersApi;
|
|
49
|
+
//# sourceMappingURL=orders.api.js.map
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
OrdersByMakerParams,
|
|
4
|
-
OrderStatusParams
|
|
5
|
-
} from './types'
|
|
6
|
-
import {PaginationParams, PaginationRequest} from '../pagination'
|
|
1
|
+
import { ActiveOrdersRequestParams, OrdersByMakerParams, OrderStatusParams } from './types';
|
|
2
|
+
import { PaginationParams, PaginationRequest } from '../pagination';
|
|
7
3
|
export declare class ActiveOrdersRequest {
|
|
8
|
-
readonly pagination: PaginationRequest
|
|
9
|
-
constructor(params?: ActiveOrdersRequestParams)
|
|
10
|
-
static new(params?: ActiveOrdersRequestParams): ActiveOrdersRequest
|
|
11
|
-
validate(): string | null
|
|
12
|
-
build(): ActiveOrdersRequestParams
|
|
4
|
+
readonly pagination: PaginationRequest;
|
|
5
|
+
constructor(params?: ActiveOrdersRequestParams);
|
|
6
|
+
static new(params?: ActiveOrdersRequestParams): ActiveOrdersRequest;
|
|
7
|
+
validate(): string | null;
|
|
8
|
+
build(): ActiveOrdersRequestParams;
|
|
13
9
|
}
|
|
14
10
|
export declare class OrderStatusRequest {
|
|
15
|
-
readonly orderHash: string
|
|
16
|
-
constructor(params: OrderStatusParams)
|
|
17
|
-
static new(params: OrderStatusParams): OrderStatusRequest
|
|
18
|
-
validate(): string | null
|
|
19
|
-
build(): OrderStatusParams
|
|
11
|
+
readonly orderHash: string;
|
|
12
|
+
constructor(params: OrderStatusParams);
|
|
13
|
+
static new(params: OrderStatusParams): OrderStatusRequest;
|
|
14
|
+
validate(): string | null;
|
|
15
|
+
build(): OrderStatusParams;
|
|
20
16
|
}
|
|
21
17
|
export declare class OrdersByMakerRequest {
|
|
22
|
-
readonly address: string
|
|
23
|
-
readonly pagination: PaginationRequest
|
|
24
|
-
constructor(params: OrdersByMakerParams)
|
|
25
|
-
static new(params: OrdersByMakerParams): OrdersByMakerRequest
|
|
26
|
-
validate(): string | null
|
|
27
|
-
buildQueryParams(): PaginationParams
|
|
18
|
+
readonly address: string;
|
|
19
|
+
readonly pagination: PaginationRequest;
|
|
20
|
+
constructor(params: OrdersByMakerParams);
|
|
21
|
+
static new(params: OrdersByMakerParams): OrdersByMakerRequest;
|
|
22
|
+
validate(): string | null;
|
|
23
|
+
buildQueryParams(): PaginationParams;
|
|
28
24
|
}
|
|
@@ -1,88 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.OrdersByMakerRequest =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const validations_1 = require('../../validations')
|
|
9
|
-
const web3_1 = tslib_1.__importDefault(require('web3'))
|
|
10
|
-
const pagination_1 = require('../pagination')
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrdersByMakerRequest = exports.OrderStatusRequest = exports.ActiveOrdersRequest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const validations_1 = require("../../validations");
|
|
6
|
+
const web3_1 = tslib_1.__importDefault(require("web3"));
|
|
7
|
+
const pagination_1 = require("../pagination");
|
|
11
8
|
class ActiveOrdersRequest {
|
|
12
9
|
constructor(params = {}) {
|
|
13
|
-
this.pagination = new pagination_1.PaginationRequest(
|
|
14
|
-
params.page,
|
|
15
|
-
params.limit
|
|
16
|
-
)
|
|
10
|
+
this.pagination = new pagination_1.PaginationRequest(params.page, params.limit);
|
|
17
11
|
}
|
|
18
12
|
static new(params) {
|
|
19
|
-
return new ActiveOrdersRequest(params)
|
|
13
|
+
return new ActiveOrdersRequest(params);
|
|
20
14
|
}
|
|
21
15
|
validate() {
|
|
22
|
-
const res = this.pagination.validate()
|
|
16
|
+
const res = this.pagination.validate();
|
|
23
17
|
if (res) {
|
|
24
|
-
return res
|
|
18
|
+
return res;
|
|
25
19
|
}
|
|
26
|
-
return null
|
|
20
|
+
return null;
|
|
27
21
|
}
|
|
28
22
|
build() {
|
|
29
23
|
return {
|
|
30
24
|
page: this.pagination.page,
|
|
31
25
|
limit: this.pagination.limit
|
|
32
|
-
}
|
|
26
|
+
};
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
|
-
exports.ActiveOrdersRequest = ActiveOrdersRequest
|
|
29
|
+
exports.ActiveOrdersRequest = ActiveOrdersRequest;
|
|
36
30
|
class OrderStatusRequest {
|
|
37
31
|
constructor(params) {
|
|
38
|
-
this.orderHash = params.orderHash
|
|
32
|
+
this.orderHash = params.orderHash;
|
|
39
33
|
}
|
|
40
34
|
static new(params) {
|
|
41
|
-
return new OrderStatusRequest(params)
|
|
35
|
+
return new OrderStatusRequest(params);
|
|
42
36
|
}
|
|
43
37
|
validate() {
|
|
44
38
|
if (this.orderHash.length !== 66) {
|
|
45
|
-
return `orderHash length should be equals 66
|
|
39
|
+
return `orderHash length should be equals 66`;
|
|
46
40
|
}
|
|
47
41
|
if (!web3_1.default.utils.isHex(this.orderHash)) {
|
|
48
|
-
return `orderHash have to be hex
|
|
42
|
+
return `orderHash have to be hex`;
|
|
49
43
|
}
|
|
50
|
-
return null
|
|
44
|
+
return null;
|
|
51
45
|
}
|
|
52
46
|
build() {
|
|
53
47
|
return {
|
|
54
48
|
orderHash: this.orderHash
|
|
55
|
-
}
|
|
49
|
+
};
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
|
-
exports.OrderStatusRequest = OrderStatusRequest
|
|
52
|
+
exports.OrderStatusRequest = OrderStatusRequest;
|
|
59
53
|
class OrdersByMakerRequest {
|
|
60
54
|
constructor(params) {
|
|
61
|
-
this.address = params.address
|
|
62
|
-
this.pagination = new pagination_1.PaginationRequest(
|
|
63
|
-
params.page,
|
|
64
|
-
params.limit
|
|
65
|
-
)
|
|
55
|
+
this.address = params.address;
|
|
56
|
+
this.pagination = new pagination_1.PaginationRequest(params.page, params.limit);
|
|
66
57
|
}
|
|
67
58
|
static new(params) {
|
|
68
|
-
return new OrdersByMakerRequest(params)
|
|
59
|
+
return new OrdersByMakerRequest(params);
|
|
69
60
|
}
|
|
70
61
|
validate() {
|
|
71
|
-
const res = this.pagination.validate()
|
|
62
|
+
const res = this.pagination.validate();
|
|
72
63
|
if (res) {
|
|
73
|
-
return res
|
|
64
|
+
return res;
|
|
74
65
|
}
|
|
75
66
|
if (!(0, validations_1.isValidAddress)(this.address)) {
|
|
76
|
-
return `${this.address} is invalid address
|
|
67
|
+
return `${this.address} is invalid address`;
|
|
77
68
|
}
|
|
78
|
-
return null
|
|
69
|
+
return null;
|
|
79
70
|
}
|
|
80
71
|
buildQueryParams() {
|
|
81
72
|
return {
|
|
82
73
|
limit: this.pagination.limit,
|
|
83
74
|
page: this.pagination.page
|
|
84
|
-
}
|
|
75
|
+
};
|
|
85
76
|
}
|
|
86
77
|
}
|
|
87
|
-
exports.OrdersByMakerRequest = OrdersByMakerRequest
|
|
88
|
-
//# sourceMappingURL=orders.request.js.map
|
|
78
|
+
exports.OrdersByMakerRequest = OrdersByMakerRequest;
|
|
79
|
+
//# sourceMappingURL=orders.request.js.map
|
package/api/orders/types.d.ts
CHANGED
|
@@ -1,68 +1,67 @@
|
|
|
1
|
-
import {LimitOrderV3Struct} from '../../limit-order'
|
|
2
|
-
import {NetworkEnum} from '../../constants'
|
|
3
|
-
import {PaginationOutput} from '../types'
|
|
4
|
-
import {AuctionPoint} from '../quoter'
|
|
5
|
-
import {PaginationParams} from '../pagination'
|
|
1
|
+
import { LimitOrderV3Struct } from '../../limit-order';
|
|
2
|
+
import { NetworkEnum } from '../../constants';
|
|
3
|
+
import { PaginationOutput } from '../types';
|
|
4
|
+
import { AuctionPoint } from '../quoter';
|
|
5
|
+
import { PaginationParams } from '../pagination';
|
|
6
6
|
export declare type OrdersApiConfig = {
|
|
7
|
-
network: NetworkEnum
|
|
8
|
-
url: string
|
|
9
|
-
}
|
|
10
|
-
export declare type ActiveOrdersRequestParams = PaginationParams
|
|
7
|
+
network: NetworkEnum;
|
|
8
|
+
url: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type ActiveOrdersRequestParams = PaginationParams;
|
|
11
11
|
export declare type ActiveOrder = {
|
|
12
|
-
orderHash: string
|
|
13
|
-
signature: string
|
|
14
|
-
deadline: string
|
|
15
|
-
auctionStartDate: string
|
|
16
|
-
auctionEndDate: string
|
|
17
|
-
remainingMakerAmount: string
|
|
18
|
-
order: LimitOrderV3Struct
|
|
19
|
-
}
|
|
20
|
-
export declare type ActiveOrdersResponse = PaginationOutput<ActiveOrder
|
|
12
|
+
orderHash: string;
|
|
13
|
+
signature: string;
|
|
14
|
+
deadline: string;
|
|
15
|
+
auctionStartDate: string;
|
|
16
|
+
auctionEndDate: string;
|
|
17
|
+
remainingMakerAmount: string;
|
|
18
|
+
order: LimitOrderV3Struct;
|
|
19
|
+
};
|
|
20
|
+
export declare type ActiveOrdersResponse = PaginationOutput<ActiveOrder>;
|
|
21
21
|
export declare type OrderStatusParams = {
|
|
22
|
-
orderHash: string
|
|
23
|
-
}
|
|
22
|
+
orderHash: string;
|
|
23
|
+
};
|
|
24
24
|
export declare enum OrderStatus {
|
|
25
|
-
Pending =
|
|
26
|
-
Filled =
|
|
27
|
-
FalsePredicate =
|
|
28
|
-
NotEnoughBalanceOrAllowance =
|
|
29
|
-
Expired =
|
|
30
|
-
PartiallyFilled =
|
|
31
|
-
WrongPermit =
|
|
32
|
-
Cancelled =
|
|
33
|
-
InvalidSignature =
|
|
25
|
+
Pending = "pending",
|
|
26
|
+
Filled = "filled",
|
|
27
|
+
FalsePredicate = "false-predicate",
|
|
28
|
+
NotEnoughBalanceOrAllowance = "not-enough-balance-or-allowance",
|
|
29
|
+
Expired = "expired",
|
|
30
|
+
PartiallyFilled = "partially-filled",
|
|
31
|
+
WrongPermit = "wrong-permit",
|
|
32
|
+
Cancelled = "cancelled",
|
|
33
|
+
InvalidSignature = "invalid-signature"
|
|
34
34
|
}
|
|
35
35
|
export declare type Fill = {
|
|
36
|
-
txHash: string
|
|
37
|
-
filledMakerAmount: string
|
|
38
|
-
filledAuctionTakerAmount: string
|
|
39
|
-
}
|
|
36
|
+
txHash: string;
|
|
37
|
+
filledMakerAmount: string;
|
|
38
|
+
filledAuctionTakerAmount: string;
|
|
39
|
+
};
|
|
40
40
|
export declare type OrderStatusResponse = {
|
|
41
|
-
status: OrderStatus
|
|
42
|
-
order: LimitOrderV3Struct
|
|
43
|
-
points: AuctionPoint[] | null
|
|
44
|
-
fills: Fill[]
|
|
45
|
-
auctionStartDate: number
|
|
46
|
-
auctionDuration: number
|
|
47
|
-
initialRateBump: number
|
|
48
|
-
isNativeCurrency: boolean
|
|
49
|
-
}
|
|
41
|
+
status: OrderStatus;
|
|
42
|
+
order: LimitOrderV3Struct;
|
|
43
|
+
points: AuctionPoint[] | null;
|
|
44
|
+
fills: Fill[];
|
|
45
|
+
auctionStartDate: number;
|
|
46
|
+
auctionDuration: number;
|
|
47
|
+
initialRateBump: number;
|
|
48
|
+
isNativeCurrency: boolean;
|
|
49
|
+
};
|
|
50
50
|
export declare type OrdersByMakerParams = {
|
|
51
|
-
address: string
|
|
52
|
-
} & PaginationParams
|
|
51
|
+
address: string;
|
|
52
|
+
} & PaginationParams;
|
|
53
53
|
export declare type OrderFillsByMakerOutput = {
|
|
54
|
-
orderHash: string
|
|
55
|
-
status: OrderStatus
|
|
56
|
-
makerAsset: string
|
|
57
|
-
makerAmount: string
|
|
58
|
-
takerAsset: string
|
|
59
|
-
cancelTx: string | null
|
|
60
|
-
fills: Fill[]
|
|
61
|
-
points: AuctionPoint[] | null
|
|
62
|
-
auctionStartDate: number
|
|
63
|
-
auctionDuration: number
|
|
64
|
-
initialRateBump: number
|
|
65
|
-
isNativeCurrency: boolean
|
|
66
|
-
}
|
|
67
|
-
export declare type OrdersByMakerResponse =
|
|
68
|
-
PaginationOutput<OrderFillsByMakerOutput>
|
|
54
|
+
orderHash: string;
|
|
55
|
+
status: OrderStatus;
|
|
56
|
+
makerAsset: string;
|
|
57
|
+
makerAmount: string;
|
|
58
|
+
takerAsset: string;
|
|
59
|
+
cancelTx: string | null;
|
|
60
|
+
fills: Fill[];
|
|
61
|
+
points: AuctionPoint[] | null;
|
|
62
|
+
auctionStartDate: number;
|
|
63
|
+
auctionDuration: number;
|
|
64
|
+
initialRateBump: number;
|
|
65
|
+
isNativeCurrency: boolean;
|
|
66
|
+
};
|
|
67
|
+
export declare type OrdersByMakerResponse = PaginationOutput<OrderFillsByMakerOutput>;
|
package/api/orders/types.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.OrderStatus = void 0
|
|
4
|
-
var OrderStatus
|
|
5
|
-
|
|
6
|
-
OrderStatus[
|
|
7
|
-
OrderStatus[
|
|
8
|
-
OrderStatus[
|
|
9
|
-
OrderStatus[
|
|
10
|
-
|
|
11
|
-
OrderStatus[
|
|
12
|
-
OrderStatus[
|
|
13
|
-
OrderStatus[
|
|
14
|
-
OrderStatus[
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderStatus = void 0;
|
|
4
|
+
var OrderStatus;
|
|
5
|
+
(function (OrderStatus) {
|
|
6
|
+
OrderStatus["Pending"] = "pending";
|
|
7
|
+
OrderStatus["Filled"] = "filled";
|
|
8
|
+
OrderStatus["FalsePredicate"] = "false-predicate";
|
|
9
|
+
OrderStatus["NotEnoughBalanceOrAllowance"] = "not-enough-balance-or-allowance";
|
|
10
|
+
OrderStatus["Expired"] = "expired";
|
|
11
|
+
OrderStatus["PartiallyFilled"] = "partially-filled";
|
|
12
|
+
OrderStatus["WrongPermit"] = "wrong-permit";
|
|
13
|
+
OrderStatus["Cancelled"] = "cancelled";
|
|
14
|
+
OrderStatus["InvalidSignature"] = "invalid-signature";
|
|
15
|
+
})(OrderStatus = exports.OrderStatus || (exports.OrderStatus = {}));
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
package/api/pagination.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare type PaginationParams = {
|
|
2
|
-
page?: number
|
|
3
|
-
limit?: number
|
|
4
|
-
}
|
|
2
|
+
page?: number;
|
|
3
|
+
limit?: number;
|
|
4
|
+
};
|
|
5
5
|
export declare class PaginationRequest {
|
|
6
|
-
page: number | undefined
|
|
7
|
-
limit: number | undefined
|
|
8
|
-
constructor(page: number | undefined, limit: number | undefined)
|
|
9
|
-
validate(): string | null
|
|
6
|
+
page: number | undefined;
|
|
7
|
+
limit: number | undefined;
|
|
8
|
+
constructor(page: number | undefined, limit: number | undefined);
|
|
9
|
+
validate(): string | null;
|
|
10
10
|
}
|
package/api/pagination.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.PaginationRequest = void 0
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaginationRequest = void 0;
|
|
4
4
|
class PaginationRequest {
|
|
5
5
|
constructor(page, limit) {
|
|
6
|
-
this.page = page
|
|
7
|
-
this.limit = limit
|
|
6
|
+
this.page = page;
|
|
7
|
+
this.limit = limit;
|
|
8
8
|
}
|
|
9
9
|
validate() {
|
|
10
10
|
if (this.limit != null && (this.limit < 1 || this.limit > 500)) {
|
|
11
|
-
return 'limit should be in range between 1 and 500'
|
|
11
|
+
return 'limit should be in range between 1 and 500';
|
|
12
12
|
}
|
|
13
13
|
if (this.page != null && this.page < 1) {
|
|
14
|
-
return `page should be >= 1
|
|
14
|
+
return `page should be >= 1`;
|
|
15
15
|
}
|
|
16
|
-
return null
|
|
16
|
+
return null;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
exports.PaginationRequest = PaginationRequest
|
|
20
|
-
//# sourceMappingURL=pagination.js.map
|
|
19
|
+
exports.PaginationRequest = PaginationRequest;
|
|
20
|
+
//# sourceMappingURL=pagination.js.map
|
package/api/pagination.spec.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|
package/api/pagination.spec.js
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const pagination_1 = require(
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const pagination_1 = require("./pagination");
|
|
4
4
|
describe(__filename, () => {
|
|
5
5
|
describe('validate', () => {
|
|
6
6
|
it('should return null for nulls', () => {
|
|
7
|
-
const request = new pagination_1.PaginationRequest(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
expect(request.validate()).toBe(null)
|
|
12
|
-
})
|
|
7
|
+
const request = new pagination_1.PaginationRequest(undefined, undefined);
|
|
8
|
+
expect(request.validate()).toBe(null);
|
|
9
|
+
});
|
|
13
10
|
it('should return error for limit < 1', () => {
|
|
14
|
-
const request = new pagination_1.PaginationRequest(undefined, 0)
|
|
15
|
-
expect(request.validate()).toBe(
|
|
16
|
-
|
|
17
|
-
)
|
|
18
|
-
})
|
|
11
|
+
const request = new pagination_1.PaginationRequest(undefined, 0);
|
|
12
|
+
expect(request.validate()).toBe('limit should be in range between 1 and 500');
|
|
13
|
+
});
|
|
19
14
|
it('should return error for limit > 500', () => {
|
|
20
|
-
const request = new pagination_1.PaginationRequest(undefined, 501)
|
|
21
|
-
expect(request.validate()).toBe(
|
|
22
|
-
|
|
23
|
-
)
|
|
24
|
-
})
|
|
15
|
+
const request = new pagination_1.PaginationRequest(undefined, 501);
|
|
16
|
+
expect(request.validate()).toBe('limit should be in range between 1 and 500');
|
|
17
|
+
});
|
|
25
18
|
it('should return error for page < 1', () => {
|
|
26
|
-
const request = new pagination_1.PaginationRequest(0, undefined)
|
|
27
|
-
expect(request.validate()).toBe('page should be >= 1')
|
|
28
|
-
})
|
|
19
|
+
const request = new pagination_1.PaginationRequest(0, undefined);
|
|
20
|
+
expect(request.validate()).toBe('page should be >= 1');
|
|
21
|
+
});
|
|
29
22
|
it('should return null for valid inputs', () => {
|
|
30
|
-
const request = new pagination_1.PaginationRequest(1, 10)
|
|
31
|
-
expect(request.validate()).toBe(null)
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
//# sourceMappingURL=pagination.spec.js.map
|
|
23
|
+
const request = new pagination_1.PaginationRequest(1, 10);
|
|
24
|
+
expect(request.validate()).toBe(null);
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=pagination.spec.js.map
|
package/api/params.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export declare function concatQueryParams<
|
|
2
|
-
T extends Record<string | number, string | string[] | number | boolean>
|
|
3
|
-
>(params: T): string
|
|
1
|
+
export declare function concatQueryParams<T extends Record<string | number, string | string[] | number | boolean>>(params: T): string;
|
package/api/params.js
CHANGED
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.concatQueryParams = void 0
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.concatQueryParams = void 0;
|
|
4
4
|
function concatQueryParams(params) {
|
|
5
5
|
if (!params) {
|
|
6
|
-
return ''
|
|
6
|
+
return '';
|
|
7
7
|
}
|
|
8
|
-
const keys = Object.keys(params)
|
|
8
|
+
const keys = Object.keys(params);
|
|
9
9
|
if (keys.length === 0) {
|
|
10
|
-
return ''
|
|
10
|
+
return '';
|
|
11
11
|
}
|
|
12
|
-
return (
|
|
13
|
-
'?' +
|
|
12
|
+
return ('?' +
|
|
14
13
|
keys
|
|
15
14
|
.reduce((a, k) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
return a
|
|
28
|
-
}, [])
|
|
29
|
-
.join('&')
|
|
30
|
-
)
|
|
15
|
+
if (!params[k]) {
|
|
16
|
+
return a;
|
|
17
|
+
}
|
|
18
|
+
const value = params[k];
|
|
19
|
+
a.push(k +
|
|
20
|
+
'=' +
|
|
21
|
+
encodeURIComponent(Array.isArray(value) ? value.join(',') : value));
|
|
22
|
+
return a;
|
|
23
|
+
}, [])
|
|
24
|
+
.join('&'));
|
|
31
25
|
}
|
|
32
|
-
exports.concatQueryParams = concatQueryParams
|
|
33
|
-
//# sourceMappingURL=params.js.map
|
|
26
|
+
exports.concatQueryParams = concatQueryParams;
|
|
27
|
+
//# sourceMappingURL=params.js.map
|
package/api/quoter/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './quote/index'
|
|
2
|
-
export * from './quoter.request'
|
|
3
|
-
export * from './quoter.api'
|
|
4
|
-
export * from './types'
|
|
5
|
-
export * from './preset'
|
|
1
|
+
export * from './quote/index';
|
|
2
|
+
export * from './quoter.request';
|
|
3
|
+
export * from './quoter.api';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './preset';
|