@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,11 +1,4 @@
1
- import {
2
- InteractionAdditionalInfo,
3
- InteractionFlags,
4
- ParsedAuctionParams,
5
- PrivateAuctionDeadline,
6
- ResolversWhitelist,
7
- TakerFeeData
8
- } from './types'
1
+ import { InteractionAdditionalInfo, InteractionFlags, ParsedAuctionParams, PrivateAuctionDeadline, ResolversWhitelist, TakerFeeData } from './types';
9
2
  /**
10
3
  * Order.interactions suffix structure:
11
4
  * M*(1 + 3 bytes) - auction points coefficients with seconds delays
@@ -15,23 +8,10 @@ import {
15
8
  * 1 byte - flags
16
9
  * @param interactions
17
10
  */
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
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;
@@ -1,18 +1,11 @@
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')
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");
16
9
  /**
17
10
  * Order.interactions suffix structure:
18
11
  * M*(1 + 3 bytes) - auction points coefficients with seconds delays
@@ -23,229 +16,155 @@ const errors_1 = require('./errors')
23
16
  * @param interactions
24
17
  */
25
18
  function parseInteractionsSuffix(interactions) {
26
- const flags = parseFlags(interactions)
19
+ const flags = parseFlags(interactions);
27
20
  if (interactions.length < minInteractionsLength(flags)) {
28
- throw new errors_1.BadOrderSuffixError('wrong interactions length')
21
+ throw new errors_1.BadOrderSuffixError('wrong interactions length');
29
22
  }
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)
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);
47
28
  return {
48
29
  whitelist,
49
30
  publicResolvingDeadline: deadline,
50
31
  takerFeeReceiver,
51
32
  takerFeeRatio,
52
33
  points
53
- }
34
+ };
54
35
  }
55
- exports.parseInteractionsSuffix = parseInteractionsSuffix
36
+ exports.parseInteractionsSuffix = parseInteractionsSuffix;
56
37
  function minInteractionsLength(flags) {
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 +
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 +
65
41
  whitelistLen +
66
42
  constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH +
67
- constants_1.FLAGS_LENGTH
43
+ constants_1.FLAGS_LENGTH;
68
44
  if (flags.takingFeeEnabled) {
69
- return (
70
- requiredLength +
71
- constants_1.TAKER_FEE_RECEIVER_LENGTH +
72
- constants_1.TAKER_FEE_RATIO_LENGTH
73
- )
45
+ return (requiredLength + constants_1.TAKER_FEE_RECEIVER_LENGTH + constants_1.TAKER_FEE_RATIO_LENGTH);
74
46
  }
75
- return requiredLength
47
+ return requiredLength;
76
48
  }
77
- exports.minInteractionsLength = minInteractionsLength
49
+ exports.minInteractionsLength = minInteractionsLength;
78
50
  function parseTakingFeeAndReturnRemainingInteractions(flags, interactions) {
79
51
  if (!flags.takingFeeEnabled) {
80
52
  return {
81
53
  interactions,
82
54
  takerFeeReceiver: constants_2.ZERO_ADDRESS,
83
55
  takerFeeRatio: '0'
84
- }
56
+ };
85
57
  }
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)
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);
94
62
  if (takerFeeReceiver === constants_2.ZERO_ADDRESS) {
95
- throw new errors_1.BadOrderSuffixError(
96
- 'takerFeeReceiver cannot be zero address'
97
- )
63
+ throw new errors_1.BadOrderSuffixError('takerFeeReceiver cannot be zero address');
98
64
  }
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
- )
65
+ const takerFeeRateHex = takerFeeData.slice(0, constants_1.TAKER_FEE_RATIO_LENGTH);
66
+ const takerFeeRatio = bignumber_1.BigNumber.from((0, utils_1.add0x)(takerFeeRateHex));
106
67
  if (takerFeeRatio.gt(constants_1.CONTRACT_TAKER_FEE_PRECISION)) {
107
- throw new errors_1.BadOrderSuffixError('takerFeeRatio cannot be > 1e9')
68
+ throw new errors_1.BadOrderSuffixError('takerFeeRatio cannot be > 1e9');
108
69
  }
109
70
  return {
110
71
  interactions: interactions.slice(0, -takerFeeDataLen),
111
72
  takerFeeReceiver,
112
73
  takerFeeRatio: takerFeeRatio.toString()
113
- }
74
+ };
114
75
  }
115
- exports.parseTakingFeeAndReturnRemainingInteractions =
116
- parseTakingFeeAndReturnRemainingInteractions
76
+ exports.parseTakingFeeAndReturnRemainingInteractions = parseTakingFeeAndReturnRemainingInteractions;
117
77
  function parsePrivateAuctionDeadline(interactions) {
118
- const privateAuctionDeadlineHex = interactions.slice(
119
- -constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH
120
- )
121
- const privateAuctionDeadline = Number.parseInt(
122
- privateAuctionDeadlineHex,
123
- 16
124
- )
78
+ const privateAuctionDeadlineHex = interactions.slice(-constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH);
79
+ const privateAuctionDeadline = Number.parseInt(privateAuctionDeadlineHex, 16);
125
80
  if (!privateAuctionDeadline) {
126
- throw new errors_1.BadOrderSuffixError(
127
- `Invalid public resolving deadline in interactions`
128
- )
81
+ throw new errors_1.BadOrderSuffixError(`Invalid public resolving deadline in interactions`);
129
82
  }
130
83
  return {
131
84
  deadline: privateAuctionDeadline,
132
- interactions: interactions.slice(
133
- 0,
134
- -constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH
135
- )
136
- }
85
+ interactions: interactions.slice(0, -constants_1.PRIVATE_AUCTION_DEADLINE_LENGTH)
86
+ };
137
87
  }
138
- exports.parsePrivateAuctionDeadline = parsePrivateAuctionDeadline
88
+ exports.parsePrivateAuctionDeadline = parsePrivateAuctionDeadline;
139
89
  function parseResolversWhitelist(flags, interactions) {
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
- )
90
+ const whitelist = [];
91
+ const allowedTsAndResolverLen = constants_1.ADDRESS_LENGTH + constants_1.ALLOWED_TIMESTAMP_LENGTH;
92
+ const addressesPacked = interactions.slice(-1 * flags.resolversCount * allowedTsAndResolverLen);
146
93
  if (addressesPacked.length % allowedTsAndResolverLen) {
147
- throw new errors_1.BadOrderSuffixError(
148
- `Invalid whitelist addresses in interactions`
149
- )
94
+ throw new errors_1.BadOrderSuffixError(`Invalid whitelist addresses in interactions`);
150
95
  }
151
96
  for (let i = 0; i < addressesPacked.length; i += allowedTsAndResolverLen) {
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)
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);
162
101
  if (timestamp !== 0 && !timestamp) {
163
- throw new errors_1.BadOrderSuffixError(
164
- `Invalid resolver allowance timestamp`
165
- )
102
+ throw new errors_1.BadOrderSuffixError(`Invalid resolver allowance timestamp`);
166
103
  }
167
104
  whitelist.push({
168
105
  address: (0, utils_1.add0x)(address).toLowerCase(),
169
106
  allowance: timestamp
170
- })
107
+ });
171
108
  }
172
109
  return {
173
110
  whitelist,
174
- interactions: interactions.slice(
175
- 0,
176
- -(flags.resolversCount * allowedTsAndResolverLen)
177
- )
178
- }
111
+ interactions: interactions.slice(0, -(flags.resolversCount * allowedTsAndResolverLen))
112
+ };
179
113
  }
180
- exports.parseResolversWhitelist = parseResolversWhitelist
114
+ exports.parseResolversWhitelist = parseResolversWhitelist;
181
115
  function parseAuctionParams(flags, interactions) {
182
116
  if (flags.pointsCount === 0) {
183
117
  return {
184
118
  interactions,
185
119
  points: []
186
- }
120
+ };
187
121
  }
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
- )
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);
194
125
  if (paramsPacked.length % auctionParamsLength) {
195
- throw new errors_1.BadOrderSuffixError(
196
- `Invalid auction params in interactions`
197
- )
126
+ throw new errors_1.BadOrderSuffixError(`Invalid auction params in interactions`);
198
127
  }
199
128
  for (let i = 0; i < paramsPacked.length; i += auctionParamsLength) {
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)
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);
207
133
  if (!duration) {
208
- throw new errors_1.BadOrderSuffixError(
209
- `Invalid auction point duration`
210
- )
134
+ throw new errors_1.BadOrderSuffixError(`Invalid auction point duration`);
211
135
  }
212
- const bump = Number.parseInt(bumpHex, 16)
136
+ const bump = Number.parseInt(bumpHex, 16);
213
137
  if (!bump) {
214
- throw new errors_1.BadOrderSuffixError(`Invalid auction point bump`)
138
+ throw new errors_1.BadOrderSuffixError(`Invalid auction point bump`);
215
139
  }
216
- points.push({delay: duration, coefficient: bump})
140
+ points.push({ delay: duration, coefficient: bump });
217
141
  }
218
142
  return {
219
143
  points,
220
- interactions: interactions.slice(
221
- 0,
222
- flags.pointsCount * auctionParamsLength
223
- )
224
- }
144
+ interactions: interactions.slice(0, flags.pointsCount * auctionParamsLength)
145
+ };
225
146
  }
226
- exports.parseAuctionParams = parseAuctionParams
147
+ exports.parseAuctionParams = parseAuctionParams;
227
148
  function parseFlags(interactions) {
228
- const flagsHex = interactions.slice(-constants_1.FLAGS_LENGTH)
149
+ const flagsHex = interactions.slice(-constants_1.FLAGS_LENGTH);
229
150
  if (flagsHex.length < constants_1.FLAGS_LENGTH) {
230
- throw new errors_1.BadOrderSuffixError(`Invalid flags length`)
151
+ throw new errors_1.BadOrderSuffixError(`Invalid flags length`);
231
152
  }
232
- const flags = Number.parseInt(flagsHex, 16)
153
+ const flags = Number.parseInt(flagsHex, 16);
233
154
  if (!flags) {
234
- throw new errors_1.BadOrderSuffixError(`cannot parse flags`)
155
+ throw new errors_1.BadOrderSuffixError(`cannot parse flags`);
235
156
  }
236
- const resolversCount =
237
- (flags & constants_1.RESOLVERS_LENGTH_MASK) >>
238
- constants_1.RESOLVERS_LENGTH_OFFSET
157
+ const resolversCount = (flags & constants_1.RESOLVERS_LENGTH_MASK) >> constants_1.RESOLVERS_LENGTH_OFFSET;
239
158
  if (resolversCount === 0) {
240
- throw new errors_1.BadOrderSuffixError(`cannot have 0 resolvers`)
159
+ throw new errors_1.BadOrderSuffixError(`cannot have 0 resolvers`);
241
160
  }
242
- const takingFeeEnabled = (flags & constants_1.HAS_TAKING_FEE_FLAG) !== 0
243
- const pointsCount = flags & constants_1.POINTS_LENGTH_MASK
161
+ const takingFeeEnabled = (flags & constants_1.HAS_TAKING_FEE_FLAG) !== 0;
162
+ const pointsCount = flags & constants_1.POINTS_LENGTH_MASK;
244
163
  return {
245
164
  pointsCount,
246
165
  takingFeeEnabled,
247
166
  resolversCount
248
- }
167
+ };
249
168
  }
250
- exports.parseFlags = parseFlags
251
- //# sourceMappingURL=parser.js.map
169
+ exports.parseFlags = parseFlags;
170
+ //# 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,8 +1,5 @@
1
- import {EIP712TypedData} from '../../limit-order'
1
+ import { EIP712TypedData } from '../../limit-order';
2
2
  export interface BlockchainProviderConnector {
3
- signTypedData(
4
- walletAddress: string,
5
- typedData: EIP712TypedData
6
- ): Promise<string>
7
- ethCall(contractAddress: string, callData: string): Promise<string>
3
+ signTypedData(walletAddress: string, typedData: EIP712TypedData): Promise<string>;
4
+ ethCall(contractAddress: string, callData: string): Promise<string>;
8
5
  }
@@ -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
@@ -1,16 +1,11 @@
1
- import {BlockchainProviderConnector} from './blockchain-provider.connector'
2
- import Web3 from 'web3'
3
- import {EIP712TypedData} from '../../limit-order'
4
- export declare class PrivateKeyProviderConnector
5
- implements BlockchainProviderConnector
6
- {
7
- readonly privateKey: string
8
- protected readonly web3Provider: Web3
9
- private readonly privateKeyBuffer
10
- constructor(privateKey: string, web3Provider: Web3)
11
- signTypedData(
12
- _walletAddress: string,
13
- typedData: EIP712TypedData
14
- ): Promise<string>
15
- ethCall(contractAddress: string, callData: string): Promise<string>
1
+ import { BlockchainProviderConnector } from './blockchain-provider.connector';
2
+ import Web3 from 'web3';
3
+ import { EIP712TypedData } from '../../limit-order';
4
+ export declare class PrivateKeyProviderConnector implements BlockchainProviderConnector {
5
+ readonly privateKey: string;
6
+ protected readonly web3Provider: Web3;
7
+ private readonly privateKeyBuffer;
8
+ constructor(privateKey: string, web3Provider: Web3);
9
+ signTypedData(_walletAddress: string, typedData: EIP712TypedData): Promise<string>;
10
+ ethCall(contractAddress: string, callData: string): Promise<string>;
16
11
  }
@@ -1,12 +1,12 @@
1
- 'use strict'
2
- Object.defineProperty(exports, '__esModule', {value: true})
3
- exports.PrivateKeyProviderConnector = void 0
4
- const eth_sig_util_1 = require('@metamask/eth-sig-util')
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrivateKeyProviderConnector = void 0;
4
+ const eth_sig_util_1 = require("@metamask/eth-sig-util");
5
5
  class PrivateKeyProviderConnector {
6
6
  constructor(privateKey, web3Provider) {
7
- this.privateKey = privateKey
8
- this.web3Provider = web3Provider
9
- this.privateKeyBuffer = Buffer.from(privateKey.replace('0x', ''), 'hex')
7
+ this.privateKey = privateKey;
8
+ this.web3Provider = web3Provider;
9
+ this.privateKeyBuffer = Buffer.from(privateKey.replace('0x', ''), 'hex');
10
10
  }
11
11
  signTypedData(_walletAddress, typedData) {
12
12
  const result = (0, eth_sig_util_1.signTypedData)({
@@ -15,15 +15,15 @@ class PrivateKeyProviderConnector {
15
15
  // @ts-ignore
16
16
  data: typedData,
17
17
  version: eth_sig_util_1.SignTypedDataVersion.V4
18
- })
19
- return Promise.resolve(result)
18
+ });
19
+ return Promise.resolve(result);
20
20
  }
21
21
  ethCall(contractAddress, callData) {
22
22
  return this.web3Provider.eth.call({
23
23
  to: contractAddress,
24
24
  data: callData
25
- })
25
+ });
26
26
  }
27
27
  }
28
- exports.PrivateKeyProviderConnector = PrivateKeyProviderConnector
29
- //# sourceMappingURL=private-key-provider.connector.js.map
28
+ exports.PrivateKeyProviderConnector = PrivateKeyProviderConnector;
29
+ //# sourceMappingURL=private-key-provider.connector.js.map
@@ -1 +1 @@
1
- export {}
1
+ export {};