@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,59 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const tslib_1 = require(
|
|
4
|
-
const auction_salt_1 = require(
|
|
5
|
-
const crypto_1 = tslib_1.__importDefault(require(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})
|
|
59
|
-
|
|
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
|
package/auction-salt/index.d.ts
CHANGED
|
@@ -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'
|
package/auction-salt/index.js
CHANGED
|
@@ -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('./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(
|
|
3
|
-
export declare const DURATION_MASK: import(
|
|
4
|
-
export declare const INITIAL_RATE_BUMP_MASK: import(
|
|
5
|
-
export declare const FEE_MASK: import(
|
|
6
|
-
export declare const SALT_MASK: import(
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.FEE_SHIFT =
|
|
4
|
-
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.FEE_MASK =
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const tslib_1 = require(
|
|
4
|
-
tslib_1.__exportStar(require(
|
|
5
|
-
tslib_1.__exportStar(require(
|
|
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 {
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.getSalt =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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)
|
|
9
|
-
|
|
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)
|
|
14
|
-
|
|
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)
|
|
26
|
-
|
|
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
|
package/auction-salt/types.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/auction-salt/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,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.AuctionSuffix = void 0
|
|
4
|
-
const utils_1 = require(
|
|
5
|
-
const constants_1 = require(
|
|
6
|
-
const encoder_1 = require(
|
|
7
|
-
const constants_2 = require(
|
|
8
|
-
const parser_1 = require(
|
|
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 ||
|
|
15
|
-
|
|
16
|
-
this.
|
|
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)(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const auction_suffix_1 = require(
|
|
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(
|
|
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(
|
|
39
|
-
|
|
39
|
+
})
|
|
40
|
+
expect(suffix.build()).toBe(
|
|
41
|
+
'000c004e200000000000000000219ab540356cbb839cbe05303d7705fa63c0566a09'
|
|
42
|
+
)
|
|
43
|
+
})
|
|
40
44
|
it('should decode auction suffix', () => {
|
|
41
|
-
const encodedSuffix =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
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 {
|
|
2
|
-
export declare function encodeAuctionParams(points: AuctionPoint[]): string
|
|
3
|
-
export declare function encodeWhitelist(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
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
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.encodeFlags =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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(
|
|
10
|
-
|
|
11
|
-
|
|
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(
|
|
17
|
-
|
|
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 (
|
|
26
|
-
|
|
37
|
+
if (
|
|
38
|
+
takerFeeReceiver === constants_1.ZERO_ADDRESS ||
|
|
39
|
+
takerFeeRatio === '0'
|
|
40
|
+
) {
|
|
41
|
+
return ''
|
|
27
42
|
}
|
|
28
|
-
return (
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
|
|
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'
|
package/auction-suffix/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
tslib_1.__exportStar(require(
|
|
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
|