@1inch/fusion-sdk 0.0.4 → 0.0.6

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/api/fusion-api.d.ts +25 -16
  2. package/api/fusion-api.js +36 -26
  3. package/api/index.d.ts +4 -4
  4. package/api/index.js +8 -8
  5. package/api/orders/index.d.ts +3 -3
  6. package/api/orders/index.js +7 -7
  7. package/api/orders/order-api.spec.d.ts +1 -1
  8. package/api/orders/order-api.spec.js +479 -395
  9. package/api/orders/order-api.spec.js.map +1 -1
  10. package/api/orders/orders.api.d.ts +24 -10
  11. package/api/orders/orders.api.js +30 -28
  12. package/api/orders/orders.request.d.ts +22 -18
  13. package/api/orders/orders.request.js +40 -31
  14. package/api/orders/types.d.ts +59 -57
  15. package/api/orders/types.js +17 -16
  16. package/api/orders/types.js.map +1 -1
  17. package/api/pagination.d.ts +7 -7
  18. package/api/pagination.js +10 -10
  19. package/api/pagination.spec.d.ts +1 -1
  20. package/api/pagination.spec.js +28 -21
  21. package/api/params.d.ts +3 -1
  22. package/api/params.js +25 -19
  23. package/api/quoter/index.d.ts +5 -5
  24. package/api/quoter/index.js +9 -9
  25. package/api/quoter/preset.d.ts +13 -13
  26. package/api/quoter/preset.js +19 -17
  27. package/api/quoter/quote/index.d.ts +3 -3
  28. package/api/quoter/quote/index.js +7 -7
  29. package/api/quoter/quote/order-params.d.ts +6 -6
  30. package/api/quoter/quote/order-params.js +12 -12
  31. package/api/quoter/quote/quote.d.ts +26 -21
  32. package/api/quoter/quote/quote.js +85 -52
  33. package/api/quoter/quote/quote.js.map +1 -1
  34. package/api/quoter/quote/types.d.ts +4 -4
  35. package/api/quoter/quote/types.js +3 -3
  36. package/api/quoter/quoter.api.d.ts +12 -9
  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 +32 -23
  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 +28 -26
  43. package/api/quoter/types.d.ts +45 -44
  44. package/api/quoter/types.js +10 -10
  45. package/api/quoter/types.js.map +1 -1
  46. package/api/relayer/index.d.ts +3 -3
  47. package/api/relayer/index.js +7 -7
  48. package/api/relayer/relayer.api.d.ts +12 -9
  49. package/api/relayer/relayer.api.js +13 -13
  50. package/api/relayer/relayer.api.spec.d.ts +1 -1
  51. package/api/relayer/relayer.api.spec.js +96 -79
  52. package/api/relayer/relayer.request.d.ts +8 -8
  53. package/api/relayer/relayer.request.js +10 -10
  54. package/api/relayer/types.d.ts +9 -9
  55. package/api/relayer/types.js +3 -3
  56. package/api/types.d.ts +17 -15
  57. package/api/types.js +3 -3
  58. package/auction-calculator/auction-calculator.d.ts +22 -13
  59. package/auction-calculator/auction-calculator.js +70 -45
  60. package/auction-calculator/auction-calculator.spec.d.ts +1 -1
  61. package/auction-calculator/auction-calculator.spec.js +45 -32
  62. package/auction-calculator/calc.d.ts +8 -2
  63. package/auction-calculator/calc.js +12 -12
  64. package/auction-calculator/constants.d.ts +1 -1
  65. package/auction-calculator/constants.js +5 -5
  66. package/auction-calculator/index.d.ts +3 -3
  67. package/auction-calculator/index.js +7 -7
  68. package/auction-salt/auction-salt.d.ts +9 -9
  69. package/auction-salt/auction-salt.js +34 -23
  70. package/auction-salt/auction.salt.spec.d.ts +1 -1
  71. package/auction-salt/auction.salt.spec.js +38 -27
  72. package/auction-salt/index.d.ts +3 -3
  73. package/auction-salt/index.js +7 -7
  74. package/auction-salt/parser/constants.d.ts +9 -9
  75. package/auction-salt/parser/constants.js +33 -14
  76. package/auction-salt/parser/index.d.ts +2 -2
  77. package/auction-salt/parser/index.js +6 -6
  78. package/auction-salt/parser/parser.d.ts +6 -6
  79. package/auction-salt/parser/parser.js +33 -22
  80. package/auction-salt/types.d.ts +6 -6
  81. package/auction-salt/types.js +3 -3
  82. package/auction-suffix/auction-suffix.d.ts +9 -9
  83. package/auction-suffix/auction-suffix.js +36 -23
  84. package/auction-suffix/auction-suffix.spec.d.ts +1 -1
  85. package/auction-suffix/auction-suffix.spec.js +20 -15
  86. package/auction-suffix/constants.d.ts +1 -1
  87. package/auction-suffix/constants.js +5 -5
  88. package/auction-suffix/encoder.d.ts +15 -6
  89. package/auction-suffix/encoder.js +45 -28
  90. package/auction-suffix/index.d.ts +5 -5
  91. package/auction-suffix/index.js +9 -9
  92. package/auction-suffix/parser/constants.d.ts +13 -13
  93. package/auction-suffix/parser/constants.js +30 -17
  94. package/auction-suffix/parser/errors.d.ts +1 -2
  95. package/auction-suffix/parser/errors.js +6 -7
  96. package/auction-suffix/parser/index.d.ts +4 -4
  97. package/auction-suffix/parser/index.js +8 -8
  98. package/auction-suffix/parser/parser.d.ts +28 -8
  99. package/auction-suffix/parser/parser.js +162 -81
  100. package/auction-suffix/parser/types.d.ts +22 -22
  101. package/auction-suffix/parser/types.js +3 -3
  102. package/auction-suffix/types.d.ts +12 -12
  103. package/auction-suffix/types.js +3 -3
  104. package/connector/blockchain/blockchain-provider.connector.d.ts +6 -3
  105. package/connector/blockchain/blockchain-provider.connector.js +3 -3
  106. package/connector/blockchain/index.d.ts +3 -3
  107. package/connector/blockchain/index.js +7 -7
  108. package/connector/blockchain/private-key-provider.connector.d.ts +15 -10
  109. package/connector/blockchain/private-key-provider.connector.js +12 -12
  110. package/connector/blockchain/private-key-provider.connector.spec.d.ts +1 -1
  111. package/connector/blockchain/private-key-provider.connector.spec.js +36 -23
  112. package/connector/blockchain/web3-provider-connector.d.ts +13 -8
  113. package/connector/blockchain/web3-provider-connector.js +12 -9
  114. package/connector/blockchain/web3-provider.connector.spec.d.ts +1 -1
  115. package/connector/blockchain/web3-provider.connector.spec.js +37 -26
  116. package/connector/http/axios-provider.connector.d.ts +3 -3
  117. package/connector/http/axios-provider.connector.js +13 -13
  118. package/connector/http/axios-provider.connector.spec.d.ts +1 -1
  119. package/connector/http/axios-provider.connector.spec.js +37 -31
  120. package/connector/http/http-provider.connector.d.ts +2 -2
  121. package/connector/http/http-provider.connector.js +3 -3
  122. package/connector/http/index.d.ts +2 -2
  123. package/connector/http/index.js +6 -6
  124. package/connector/index.d.ts +2 -2
  125. package/connector/index.js +6 -6
  126. package/constants.d.ts +10 -6
  127. package/constants.js +23 -16
  128. package/fusion-order/fusion-order.d.ts +17 -7
  129. package/fusion-order/fusion-order.js +14 -12
  130. package/fusion-order/fusion-order.spec.d.ts +1 -1
  131. package/fusion-order/fusion-order.spec.js +27 -22
  132. package/fusion-order/index.d.ts +1 -1
  133. package/fusion-order/index.js +5 -5
  134. package/index.d.ts +11 -11
  135. package/index.js +15 -15
  136. package/limit-order/eip712/domain.d.ts +10 -9
  137. package/limit-order/eip712/domain.js +28 -23
  138. package/limit-order/eip712/eip712.types.d.ts +19 -15
  139. package/limit-order/eip712/eip712.types.js +3 -3
  140. package/limit-order/eip712/index.d.ts +3 -3
  141. package/limit-order/eip712/index.js +7 -7
  142. package/limit-order/eip712/order-typed-data-builder.d.ts +17 -6
  143. package/limit-order/eip712/order-typed-data-builder.js +34 -19
  144. package/limit-order/index.d.ts +4 -4
  145. package/limit-order/index.js +8 -8
  146. package/limit-order/interactions-factory.d.ts +1 -1
  147. package/limit-order/interactions-factory.js +6 -6
  148. package/limit-order/limit-order.d.ts +31 -25
  149. package/limit-order/limit-order.js +103 -50
  150. package/limit-order/limit-order.spec.d.ts +1 -1
  151. package/limit-order/limit-order.spec.js +75 -51
  152. package/limit-order/parser/constants.d.ts +9 -9
  153. package/limit-order/parser/constants.js +5 -5
  154. package/limit-order/parser/index.d.ts +3 -3
  155. package/limit-order/parser/index.js +7 -7
  156. package/limit-order/parser/parser.d.ts +5 -2
  157. package/limit-order/parser/parser.js +23 -18
  158. package/limit-order/parser/types.d.ts +3 -3
  159. package/limit-order/parser/types.js +3 -3
  160. package/limit-order/predicate-factory.d.ts +9 -5
  161. package/limit-order/predicate-factory.js +40 -24
  162. package/limit-order/predicate-factory.spec.d.ts +1 -1
  163. package/limit-order/predicate-factory.spec.js +44 -29
  164. package/limit-order/types.d.ts +29 -29
  165. package/limit-order/types.js +3 -3
  166. package/limit-order/utils.d.ts +1 -1
  167. package/limit-order/utils.js +6 -6
  168. package/package.json +2 -3
  169. package/sdk/index.d.ts +2 -2
  170. package/sdk/index.js +6 -6
  171. package/sdk/sdk.d.ts +29 -11
  172. package/sdk/sdk.js +48 -38
  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 +26 -12
  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 +13 -4
  182. package/settlement/encoders/settlement.encoder.js +41 -19
  183. package/settlement/index.d.ts +4 -4
  184. package/settlement/index.js +8 -8
  185. package/settlement/settlement.d.ts +8 -5
  186. package/settlement/settlement.js +28 -14
  187. package/settlement/settlement.spec.d.ts +1 -1
  188. package/settlement/settlement.spec.js +45 -35
  189. package/settlement/signature-patcher.d.ts +1 -1
  190. package/settlement/signature-patcher.js +19 -16
  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 +29 -23
  195. package/validations.d.ts +2 -2
  196. package/validations.js +14 -15
@@ -1,13 +1,13 @@
1
- export declare const AUCTION_BUMP_LENGTH = 6;
2
- export declare const AUCTION_DELAY_LENGTH = 4;
3
- export declare const ADDRESS_LENGTH = 40;
4
- export declare const ALLOWED_TIMESTAMP_LENGTH = 8;
5
- export declare const PRIVATE_AUCTION_DEADLINE_LENGTH = 8;
6
- export declare const TAKER_FEE_RECEIVER_LENGTH = 40;
7
- export declare const TAKER_FEE_RATIO_LENGTH = 24;
8
- export declare const FLAGS_LENGTH = 2;
9
- export declare const HAS_TAKING_FEE_FLAG = 128;
10
- export declare const RESOLVERS_LENGTH_MASK = 120;
11
- export declare const RESOLVERS_LENGTH_OFFSET = 3;
12
- export declare const POINTS_LENGTH_MASK = 7;
13
- export declare const CONTRACT_TAKER_FEE_PRECISION = 1000000000;
1
+ export declare const AUCTION_BUMP_LENGTH = 6
2
+ export declare const AUCTION_DELAY_LENGTH = 4
3
+ export declare const ADDRESS_LENGTH = 40
4
+ export declare const ALLOWED_TIMESTAMP_LENGTH = 8
5
+ export declare const PRIVATE_AUCTION_DEADLINE_LENGTH = 8
6
+ export declare const TAKER_FEE_RECEIVER_LENGTH = 40
7
+ export declare const TAKER_FEE_RATIO_LENGTH = 24
8
+ export declare const FLAGS_LENGTH = 2
9
+ export declare const HAS_TAKING_FEE_FLAG = 128
10
+ export declare const RESOLVERS_LENGTH_MASK = 120
11
+ export declare const RESOLVERS_LENGTH_OFFSET = 3
12
+ export declare const POINTS_LENGTH_MASK = 7
13
+ export declare const CONTRACT_TAKER_FEE_PRECISION = 1000000000
@@ -1,17 +1,30 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTRACT_TAKER_FEE_PRECISION = exports.POINTS_LENGTH_MASK = exports.RESOLVERS_LENGTH_OFFSET = exports.RESOLVERS_LENGTH_MASK = exports.HAS_TAKING_FEE_FLAG = exports.FLAGS_LENGTH = exports.TAKER_FEE_RATIO_LENGTH = exports.TAKER_FEE_RECEIVER_LENGTH = exports.PRIVATE_AUCTION_DEADLINE_LENGTH = exports.ALLOWED_TIMESTAMP_LENGTH = exports.ADDRESS_LENGTH = exports.AUCTION_DELAY_LENGTH = exports.AUCTION_BUMP_LENGTH = void 0;
4
- exports.AUCTION_BUMP_LENGTH = 6;
5
- exports.AUCTION_DELAY_LENGTH = 4;
6
- exports.ADDRESS_LENGTH = 40;
7
- exports.ALLOWED_TIMESTAMP_LENGTH = 8;
8
- exports.PRIVATE_AUCTION_DEADLINE_LENGTH = 8;
9
- exports.TAKER_FEE_RECEIVER_LENGTH = 40;
10
- exports.TAKER_FEE_RATIO_LENGTH = 24;
11
- exports.FLAGS_LENGTH = 2;
12
- exports.HAS_TAKING_FEE_FLAG = 0x80;
13
- exports.RESOLVERS_LENGTH_MASK = 0x78;
14
- exports.RESOLVERS_LENGTH_OFFSET = 3;
15
- exports.POINTS_LENGTH_MASK = 0x07;
16
- exports.CONTRACT_TAKER_FEE_PRECISION = 1e9;
17
- //# sourceMappingURL=constants.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.CONTRACT_TAKER_FEE_PRECISION =
4
+ exports.POINTS_LENGTH_MASK =
5
+ exports.RESOLVERS_LENGTH_OFFSET =
6
+ exports.RESOLVERS_LENGTH_MASK =
7
+ exports.HAS_TAKING_FEE_FLAG =
8
+ exports.FLAGS_LENGTH =
9
+ exports.TAKER_FEE_RATIO_LENGTH =
10
+ exports.TAKER_FEE_RECEIVER_LENGTH =
11
+ exports.PRIVATE_AUCTION_DEADLINE_LENGTH =
12
+ exports.ALLOWED_TIMESTAMP_LENGTH =
13
+ exports.ADDRESS_LENGTH =
14
+ exports.AUCTION_DELAY_LENGTH =
15
+ exports.AUCTION_BUMP_LENGTH =
16
+ void 0
17
+ exports.AUCTION_BUMP_LENGTH = 6
18
+ exports.AUCTION_DELAY_LENGTH = 4
19
+ exports.ADDRESS_LENGTH = 40
20
+ exports.ALLOWED_TIMESTAMP_LENGTH = 8
21
+ exports.PRIVATE_AUCTION_DEADLINE_LENGTH = 8
22
+ exports.TAKER_FEE_RECEIVER_LENGTH = 40
23
+ exports.TAKER_FEE_RATIO_LENGTH = 24
24
+ exports.FLAGS_LENGTH = 2
25
+ exports.HAS_TAKING_FEE_FLAG = 0x80
26
+ exports.RESOLVERS_LENGTH_MASK = 0x78
27
+ exports.RESOLVERS_LENGTH_OFFSET = 3
28
+ exports.POINTS_LENGTH_MASK = 0x07
29
+ exports.CONTRACT_TAKER_FEE_PRECISION = 1e9
30
+ //# sourceMappingURL=constants.js.map
@@ -1,2 +1 @@
1
- export declare class BadOrderSuffixError extends Error {
2
- }
1
+ export declare class BadOrderSuffixError extends Error {}
@@ -1,7 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BadOrderSuffixError = void 0;
4
- class BadOrderSuffixError extends Error {
5
- }
6
- exports.BadOrderSuffixError = BadOrderSuffixError;
7
- //# sourceMappingURL=errors.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.BadOrderSuffixError = void 0
4
+ class BadOrderSuffixError extends Error {}
5
+ exports.BadOrderSuffixError = BadOrderSuffixError
6
+ //# sourceMappingURL=errors.js.map
@@ -1,4 +1,4 @@
1
- export * from './constants';
2
- export * from './parser';
3
- export * from './types';
4
- export * from './errors';
1
+ export * from './constants'
2
+ export * from './parser'
3
+ export * from './types'
4
+ export * from './errors'
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./constants"), exports);
5
- tslib_1.__exportStar(require("./parser"), exports);
6
- tslib_1.__exportStar(require("./types"), exports);
7
- tslib_1.__exportStar(require("./errors"), exports);
8
- //# sourceMappingURL=index.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ const tslib_1 = require('tslib')
4
+ tslib_1.__exportStar(require('./constants'), exports)
5
+ tslib_1.__exportStar(require('./parser'), exports)
6
+ tslib_1.__exportStar(require('./types'), exports)
7
+ tslib_1.__exportStar(require('./errors'), exports)
8
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,11 @@
1
- import { InteractionAdditionalInfo, InteractionFlags, ParsedAuctionParams, PrivateAuctionDeadline, ResolversWhitelist, TakerFeeData } from './types';
1
+ import {
2
+ InteractionAdditionalInfo,
3
+ InteractionFlags,
4
+ ParsedAuctionParams,
5
+ PrivateAuctionDeadline,
6
+ ResolversWhitelist,
7
+ TakerFeeData
8
+ } from './types'
2
9
  /**
3
10
  * Order.interactions suffix structure:
4
11
  * M*(1 + 3 bytes) - auction points coefficients with seconds delays
@@ -8,10 +15,23 @@ import { InteractionAdditionalInfo, InteractionFlags, ParsedAuctionParams, Priva
8
15
  * 1 byte - flags
9
16
  * @param interactions
10
17
  */
11
- export declare function parseInteractionsSuffix(interactions: string): InteractionAdditionalInfo;
12
- export declare function minInteractionsLength(flags: InteractionFlags): number;
13
- export declare function parseTakingFeeAndReturnRemainingInteractions(flags: InteractionFlags, interactions: string): TakerFeeData;
14
- export declare function parsePrivateAuctionDeadline(interactions: string): PrivateAuctionDeadline;
15
- export declare function parseResolversWhitelist(flags: InteractionFlags, interactions: string): ResolversWhitelist;
16
- export declare function parseAuctionParams(flags: InteractionFlags, interactions: string): ParsedAuctionParams;
17
- export declare function parseFlags(interactions: string): InteractionFlags;
18
+ export declare function parseInteractionsSuffix(
19
+ interactions: string
20
+ ): InteractionAdditionalInfo
21
+ export declare function minInteractionsLength(flags: InteractionFlags): number
22
+ export declare function parseTakingFeeAndReturnRemainingInteractions(
23
+ flags: InteractionFlags,
24
+ interactions: string
25
+ ): TakerFeeData
26
+ export declare function parsePrivateAuctionDeadline(
27
+ interactions: string
28
+ ): PrivateAuctionDeadline
29
+ export declare function parseResolversWhitelist(
30
+ flags: InteractionFlags,
31
+ interactions: string
32
+ ): ResolversWhitelist
33
+ export declare function parseAuctionParams(
34
+ flags: InteractionFlags,
35
+ interactions: string
36
+ ): ParsedAuctionParams
37
+ export declare function parseFlags(interactions: string): InteractionFlags
@@ -1,11 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseFlags = exports.parseAuctionParams = exports.parseResolversWhitelist = exports.parsePrivateAuctionDeadline = exports.parseTakingFeeAndReturnRemainingInteractions = exports.minInteractionsLength = exports.parseInteractionsSuffix = void 0;
4
- const constants_1 = require("./constants");
5
- const bignumber_1 = require("@ethersproject/bignumber");
6
- const constants_2 = require("../../constants");
7
- const utils_1 = require("../../utils");
8
- const errors_1 = require("./errors");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.parseFlags =
4
+ exports.parseAuctionParams =
5
+ exports.parseResolversWhitelist =
6
+ exports.parsePrivateAuctionDeadline =
7
+ exports.parseTakingFeeAndReturnRemainingInteractions =
8
+ exports.minInteractionsLength =
9
+ exports.parseInteractionsSuffix =
10
+ void 0
11
+ const constants_1 = require('./constants')
12
+ const bignumber_1 = require('@ethersproject/bignumber')
13
+ const constants_2 = require('../../constants')
14
+ const utils_1 = require('../../utils')
15
+ const errors_1 = require('./errors')
9
16
  /**
10
17
  * Order.interactions suffix structure:
11
18
  * M*(1 + 3 bytes) - auction points coefficients with seconds delays
@@ -16,155 +23,229 @@ const errors_1 = require("./errors");
16
23
  * @param interactions
17
24
  */
18
25
  function parseInteractionsSuffix(interactions) {
19
- const flags = parseFlags(interactions);
26
+ const flags = parseFlags(interactions)
20
27
  if (interactions.length < minInteractionsLength(flags)) {
21
- throw new errors_1.BadOrderSuffixError('wrong interactions length');
28
+ throw new errors_1.BadOrderSuffixError('wrong interactions length')
22
29
  }
23
- const interactionsWithoutFlags = interactions.slice(0, -constants_1.FLAGS_LENGTH);
24
- const { takerFeeReceiver, takerFeeRatio, interactions: interactionsNoTakingFee } = parseTakingFeeAndReturnRemainingInteractions(flags, interactionsWithoutFlags);
25
- const { deadline, interactions: interactionsNoDeadline } = parsePrivateAuctionDeadline(interactionsNoTakingFee);
26
- const { whitelist, interactions: interactionsWithoutWhitelist } = parseResolversWhitelist(flags, interactionsNoDeadline);
27
- const { points } = parseAuctionParams(flags, interactionsWithoutWhitelist);
30
+ const interactionsWithoutFlags = interactions.slice(
31
+ 0,
32
+ -constants_1.FLAGS_LENGTH
33
+ )
34
+ const {
35
+ takerFeeReceiver,
36
+ takerFeeRatio,
37
+ interactions: interactionsNoTakingFee
38
+ } = parseTakingFeeAndReturnRemainingInteractions(
39
+ flags,
40
+ interactionsWithoutFlags
41
+ )
42
+ const {deadline, interactions: interactionsNoDeadline} =
43
+ parsePrivateAuctionDeadline(interactionsNoTakingFee)
44
+ const {whitelist, interactions: interactionsWithoutWhitelist} =
45
+ parseResolversWhitelist(flags, interactionsNoDeadline)
46
+ const {points} = parseAuctionParams(flags, interactionsWithoutWhitelist)
28
47
  return {
29
48
  whitelist,
30
49
  publicResolvingDeadline: deadline,
31
50
  takerFeeReceiver,
32
51
  takerFeeRatio,
33
52
  points
34
- };
53
+ }
35
54
  }
36
- exports.parseInteractionsSuffix = parseInteractionsSuffix;
55
+ exports.parseInteractionsSuffix = parseInteractionsSuffix
37
56
  function minInteractionsLength(flags) {
38
- const auctionPointsLen = flags.pointsCount * (constants_1.AUCTION_DELAY_LENGTH + constants_1.AUCTION_BUMP_LENGTH);
39
- const whitelistLen = flags.resolversCount * (constants_1.ALLOWED_TIMESTAMP_LENGTH + constants_1.ADDRESS_LENGTH);
40
- const requiredLength = auctionPointsLen +
57
+ const auctionPointsLen =
58
+ flags.pointsCount *
59
+ (constants_1.AUCTION_DELAY_LENGTH + constants_1.AUCTION_BUMP_LENGTH)
60
+ const whitelistLen =
61
+ flags.resolversCount *
62
+ (constants_1.ALLOWED_TIMESTAMP_LENGTH + constants_1.ADDRESS_LENGTH)
63
+ const requiredLength =
64
+ auctionPointsLen +
41
65
  whitelistLen +
42
66
  constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH +
43
- constants_1.FLAGS_LENGTH;
67
+ constants_1.FLAGS_LENGTH
44
68
  if (flags.takingFeeEnabled) {
45
- return (requiredLength + constants_1.TAKER_FEE_RECEIVER_LENGTH + constants_1.TAKER_FEE_RATIO_LENGTH);
69
+ return (
70
+ requiredLength +
71
+ constants_1.TAKER_FEE_RECEIVER_LENGTH +
72
+ constants_1.TAKER_FEE_RATIO_LENGTH
73
+ )
46
74
  }
47
- return requiredLength;
75
+ return requiredLength
48
76
  }
49
- exports.minInteractionsLength = minInteractionsLength;
77
+ exports.minInteractionsLength = minInteractionsLength
50
78
  function parseTakingFeeAndReturnRemainingInteractions(flags, interactions) {
51
79
  if (!flags.takingFeeEnabled) {
52
80
  return {
53
81
  interactions,
54
82
  takerFeeReceiver: constants_2.ZERO_ADDRESS,
55
83
  takerFeeRatio: '0'
56
- };
84
+ }
57
85
  }
58
- const takerFeeDataLen = constants_1.TAKER_FEE_RECEIVER_LENGTH + constants_1.TAKER_FEE_RATIO_LENGTH;
59
- const takerFeeData = interactions.slice(-takerFeeDataLen);
60
- const takerFeeReceiverHex = takerFeeData.slice(constants_1.TAKER_FEE_RATIO_LENGTH);
61
- const takerFeeReceiver = (0, utils_1.add0x)(takerFeeReceiverHex);
86
+ const takerFeeDataLen =
87
+ constants_1.TAKER_FEE_RECEIVER_LENGTH +
88
+ constants_1.TAKER_FEE_RATIO_LENGTH
89
+ const takerFeeData = interactions.slice(-takerFeeDataLen)
90
+ const takerFeeReceiverHex = takerFeeData.slice(
91
+ constants_1.TAKER_FEE_RATIO_LENGTH
92
+ )
93
+ const takerFeeReceiver = (0, utils_1.add0x)(takerFeeReceiverHex)
62
94
  if (takerFeeReceiver === constants_2.ZERO_ADDRESS) {
63
- throw new errors_1.BadOrderSuffixError('takerFeeReceiver cannot be zero address');
95
+ throw new errors_1.BadOrderSuffixError(
96
+ 'takerFeeReceiver cannot be zero address'
97
+ )
64
98
  }
65
- const takerFeeRateHex = takerFeeData.slice(0, constants_1.TAKER_FEE_RATIO_LENGTH);
66
- const takerFeeRatio = bignumber_1.BigNumber.from((0, utils_1.add0x)(takerFeeRateHex));
99
+ const takerFeeRateHex = takerFeeData.slice(
100
+ 0,
101
+ constants_1.TAKER_FEE_RATIO_LENGTH
102
+ )
103
+ const takerFeeRatio = bignumber_1.BigNumber.from(
104
+ (0, utils_1.add0x)(takerFeeRateHex)
105
+ )
67
106
  if (takerFeeRatio.gt(constants_1.CONTRACT_TAKER_FEE_PRECISION)) {
68
- throw new errors_1.BadOrderSuffixError('takerFeeRatio cannot be > 1e9');
107
+ throw new errors_1.BadOrderSuffixError('takerFeeRatio cannot be > 1e9')
69
108
  }
70
109
  return {
71
110
  interactions: interactions.slice(0, -takerFeeDataLen),
72
111
  takerFeeReceiver,
73
112
  takerFeeRatio: takerFeeRatio.toString()
74
- };
113
+ }
75
114
  }
76
- exports.parseTakingFeeAndReturnRemainingInteractions = parseTakingFeeAndReturnRemainingInteractions;
115
+ exports.parseTakingFeeAndReturnRemainingInteractions =
116
+ parseTakingFeeAndReturnRemainingInteractions
77
117
  function parsePrivateAuctionDeadline(interactions) {
78
- const privateAuctionDeadlineHex = interactions.slice(-constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH);
79
- const privateAuctionDeadline = Number.parseInt(privateAuctionDeadlineHex, 16);
118
+ const privateAuctionDeadlineHex = interactions.slice(
119
+ -constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH
120
+ )
121
+ const privateAuctionDeadline = Number.parseInt(
122
+ privateAuctionDeadlineHex,
123
+ 16
124
+ )
80
125
  if (!privateAuctionDeadline) {
81
- throw new errors_1.BadOrderSuffixError(`Invalid public resolving deadline in interactions`);
126
+ throw new errors_1.BadOrderSuffixError(
127
+ `Invalid public resolving deadline in interactions`
128
+ )
82
129
  }
83
130
  return {
84
131
  deadline: privateAuctionDeadline,
85
- interactions: interactions.slice(0, -constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH)
86
- };
132
+ interactions: interactions.slice(
133
+ 0,
134
+ -constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH
135
+ )
136
+ }
87
137
  }
88
- exports.parsePrivateAuctionDeadline = parsePrivateAuctionDeadline;
138
+ exports.parsePrivateAuctionDeadline = parsePrivateAuctionDeadline
89
139
  function parseResolversWhitelist(flags, interactions) {
90
- const whitelist = [];
91
- const allowedTsAndResolverLen = constants_1.ADDRESS_LENGTH + constants_1.ALLOWED_TIMESTAMP_LENGTH;
92
- const addressesPacked = interactions.slice(-1 * flags.resolversCount * allowedTsAndResolverLen);
140
+ const whitelist = []
141
+ const allowedTsAndResolverLen =
142
+ constants_1.ADDRESS_LENGTH + constants_1.ALLOWED_TIMESTAMP_LENGTH
143
+ const addressesPacked = interactions.slice(
144
+ -1 * flags.resolversCount * allowedTsAndResolverLen
145
+ )
93
146
  if (addressesPacked.length % allowedTsAndResolverLen) {
94
- throw new errors_1.BadOrderSuffixError(`Invalid whitelist addresses in interactions`);
147
+ throw new errors_1.BadOrderSuffixError(
148
+ `Invalid whitelist addresses in interactions`
149
+ )
95
150
  }
96
151
  for (let i = 0; i < addressesPacked.length; i += allowedTsAndResolverLen) {
97
- const tsAndAddress = addressesPacked.slice(i, i + allowedTsAndResolverLen);
98
- const timestampHex = tsAndAddress.slice(0, constants_1.ALLOWED_TIMESTAMP_LENGTH);
99
- const address = tsAndAddress.slice(constants_1.ALLOWED_TIMESTAMP_LENGTH);
100
- const timestamp = Number.parseInt(timestampHex, 16);
152
+ const tsAndAddress = addressesPacked.slice(
153
+ i,
154
+ i + allowedTsAndResolverLen
155
+ )
156
+ const timestampHex = tsAndAddress.slice(
157
+ 0,
158
+ constants_1.ALLOWED_TIMESTAMP_LENGTH
159
+ )
160
+ const address = tsAndAddress.slice(constants_1.ALLOWED_TIMESTAMP_LENGTH)
161
+ const timestamp = Number.parseInt(timestampHex, 16)
101
162
  if (timestamp !== 0 && !timestamp) {
102
- throw new errors_1.BadOrderSuffixError(`Invalid resolver allowance timestamp`);
163
+ throw new errors_1.BadOrderSuffixError(
164
+ `Invalid resolver allowance timestamp`
165
+ )
103
166
  }
104
167
  whitelist.push({
105
168
  address: (0, utils_1.add0x)(address).toLowerCase(),
106
169
  allowance: timestamp
107
- });
170
+ })
108
171
  }
109
172
  return {
110
173
  whitelist,
111
- interactions: interactions.slice(0, -(flags.resolversCount * allowedTsAndResolverLen))
112
- };
174
+ interactions: interactions.slice(
175
+ 0,
176
+ -(flags.resolversCount * allowedTsAndResolverLen)
177
+ )
178
+ }
113
179
  }
114
- exports.parseResolversWhitelist = parseResolversWhitelist;
180
+ exports.parseResolversWhitelist = parseResolversWhitelist
115
181
  function parseAuctionParams(flags, interactions) {
116
182
  if (flags.pointsCount === 0) {
117
183
  return {
118
184
  interactions,
119
185
  points: []
120
- };
186
+ }
121
187
  }
122
- const points = [];
123
- const auctionParamsLength = constants_1.AUCTION_DELAY_LENGTH + constants_1.AUCTION_BUMP_LENGTH;
124
- const paramsPacked = interactions.slice(-1 * flags.pointsCount * auctionParamsLength);
188
+ const points = []
189
+ const auctionParamsLength =
190
+ constants_1.AUCTION_DELAY_LENGTH + constants_1.AUCTION_BUMP_LENGTH
191
+ const paramsPacked = interactions.slice(
192
+ -1 * flags.pointsCount * auctionParamsLength
193
+ )
125
194
  if (paramsPacked.length % auctionParamsLength) {
126
- throw new errors_1.BadOrderSuffixError(`Invalid auction params in interactions`);
195
+ throw new errors_1.BadOrderSuffixError(
196
+ `Invalid auction params in interactions`
197
+ )
127
198
  }
128
199
  for (let i = 0; i < paramsPacked.length; i += auctionParamsLength) {
129
- const durationAndBump = paramsPacked.slice(i, i + auctionParamsLength);
130
- const durationHex = durationAndBump.slice(0, constants_1.AUCTION_DELAY_LENGTH);
131
- const bumpHex = durationAndBump.slice(constants_1.AUCTION_DELAY_LENGTH);
132
- const duration = Number.parseInt(durationHex, 16);
200
+ const durationAndBump = paramsPacked.slice(i, i + auctionParamsLength)
201
+ const durationHex = durationAndBump.slice(
202
+ 0,
203
+ constants_1.AUCTION_DELAY_LENGTH
204
+ )
205
+ const bumpHex = durationAndBump.slice(constants_1.AUCTION_DELAY_LENGTH)
206
+ const duration = Number.parseInt(durationHex, 16)
133
207
  if (!duration) {
134
- throw new errors_1.BadOrderSuffixError(`Invalid auction point duration`);
208
+ throw new errors_1.BadOrderSuffixError(
209
+ `Invalid auction point duration`
210
+ )
135
211
  }
136
- const bump = Number.parseInt(bumpHex, 16);
212
+ const bump = Number.parseInt(bumpHex, 16)
137
213
  if (!bump) {
138
- throw new errors_1.BadOrderSuffixError(`Invalid auction point bump`);
214
+ throw new errors_1.BadOrderSuffixError(`Invalid auction point bump`)
139
215
  }
140
- points.push({ delay: duration, coefficient: bump });
216
+ points.push({delay: duration, coefficient: bump})
141
217
  }
142
218
  return {
143
219
  points,
144
- interactions: interactions.slice(0, flags.pointsCount * auctionParamsLength)
145
- };
220
+ interactions: interactions.slice(
221
+ 0,
222
+ flags.pointsCount * auctionParamsLength
223
+ )
224
+ }
146
225
  }
147
- exports.parseAuctionParams = parseAuctionParams;
226
+ exports.parseAuctionParams = parseAuctionParams
148
227
  function parseFlags(interactions) {
149
- const flagsHex = interactions.slice(-constants_1.FLAGS_LENGTH);
228
+ const flagsHex = interactions.slice(-constants_1.FLAGS_LENGTH)
150
229
  if (flagsHex.length < constants_1.FLAGS_LENGTH) {
151
- throw new errors_1.BadOrderSuffixError(`Invalid flags length`);
230
+ throw new errors_1.BadOrderSuffixError(`Invalid flags length`)
152
231
  }
153
- const flags = Number.parseInt(flagsHex, 16);
232
+ const flags = Number.parseInt(flagsHex, 16)
154
233
  if (!flags) {
155
- throw new errors_1.BadOrderSuffixError(`cannot parse flags`);
234
+ throw new errors_1.BadOrderSuffixError(`cannot parse flags`)
156
235
  }
157
- const resolversCount = (flags & constants_1.RESOLVERS_LENGTH_MASK) >> constants_1.RESOLVERS_LENGTH_OFFSET;
236
+ const resolversCount =
237
+ (flags & constants_1.RESOLVERS_LENGTH_MASK) >>
238
+ constants_1.RESOLVERS_LENGTH_OFFSET
158
239
  if (resolversCount === 0) {
159
- throw new errors_1.BadOrderSuffixError(`cannot have 0 resolvers`);
240
+ throw new errors_1.BadOrderSuffixError(`cannot have 0 resolvers`)
160
241
  }
161
- const takingFeeEnabled = (flags & constants_1.HAS_TAKING_FEE_FLAG) !== 0;
162
- const pointsCount = flags & constants_1.POINTS_LENGTH_MASK;
242
+ const takingFeeEnabled = (flags & constants_1.HAS_TAKING_FEE_FLAG) !== 0
243
+ const pointsCount = flags & constants_1.POINTS_LENGTH_MASK
163
244
  return {
164
245
  pointsCount,
165
246
  takingFeeEnabled,
166
247
  resolversCount
167
- };
248
+ }
168
249
  }
169
- exports.parseFlags = parseFlags;
170
- //# sourceMappingURL=parser.js.map
250
+ exports.parseFlags = parseFlags
251
+ //# sourceMappingURL=parser.js.map
@@ -1,29 +1,29 @@
1
- import { AuctionPoint, AuctionWhitelistItem } from '../types';
1
+ import {AuctionPoint, AuctionWhitelistItem} from '../types'
2
2
  export declare type InteractionAdditionalInfo = {
3
- points: AuctionPoint[];
4
- whitelist: AuctionWhitelistItem[];
5
- publicResolvingDeadline: number;
6
- takerFeeReceiver: string;
7
- takerFeeRatio: string;
8
- };
3
+ points: AuctionPoint[]
4
+ whitelist: AuctionWhitelistItem[]
5
+ publicResolvingDeadline: number
6
+ takerFeeReceiver: string
7
+ takerFeeRatio: string
8
+ }
9
9
  export declare type InteractionFlags = {
10
- takingFeeEnabled: boolean;
11
- resolversCount: number;
12
- pointsCount: number;
13
- };
10
+ takingFeeEnabled: boolean
11
+ resolversCount: number
12
+ pointsCount: number
13
+ }
14
14
  export declare type TakerFeeData = {
15
- takerFeeRatio: string;
16
- takerFeeReceiver: string;
17
- } & RemainingInteractions;
15
+ takerFeeRatio: string
16
+ takerFeeReceiver: string
17
+ } & RemainingInteractions
18
18
  export declare type PrivateAuctionDeadline = {
19
- deadline: number;
20
- } & RemainingInteractions;
19
+ deadline: number
20
+ } & RemainingInteractions
21
21
  export declare type ResolversWhitelist = {
22
- whitelist: AuctionWhitelistItem[];
23
- } & RemainingInteractions;
22
+ whitelist: AuctionWhitelistItem[]
23
+ } & RemainingInteractions
24
24
  export declare type ParsedAuctionParams = {
25
- points: AuctionPoint[];
26
- } & RemainingInteractions;
25
+ points: AuctionPoint[]
26
+ } & RemainingInteractions
27
27
  export declare type RemainingInteractions = {
28
- interactions: string;
29
- };
28
+ interactions: string
29
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ //# sourceMappingURL=types.js.map
@@ -1,15 +1,15 @@
1
1
  export declare type AuctionPoint = {
2
- delay: number;
3
- coefficient: number;
4
- };
2
+ delay: number
3
+ coefficient: number
4
+ }
5
5
  export declare type AuctionWhitelistItem = {
6
- address: string;
7
- allowance: number;
8
- };
6
+ address: string
7
+ allowance: number
8
+ }
9
9
  export declare type SettlementSuffixData = {
10
- points: AuctionPoint[];
11
- whitelist: AuctionWhitelistItem[];
12
- publicResolvingDeadline?: number;
13
- takerFeeReceiver?: string;
14
- takerFeeRatio?: string;
15
- };
10
+ points: AuctionPoint[]
11
+ whitelist: AuctionWhitelistItem[]
12
+ publicResolvingDeadline?: number
13
+ takerFeeReceiver?: string
14
+ takerFeeRatio?: string
15
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ //# sourceMappingURL=types.js.map
@@ -1,5 +1,8 @@
1
- import { EIP712TypedData } from '../../limit-order';
1
+ import {EIP712TypedData} from '../../limit-order'
2
2
  export interface BlockchainProviderConnector {
3
- signTypedData(walletAddress: string, typedData: EIP712TypedData): Promise<string>;
4
- ethCall(contractAddress: string, callData: string): Promise<string>;
3
+ signTypedData(
4
+ walletAddress: string,
5
+ typedData: EIP712TypedData
6
+ ): Promise<string>
7
+ ethCall(contractAddress: string, callData: string): Promise<string>
5
8
  }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=blockchain-provider.connector.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ //# sourceMappingURL=blockchain-provider.connector.js.map
@@ -1,3 +1,3 @@
1
- export * from './blockchain-provider.connector';
2
- export * from './private-key-provider.connector';
3
- export * from './web3-provider-connector';
1
+ export * from './blockchain-provider.connector'
2
+ export * from './private-key-provider.connector'
3
+ export * from './web3-provider-connector'
@@ -1,7 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./blockchain-provider.connector"), exports);
5
- tslib_1.__exportStar(require("./private-key-provider.connector"), exports);
6
- tslib_1.__exportStar(require("./web3-provider-connector"), exports);
7
- //# sourceMappingURL=index.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ const tslib_1 = require('tslib')
4
+ tslib_1.__exportStar(require('./blockchain-provider.connector'), exports)
5
+ tslib_1.__exportStar(require('./private-key-provider.connector'), exports)
6
+ tslib_1.__exportStar(require('./web3-provider-connector'), exports)
7
+ //# sourceMappingURL=index.js.map