@1inch/fusion-sdk 0.0.6 → 0.0.8
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 +5 -13
- package/settlement/encoders/settlement.encoder.js +38 -42
- package/settlement/encoders/settlement.encoder.js.map +1 -1
- package/settlement/index.d.ts +4 -4
- package/settlement/index.js +8 -8
- package/settlement/settlement.d.ts +6 -8
- package/settlement/settlement.js +20 -28
- package/settlement/settlement.js.map +1 -1
- package/settlement/settlement.spec.d.ts +1 -1
- package/settlement/settlement.spec.js +41 -45
- package/settlement/settlement.spec.js.map +1 -1
- 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
package/fusion-order/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const tslib_1 = require(
|
|
4
|
-
tslib_1.__exportStar(require(
|
|
5
|
-
//# 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("./fusion-order"), exports);
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './auction-suffix/index'
|
|
2
|
-
export * from './auction-salt/index'
|
|
3
|
-
export * from './fusion-order/index'
|
|
4
|
-
export * from './limit-order/index'
|
|
5
|
-
export * from './auction-calculator/index'
|
|
6
|
-
export * from './connector/index'
|
|
7
|
-
export * from './sdk/index'
|
|
8
|
-
export * from './constants'
|
|
9
|
-
export * from './utils'
|
|
10
|
-
export * from './validations'
|
|
11
|
-
export * from './settlement'
|
|
1
|
+
export * from './auction-suffix/index';
|
|
2
|
+
export * from './auction-salt/index';
|
|
3
|
+
export * from './fusion-order/index';
|
|
4
|
+
export * from './limit-order/index';
|
|
5
|
+
export * from './auction-calculator/index';
|
|
6
|
+
export * from './connector/index';
|
|
7
|
+
export * from './sdk/index';
|
|
8
|
+
export * from './constants';
|
|
9
|
+
export * from './utils';
|
|
10
|
+
export * from './validations';
|
|
11
|
+
export * from './settlement';
|
package/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
tslib_1.__exportStar(require(
|
|
10
|
-
tslib_1.__exportStar(require(
|
|
11
|
-
tslib_1.__exportStar(require(
|
|
12
|
-
tslib_1.__exportStar(require(
|
|
13
|
-
tslib_1.__exportStar(require(
|
|
14
|
-
tslib_1.__exportStar(require(
|
|
15
|
-
//# 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/index"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./auction-salt/index"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./fusion-order/index"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./limit-order/index"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./auction-calculator/index"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./connector/index"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./sdk/index"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./constants"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./utils"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./validations"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./settlement"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export declare const EIP712Domain: {
|
|
2
|
-
name: string
|
|
3
|
-
type: string
|
|
4
|
-
}[]
|
|
2
|
+
name: string;
|
|
3
|
+
type: string;
|
|
4
|
+
}[];
|
|
5
5
|
export declare const Order: {
|
|
6
|
-
name: string
|
|
7
|
-
type: string
|
|
8
|
-
}[]
|
|
9
|
-
export declare const LimitOrderV3TypeDataName =
|
|
10
|
-
export declare const LimitOrderV3TypeDataVersion =
|
|
11
|
-
export declare const VerifyingContract =
|
|
12
|
-
'0x1111111254eeb25477b68fb85ed929f73a960582'
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare const LimitOrderV3TypeDataName = "1inch Aggregation Router";
|
|
10
|
+
export declare const LimitOrderV3TypeDataVersion = "5";
|
|
11
|
+
export declare const VerifyingContract = "0x1111111254eeb25477b68fb85ed929f73a960582";
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.VerifyingContract =
|
|
4
|
-
exports.LimitOrderV3TypeDataVersion =
|
|
5
|
-
exports.LimitOrderV3TypeDataName =
|
|
6
|
-
exports.Order =
|
|
7
|
-
exports.EIP712Domain =
|
|
8
|
-
void 0
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VerifyingContract = exports.LimitOrderV3TypeDataVersion = exports.LimitOrderV3TypeDataName = exports.Order = exports.EIP712Domain = void 0;
|
|
9
4
|
exports.EIP712Domain = [
|
|
10
|
-
{name: 'name', type: 'string'},
|
|
11
|
-
{name: 'version', type: 'string'},
|
|
12
|
-
{name: 'chainId', type: 'uint256'},
|
|
13
|
-
{name: 'verifyingContract', type: 'address'}
|
|
14
|
-
]
|
|
5
|
+
{ name: 'name', type: 'string' },
|
|
6
|
+
{ name: 'version', type: 'string' },
|
|
7
|
+
{ name: 'chainId', type: 'uint256' },
|
|
8
|
+
{ name: 'verifyingContract', type: 'address' }
|
|
9
|
+
];
|
|
15
10
|
exports.Order = [
|
|
16
|
-
{name: 'salt', type: 'uint256'},
|
|
17
|
-
{name: 'makerAsset', type: 'address'},
|
|
18
|
-
{name: 'takerAsset', type: 'address'},
|
|
19
|
-
{name: 'maker', type: 'address'},
|
|
20
|
-
{name: 'receiver', type: 'address'},
|
|
21
|
-
{name: 'allowedSender', type: 'address'},
|
|
22
|
-
{name: 'makingAmount', type: 'uint256'},
|
|
23
|
-
{name: 'takingAmount', type: 'uint256'},
|
|
24
|
-
{name: 'offsets', type: 'uint256'},
|
|
25
|
-
{name: 'interactions', type: 'bytes'}
|
|
26
|
-
]
|
|
27
|
-
exports.LimitOrderV3TypeDataName = '1inch Aggregation Router'
|
|
28
|
-
exports.LimitOrderV3TypeDataVersion = '5'
|
|
29
|
-
exports.VerifyingContract = '0x1111111254eeb25477b68fb85ed929f73a960582'
|
|
30
|
-
//# sourceMappingURL=domain.js.map
|
|
11
|
+
{ name: 'salt', type: 'uint256' },
|
|
12
|
+
{ name: 'makerAsset', type: 'address' },
|
|
13
|
+
{ name: 'takerAsset', type: 'address' },
|
|
14
|
+
{ name: 'maker', type: 'address' },
|
|
15
|
+
{ name: 'receiver', type: 'address' },
|
|
16
|
+
{ name: 'allowedSender', type: 'address' },
|
|
17
|
+
{ name: 'makingAmount', type: 'uint256' },
|
|
18
|
+
{ name: 'takingAmount', type: 'uint256' },
|
|
19
|
+
{ name: 'offsets', type: 'uint256' },
|
|
20
|
+
{ name: 'interactions', type: 'bytes' }
|
|
21
|
+
];
|
|
22
|
+
exports.LimitOrderV3TypeDataName = '1inch Aggregation Router';
|
|
23
|
+
exports.LimitOrderV3TypeDataVersion = '5';
|
|
24
|
+
exports.VerifyingContract = '0x1111111254eeb25477b68fb85ed929f73a960582';
|
|
25
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import {BigNumber} from '@ethersproject/bignumber'
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
2
|
export interface EIP712TypedData {
|
|
3
|
-
types: EIP712Types
|
|
4
|
-
domain: EIP712Object
|
|
5
|
-
message: EIP712Object
|
|
6
|
-
primaryType: string
|
|
3
|
+
types: EIP712Types;
|
|
4
|
+
domain: EIP712Object;
|
|
5
|
+
message: EIP712Object;
|
|
6
|
+
primaryType: string;
|
|
7
7
|
}
|
|
8
8
|
export interface EIP712Types {
|
|
9
|
-
[key: string]: EIP712Parameter[]
|
|
9
|
+
[key: string]: EIP712Parameter[];
|
|
10
10
|
}
|
|
11
11
|
export interface EIP712Parameter {
|
|
12
|
-
name: string
|
|
13
|
-
type: string
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
14
|
}
|
|
15
|
-
export declare type EIP712ObjectValue =
|
|
16
|
-
| BigNumber
|
|
17
|
-
| string
|
|
18
|
-
| number
|
|
19
|
-
| EIP712Object
|
|
15
|
+
export declare type EIP712ObjectValue = BigNumber | string | number | EIP712Object;
|
|
20
16
|
export interface EIP712Object {
|
|
21
|
-
[key: string]: EIP712ObjectValue
|
|
17
|
+
[key: string]: EIP712ObjectValue;
|
|
22
18
|
}
|
|
23
19
|
export declare type EIP712DomainType = {
|
|
24
|
-
name: string
|
|
25
|
-
version: string
|
|
26
|
-
chainId: number
|
|
27
|
-
verifyingContract: string
|
|
28
|
-
}
|
|
20
|
+
name: string;
|
|
21
|
+
version: string;
|
|
22
|
+
chainId: number;
|
|
23
|
+
verifyingContract: string;
|
|
24
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
//# sourceMappingURL=eip712.types.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=eip712.types.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './domain'
|
|
2
|
-
export * from './eip712.types'
|
|
3
|
-
export * from './order-typed-data-builder'
|
|
1
|
+
export * from './domain';
|
|
2
|
+
export * from './eip712.types';
|
|
3
|
+
export * from './order-typed-data-builder';
|
|
@@ -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("./domain"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./eip712.types"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./order-typed-data-builder"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {EIP712DomainType, EIP712TypedData} from './eip712.types'
|
|
2
|
-
import {LimitOrderV3Struct} from '../types'
|
|
3
|
-
export declare function getOrderHash(data: EIP712TypedData): string
|
|
4
|
-
export declare function buildOrderData(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
name: string,
|
|
8
|
-
version: string,
|
|
9
|
-
order: LimitOrderV3Struct
|
|
10
|
-
): EIP712TypedData
|
|
11
|
-
export declare function domainSeparator(
|
|
12
|
-
name: string,
|
|
13
|
-
version: string,
|
|
14
|
-
chainId: number,
|
|
15
|
-
verifyingContract: string
|
|
16
|
-
): string
|
|
17
|
-
export declare function getLimitOrderV3Domain(chainId: number): EIP712DomainType
|
|
1
|
+
import { EIP712DomainType, EIP712TypedData } from './eip712.types';
|
|
2
|
+
import { LimitOrderV3Struct } from '../types';
|
|
3
|
+
export declare function getOrderHash(data: EIP712TypedData): string;
|
|
4
|
+
export declare function buildOrderData(chainId: number, verifyingContract: string, name: string, version: string, order: LimitOrderV3Struct): EIP712TypedData;
|
|
5
|
+
export declare function domainSeparator(name: string, version: string, chainId: number, verifyingContract: string): string;
|
|
6
|
+
export declare function getLimitOrderV3Domain(chainId: number): EIP712DomainType;
|
|
@@ -1,51 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.getLimitOrderV3Domain =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.getOrderHash =
|
|
7
|
-
void 0
|
|
8
|
-
const eth_sig_util_1 = require('@metamask/eth-sig-util')
|
|
9
|
-
const domain_1 = require('./domain')
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLimitOrderV3Domain = exports.domainSeparator = exports.buildOrderData = exports.getOrderHash = void 0;
|
|
4
|
+
const eth_sig_util_1 = require("@metamask/eth-sig-util");
|
|
5
|
+
const domain_1 = require("./domain");
|
|
10
6
|
function getOrderHash(data) {
|
|
11
|
-
return (
|
|
12
|
-
'0x' +
|
|
7
|
+
return ('0x' +
|
|
13
8
|
eth_sig_util_1.TypedDataUtils.eip712Hash(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
eth_sig_util_1.SignTypedDataVersion.V4
|
|
17
|
-
).toString('hex')
|
|
18
|
-
)
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
data, eth_sig_util_1.SignTypedDataVersion.V4).toString('hex'));
|
|
19
11
|
}
|
|
20
|
-
exports.getOrderHash = getOrderHash
|
|
12
|
+
exports.getOrderHash = getOrderHash;
|
|
21
13
|
function buildOrderData(chainId, verifyingContract, name, version, order) {
|
|
22
14
|
return {
|
|
23
15
|
primaryType: 'Order',
|
|
24
|
-
types: {EIP712Domain: domain_1.EIP712Domain, Order: domain_1.Order},
|
|
25
|
-
domain: {name, version, chainId, verifyingContract},
|
|
16
|
+
types: { EIP712Domain: domain_1.EIP712Domain, Order: domain_1.Order },
|
|
17
|
+
domain: { name, version, chainId, verifyingContract },
|
|
26
18
|
message: order
|
|
27
|
-
}
|
|
19
|
+
};
|
|
28
20
|
}
|
|
29
|
-
exports.buildOrderData = buildOrderData
|
|
21
|
+
exports.buildOrderData = buildOrderData;
|
|
30
22
|
function domainSeparator(name, version, chainId, verifyingContract) {
|
|
31
|
-
return (
|
|
32
|
-
'
|
|
33
|
-
eth_sig_util_1.TypedDataUtils.hashStruct(
|
|
34
|
-
'EIP712Domain',
|
|
35
|
-
{name, version, chainId, verifyingContract},
|
|
36
|
-
{EIP712Domain: domain_1.EIP712Domain},
|
|
37
|
-
eth_sig_util_1.SignTypedDataVersion.V4
|
|
38
|
-
).toString('hex')
|
|
39
|
-
)
|
|
23
|
+
return ('0x' +
|
|
24
|
+
eth_sig_util_1.TypedDataUtils.hashStruct('EIP712Domain', { name, version, chainId, verifyingContract }, { EIP712Domain: domain_1.EIP712Domain }, eth_sig_util_1.SignTypedDataVersion.V4).toString('hex'));
|
|
40
25
|
}
|
|
41
|
-
exports.domainSeparator = domainSeparator
|
|
26
|
+
exports.domainSeparator = domainSeparator;
|
|
42
27
|
function getLimitOrderV3Domain(chainId) {
|
|
43
28
|
return {
|
|
44
29
|
name: domain_1.LimitOrderV3TypeDataName,
|
|
45
30
|
version: domain_1.LimitOrderV3TypeDataVersion,
|
|
46
31
|
chainId,
|
|
47
32
|
verifyingContract: domain_1.VerifyingContract
|
|
48
|
-
}
|
|
33
|
+
};
|
|
49
34
|
}
|
|
50
|
-
exports.getLimitOrderV3Domain = getLimitOrderV3Domain
|
|
51
|
-
//# sourceMappingURL=order-typed-data-builder.js.map
|
|
35
|
+
exports.getLimitOrderV3Domain = getLimitOrderV3Domain;
|
|
36
|
+
//# sourceMappingURL=order-typed-data-builder.js.map
|
package/limit-order/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './eip712/index'
|
|
2
|
-
export * from './limit-order'
|
|
3
|
-
export * from './types'
|
|
4
|
-
export * from './parser/index'
|
|
1
|
+
export * from './eip712/index';
|
|
2
|
+
export * from './limit-order';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export * from './parser/index';
|
package/limit-order/index.js
CHANGED
|
@@ -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("./eip712/index"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./limit-order"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./parser/index"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.InteractionsFactory = void 0
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InteractionsFactory = void 0;
|
|
4
4
|
class InteractionsFactory {
|
|
5
5
|
static unwrap(wethUnwrapper, receiverAddress) {
|
|
6
|
-
return wethUnwrapper + receiverAddress.substring(2)
|
|
6
|
+
return wethUnwrapper + receiverAddress.substring(2);
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
exports.InteractionsFactory = InteractionsFactory
|
|
10
|
-
//# sourceMappingURL=interactions-factory.js.map
|
|
9
|
+
exports.InteractionsFactory = InteractionsFactory;
|
|
10
|
+
//# sourceMappingURL=interactions-factory.js.map
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import {EIP712TypedData} from './eip712'
|
|
2
|
-
import {InteractionsData, LimitOrderV3Struct, OrderInfoData} from './types'
|
|
1
|
+
import { EIP712TypedData } from './eip712';
|
|
2
|
+
import { InteractionsData, LimitOrderV3Struct, OrderInfoData } from './types';
|
|
3
3
|
export declare class LimitOrder {
|
|
4
|
-
readonly makerAsset: string
|
|
5
|
-
readonly takerAsset: string
|
|
6
|
-
readonly makingAmount: string
|
|
7
|
-
readonly takingAmount: string
|
|
8
|
-
readonly from: string
|
|
9
|
-
readonly allowedSender: string
|
|
10
|
-
readonly receiver: string
|
|
11
|
-
readonly makerAssetData: string
|
|
12
|
-
readonly takerAssetData: string
|
|
13
|
-
readonly getMakingAmount: string
|
|
14
|
-
readonly getTakingAmount: string
|
|
15
|
-
readonly predicate: string
|
|
16
|
-
readonly permit: string
|
|
17
|
-
readonly preInteraction: string
|
|
18
|
-
readonly postInteraction: string
|
|
19
|
-
protected salt: string
|
|
20
|
-
constructor(orderInfo: OrderInfoData, interactions?: InteractionsData)
|
|
21
|
-
static getOrderHash(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
domain?: import('./eip712').EIP712DomainType
|
|
28
|
-
): EIP712TypedData
|
|
29
|
-
static decode(struct: LimitOrderV3Struct): LimitOrder
|
|
30
|
-
build(): LimitOrderV3Struct
|
|
31
|
-
getTypedData(domain?: import('./eip712').EIP712DomainType): EIP712TypedData
|
|
32
|
-
getOrderHash(domain?: import('./eip712').EIP712DomainType): string
|
|
4
|
+
readonly makerAsset: string;
|
|
5
|
+
readonly takerAsset: string;
|
|
6
|
+
readonly makingAmount: string;
|
|
7
|
+
readonly takingAmount: string;
|
|
8
|
+
readonly from: string;
|
|
9
|
+
readonly allowedSender: string;
|
|
10
|
+
readonly receiver: string;
|
|
11
|
+
readonly makerAssetData: string;
|
|
12
|
+
readonly takerAssetData: string;
|
|
13
|
+
readonly getMakingAmount: string;
|
|
14
|
+
readonly getTakingAmount: string;
|
|
15
|
+
readonly predicate: string;
|
|
16
|
+
readonly permit: string;
|
|
17
|
+
readonly preInteraction: string;
|
|
18
|
+
readonly postInteraction: string;
|
|
19
|
+
protected salt: string;
|
|
20
|
+
constructor(orderInfo: OrderInfoData, interactions?: InteractionsData);
|
|
21
|
+
static getOrderHash(order: LimitOrderV3Struct, domain?: import("./eip712").EIP712DomainType): string;
|
|
22
|
+
static getTypedData(order: LimitOrderV3Struct, domain?: import("./eip712").EIP712DomainType): EIP712TypedData;
|
|
23
|
+
static decode(struct: LimitOrderV3Struct): LimitOrder;
|
|
24
|
+
build(): LimitOrderV3Struct;
|
|
25
|
+
getTypedData(domain?: import("./eip712").EIP712DomainType): EIP712TypedData;
|
|
26
|
+
getOrderHash(domain?: import("./eip712").EIP712DomainType): string;
|
|
33
27
|
}
|
|
@@ -1,92 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.LimitOrder = void 0
|
|
4
|
-
const utils_1 = require(
|
|
5
|
-
const eip712_1 = require(
|
|
6
|
-
const constants_1 = require(
|
|
7
|
-
const utils_2 = require(
|
|
8
|
-
const parser_1 = require(
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimitOrder = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const eip712_1 = require("./eip712");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const utils_2 = require("./utils");
|
|
8
|
+
const parser_1 = require("./parser/parser");
|
|
9
9
|
class LimitOrder {
|
|
10
10
|
constructor(orderInfo, interactions) {
|
|
11
|
-
this.makerAsset = orderInfo.makerAsset
|
|
12
|
-
this.takerAsset = orderInfo.takerAsset
|
|
13
|
-
this.makingAmount = orderInfo.makingAmount
|
|
14
|
-
this.takingAmount = orderInfo.takingAmount
|
|
15
|
-
this.salt = orderInfo.salt || (0, utils_2.buildSalt)()
|
|
16
|
-
this.from = orderInfo.maker
|
|
17
|
-
this.allowedSender = orderInfo.allowedSender || constants_1.ZERO_ADDRESS
|
|
18
|
-
this.receiver = orderInfo.receiver || constants_1.ZERO_ADDRESS
|
|
19
|
-
this.makerAssetData =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.getMakingAmount =
|
|
28
|
-
(interactions === null || interactions === void 0
|
|
29
|
-
? void 0
|
|
30
|
-
: interactions.getMakingAmount) || constants_1.ZX
|
|
31
|
-
this.getTakingAmount =
|
|
32
|
-
(interactions === null || interactions === void 0
|
|
33
|
-
? void 0
|
|
34
|
-
: interactions.getTakingAmount) || constants_1.ZX
|
|
35
|
-
this.predicate =
|
|
36
|
-
(interactions === null || interactions === void 0
|
|
37
|
-
? void 0
|
|
38
|
-
: interactions.predicate) || constants_1.ZX
|
|
39
|
-
this.permit =
|
|
40
|
-
(interactions === null || interactions === void 0
|
|
41
|
-
? void 0
|
|
42
|
-
: interactions.permit) || constants_1.ZX
|
|
43
|
-
this.preInteraction =
|
|
44
|
-
(interactions === null || interactions === void 0
|
|
45
|
-
? void 0
|
|
46
|
-
: interactions.preInteraction) || constants_1.ZX
|
|
47
|
-
this.postInteraction =
|
|
48
|
-
(interactions === null || interactions === void 0
|
|
49
|
-
? void 0
|
|
50
|
-
: interactions.postInteraction) || constants_1.ZX
|
|
11
|
+
this.makerAsset = orderInfo.makerAsset;
|
|
12
|
+
this.takerAsset = orderInfo.takerAsset;
|
|
13
|
+
this.makingAmount = orderInfo.makingAmount;
|
|
14
|
+
this.takingAmount = orderInfo.takingAmount;
|
|
15
|
+
this.salt = orderInfo.salt || (0, utils_2.buildSalt)();
|
|
16
|
+
this.from = orderInfo.maker;
|
|
17
|
+
this.allowedSender = orderInfo.allowedSender || constants_1.ZERO_ADDRESS;
|
|
18
|
+
this.receiver = orderInfo.receiver || constants_1.ZERO_ADDRESS;
|
|
19
|
+
this.makerAssetData = (interactions === null || interactions === void 0 ? void 0 : interactions.makerAssetData) || constants_1.ZX;
|
|
20
|
+
this.takerAssetData = (interactions === null || interactions === void 0 ? void 0 : interactions.takerAssetData) || constants_1.ZX;
|
|
21
|
+
this.getMakingAmount = (interactions === null || interactions === void 0 ? void 0 : interactions.getMakingAmount) || constants_1.ZX;
|
|
22
|
+
this.getTakingAmount = (interactions === null || interactions === void 0 ? void 0 : interactions.getTakingAmount) || constants_1.ZX;
|
|
23
|
+
this.predicate = (interactions === null || interactions === void 0 ? void 0 : interactions.predicate) || constants_1.ZX;
|
|
24
|
+
this.permit = (interactions === null || interactions === void 0 ? void 0 : interactions.permit) || constants_1.ZX;
|
|
25
|
+
this.preInteraction = (interactions === null || interactions === void 0 ? void 0 : interactions.preInteraction) || constants_1.ZX;
|
|
26
|
+
this.postInteraction = (interactions === null || interactions === void 0 ? void 0 : interactions.postInteraction) || constants_1.ZX;
|
|
51
27
|
}
|
|
52
|
-
static getOrderHash(
|
|
53
|
-
order,
|
|
54
|
-
domain = (0, eip712_1.getLimitOrderV3Domain)(1)
|
|
55
|
-
) {
|
|
56
|
-
return (0, eip712_1.getOrderHash)(
|
|
57
|
-
LimitOrder.getTypedData(order, domain)
|
|
58
|
-
)
|
|
28
|
+
static getOrderHash(order, domain = (0, eip712_1.getLimitOrderV3Domain)(1)) {
|
|
29
|
+
return (0, eip712_1.getOrderHash)(LimitOrder.getTypedData(order, domain));
|
|
59
30
|
}
|
|
60
|
-
static getTypedData(
|
|
61
|
-
order
|
|
62
|
-
domain = (0, eip712_1.getLimitOrderV3Domain)(1)
|
|
63
|
-
) {
|
|
64
|
-
return (0, eip712_1.buildOrderData)(
|
|
65
|
-
domain.chainId,
|
|
66
|
-
domain.verifyingContract,
|
|
67
|
-
domain.name,
|
|
68
|
-
domain.version,
|
|
69
|
-
order
|
|
70
|
-
)
|
|
31
|
+
static getTypedData(order, domain = (0, eip712_1.getLimitOrderV3Domain)(1)) {
|
|
32
|
+
return (0, eip712_1.buildOrderData)(domain.chainId, domain.verifyingContract, domain.name, domain.version, order);
|
|
71
33
|
}
|
|
72
34
|
static decode(struct) {
|
|
73
|
-
const interactions = (0, parser_1.parseInteractions)(
|
|
74
|
-
|
|
75
|
-
struct.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
allowedSender: struct.allowedSender,
|
|
85
|
-
receiver: struct.receiver,
|
|
86
|
-
salt: struct.salt
|
|
87
|
-
},
|
|
88
|
-
interactions
|
|
89
|
-
)
|
|
35
|
+
const interactions = (0, parser_1.parseInteractions)(struct.offsets, struct.interactions);
|
|
36
|
+
return new LimitOrder({
|
|
37
|
+
makerAsset: struct.makerAsset,
|
|
38
|
+
takerAsset: struct.takerAsset,
|
|
39
|
+
maker: struct.maker,
|
|
40
|
+
takingAmount: struct.takingAmount,
|
|
41
|
+
makingAmount: struct.makingAmount,
|
|
42
|
+
allowedSender: struct.allowedSender,
|
|
43
|
+
receiver: struct.receiver,
|
|
44
|
+
salt: struct.salt
|
|
45
|
+
}, interactions);
|
|
90
46
|
}
|
|
91
47
|
build() {
|
|
92
48
|
const allInteractions = [
|
|
@@ -98,20 +54,17 @@ class LimitOrder {
|
|
|
98
54
|
this.permit,
|
|
99
55
|
this.preInteraction,
|
|
100
56
|
this.postInteraction
|
|
101
|
-
]
|
|
57
|
+
];
|
|
102
58
|
// https://stackoverflow.com/a/55261098/440168
|
|
103
59
|
const cumulativeSum = ((sum) => (value) => {
|
|
104
|
-
sum += value
|
|
105
|
-
return sum
|
|
106
|
-
})(0)
|
|
60
|
+
sum += value;
|
|
61
|
+
return sum;
|
|
62
|
+
})(0);
|
|
107
63
|
const offsets = allInteractions
|
|
108
64
|
.map((a) => a.length / 2 - 1)
|
|
109
65
|
.map(cumulativeSum)
|
|
110
|
-
.reduce(
|
|
111
|
-
|
|
112
|
-
(0, utils_1.toBN)(0)
|
|
113
|
-
)
|
|
114
|
-
const interactions = '0x' + allInteractions.map(utils_1.trim0x).join('')
|
|
66
|
+
.reduce((acc, a, i) => acc.add((0, utils_1.toBN)(a).shln(32 * i)), (0, utils_1.toBN)(0));
|
|
67
|
+
const interactions = '0x' + allInteractions.map(utils_1.trim0x).join('');
|
|
115
68
|
return {
|
|
116
69
|
salt: this.salt,
|
|
117
70
|
makerAsset: this.makerAsset,
|
|
@@ -123,20 +76,14 @@ class LimitOrder {
|
|
|
123
76
|
takingAmount: this.takingAmount,
|
|
124
77
|
offsets: offsets.toString(),
|
|
125
78
|
interactions
|
|
126
|
-
}
|
|
79
|
+
};
|
|
127
80
|
}
|
|
128
81
|
getTypedData(domain = (0, eip712_1.getLimitOrderV3Domain)(1)) {
|
|
129
|
-
return (0, eip712_1.buildOrderData)(
|
|
130
|
-
domain.chainId,
|
|
131
|
-
domain.verifyingContract,
|
|
132
|
-
domain.name,
|
|
133
|
-
domain.version,
|
|
134
|
-
this.build()
|
|
135
|
-
)
|
|
82
|
+
return (0, eip712_1.buildOrderData)(domain.chainId, domain.verifyingContract, domain.name, domain.version, this.build());
|
|
136
83
|
}
|
|
137
84
|
getOrderHash(domain = (0, eip712_1.getLimitOrderV3Domain)(1)) {
|
|
138
|
-
return (0, eip712_1.getOrderHash)(this.getTypedData(domain))
|
|
85
|
+
return (0, eip712_1.getOrderHash)(this.getTypedData(domain));
|
|
139
86
|
}
|
|
140
87
|
}
|
|
141
|
-
exports.LimitOrder = LimitOrder
|
|
142
|
-
//# sourceMappingURL=limit-order.js.map
|
|
88
|
+
exports.LimitOrder = LimitOrder;
|
|
89
|
+
//# sourceMappingURL=limit-order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|