@1inch/fusion-sdk 0.0.5 → 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 +1 -1
  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,4 +1,13 @@
1
- import { FillOrderParamsExtended } from '../types';
2
- export declare function encodeSettleOrders(params: FillOrderParamsExtended): string;
3
- export declare function buildResolveOrdersBytes(settlementContract: string, resolverContract: string, executionBytes: string): string;
4
- export declare function buildRecursiveFillInteraction(settlementContract: string, params: FillOrderParamsExtended): string;
1
+ import {FillOrderParamsExtended} from '../types'
2
+ export declare function encodeSettleOrders(
3
+ params: FillOrderParamsExtended
4
+ ): string
5
+ export declare function buildResolveOrdersBytes(
6
+ settlementContract: string,
7
+ resolverContract: string,
8
+ executionBytes: string
9
+ ): string
10
+ export declare function buildRecursiveFillInteraction(
11
+ settlementContract: string,
12
+ params: FillOrderParamsExtended
13
+ ): string
@@ -1,26 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildRecursiveFillInteraction = exports.buildResolveOrdersBytes = exports.encodeSettleOrders = void 0;
4
- const tslib_1 = require("tslib");
5
- const web3_eth_abi_1 = tslib_1.__importDefault(require("web3-eth-abi"));
6
- const constants_1 = require("./constants");
7
- const utils_1 = require("../../utils");
8
- const fill_order_encoder_1 = require("./fill-order.encoder");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.buildRecursiveFillInteraction =
4
+ exports.buildResolveOrdersBytes =
5
+ exports.encodeSettleOrders =
6
+ void 0
7
+ const tslib_1 = require('tslib')
8
+ const web3_eth_abi_1 = tslib_1.__importDefault(require('web3-eth-abi'))
9
+ const constants_1 = require('./constants')
10
+ const utils_1 = require('../../utils')
11
+ const fill_order_encoder_1 = require('./fill-order.encoder')
9
12
  function encodeSettleOrders(params) {
10
- const encodedOrder = (0, fill_order_encoder_1.encodeFillOrder)(params).substring(10);
11
- return (constants_1.SETTLE_ORDERS_SELECTOR +
12
- (0, utils_1.trim0x)(web3_eth_abi_1.default.encodeParameters(['bytes'], [(0, utils_1.add0x)(encodedOrder)])));
13
+ const encodedOrder = (0, fill_order_encoder_1.encodeFillOrder)(
14
+ params
15
+ ).substring(10)
16
+ return (
17
+ constants_1.SETTLE_ORDERS_SELECTOR +
18
+ (0, utils_1.trim0x)(
19
+ web3_eth_abi_1.default.encodeParameters(
20
+ ['bytes'],
21
+ [(0, utils_1.add0x)(encodedOrder)]
22
+ )
23
+ )
24
+ )
13
25
  }
14
- exports.encodeSettleOrders = encodeSettleOrders;
15
- function buildResolveOrdersBytes(settlementContract, resolverContract, executionBytes) {
16
- return (settlementContract +
26
+ exports.encodeSettleOrders = encodeSettleOrders
27
+ function buildResolveOrdersBytes(
28
+ settlementContract,
29
+ resolverContract,
30
+ executionBytes
31
+ ) {
32
+ return (
33
+ settlementContract +
17
34
  '01' +
18
35
  (0, utils_1.trim0x)(resolverContract) +
19
- (0, utils_1.trim0x)(executionBytes));
36
+ (0, utils_1.trim0x)(executionBytes)
37
+ )
20
38
  }
21
- exports.buildResolveOrdersBytes = buildResolveOrdersBytes;
39
+ exports.buildResolveOrdersBytes = buildResolveOrdersBytes
22
40
  function buildRecursiveFillInteraction(settlementContract, params) {
23
- return settlementContract + '00' + (0, fill_order_encoder_1.encodeFillOrder)(params).substring(10);
41
+ return (
42
+ settlementContract +
43
+ '00' +
44
+ (0, fill_order_encoder_1.encodeFillOrder)(params).substring(10)
45
+ )
24
46
  }
25
- exports.buildRecursiveFillInteraction = buildRecursiveFillInteraction;
26
- //# sourceMappingURL=settlement.encoder.js.map
47
+ exports.buildRecursiveFillInteraction = buildRecursiveFillInteraction
48
+ //# sourceMappingURL=settlement.encoder.js.map
@@ -1,4 +1,4 @@
1
- export * from './encoders';
2
- export * from './settlement';
3
- export * from './signature-patcher';
4
- export * from './types';
1
+ export * from './encoders'
2
+ export * from './settlement'
3
+ export * from './signature-patcher'
4
+ export * from './types'
@@ -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("./encoders"), exports);
5
- tslib_1.__exportStar(require("./settlement"), exports);
6
- tslib_1.__exportStar(require("./signature-patcher"), exports);
7
- tslib_1.__exportStar(require("./types"), 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('./encoders'), exports)
5
+ tslib_1.__exportStar(require('./settlement'), exports)
6
+ tslib_1.__exportStar(require('./signature-patcher'), exports)
7
+ tslib_1.__exportStar(require('./types'), exports)
8
+ //# sourceMappingURL=index.js.map
@@ -1,7 +1,10 @@
1
- import { FillOrderParams, SettlementConfig } from './types';
1
+ import {FillOrderParams, SettlementConfig} from './types'
2
2
  export declare class Settlement {
3
- private readonly config;
4
- constructor(config: SettlementConfig);
5
- static new(config: SettlementConfig): Settlement;
6
- encodeSettleOrders(orders: FillOrderParams[], resolverExecutionBytes: string): string;
3
+ private readonly config
4
+ constructor(config: SettlementConfig)
5
+ static new(config: SettlementConfig): Settlement
6
+ encodeSettleOrders(
7
+ orders: FillOrderParams[],
8
+ resolverExecutionBytes: string
9
+ ): string
7
10
  }
@@ -1,26 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Settlement = void 0;
4
- const settlement_encoder_1 = require("./encoders/settlement.encoder");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.Settlement = void 0
4
+ const settlement_encoder_1 = require('./encoders/settlement.encoder')
5
5
  class Settlement {
6
6
  constructor(config) {
7
- this.config = config;
7
+ this.config = config
8
8
  }
9
9
  static new(config) {
10
- return new Settlement(config);
10
+ return new Settlement(config)
11
11
  }
12
12
  encodeSettleOrders(
13
- // sorted by: orders[0] executes first, orders[orders.length - 1] executes last
14
- orders, resolverExecutionBytes) {
15
- const finalActionBytes = (0, settlement_encoder_1.buildResolveOrdersBytes)(this.config.settlementContract, this.config.resolverContract, resolverExecutionBytes);
13
+ // sorted by: orders[0] executes first, orders[orders.length - 1] executes last
14
+ orders,
15
+ resolverExecutionBytes
16
+ ) {
17
+ const finalActionBytes = (0,
18
+ settlement_encoder_1.buildResolveOrdersBytes)(
19
+ this.config.settlementContract,
20
+ this.config.resolverContract,
21
+ resolverExecutionBytes
22
+ )
16
23
  const interaction = orders
17
24
  .slice(1)
18
25
  .reverse()
19
26
  .reduce((acc, fillParams) => {
20
- return (0, settlement_encoder_1.buildRecursiveFillInteraction)(this.config.settlementContract, Object.assign(Object.assign({}, fillParams), { interaction: acc }));
21
- }, finalActionBytes);
22
- return (0, settlement_encoder_1.encodeSettleOrders)(Object.assign(Object.assign({}, orders[0]), { interaction }));
27
+ return (0, settlement_encoder_1.buildRecursiveFillInteraction)(
28
+ this.config.settlementContract,
29
+ Object.assign(Object.assign({}, fillParams), {
30
+ interaction: acc
31
+ })
32
+ )
33
+ }, finalActionBytes)
34
+ return (0, settlement_encoder_1.encodeSettleOrders)(
35
+ Object.assign(Object.assign({}, orders[0]), {interaction})
36
+ )
23
37
  }
24
38
  }
25
- exports.Settlement = Settlement;
26
- //# sourceMappingURL=settlement.js.map
39
+ exports.Settlement = Settlement
40
+ //# sourceMappingURL=settlement.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {}
@@ -1,14 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const settlement_1 = require("./settlement");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ const settlement_1 = require('./settlement')
4
4
  describe('Settlement', () => {
5
- const resolverContract = '0x84d99aa569d93a9ca187d83734c8c4a519c4e9b1';
6
- const settlementContract = '0xa88800cd213da5ae406ce248380802bd53b47647';
5
+ const resolverContract = '0x84d99aa569d93a9ca187d83734c8c4a519c4e9b1'
6
+ const settlementContract = '0xa88800cd213da5ae406ce248380802bd53b47647'
7
7
  it('should encode settlement', () => {
8
8
  const settlement = settlement_1.Settlement.new({
9
9
  resolverContract,
10
10
  settlementContract
11
- });
11
+ })
12
12
  const limitOrder0 = {
13
13
  salt: '618054093254',
14
14
  makerAsset: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
@@ -18,10 +18,12 @@ describe('Settlement', () => {
18
18
  allowedSender: '0x0000000000000000000000000000000000000000',
19
19
  makingAmount: '1000000000000000000',
20
20
  takingAmount: '1000000000000000000',
21
- offsets: '9813420589127697917471531885823684359047649055178615469676279994777600',
21
+ offsets:
22
+ '9813420589127697917471531885823684359047649055178615469676279994777600',
22
23
  // eslint-disable-next-line max-len
23
- interactions: '0x20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d43070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
24
- };
24
+ interactions:
25
+ '0x20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d43070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
26
+ }
25
27
  const limitOrder1 = {
26
28
  salt: '618054093254',
27
29
  makerAsset: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
@@ -31,31 +33,39 @@ describe('Settlement', () => {
31
33
  allowedSender: '0x0000000000000000000000000000000000000000',
32
34
  makingAmount: '1000000000000000000',
33
35
  takingAmount: '1000000000000000000',
34
- offsets: '9813420589127697917471531885823684359047649055178615469676279994777600',
36
+ offsets:
37
+ '9813420589127697917471531885823684359047649055178615469676279994777600',
35
38
  // eslint-disable-next-line max-len
36
- interactions: '0x20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d43070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
37
- };
38
- const calldata = settlement.encodeSettleOrders([
39
- {
40
- order: limitOrder0,
41
- makingAmount: '12345',
42
- takingAmount: '0',
43
- thresholdAmount: '12342343242342342342424324234242',
44
- signature: '0xaefe4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d1b',
45
- target: resolverContract
46
- },
47
- {
48
- order: limitOrder1,
49
- makingAmount: '678910',
50
- takingAmount: '0',
51
- thresholdAmount: '12342343242342342342424324234242',
52
- signature: '0x123e4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d1b',
53
- target: resolverContract
54
- }
55
- ], '0x123456');
39
+ interactions:
40
+ '0x20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d43070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
41
+ }
42
+ const calldata = settlement.encodeSettleOrders(
43
+ [
44
+ {
45
+ order: limitOrder0,
46
+ makingAmount: '12345',
47
+ takingAmount: '0',
48
+ thresholdAmount: '12342343242342342342424324234242',
49
+ signature:
50
+ '0xaefe4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d1b',
51
+ target: resolverContract
52
+ },
53
+ {
54
+ order: limitOrder1,
55
+ makingAmount: '678910',
56
+ takingAmount: '0',
57
+ thresholdAmount: '12342343242342342342424324234242',
58
+ signature:
59
+ '0x123e4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d1b',
60
+ target: resolverContract
61
+ }
62
+ ],
63
+ '0x123456'
64
+ )
56
65
  expect(calldata).toBe(
57
- // eslint-disable-next-line max-len
58
- '0x0965d04b000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000030390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009bc8430b2577b5a268bb3c5c0200000000000000000000000084d99aa569d93a9ca187d83734c8c4a519c4e9b10000000000000000000000000000000000000000000000000000008fe6e509c6000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000016c0000016c0000016c0000016c000000880000004400000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016c20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040aefe4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d0000000000000000000000000000000000000000000000000000000000000495a88800cd213da5ae406ce248380802bd53b476470000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000a5bfe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009bc8430b2577b5a268bb3c5c0200000000000000000000000084d99aa569d93a9ca187d83734c8c4a519c4e9b10000000000000000000000000000000000000000000000000000008fe6e509c6000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000016c0000016c0000016c0000016c000000880000004400000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016c20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040123e4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d000000000000000000000000000000000000000000000000000000000000002ca88800cd213da5ae406ce248380802bd53b476470184d99aa569d93a9ca187d83734c8c4a519c4e9b112345600000000000000000000000000000000000000000000000000000000000000');
59
- });
60
- });
61
- //# sourceMappingURL=settlement.spec.js.map
66
+ // eslint-disable-next-line max-len
67
+ '0x0965d04b000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000030390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009bc8430b2577b5a268bb3c5c0200000000000000000000000084d99aa569d93a9ca187d83734c8c4a519c4e9b10000000000000000000000000000000000000000000000000000008fe6e509c6000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000016c0000016c0000016c0000016c000000880000004400000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016c20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040aefe4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d0000000000000000000000000000000000000000000000000000000000000495a88800cd213da5ae406ce248380802bd53b476470000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000a5bfe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009bc8430b2577b5a268bb3c5c0200000000000000000000000084d99aa569d93a9ca187d83734c8c4a519c4e9b10000000000000000000000000000000000000000000000000000008fe6e509c6000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000016c0000016c0000016c0000016c000000880000004400000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016c20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040123e4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d000000000000000000000000000000000000000000000000000000000000002ca88800cd213da5ae406ce248380802bd53b476470184d99aa569d93a9ca187d83734c8c4a519c4e9b112345600000000000000000000000000000000000000000000000000000000000000'
68
+ )
69
+ })
70
+ })
71
+ //# sourceMappingURL=settlement.spec.js.map
@@ -1 +1 @@
1
- export declare function patchSignature(signature: string): string;
1
+ export declare function patchSignature(signature: string): string
@@ -1,29 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.patchSignature = void 0;
4
- const tslib_1 = require("tslib");
5
- const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.patchSignature = void 0
4
+ const tslib_1 = require('tslib')
5
+ const bn_js_1 = tslib_1.__importDefault(require('bn.js'))
6
6
  function patchSignature(signature) {
7
- const isGnosisSafe = signature === '0x';
7
+ const isGnosisSafe = signature === '0x'
8
8
  if (isGnosisSafe) {
9
- return signature;
9
+ return signature
10
10
  }
11
11
  // with 0x (64 len)
12
12
  if (signature.length === 130) {
13
- return signature;
13
+ return signature
14
14
  }
15
15
  if (signature.length > 132) {
16
- return signature;
16
+ return signature
17
17
  }
18
- const sig = signature.substr(0, 130);
19
- const lastByte = signature.substr(130, 2);
18
+ const sig = signature.substr(0, 130)
19
+ const lastByte = signature.substr(130, 2)
20
20
  if (lastByte.toLowerCase() === '1b' || lastByte === '00') {
21
- return sig;
21
+ return sig
22
22
  }
23
23
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
24
  // @ts-ignore
25
- const bnSig = new bn_js_1.default(sig.substring(2 + 64), 'hex').setn(255, true);
26
- return sig.substring(0, 2 + 64) + bnSig.toString('hex');
25
+ const bnSig = new bn_js_1.default(sig.substring(2 + 64), 'hex').setn(
26
+ 255,
27
+ true
28
+ )
29
+ return sig.substring(0, 2 + 64) + bnSig.toString('hex')
27
30
  }
28
- exports.patchSignature = patchSignature;
29
- //# sourceMappingURL=signature-patcher.js.map
31
+ exports.patchSignature = patchSignature
32
+ //# sourceMappingURL=signature-patcher.js.map
@@ -1,16 +1,16 @@
1
- import { LimitOrderV3Struct } from '../limit-order';
1
+ import {LimitOrderV3Struct} from '../limit-order'
2
2
  export declare type SettlementConfig = {
3
- resolverContract: string;
4
- settlementContract: string;
5
- };
3
+ resolverContract: string
4
+ settlementContract: string
5
+ }
6
6
  export declare type FillOrderParams = {
7
- order: LimitOrderV3Struct;
8
- signature: string;
9
- makingAmount: string;
10
- takingAmount: string;
11
- thresholdAmount: string;
12
- target: string;
13
- };
7
+ order: LimitOrderV3Struct
8
+ signature: string
9
+ makingAmount: string
10
+ takingAmount: string
11
+ thresholdAmount: string
12
+ target: string
13
+ }
14
14
  export declare type FillOrderParamsExtended = FillOrderParams & {
15
- interaction: string;
16
- };
15
+ interaction: string
16
+ }
@@ -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
package/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import BN from 'bn.js';
2
- export declare const isNativeCurrency: (address: string) => boolean;
3
- export declare function toSec(time: number | string | Date): number;
4
- export declare function toBN(val: number | string): BN;
5
- export declare function trim0x(data: string): string;
6
- export declare function add0x(data: string): string;
1
+ import BN from 'bn.js'
2
+ export declare const isNativeCurrency: (address: string) => boolean
3
+ export declare function toSec(time: number | string | Date): number
4
+ export declare function toBN(val: number | string): BN
5
+ export declare function trim0x(data: string): string
6
+ export declare function add0x(data: string): string
package/utils.js CHANGED
@@ -1,41 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.add0x = exports.trim0x = exports.toBN = exports.toSec = exports.isNativeCurrency = void 0;
4
- const tslib_1 = require("tslib");
5
- const bn_js_1 = tslib_1.__importDefault(require("bn.js"));
6
- const constants_1 = require("./constants");
7
- const isNativeCurrency = (address) => address.toLowerCase() === constants_1.NATIVE_CURRENCY;
8
- exports.isNativeCurrency = isNativeCurrency;
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.add0x =
4
+ exports.trim0x =
5
+ exports.toBN =
6
+ exports.toSec =
7
+ exports.isNativeCurrency =
8
+ void 0
9
+ const tslib_1 = require('tslib')
10
+ const bn_js_1 = tslib_1.__importDefault(require('bn.js'))
11
+ const constants_1 = require('./constants')
12
+ const isNativeCurrency = (address) =>
13
+ address.toLowerCase() === constants_1.NATIVE_CURRENCY
14
+ exports.isNativeCurrency = isNativeCurrency
9
15
  function toSec(time) {
10
- const t = time instanceof Date ? time.getTime() : time;
11
- return Math.floor(+t / 1000);
16
+ const t = time instanceof Date ? time.getTime() : time
17
+ return Math.floor(+t / 1000)
12
18
  }
13
- exports.toSec = toSec;
19
+ exports.toSec = toSec
14
20
  function toBN(val) {
15
21
  if (typeof val === 'number') {
16
22
  if (!Number.isSafeInteger(val)) {
17
- throw new Error('integer is not safe');
23
+ throw new Error('integer is not safe')
18
24
  }
19
- return new bn_js_1.default(val);
25
+ return new bn_js_1.default(val)
20
26
  }
21
27
  if (val.startsWith('0x')) {
22
- return new bn_js_1.default(trim0x(val), 'hex');
28
+ return new bn_js_1.default(trim0x(val), 'hex')
23
29
  }
24
- return new bn_js_1.default(val);
30
+ return new bn_js_1.default(val)
25
31
  }
26
- exports.toBN = toBN;
32
+ exports.toBN = toBN
27
33
  function trim0x(data) {
28
34
  if (data.startsWith('0x')) {
29
- return data.substring(2);
35
+ return data.substring(2)
30
36
  }
31
- return data;
37
+ return data
32
38
  }
33
- exports.trim0x = trim0x;
39
+ exports.trim0x = trim0x
34
40
  function add0x(data) {
35
41
  if (data.includes('0x')) {
36
- return data;
42
+ return data
37
43
  }
38
- return '0x' + data;
44
+ return '0x' + data
39
45
  }
40
- exports.add0x = add0x;
41
- //# sourceMappingURL=utils.js.map
46
+ exports.add0x = add0x
47
+ //# sourceMappingURL=utils.js.map
package/validations.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare function isValidAddress(address: string): boolean;
2
- export declare function isValidAmount(value: string): boolean;
1
+ export declare function isValidAddress(address: string): boolean
2
+ export declare function isValidAmount(value: string): boolean
package/validations.js CHANGED
@@ -1,21 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidAmount = exports.isValidAddress = void 0;
4
- const tslib_1 = require("tslib");
5
- const web3_1 = tslib_1.__importDefault(require("web3"));
6
- const bignumber_1 = require("@ethersproject/bignumber");
1
+ 'use strict'
2
+ Object.defineProperty(exports, '__esModule', {value: true})
3
+ exports.isValidAmount = exports.isValidAddress = void 0
4
+ const tslib_1 = require('tslib')
5
+ const web3_1 = tslib_1.__importDefault(require('web3'))
6
+ const bignumber_1 = require('@ethersproject/bignumber')
7
7
  function isValidAddress(address) {
8
- return web3_1.default.utils.isAddress(address);
8
+ return web3_1.default.utils.isAddress(address)
9
9
  }
10
- exports.isValidAddress = isValidAddress;
10
+ exports.isValidAddress = isValidAddress
11
11
  function isValidAmount(value) {
12
12
  try {
13
- const amount = bignumber_1.BigNumber.from(value);
14
- return amount.gt(0);
15
- }
16
- catch (e) {
17
- return false;
13
+ const amount = bignumber_1.BigNumber.from(value)
14
+ return amount.gt(0)
15
+ } catch (e) {
16
+ return false
18
17
  }
19
18
  }
20
- exports.isValidAmount = isValidAmount;
21
- //# sourceMappingURL=validations.js.map
19
+ exports.isValidAmount = isValidAmount
20
+ //# sourceMappingURL=validations.js.map