@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,59 +1,70 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const auction_salt_1 = require("./auction-salt");
5
- const crypto_1 = tslib_1.__importDefault(require("crypto"));
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ const tslib_1 = require('tslib')
4
+ const auction_salt_1 = require('./auction-salt')
5
+ const crypto_1 = tslib_1.__importDefault(require('crypto'))
6
6
  describe('Auction Salt', () => {
7
- jest.spyOn(crypto_1.default, 'randomInt').mockImplementation(() => 1000);
7
+ jest.spyOn(crypto_1.default, 'randomInt').mockImplementation(() => 1000)
8
8
  it('should create salt', () => {
9
9
  const salt = new auction_salt_1.AuctionSalt({
10
10
  duration: 180,
11
11
  auctionStartTime: 1673548149,
12
12
  initialRateBump: 50000,
13
13
  bankFee: '0'
14
- });
15
- expect(salt.build()).toBe('45118768841948961586167738353692277076075522015101619148498725069326976549864');
16
- });
14
+ })
15
+ expect(salt.build()).toBe(
16
+ '45118768841948961586167738353692277076075522015101619148498725069326976549864'
17
+ )
18
+ })
17
19
  it('should create salt with non zero bank fee', () => {
18
20
  const salt = new auction_salt_1.AuctionSalt({
19
21
  duration: 180,
20
22
  auctionStartTime: 1673548149,
21
23
  initialRateBump: 50000,
22
24
  bankFee: '123123123'
23
- });
24
- expect(salt.build()).toBe('45118768841948961586167741099429671146420854337050268925130474518618971309032');
25
- });
25
+ })
26
+ expect(salt.build()).toBe(
27
+ '45118768841948961586167741099429671146420854337050268925130474518618971309032'
28
+ )
29
+ })
26
30
  it('should fail to create salt due to wrong auction start time', () => {
27
31
  const salt = new auction_salt_1.AuctionSalt({
28
32
  duration: 180,
29
33
  auctionStartTime: 1673548149 * 1000,
30
34
  initialRateBump: 50000,
31
35
  bankFee: '123123123'
32
- });
33
- expect(() => salt.build()).toThrow('Some inputs were out of allowed ranges');
34
- });
36
+ })
37
+ expect(() => salt.build()).toThrow(
38
+ 'Some inputs were out of allowed ranges'
39
+ )
40
+ })
35
41
  it('should fail to create salt due to initial rate bump out of range', () => {
36
42
  const salt = new auction_salt_1.AuctionSalt({
37
43
  duration: 180,
38
44
  auctionStartTime: 1673548149,
39
45
  initialRateBump: 16777215 + 1,
40
46
  bankFee: '123123123'
41
- });
42
- expect(() => salt.build()).toThrow('Some inputs were out of allowed ranges');
43
- });
47
+ })
48
+ expect(() => salt.build()).toThrow(
49
+ 'Some inputs were out of allowed ranges'
50
+ )
51
+ })
44
52
  it('should fail to create salt due to wrong duration', () => {
45
53
  const salt = new auction_salt_1.AuctionSalt({
46
54
  duration: 16777215 + 1,
47
55
  auctionStartTime: 1673548149,
48
56
  initialRateBump: 50000,
49
57
  bankFee: '123123123'
50
- });
51
- expect(() => salt.build()).toThrow('Some inputs were out of allowed ranges');
52
- });
58
+ })
59
+ expect(() => salt.build()).toThrow(
60
+ 'Some inputs were out of allowed ranges'
61
+ )
62
+ })
53
63
  it('should decode salt', () => {
54
- const encodedSalt = '45118768841948961586167741099429671146420854337050268925130474518618971309032';
55
- const salt = auction_salt_1.AuctionSalt.decode(encodedSalt);
56
- expect(salt.build()).toBe(encodedSalt);
57
- });
58
- });
59
- //# sourceMappingURL=auction.salt.spec.js.map
64
+ const encodedSalt =
65
+ '45118768841948961586167741099429671146420854337050268925130474518618971309032'
66
+ const salt = auction_salt_1.AuctionSalt.decode(encodedSalt)
67
+ expect(salt.build()).toBe(encodedSalt)
68
+ })
69
+ })
70
+ //# sourceMappingURL=auction.salt.spec.js.map
@@ -1,3 +1,3 @@
1
- export * from './auction-salt';
2
- export * from './types';
3
- export * from './parser/index';
1
+ export * from './auction-salt'
2
+ export * from './types'
3
+ export * from './parser/index'
@@ -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("./auction-salt"), exports);
5
- tslib_1.__exportStar(require("./types"), exports);
6
- tslib_1.__exportStar(require("./parser/index"), 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('./auction-salt'), exports)
5
+ tslib_1.__exportStar(require('./types'), exports)
6
+ tslib_1.__exportStar(require('./parser/index'), exports)
7
+ //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
1
  /// <reference types="bn.js" />
2
- export declare const TIME_START_MASK: import("bn.js");
3
- export declare const DURATION_MASK: import("bn.js");
4
- export declare const INITIAL_RATE_BUMP_MASK: import("bn.js");
5
- export declare const FEE_MASK: import("bn.js");
6
- export declare const SALT_MASK: import("bn.js");
7
- export declare const TIME_START_SHIFT = 224;
8
- export declare const DURATION_SHIFT = 200;
9
- export declare const INITIAL_RATE_BUMP_SHIFT = 176;
10
- export declare const FEE_SHIFT = 144;
2
+ export declare const TIME_START_MASK: import('bn.js')
3
+ export declare const DURATION_MASK: import('bn.js')
4
+ export declare const INITIAL_RATE_BUMP_MASK: import('bn.js')
5
+ export declare const FEE_MASK: import('bn.js')
6
+ export declare const SALT_MASK: import('bn.js')
7
+ export declare const TIME_START_SHIFT = 224
8
+ export declare const DURATION_SHIFT = 200
9
+ export declare const INITIAL_RATE_BUMP_SHIFT = 176
10
+ export declare const FEE_SHIFT = 144
@@ -1,14 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FEE_SHIFT = exports.INITIAL_RATE_BUMP_SHIFT = exports.DURATION_SHIFT = exports.TIME_START_SHIFT = exports.SALT_MASK = exports.FEE_MASK = exports.INITIAL_RATE_BUMP_MASK = exports.DURATION_MASK = exports.TIME_START_MASK = void 0;
4
- const utils_1 = require("../../utils");
5
- exports.TIME_START_MASK = (0, utils_1.toBN)('0xFFFFFFFF00000000000000000000000000000000000000000000000000000000');
6
- exports.DURATION_MASK = (0, utils_1.toBN)('0x00000000FFFFFF00000000000000000000000000000000000000000000000000');
7
- exports.INITIAL_RATE_BUMP_MASK = (0, utils_1.toBN)('0x00000000000000FFFFFF00000000000000000000000000000000000000000000');
8
- exports.FEE_MASK = (0, utils_1.toBN)('0x00000000000000000000FFFFFFFF000000000000000000000000000000000000');
9
- exports.SALT_MASK = (0, utils_1.toBN)('0x0000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF');
10
- exports.TIME_START_SHIFT = 224; // orderTimeMask 224-255
11
- exports.DURATION_SHIFT = 200; // durationMask 200-223
12
- exports.INITIAL_RATE_BUMP_SHIFT = 176; // initialRateMask 176-200
13
- exports.FEE_SHIFT = 144; // orderFee 144-175
14
- //# sourceMappingURL=constants.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.FEE_SHIFT =
4
+ exports.INITIAL_RATE_BUMP_SHIFT =
5
+ exports.DURATION_SHIFT =
6
+ exports.TIME_START_SHIFT =
7
+ exports.SALT_MASK =
8
+ exports.FEE_MASK =
9
+ exports.INITIAL_RATE_BUMP_MASK =
10
+ exports.DURATION_MASK =
11
+ exports.TIME_START_MASK =
12
+ void 0
13
+ const utils_1 = require('../../utils')
14
+ exports.TIME_START_MASK = (0, utils_1.toBN)(
15
+ '0xFFFFFFFF00000000000000000000000000000000000000000000000000000000'
16
+ )
17
+ exports.DURATION_MASK = (0, utils_1.toBN)(
18
+ '0x00000000FFFFFF00000000000000000000000000000000000000000000000000'
19
+ )
20
+ exports.INITIAL_RATE_BUMP_MASK = (0, utils_1.toBN)(
21
+ '0x00000000000000FFFFFF00000000000000000000000000000000000000000000'
22
+ )
23
+ exports.FEE_MASK = (0, utils_1.toBN)(
24
+ '0x00000000000000000000FFFFFFFF000000000000000000000000000000000000'
25
+ )
26
+ exports.SALT_MASK = (0, utils_1.toBN)(
27
+ '0x0000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
28
+ )
29
+ exports.TIME_START_SHIFT = 224 // orderTimeMask 224-255
30
+ exports.DURATION_SHIFT = 200 // durationMask 200-223
31
+ exports.INITIAL_RATE_BUMP_SHIFT = 176 // initialRateMask 176-200
32
+ exports.FEE_SHIFT = 144 // orderFee 144-175
33
+ //# sourceMappingURL=constants.js.map
@@ -1,2 +1,2 @@
1
- export * from './parser';
2
- export * from './constants';
1
+ export * from './parser'
2
+ export * from './constants'
@@ -1,6 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./parser"), exports);
5
- tslib_1.__exportStar(require("./constants"), exports);
6
- //# 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('./parser'), exports)
5
+ tslib_1.__exportStar(require('./constants'), exports)
6
+ //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- export declare function getStartTime(salt: string): BigNumber;
3
- export declare function getDuration(salt: string): BigNumber;
4
- export declare function getInitialRateBump(salt: string): BigNumber;
5
- export declare function getFee(salt: string): BigNumber;
6
- export declare function getSalt(salt: string): BigNumber;
1
+ import {BigNumber} from '@ethersproject/bignumber'
2
+ export declare function getStartTime(salt: string): BigNumber
3
+ export declare function getDuration(salt: string): BigNumber
4
+ export declare function getInitialRateBump(salt: string): BigNumber
5
+ export declare function getFee(salt: string): BigNumber
6
+ export declare function getSalt(salt: string): BigNumber
@@ -1,34 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSalt = exports.getFee = exports.getInitialRateBump = exports.getDuration = exports.getStartTime = void 0;
4
- const utils_1 = require("../../utils");
5
- const bignumber_1 = require("@ethersproject/bignumber");
6
- const constants_1 = require("./constants");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.getSalt =
4
+ exports.getFee =
5
+ exports.getInitialRateBump =
6
+ exports.getDuration =
7
+ exports.getStartTime =
8
+ void 0
9
+ const utils_1 = require('../../utils')
10
+ const bignumber_1 = require('@ethersproject/bignumber')
11
+ const constants_1 = require('./constants')
7
12
  function getStartTime(salt) {
8
- const val = (0, utils_1.toBN)(salt).and(constants_1.TIME_START_MASK).shrn(constants_1.TIME_START_SHIFT);
9
- return bignumber_1.BigNumber.from(val.toString());
13
+ const val = (0, utils_1.toBN)(salt)
14
+ .and(constants_1.TIME_START_MASK)
15
+ .shrn(constants_1.TIME_START_SHIFT)
16
+ return bignumber_1.BigNumber.from(val.toString())
10
17
  }
11
- exports.getStartTime = getStartTime;
18
+ exports.getStartTime = getStartTime
12
19
  function getDuration(salt) {
13
- const val = (0, utils_1.toBN)(salt).and(constants_1.DURATION_MASK).shrn(constants_1.DURATION_SHIFT);
14
- return bignumber_1.BigNumber.from(val.toString());
20
+ const val = (0, utils_1.toBN)(salt)
21
+ .and(constants_1.DURATION_MASK)
22
+ .shrn(constants_1.DURATION_SHIFT)
23
+ return bignumber_1.BigNumber.from(val.toString())
15
24
  }
16
- exports.getDuration = getDuration;
25
+ exports.getDuration = getDuration
17
26
  function getInitialRateBump(salt) {
18
27
  const val = (0, utils_1.toBN)(salt)
19
28
  .and(constants_1.INITIAL_RATE_BUMP_MASK)
20
- .shrn(constants_1.INITIAL_RATE_BUMP_SHIFT);
21
- return bignumber_1.BigNumber.from(val.toString());
29
+ .shrn(constants_1.INITIAL_RATE_BUMP_SHIFT)
30
+ return bignumber_1.BigNumber.from(val.toString())
22
31
  }
23
- exports.getInitialRateBump = getInitialRateBump;
32
+ exports.getInitialRateBump = getInitialRateBump
24
33
  function getFee(salt) {
25
- const val = (0, utils_1.toBN)(salt).and(constants_1.FEE_MASK).shrn(constants_1.FEE_SHIFT);
26
- return bignumber_1.BigNumber.from(val.toString());
34
+ const val = (0, utils_1.toBN)(salt)
35
+ .and(constants_1.FEE_MASK)
36
+ .shrn(constants_1.FEE_SHIFT)
37
+ return bignumber_1.BigNumber.from(val.toString())
27
38
  }
28
- exports.getFee = getFee;
39
+ exports.getFee = getFee
29
40
  function getSalt(salt) {
30
- const val = (0, utils_1.toBN)(salt).and(constants_1.SALT_MASK);
31
- return bignumber_1.BigNumber.from(val.toString());
41
+ const val = (0, utils_1.toBN)(salt).and(constants_1.SALT_MASK)
42
+ return bignumber_1.BigNumber.from(val.toString())
32
43
  }
33
- exports.getSalt = getSalt;
34
- //# sourceMappingURL=parser.js.map
44
+ exports.getSalt = getSalt
45
+ //# sourceMappingURL=parser.js.map
@@ -1,7 +1,7 @@
1
1
  export declare type AuctionSaltData = {
2
- auctionStartTime: number;
3
- initialRateBump: number;
4
- duration: number;
5
- bankFee: string;
6
- salt?: string;
7
- };
2
+ auctionStartTime: number
3
+ initialRateBump: number
4
+ duration: number
5
+ bankFee: string
6
+ salt?: string
7
+ }
@@ -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,11 +1,11 @@
1
- import { AuctionPoint, AuctionWhitelistItem, SettlementSuffixData } from './types';
1
+ import {AuctionPoint, AuctionWhitelistItem, SettlementSuffixData} from './types'
2
2
  export declare class AuctionSuffix {
3
- readonly points: AuctionPoint[];
4
- readonly whitelist: AuctionWhitelistItem[];
5
- readonly publicResolvingDeadline: number;
6
- readonly takerFeeReceiver: string;
7
- readonly takerFeeRatio: string;
8
- constructor(suffix: SettlementSuffixData);
9
- static decode(interactions: string): AuctionSuffix;
10
- build(): string;
3
+ readonly points: AuctionPoint[]
4
+ readonly whitelist: AuctionWhitelistItem[]
5
+ readonly publicResolvingDeadline: number
6
+ readonly takerFeeReceiver: string
7
+ readonly takerFeeRatio: string
8
+ constructor(suffix: SettlementSuffixData)
9
+ static decode(interactions: string): AuctionSuffix
10
+ build(): string
11
11
  }
@@ -1,38 +1,51 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuctionSuffix = void 0;
4
- const utils_1 = require("../utils");
5
- const constants_1 = require("../constants");
6
- const encoder_1 = require("./encoder");
7
- const constants_2 = require("./constants");
8
- const parser_1 = require("./parser");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.AuctionSuffix = void 0
4
+ const utils_1 = require('../utils')
5
+ const constants_1 = require('../constants')
6
+ const encoder_1 = require('./encoder')
7
+ const constants_2 = require('./constants')
8
+ const parser_1 = require('./parser')
9
9
  class AuctionSuffix {
10
10
  constructor(suffix) {
11
- this.points = suffix.points;
12
- this.whitelist = suffix.whitelist;
11
+ this.points = suffix.points
12
+ this.whitelist = suffix.whitelist
13
13
  this.publicResolvingDeadline =
14
- suffix.publicResolvingDeadline || (0, utils_1.toSec)(constants_2.NoPublicResolvingDeadline);
15
- this.takerFeeReceiver = suffix.takerFeeReceiver || constants_1.ZERO_ADDRESS;
16
- this.takerFeeRatio = suffix.takerFeeRatio || '0';
14
+ suffix.publicResolvingDeadline ||
15
+ (0, utils_1.toSec)(constants_2.NoPublicResolvingDeadline)
16
+ this.takerFeeReceiver =
17
+ suffix.takerFeeReceiver || constants_1.ZERO_ADDRESS
18
+ this.takerFeeRatio = suffix.takerFeeRatio || '0'
17
19
  }
18
20
  static decode(interactions) {
19
- const suffix = (0, parser_1.parseInteractionsSuffix)(interactions);
21
+ const suffix = (0, parser_1.parseInteractionsSuffix)(interactions)
20
22
  return new AuctionSuffix({
21
23
  publicResolvingDeadline: suffix.publicResolvingDeadline,
22
24
  points: suffix.points,
23
25
  takerFeeRatio: suffix.takerFeeRatio,
24
26
  takerFeeReceiver: suffix.takerFeeReceiver,
25
27
  whitelist: suffix.whitelist
26
- });
28
+ })
27
29
  }
28
30
  build() {
29
- const auctionParams = (0, encoder_1.encodeAuctionParams)(this.points);
30
- const whitelist = (0, encoder_1.encodeWhitelist)(this.whitelist);
31
- const publicResolving = (0, encoder_1.encodePublicResolvingDeadline)(this.publicResolvingDeadline);
32
- const takingFeeData = (0, encoder_1.encodeTakingFeeData)(this.takerFeeReceiver, this.takerFeeRatio);
33
- const flags = (0, encoder_1.encodeFlags)(this.whitelist, this.points, takingFeeData);
34
- return (auctionParams + whitelist + publicResolving + takingFeeData + flags);
31
+ const auctionParams = (0, encoder_1.encodeAuctionParams)(this.points)
32
+ const whitelist = (0, encoder_1.encodeWhitelist)(this.whitelist)
33
+ const publicResolving = (0, encoder_1.encodePublicResolvingDeadline)(
34
+ this.publicResolvingDeadline
35
+ )
36
+ const takingFeeData = (0, encoder_1.encodeTakingFeeData)(
37
+ this.takerFeeReceiver,
38
+ this.takerFeeRatio
39
+ )
40
+ const flags = (0, encoder_1.encodeFlags)(
41
+ this.whitelist,
42
+ this.points,
43
+ takingFeeData
44
+ )
45
+ return (
46
+ auctionParams + whitelist + publicResolving + takingFeeData + flags
47
+ )
35
48
  }
36
49
  }
37
- exports.AuctionSuffix = AuctionSuffix;
38
- //# sourceMappingURL=auction-suffix.js.map
50
+ exports.AuctionSuffix = AuctionSuffix
51
+ //# sourceMappingURL=auction-suffix.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {}
@@ -1,6 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const auction_suffix_1 = require("./auction-suffix");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ const auction_suffix_1 = require('./auction-suffix')
4
4
  describe('Auction Suffix', () => {
5
5
  it('should create suffix with required params', () => {
6
6
  const suffix = new auction_suffix_1.AuctionSuffix({
@@ -16,9 +16,11 @@ describe('Auction Suffix', () => {
16
16
  allowance: 0
17
17
  }
18
18
  ]
19
- });
20
- expect(suffix.build()).toBe('000c004e200000000000000000219ab540356cbb839cbe05303d7705faf486570009');
21
- });
19
+ })
20
+ expect(suffix.build()).toBe(
21
+ '000c004e200000000000000000219ab540356cbb839cbe05303d7705faf486570009'
22
+ )
23
+ })
22
24
  it('should create suffix with specified public resolving deadline', () => {
23
25
  const suffix = new auction_suffix_1.AuctionSuffix({
24
26
  points: [
@@ -34,13 +36,16 @@ describe('Auction Suffix', () => {
34
36
  }
35
37
  ],
36
38
  publicResolvingDeadline: 1673549418
37
- });
38
- expect(suffix.build()).toBe('000c004e200000000000000000219ab540356cbb839cbe05303d7705fa63c0566a09');
39
- });
39
+ })
40
+ expect(suffix.build()).toBe(
41
+ '000c004e200000000000000000219ab540356cbb839cbe05303d7705fa63c0566a09'
42
+ )
43
+ })
40
44
  it('should decode auction suffix', () => {
41
- const encodedSuffix = '000c004e200000000000000000219ab540356cbb839cbe05303d7705fa63c0566a09';
42
- const suffix = auction_suffix_1.AuctionSuffix.decode(encodedSuffix);
43
- expect(suffix.build()).toBe(encodedSuffix);
44
- });
45
- });
46
- //# sourceMappingURL=auction-suffix.spec.js.map
45
+ const encodedSuffix =
46
+ '000c004e200000000000000000219ab540356cbb839cbe05303d7705fa63c0566a09'
47
+ const suffix = auction_suffix_1.AuctionSuffix.decode(encodedSuffix)
48
+ expect(suffix.build()).toBe(encodedSuffix)
49
+ })
50
+ })
51
+ //# sourceMappingURL=auction-suffix.spec.js.map
@@ -1 +1 @@
1
- export declare const NoPublicResolvingDeadline: Date;
1
+ export declare const NoPublicResolvingDeadline: Date
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoPublicResolvingDeadline = void 0;
4
- exports.NoPublicResolvingDeadline = new Date(4102444800000);
5
- //# sourceMappingURL=constants.js.map
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.NoPublicResolvingDeadline = void 0
4
+ exports.NoPublicResolvingDeadline = new Date(4102444800000)
5
+ //# sourceMappingURL=constants.js.map
@@ -1,6 +1,15 @@
1
- import { AuctionPoint, AuctionWhitelistItem } from './types';
2
- export declare function encodeAuctionParams(points: AuctionPoint[]): string;
3
- export declare function encodeWhitelist(whitelist: AuctionWhitelistItem[]): string;
4
- export declare function encodePublicResolvingDeadline(deadline: number): string;
5
- export declare function encodeTakingFeeData(takerFeeReceiver: string, takerFeeRatio: string): string;
6
- export declare function encodeFlags(whitelist: AuctionWhitelistItem[], points: AuctionPoint[], takingFeeData: string): string;
1
+ import {AuctionPoint, AuctionWhitelistItem} from './types'
2
+ export declare function encodeAuctionParams(points: AuctionPoint[]): string
3
+ export declare function encodeWhitelist(
4
+ whitelist: AuctionWhitelistItem[]
5
+ ): string
6
+ export declare function encodePublicResolvingDeadline(deadline: number): string
7
+ export declare function encodeTakingFeeData(
8
+ takerFeeReceiver: string,
9
+ takerFeeRatio: string
10
+ ): string
11
+ export declare function encodeFlags(
12
+ whitelist: AuctionWhitelistItem[],
13
+ points: AuctionPoint[],
14
+ takingFeeData: string
15
+ ): string
@@ -1,45 +1,62 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encodeFlags = exports.encodeTakingFeeData = exports.encodePublicResolvingDeadline = exports.encodeWhitelist = exports.encodeAuctionParams = void 0;
4
- const bignumber_1 = require("@ethersproject/bignumber");
5
- const utils_1 = require("../utils");
6
- const constants_1 = require("../constants");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.encodeFlags =
4
+ exports.encodeTakingFeeData =
5
+ exports.encodePublicResolvingDeadline =
6
+ exports.encodeWhitelist =
7
+ exports.encodeAuctionParams =
8
+ void 0
9
+ const bignumber_1 = require('@ethersproject/bignumber')
10
+ const utils_1 = require('../utils')
11
+ const constants_1 = require('../constants')
7
12
  function encodeAuctionParams(points) {
8
13
  return points
9
- .map(({ delay, coefficient }) => delay.toString(16).padStart(4, '0') +
10
- coefficient.toString(16).padStart(6, '0'))
11
- .join('');
14
+ .map(
15
+ ({delay, coefficient}) =>
16
+ delay.toString(16).padStart(4, '0') +
17
+ coefficient.toString(16).padStart(6, '0')
18
+ )
19
+ .join('')
12
20
  }
13
- exports.encodeAuctionParams = encodeAuctionParams;
21
+ exports.encodeAuctionParams = encodeAuctionParams
14
22
  function encodeWhitelist(whitelist) {
15
23
  return whitelist
16
- .map(({ address, allowance }) => allowance.toString(16).padStart(8, '0') + (0, utils_1.trim0x)(address))
17
- .join('');
24
+ .map(
25
+ ({address, allowance}) =>
26
+ allowance.toString(16).padStart(8, '0') +
27
+ (0, utils_1.trim0x)(address)
28
+ )
29
+ .join('')
18
30
  }
19
- exports.encodeWhitelist = encodeWhitelist;
31
+ exports.encodeWhitelist = encodeWhitelist
20
32
  function encodePublicResolvingDeadline(deadline) {
21
- return deadline.toString(16).padStart(8, '0');
33
+ return deadline.toString(16).padStart(8, '0')
22
34
  }
23
- exports.encodePublicResolvingDeadline = encodePublicResolvingDeadline;
35
+ exports.encodePublicResolvingDeadline = encodePublicResolvingDeadline
24
36
  function encodeTakingFeeData(takerFeeReceiver, takerFeeRatio) {
25
- if (takerFeeReceiver === constants_1.ZERO_ADDRESS || takerFeeRatio === '0') {
26
- return '';
37
+ if (
38
+ takerFeeReceiver === constants_1.ZERO_ADDRESS ||
39
+ takerFeeRatio === '0'
40
+ ) {
41
+ return ''
27
42
  }
28
- return (bignumber_1.BigNumber.from(takerFeeRatio)
29
- .toHexString()
30
- .substring(2)
31
- .padStart(24, '0') + (0, utils_1.trim0x)(takerFeeReceiver));
43
+ return (
44
+ bignumber_1.BigNumber.from(takerFeeRatio)
45
+ .toHexString()
46
+ .substring(2)
47
+ .padStart(24, '0') + (0, utils_1.trim0x)(takerFeeReceiver)
48
+ )
32
49
  }
33
- exports.encodeTakingFeeData = encodeTakingFeeData;
50
+ exports.encodeTakingFeeData = encodeTakingFeeData
34
51
  function encodeFlags(whitelist, points, takingFeeData) {
35
52
  if (points.length > 8) {
36
- throw new Error('max points count = 8');
53
+ throw new Error('max points count = 8')
37
54
  }
38
- let flags = (whitelist.length << 3) | points.length;
55
+ let flags = (whitelist.length << 3) | points.length
39
56
  if (takingFeeData !== '') {
40
- flags |= 0x80;
57
+ flags |= 0x80
41
58
  }
42
- return flags.toString(16).padStart(2, '0');
59
+ return flags.toString(16).padStart(2, '0')
43
60
  }
44
- exports.encodeFlags = encodeFlags;
45
- //# sourceMappingURL=encoder.js.map
61
+ exports.encodeFlags = encodeFlags
62
+ //# sourceMappingURL=encoder.js.map
@@ -1,5 +1,5 @@
1
- export * from './auction-suffix';
2
- export * from './constants';
3
- export * from './encoder';
4
- export * from './types';
5
- export * from './parser/index';
1
+ export * from './auction-suffix'
2
+ export * from './constants'
3
+ export * from './encoder'
4
+ export * from './types'
5
+ export * from './parser/index'
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./auction-suffix"), exports);
5
- tslib_1.__exportStar(require("./constants"), exports);
6
- tslib_1.__exportStar(require("./encoder"), exports);
7
- tslib_1.__exportStar(require("./types"), exports);
8
- tslib_1.__exportStar(require("./parser/index"), exports);
9
- //# 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('./auction-suffix'), exports)
5
+ tslib_1.__exportStar(require('./constants'), exports)
6
+ tslib_1.__exportStar(require('./encoder'), exports)
7
+ tslib_1.__exportStar(require('./types'), exports)
8
+ tslib_1.__exportStar(require('./parser/index'), exports)
9
+ //# sourceMappingURL=index.js.map