@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.
Files changed (196) hide show
  1. package/README.md +4 -0
  2. package/api/fusion-api.d.ts +16 -25
  3. package/api/fusion-api.js +26 -36
  4. package/api/index.d.ts +4 -4
  5. package/api/index.js +8 -8
  6. package/api/orders/index.d.ts +3 -3
  7. package/api/orders/index.js +7 -7
  8. package/api/orders/order-api.spec.d.ts +1 -1
  9. package/api/orders/order-api.spec.js +397 -479
  10. package/api/orders/orders.api.d.ts +10 -24
  11. package/api/orders/orders.api.js +28 -30
  12. package/api/orders/orders.request.d.ts +18 -22
  13. package/api/orders/orders.request.js +31 -40
  14. package/api/orders/types.d.ts +58 -59
  15. package/api/orders/types.js +16 -17
  16. package/api/pagination.d.ts +7 -7
  17. package/api/pagination.js +10 -10
  18. package/api/pagination.spec.d.ts +1 -1
  19. package/api/pagination.spec.js +21 -28
  20. package/api/params.d.ts +1 -3
  21. package/api/params.js +19 -25
  22. package/api/quoter/index.d.ts +5 -5
  23. package/api/quoter/index.js +9 -9
  24. package/api/quoter/preset.d.ts +13 -13
  25. package/api/quoter/preset.js +17 -19
  26. package/api/quoter/quote/index.d.ts +3 -3
  27. package/api/quoter/quote/index.js +7 -7
  28. package/api/quoter/quote/order-params.d.ts +7 -6
  29. package/api/quoter/quote/order-params.js +13 -12
  30. package/api/quoter/quote/order-params.js.map +1 -1
  31. package/api/quoter/quote/quote.d.ts +22 -26
  32. package/api/quoter/quote/quote.js +59 -84
  33. package/api/quoter/quote/quote.js.map +1 -1
  34. package/api/quoter/quote/types.d.ts +5 -4
  35. package/api/quoter/quote/types.js +3 -3
  36. package/api/quoter/quoter.api.d.ts +9 -12
  37. package/api/quoter/quoter.api.js +19 -19
  38. package/api/quoter/quoter.api.spec.d.ts +1 -1
  39. package/api/quoter/quoter.api.spec.js +24 -30
  40. package/api/quoter/quoter.api.spec.js.map +1 -1
  41. package/api/quoter/quoter.request.d.ts +11 -11
  42. package/api/quoter/quoter.request.js +26 -28
  43. package/api/quoter/types.d.ts +45 -45
  44. package/api/quoter/types.js +10 -10
  45. package/api/relayer/index.d.ts +3 -3
  46. package/api/relayer/index.js +7 -7
  47. package/api/relayer/relayer.api.d.ts +9 -12
  48. package/api/relayer/relayer.api.js +13 -13
  49. package/api/relayer/relayer.api.spec.d.ts +1 -1
  50. package/api/relayer/relayer.api.spec.js +79 -96
  51. package/api/relayer/relayer.request.d.ts +8 -8
  52. package/api/relayer/relayer.request.js +10 -10
  53. package/api/relayer/types.d.ts +9 -9
  54. package/api/relayer/types.js +3 -3
  55. package/api/types.d.ts +15 -17
  56. package/api/types.js +3 -3
  57. package/auction-calculator/auction-calculator.d.ts +13 -22
  58. package/auction-calculator/auction-calculator.js +45 -70
  59. package/auction-calculator/auction-calculator.spec.d.ts +1 -1
  60. package/auction-calculator/auction-calculator.spec.js +32 -45
  61. package/auction-calculator/calc.d.ts +2 -8
  62. package/auction-calculator/calc.js +12 -12
  63. package/auction-calculator/constants.d.ts +1 -1
  64. package/auction-calculator/constants.js +5 -5
  65. package/auction-calculator/index.d.ts +3 -3
  66. package/auction-calculator/index.js +7 -7
  67. package/auction-salt/auction-salt.d.ts +9 -9
  68. package/auction-salt/auction-salt.js +23 -34
  69. package/auction-salt/auction.salt.spec.d.ts +1 -1
  70. package/auction-salt/auction.salt.spec.js +27 -38
  71. package/auction-salt/index.d.ts +3 -3
  72. package/auction-salt/index.js +7 -7
  73. package/auction-salt/parser/constants.d.ts +9 -9
  74. package/auction-salt/parser/constants.js +14 -33
  75. package/auction-salt/parser/index.d.ts +2 -2
  76. package/auction-salt/parser/index.js +6 -6
  77. package/auction-salt/parser/parser.d.ts +6 -6
  78. package/auction-salt/parser/parser.js +22 -33
  79. package/auction-salt/types.d.ts +6 -6
  80. package/auction-salt/types.js +3 -3
  81. package/auction-suffix/auction-suffix.d.ts +9 -9
  82. package/auction-suffix/auction-suffix.js +23 -36
  83. package/auction-suffix/auction-suffix.spec.d.ts +1 -1
  84. package/auction-suffix/auction-suffix.spec.js +15 -20
  85. package/auction-suffix/constants.d.ts +1 -1
  86. package/auction-suffix/constants.js +5 -5
  87. package/auction-suffix/encoder.d.ts +6 -15
  88. package/auction-suffix/encoder.js +28 -45
  89. package/auction-suffix/index.d.ts +5 -5
  90. package/auction-suffix/index.js +9 -9
  91. package/auction-suffix/parser/constants.d.ts +13 -13
  92. package/auction-suffix/parser/constants.js +17 -30
  93. package/auction-suffix/parser/errors.d.ts +2 -1
  94. package/auction-suffix/parser/errors.js +7 -6
  95. package/auction-suffix/parser/index.d.ts +4 -4
  96. package/auction-suffix/parser/index.js +8 -8
  97. package/auction-suffix/parser/parser.d.ts +8 -28
  98. package/auction-suffix/parser/parser.js +81 -162
  99. package/auction-suffix/parser/types.d.ts +22 -22
  100. package/auction-suffix/parser/types.js +3 -3
  101. package/auction-suffix/types.d.ts +12 -12
  102. package/auction-suffix/types.js +3 -3
  103. package/connector/blockchain/blockchain-provider.connector.d.ts +3 -6
  104. package/connector/blockchain/blockchain-provider.connector.js +3 -3
  105. package/connector/blockchain/index.d.ts +3 -3
  106. package/connector/blockchain/index.js +7 -7
  107. package/connector/blockchain/private-key-provider.connector.d.ts +10 -15
  108. package/connector/blockchain/private-key-provider.connector.js +12 -12
  109. package/connector/blockchain/private-key-provider.connector.spec.d.ts +1 -1
  110. package/connector/blockchain/private-key-provider.connector.spec.js +23 -36
  111. package/connector/blockchain/web3-provider-connector.d.ts +8 -13
  112. package/connector/blockchain/web3-provider-connector.js +9 -12
  113. package/connector/blockchain/web3-provider.connector.spec.d.ts +1 -1
  114. package/connector/blockchain/web3-provider.connector.spec.js +26 -37
  115. package/connector/http/axios-provider.connector.d.ts +3 -3
  116. package/connector/http/axios-provider.connector.js +13 -13
  117. package/connector/http/axios-provider.connector.spec.d.ts +1 -1
  118. package/connector/http/axios-provider.connector.spec.js +31 -37
  119. package/connector/http/http-provider.connector.d.ts +2 -2
  120. package/connector/http/http-provider.connector.js +3 -3
  121. package/connector/http/index.d.ts +2 -2
  122. package/connector/http/index.js +6 -6
  123. package/connector/index.d.ts +2 -2
  124. package/connector/index.js +6 -6
  125. package/constants.d.ts +6 -10
  126. package/constants.js +16 -23
  127. package/fusion-order/fusion-order.d.ts +7 -17
  128. package/fusion-order/fusion-order.js +12 -14
  129. package/fusion-order/fusion-order.spec.d.ts +1 -1
  130. package/fusion-order/fusion-order.spec.js +22 -27
  131. package/fusion-order/index.d.ts +1 -1
  132. package/fusion-order/index.js +5 -5
  133. package/index.d.ts +11 -11
  134. package/index.js +15 -15
  135. package/limit-order/eip712/domain.d.ts +9 -10
  136. package/limit-order/eip712/domain.js +23 -28
  137. package/limit-order/eip712/eip712.types.d.ts +15 -19
  138. package/limit-order/eip712/eip712.types.js +3 -3
  139. package/limit-order/eip712/index.d.ts +3 -3
  140. package/limit-order/eip712/index.js +7 -7
  141. package/limit-order/eip712/order-typed-data-builder.d.ts +6 -17
  142. package/limit-order/eip712/order-typed-data-builder.js +19 -34
  143. package/limit-order/index.d.ts +4 -4
  144. package/limit-order/index.js +8 -8
  145. package/limit-order/interactions-factory.d.ts +1 -1
  146. package/limit-order/interactions-factory.js +6 -6
  147. package/limit-order/limit-order.d.ts +25 -31
  148. package/limit-order/limit-order.js +50 -103
  149. package/limit-order/limit-order.spec.d.ts +1 -1
  150. package/limit-order/limit-order.spec.js +51 -75
  151. package/limit-order/parser/constants.d.ts +9 -9
  152. package/limit-order/parser/constants.js +5 -5
  153. package/limit-order/parser/index.d.ts +3 -3
  154. package/limit-order/parser/index.js +7 -7
  155. package/limit-order/parser/parser.d.ts +2 -5
  156. package/limit-order/parser/parser.js +18 -23
  157. package/limit-order/parser/types.d.ts +3 -3
  158. package/limit-order/parser/types.js +3 -3
  159. package/limit-order/predicate-factory.d.ts +5 -9
  160. package/limit-order/predicate-factory.js +24 -40
  161. package/limit-order/predicate-factory.spec.d.ts +1 -1
  162. package/limit-order/predicate-factory.spec.js +29 -44
  163. package/limit-order/types.d.ts +29 -29
  164. package/limit-order/types.js +3 -3
  165. package/limit-order/utils.d.ts +1 -1
  166. package/limit-order/utils.js +6 -6
  167. package/package.json +1 -1
  168. package/sdk/index.d.ts +2 -2
  169. package/sdk/index.js +6 -6
  170. package/sdk/sdk.d.ts +11 -29
  171. package/sdk/sdk.js +40 -49
  172. package/sdk/sdk.js.map +1 -1
  173. package/sdk/types.d.ts +27 -27
  174. package/sdk/types.js +3 -3
  175. package/settlement/encoders/constants.d.ts +1 -1
  176. package/settlement/encoders/constants.js +5 -5
  177. package/settlement/encoders/fill-order.encoder.d.ts +2 -2
  178. package/settlement/encoders/fill-order.encoder.js +12 -26
  179. package/settlement/encoders/index.d.ts +3 -3
  180. package/settlement/encoders/index.js +7 -7
  181. package/settlement/encoders/settlement.encoder.d.ts +4 -13
  182. package/settlement/encoders/settlement.encoder.js +19 -41
  183. package/settlement/index.d.ts +4 -4
  184. package/settlement/index.js +8 -8
  185. package/settlement/settlement.d.ts +5 -8
  186. package/settlement/settlement.js +14 -28
  187. package/settlement/settlement.spec.d.ts +1 -1
  188. package/settlement/settlement.spec.js +35 -45
  189. package/settlement/signature-patcher.d.ts +1 -1
  190. package/settlement/signature-patcher.js +16 -19
  191. package/settlement/types.d.ts +13 -13
  192. package/settlement/types.js +3 -3
  193. package/utils.d.ts +6 -6
  194. package/utils.js +23 -29
  195. package/validations.d.ts +2 -2
  196. package/validations.js +15 -14
@@ -1,26 +1,12 @@
1
- import {AxiosProviderConnector, HttpProviderConnector} from '../../connector'
2
- import {
3
- ActiveOrdersRequest,
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
- config: OrdersApiConfig,
19
- httpClient?: AxiosProviderConnector
20
- ): OrdersApi
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
  }
@@ -1,51 +1,49 @@
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')
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
- params.buildQueryParams()
44
- )
45
- const url = `${this.config.url}/v1.0/${this.config.network}/order/maker/${params.address}/${queryParams}`
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
- ActiveOrdersRequestParams,
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
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', {value: true})
3
- exports.OrdersByMakerRequest =
4
- exports.OrderStatusRequest =
5
- exports.ActiveOrdersRequest =
6
- void 0
7
- const tslib_1 = require('tslib')
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
@@ -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 = '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'
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>;
@@ -1,17 +1,16 @@
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'] =
10
- 'not-enough-balance-or-allowance'
11
- OrderStatus['Expired'] = 'expired'
12
- OrderStatus['PartiallyFilled'] = 'partially-filled'
13
- OrderStatus['WrongPermit'] = 'wrong-permit'
14
- OrderStatus['Cancelled'] = 'cancelled'
15
- OrderStatus['InvalidSignature'] = 'invalid-signature'
16
- })((OrderStatus = exports.OrderStatus || (exports.OrderStatus = {})))
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
@@ -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
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', {value: true})
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
@@ -1 +1 @@
1
- export {}
1
+ export {};
@@ -1,35 +1,28 @@
1
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', {value: true})
3
- const pagination_1 = require('./pagination')
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
- undefined,
9
- undefined
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
- 'limit should be in range between 1 and 500'
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
- 'limit should be in range between 1 and 500'
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
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', {value: true})
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
- if (!params[k]) {
17
- return a
18
- }
19
- const value = params[k]
20
- a.push(
21
- k +
22
- '=' +
23
- encodeURIComponent(
24
- Array.isArray(value) ? value.join(',') : value
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
@@ -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';