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