@1inch/fusion-sdk 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/api/fusion-api.d.ts +16 -25
- package/api/fusion-api.js +26 -36
- 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 +397 -479
- package/api/orders/orders.api.d.ts +10 -24
- package/api/orders/orders.api.js +28 -30
- package/api/orders/orders.request.d.ts +18 -22
- package/api/orders/orders.request.js +31 -40
- package/api/orders/types.d.ts +58 -59
- package/api/orders/types.js +16 -17
- 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 +21 -28
- package/api/params.d.ts +1 -3
- package/api/params.js +19 -25
- 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 +17 -19
- 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 +7 -6
- package/api/quoter/quote/order-params.js +13 -12
- package/api/quoter/quote/order-params.js.map +1 -1
- package/api/quoter/quote/quote.d.ts +22 -26
- package/api/quoter/quote/quote.js +59 -84
- package/api/quoter/quote/quote.js.map +1 -1
- package/api/quoter/quote/types.d.ts +5 -4
- package/api/quoter/quote/types.js +3 -3
- package/api/quoter/quoter.api.d.ts +9 -12
- 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 +24 -30
- 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 +26 -28
- package/api/quoter/types.d.ts +45 -45
- package/api/quoter/types.js +10 -10
- package/api/relayer/index.d.ts +3 -3
- package/api/relayer/index.js +7 -7
- package/api/relayer/relayer.api.d.ts +9 -12
- 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 +79 -96
- 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 +15 -17
- package/api/types.js +3 -3
- package/auction-calculator/auction-calculator.d.ts +13 -22
- package/auction-calculator/auction-calculator.js +45 -70
- package/auction-calculator/auction-calculator.spec.d.ts +1 -1
- package/auction-calculator/auction-calculator.spec.js +32 -45
- package/auction-calculator/calc.d.ts +2 -8
- 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 +23 -34
- package/auction-salt/auction.salt.spec.d.ts +1 -1
- package/auction-salt/auction.salt.spec.js +27 -38
- 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 +14 -33
- 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 +22 -33
- 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 +23 -36
- package/auction-suffix/auction-suffix.spec.d.ts +1 -1
- package/auction-suffix/auction-suffix.spec.js +15 -20
- package/auction-suffix/constants.d.ts +1 -1
- package/auction-suffix/constants.js +5 -5
- package/auction-suffix/encoder.d.ts +6 -15
- package/auction-suffix/encoder.js +28 -45
- 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 +17 -30
- package/auction-suffix/parser/errors.d.ts +2 -1
- package/auction-suffix/parser/errors.js +7 -6
- package/auction-suffix/parser/index.d.ts +4 -4
- package/auction-suffix/parser/index.js +8 -8
- package/auction-suffix/parser/parser.d.ts +8 -28
- package/auction-suffix/parser/parser.js +81 -162
- 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 +3 -6
- 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 +10 -15
- 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 +23 -36
- package/connector/blockchain/web3-provider-connector.d.ts +8 -13
- package/connector/blockchain/web3-provider-connector.js +9 -12
- package/connector/blockchain/web3-provider.connector.spec.d.ts +1 -1
- package/connector/blockchain/web3-provider.connector.spec.js +26 -37
- 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 +31 -37
- 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 +6 -10
- package/constants.js +16 -23
- package/fusion-order/fusion-order.d.ts +7 -17
- package/fusion-order/fusion-order.js +12 -14
- package/fusion-order/fusion-order.spec.d.ts +1 -1
- package/fusion-order/fusion-order.spec.js +22 -27
- 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 +9 -10
- package/limit-order/eip712/domain.js +23 -28
- package/limit-order/eip712/eip712.types.d.ts +15 -19
- 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 +6 -17
- package/limit-order/eip712/order-typed-data-builder.js +19 -34
- 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 +25 -31
- package/limit-order/limit-order.js +50 -103
- package/limit-order/limit-order.spec.d.ts +1 -1
- package/limit-order/limit-order.spec.js +51 -75
- 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 +2 -5
- package/limit-order/parser/parser.js +18 -23
- package/limit-order/parser/types.d.ts +3 -3
- package/limit-order/parser/types.js +3 -3
- package/limit-order/predicate-factory.d.ts +5 -9
- package/limit-order/predicate-factory.js +24 -40
- package/limit-order/predicate-factory.spec.d.ts +1 -1
- package/limit-order/predicate-factory.spec.js +29 -44
- 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 +11 -29
- package/sdk/sdk.js +40 -49
- package/sdk/sdk.js.map +1 -1
- 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 +12 -26
- package/settlement/encoders/index.d.ts +3 -3
- package/settlement/encoders/index.js +7 -7
- package/settlement/encoders/settlement.encoder.d.ts +4 -13
- package/settlement/encoders/settlement.encoder.js +19 -41
- package/settlement/index.d.ts +4 -4
- package/settlement/index.js +8 -8
- package/settlement/settlement.d.ts +5 -8
- package/settlement/settlement.js +14 -28
- package/settlement/settlement.spec.d.ts +1 -1
- package/settlement/settlement.spec.js +35 -45
- package/settlement/signature-patcher.d.ts +1 -1
- package/settlement/signature-patcher.js +16 -19
- package/settlement/types.d.ts +13 -13
- package/settlement/types.js +3 -3
- package/utils.d.ts +6 -6
- package/utils.js +23 -29
- package/validations.d.ts +2 -2
- package/validations.js +15 -14
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const settlement_1 = require(
|
|
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,12 +18,10 @@ describe('Settlement', () => {
|
|
|
18
18
|
allowedSender: '0x0000000000000000000000000000000000000000',
|
|
19
19
|
makingAmount: '1000000000000000000',
|
|
20
20
|
takingAmount: '1000000000000000000',
|
|
21
|
-
offsets:
|
|
22
|
-
'9813420589127697917471531885823684359047649055178615469676279994777600',
|
|
21
|
+
offsets: '9813420589127697917471531885823684359047649055178615469676279994777600',
|
|
23
22
|
// eslint-disable-next-line max-len
|
|
24
|
-
interactions:
|
|
25
|
-
|
|
26
|
-
}
|
|
23
|
+
interactions: '0x20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d43070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
|
|
24
|
+
};
|
|
27
25
|
const limitOrder1 = {
|
|
28
26
|
salt: '618054093254',
|
|
29
27
|
makerAsset: '0xe9e7cea3dedca5984780bafc599bd69add087d56',
|
|
@@ -33,39 +31,31 @@ describe('Settlement', () => {
|
|
|
33
31
|
allowedSender: '0x0000000000000000000000000000000000000000',
|
|
34
32
|
makingAmount: '1000000000000000000',
|
|
35
33
|
takingAmount: '1000000000000000000',
|
|
36
|
-
offsets:
|
|
37
|
-
'9813420589127697917471531885823684359047649055178615469676279994777600',
|
|
34
|
+
offsets: '9813420589127697917471531885823684359047649055178615469676279994777600',
|
|
38
35
|
// eslint-disable-next-line max-len
|
|
39
|
-
interactions:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'0x123e4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d1b',
|
|
60
|
-
target: resolverContract
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
'0x123456'
|
|
64
|
-
)
|
|
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');
|
|
65
56
|
expect(calldata).toBe(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=settlement.spec.js.map
|
|
57
|
+
// eslint-disable-next-line max-len
|
|
58
|
+
'0x0965d04b000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000008e000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000030390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009bc8430b2577b5a268bb3c5c0200000000000000000000000084d99aa569d93a9ca187d83734c8c4a519c4e9b10000000000000000000000000000000000000000000000000000008fe6e509c6000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000016c0000016c0000016c0000016c000000880000004400000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016c20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040aefe4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d0000000000000000000000000000000000000000000000000000000000000495a88800cd213da5ae406ce248380802bd53b476470000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000003c0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000a5bfe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009bc8430b2577b5a268bb3c5c0200000000000000000000000084d99aa569d93a9ca187d83734c8c4a519c4e9b10000000000000000000000000000000000000000000000000000008fe6e509c6000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000111111111117dc0aa78b770fa6a738034120c302000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400000000016c0000016c0000016c0000016c000000880000004400000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016c20b83f2d0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a76400007e2d21830000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a7640000bfa7514300000000000000000000000000000000000000000000000000000068000000240000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000006863592c2b0000000000000000000000000000000000000000000000000000000063593ad9cf6fc6e3000000000000000000000000fb3c7eb936caa12b5a884d612393969a557d4307000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040123e4201b2a66009b0f2976a638f54d6f6a63b0fdcfdc289523c7ea6220c7ab13d1af9de1b85701cfff745b96742e9e4c3b29057adcac8f3b62de7b1a4eb110d000000000000000000000000000000000000000000000000000000000000002ca88800cd213da5ae406ce248380802bd53b476470184d99aa569d93a9ca187d83734c8c4a519c4e9b112345600000000000000000000000000000000000000000000000000000000000000');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=settlement.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function patchSignature(signature: string): string
|
|
1
|
+
export declare function patchSignature(signature: string): string;
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.patchSignature = void 0
|
|
4
|
-
const tslib_1 = require(
|
|
5
|
-
const bn_js_1 = tslib_1.__importDefault(require(
|
|
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(
|
|
26
|
-
|
|
27
|
-
true
|
|
28
|
-
)
|
|
29
|
-
return sig.substring(0, 2 + 64) + bnSig.toString('hex')
|
|
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');
|
|
30
27
|
}
|
|
31
|
-
exports.patchSignature = patchSignature
|
|
32
|
-
//# sourceMappingURL=signature-patcher.js.map
|
|
28
|
+
exports.patchSignature = patchSignature;
|
|
29
|
+
//# sourceMappingURL=signature-patcher.js.map
|
package/settlement/types.d.ts
CHANGED
|
@@ -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
|
+
};
|
package/settlement/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
|
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,47 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.add0x =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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;
|
|
15
9
|
function toSec(time) {
|
|
16
|
-
const t = time instanceof Date ? time.getTime() : time
|
|
17
|
-
return Math.floor(+t / 1000)
|
|
10
|
+
const t = time instanceof Date ? time.getTime() : time;
|
|
11
|
+
return Math.floor(+t / 1000);
|
|
18
12
|
}
|
|
19
|
-
exports.toSec = toSec
|
|
13
|
+
exports.toSec = toSec;
|
|
20
14
|
function toBN(val) {
|
|
21
15
|
if (typeof val === 'number') {
|
|
22
16
|
if (!Number.isSafeInteger(val)) {
|
|
23
|
-
throw new Error('integer is not safe')
|
|
17
|
+
throw new Error('integer is not safe');
|
|
24
18
|
}
|
|
25
|
-
return new bn_js_1.default(val)
|
|
19
|
+
return new bn_js_1.default(val);
|
|
26
20
|
}
|
|
27
21
|
if (val.startsWith('0x')) {
|
|
28
|
-
return new bn_js_1.default(trim0x(val), 'hex')
|
|
22
|
+
return new bn_js_1.default(trim0x(val), 'hex');
|
|
29
23
|
}
|
|
30
|
-
return new bn_js_1.default(val)
|
|
24
|
+
return new bn_js_1.default(val);
|
|
31
25
|
}
|
|
32
|
-
exports.toBN = toBN
|
|
26
|
+
exports.toBN = toBN;
|
|
33
27
|
function trim0x(data) {
|
|
34
28
|
if (data.startsWith('0x')) {
|
|
35
|
-
return data.substring(2)
|
|
29
|
+
return data.substring(2);
|
|
36
30
|
}
|
|
37
|
-
return data
|
|
31
|
+
return data;
|
|
38
32
|
}
|
|
39
|
-
exports.trim0x = trim0x
|
|
33
|
+
exports.trim0x = trim0x;
|
|
40
34
|
function add0x(data) {
|
|
41
35
|
if (data.includes('0x')) {
|
|
42
|
-
return data
|
|
36
|
+
return data;
|
|
43
37
|
}
|
|
44
|
-
return '0x' + data
|
|
38
|
+
return '0x' + data;
|
|
45
39
|
}
|
|
46
|
-
exports.add0x = add0x
|
|
47
|
-
//# sourceMappingURL=utils.js.map
|
|
40
|
+
exports.add0x = add0x;
|
|
41
|
+
//# 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,20 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.isValidAmount = exports.isValidAddress = void 0
|
|
4
|
-
const tslib_1 = require(
|
|
5
|
-
const web3_1 = tslib_1.__importDefault(require(
|
|
6
|
-
const bignumber_1 = require(
|
|
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
|
-
|
|
13
|
+
const amount = bignumber_1.BigNumber.from(value);
|
|
14
|
+
return amount.gt(0);
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
return false;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
exports.isValidAmount = isValidAmount
|
|
20
|
-
//# sourceMappingURL=validations.js.map
|
|
20
|
+
exports.isValidAmount = isValidAmount;
|
|
21
|
+
//# sourceMappingURL=validations.js.map
|