@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
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {QuoterRequestParams} from './types'
|
|
1
|
+
import { QuoterRequestParams } from './types';
|
|
2
2
|
export declare class QuoterRequest {
|
|
3
|
-
readonly fromTokenAddress: string
|
|
4
|
-
readonly toTokenAddress: string
|
|
5
|
-
readonly amount: string
|
|
6
|
-
readonly walletAddress: string
|
|
7
|
-
readonly enableEstimate: boolean
|
|
8
|
-
readonly permit: string | undefined
|
|
9
|
-
constructor(params: QuoterRequestParams)
|
|
10
|
-
static new(params: QuoterRequestParams): QuoterRequest
|
|
11
|
-
validate(): string | null
|
|
12
|
-
build(): QuoterRequestParams
|
|
3
|
+
readonly fromTokenAddress: string;
|
|
4
|
+
readonly toTokenAddress: string;
|
|
5
|
+
readonly amount: string;
|
|
6
|
+
readonly walletAddress: string;
|
|
7
|
+
readonly enableEstimate: boolean;
|
|
8
|
+
readonly permit: string | undefined;
|
|
9
|
+
constructor(params: QuoterRequestParams);
|
|
10
|
+
static new(params: QuoterRequestParams): QuoterRequest;
|
|
11
|
+
validate(): string | null;
|
|
12
|
+
build(): QuoterRequestParams;
|
|
13
13
|
}
|
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.QuoterRequest = void 0
|
|
4
|
-
const utils_1 = require(
|
|
5
|
-
const constants_1 = require(
|
|
6
|
-
const validations_1 = require(
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuoterRequest = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const validations_1 = require("../../validations");
|
|
7
7
|
class QuoterRequest {
|
|
8
8
|
constructor(params) {
|
|
9
|
-
this.fromTokenAddress = params.fromTokenAddress.toLowerCase()
|
|
10
|
-
this.toTokenAddress = params.toTokenAddress.toLowerCase()
|
|
11
|
-
this.amount = params.amount
|
|
12
|
-
this.walletAddress = params.walletAddress.toLowerCase()
|
|
13
|
-
this.enableEstimate = params.enableEstimate || false
|
|
14
|
-
this.permit = params.permit
|
|
9
|
+
this.fromTokenAddress = params.fromTokenAddress.toLowerCase();
|
|
10
|
+
this.toTokenAddress = params.toTokenAddress.toLowerCase();
|
|
11
|
+
this.amount = params.amount;
|
|
12
|
+
this.walletAddress = params.walletAddress.toLowerCase();
|
|
13
|
+
this.enableEstimate = params.enableEstimate || false;
|
|
14
|
+
this.permit = params.permit;
|
|
15
15
|
}
|
|
16
16
|
static new(params) {
|
|
17
|
-
return new QuoterRequest(params)
|
|
17
|
+
return new QuoterRequest(params);
|
|
18
18
|
}
|
|
19
19
|
validate() {
|
|
20
20
|
if ((0, utils_1.isNativeCurrency)(this.fromTokenAddress)) {
|
|
21
|
-
return `cannot swap ${constants_1.NATIVE_CURRENCY}: wrap native currency to it's wrapper fist
|
|
21
|
+
return `cannot swap ${constants_1.NATIVE_CURRENCY}: wrap native currency to it's wrapper fist`;
|
|
22
22
|
}
|
|
23
|
-
if (
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
) {
|
|
27
|
-
return `replace ${constants_1.ZERO_ADDRESS} with ${constants_1.NATIVE_CURRENCY}`
|
|
23
|
+
if (this.fromTokenAddress === constants_1.ZERO_ADDRESS ||
|
|
24
|
+
this.toTokenAddress === constants_1.ZERO_ADDRESS) {
|
|
25
|
+
return `replace ${constants_1.ZERO_ADDRESS} with ${constants_1.NATIVE_CURRENCY}`;
|
|
28
26
|
}
|
|
29
27
|
if (this.fromTokenAddress === this.toTokenAddress) {
|
|
30
|
-
return 'fromTokenAddress and toTokenAddress should be different'
|
|
28
|
+
return 'fromTokenAddress and toTokenAddress should be different';
|
|
31
29
|
}
|
|
32
30
|
if (!(0, validations_1.isValidAddress)(this.fromTokenAddress)) {
|
|
33
|
-
return `${this.fromTokenAddress} is invalid fromTokenAddress
|
|
31
|
+
return `${this.fromTokenAddress} is invalid fromTokenAddress`;
|
|
34
32
|
}
|
|
35
33
|
if (!(0, validations_1.isValidAddress)(this.toTokenAddress)) {
|
|
36
|
-
return `${this.toTokenAddress} is invalid toTokenAddress
|
|
34
|
+
return `${this.toTokenAddress} is invalid toTokenAddress`;
|
|
37
35
|
}
|
|
38
36
|
if (!(0, validations_1.isValidAddress)(this.walletAddress)) {
|
|
39
|
-
return `${this.walletAddress} is invalid walletAddress
|
|
37
|
+
return `${this.walletAddress} is invalid walletAddress`;
|
|
40
38
|
}
|
|
41
39
|
if (!(0, validations_1.isValidAmount)(this.amount)) {
|
|
42
|
-
return `${this.amount} is invalid amount
|
|
40
|
+
return `${this.amount} is invalid amount`;
|
|
43
41
|
}
|
|
44
|
-
return null
|
|
42
|
+
return null;
|
|
45
43
|
}
|
|
46
44
|
build() {
|
|
47
45
|
return {
|
|
@@ -51,8 +49,8 @@ class QuoterRequest {
|
|
|
51
49
|
walletAddress: this.walletAddress,
|
|
52
50
|
enableEstimate: this.enableEstimate,
|
|
53
51
|
permit: this.permit
|
|
54
|
-
}
|
|
52
|
+
};
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
|
-
exports.QuoterRequest = QuoterRequest
|
|
58
|
-
//# sourceMappingURL=quoter.request.js.map
|
|
55
|
+
exports.QuoterRequest = QuoterRequest;
|
|
56
|
+
//# sourceMappingURL=quoter.request.js.map
|
package/api/quoter/types.d.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import {NetworkEnum} from '../../constants'
|
|
1
|
+
import { NetworkEnum } from '../../constants';
|
|
2
2
|
export declare type QuoterRequestParams = {
|
|
3
|
-
fromTokenAddress: string
|
|
4
|
-
toTokenAddress: string
|
|
5
|
-
amount: string
|
|
6
|
-
walletAddress: string
|
|
7
|
-
enableEstimate?: boolean
|
|
8
|
-
permit?: string
|
|
9
|
-
}
|
|
3
|
+
fromTokenAddress: string;
|
|
4
|
+
toTokenAddress: string;
|
|
5
|
+
amount: string;
|
|
6
|
+
walletAddress: string;
|
|
7
|
+
enableEstimate?: boolean;
|
|
8
|
+
permit?: string;
|
|
9
|
+
};
|
|
10
10
|
export declare type QuoterApiConfig = {
|
|
11
|
-
network: NetworkEnum
|
|
12
|
-
url: string
|
|
13
|
-
}
|
|
11
|
+
network: NetworkEnum;
|
|
12
|
+
url: string;
|
|
13
|
+
};
|
|
14
14
|
export declare type QuoterResponse = {
|
|
15
|
-
fromTokenAmount: string
|
|
16
|
-
feeToken: string
|
|
17
|
-
presets: QuoterPresets
|
|
18
|
-
recommended_preset: PresetEnum
|
|
19
|
-
toTokenAmount: string
|
|
20
|
-
prices: Cost
|
|
21
|
-
volume: Cost
|
|
22
|
-
settlementAddress: string
|
|
23
|
-
whitelist: string[]
|
|
24
|
-
quoteId: string | null
|
|
25
|
-
}
|
|
15
|
+
fromTokenAmount: string;
|
|
16
|
+
feeToken: string;
|
|
17
|
+
presets: QuoterPresets;
|
|
18
|
+
recommended_preset: PresetEnum;
|
|
19
|
+
toTokenAmount: string;
|
|
20
|
+
prices: Cost;
|
|
21
|
+
volume: Cost;
|
|
22
|
+
settlementAddress: string;
|
|
23
|
+
whitelist: string[];
|
|
24
|
+
quoteId: string | null;
|
|
25
|
+
};
|
|
26
26
|
export declare type QuoterPresets = {
|
|
27
|
-
fast: PresetData
|
|
28
|
-
medium: PresetData
|
|
29
|
-
slow: PresetData
|
|
30
|
-
}
|
|
27
|
+
fast: PresetData;
|
|
28
|
+
medium: PresetData;
|
|
29
|
+
slow: PresetData;
|
|
30
|
+
};
|
|
31
31
|
export declare type PresetData = {
|
|
32
|
-
auctionDuration: number
|
|
33
|
-
startAuctionIn: number
|
|
34
|
-
bankFee: string
|
|
35
|
-
initialRateBump: number
|
|
36
|
-
auctionStartAmount: string
|
|
37
|
-
auctionEndAmount: string
|
|
38
|
-
tokenFee: string
|
|
39
|
-
points: AuctionPoint[]
|
|
40
|
-
}
|
|
32
|
+
auctionDuration: number;
|
|
33
|
+
startAuctionIn: number;
|
|
34
|
+
bankFee: string;
|
|
35
|
+
initialRateBump: number;
|
|
36
|
+
auctionStartAmount: string;
|
|
37
|
+
auctionEndAmount: string;
|
|
38
|
+
tokenFee: string;
|
|
39
|
+
points: AuctionPoint[];
|
|
40
|
+
};
|
|
41
41
|
export declare type AuctionPoint = {
|
|
42
|
-
delay: number
|
|
43
|
-
coefficient: number
|
|
44
|
-
}
|
|
42
|
+
delay: number;
|
|
43
|
+
coefficient: number;
|
|
44
|
+
};
|
|
45
45
|
export declare type Cost = {
|
|
46
46
|
usd: {
|
|
47
|
-
fromToken: string
|
|
48
|
-
toToken: string
|
|
49
|
-
}
|
|
50
|
-
}
|
|
47
|
+
fromToken: string;
|
|
48
|
+
toToken: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
51
|
export declare enum PresetEnum {
|
|
52
|
-
fast =
|
|
53
|
-
medium =
|
|
54
|
-
slow =
|
|
52
|
+
fast = "fast",
|
|
53
|
+
medium = "medium",
|
|
54
|
+
slow = "slow"
|
|
55
55
|
}
|
package/api/quoter/types.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.PresetEnum = void 0
|
|
4
|
-
var PresetEnum
|
|
5
|
-
|
|
6
|
-
PresetEnum[
|
|
7
|
-
PresetEnum[
|
|
8
|
-
PresetEnum[
|
|
9
|
-
})(
|
|
10
|
-
//# sourceMappingURL=types.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PresetEnum = void 0;
|
|
4
|
+
var PresetEnum;
|
|
5
|
+
(function (PresetEnum) {
|
|
6
|
+
PresetEnum["fast"] = "fast";
|
|
7
|
+
PresetEnum["medium"] = "medium";
|
|
8
|
+
PresetEnum["slow"] = "slow";
|
|
9
|
+
})(PresetEnum = exports.PresetEnum || (exports.PresetEnum = {}));
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
package/api/relayer/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './relayer.request'
|
|
2
|
-
export * from './relayer.api'
|
|
3
|
-
export * from './types'
|
|
1
|
+
export * from './relayer.request';
|
|
2
|
+
export * from './relayer.api';
|
|
3
|
+
export * from './types';
|
package/api/relayer/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("./relayer.request"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./relayer.api"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {AxiosProviderConnector, HttpProviderConnector} from '../../connector'
|
|
2
|
-
import {RelayerRequest} from './relayer.request'
|
|
3
|
-
import {RelayerApiConfig} from './types'
|
|
1
|
+
import { AxiosProviderConnector, HttpProviderConnector } from '../../connector';
|
|
2
|
+
import { RelayerRequest } from './relayer.request';
|
|
3
|
+
import { RelayerApiConfig } from './types';
|
|
4
4
|
export declare class RelayerApi {
|
|
5
|
-
private readonly config
|
|
6
|
-
private readonly httpClient
|
|
7
|
-
constructor(config: RelayerApiConfig, httpClient: HttpProviderConnector)
|
|
8
|
-
static new(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
): RelayerApi
|
|
12
|
-
submit(params: RelayerRequest): Promise<void>
|
|
13
|
-
submitBatch(params: RelayerRequest[]): Promise<void>
|
|
5
|
+
private readonly config;
|
|
6
|
+
private readonly httpClient;
|
|
7
|
+
constructor(config: RelayerApiConfig, httpClient: HttpProviderConnector);
|
|
8
|
+
static new(config: RelayerApiConfig, httpClient?: AxiosProviderConnector): RelayerApi;
|
|
9
|
+
submit(params: RelayerRequest): Promise<void>;
|
|
10
|
+
submitBatch(params: RelayerRequest[]): Promise<void>;
|
|
14
11
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.RelayerApi = void 0
|
|
4
|
-
const connector_1 = require(
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RelayerApi = void 0;
|
|
4
|
+
const connector_1 = require("../../connector");
|
|
5
5
|
class RelayerApi {
|
|
6
6
|
constructor(config, httpClient) {
|
|
7
|
-
this.config = config
|
|
8
|
-
this.httpClient = httpClient
|
|
7
|
+
this.config = config;
|
|
8
|
+
this.httpClient = httpClient;
|
|
9
9
|
}
|
|
10
10
|
static new(config, httpClient = new connector_1.AxiosProviderConnector()) {
|
|
11
|
-
return new RelayerApi(config, httpClient)
|
|
11
|
+
return new RelayerApi(config, httpClient);
|
|
12
12
|
}
|
|
13
13
|
submit(params) {
|
|
14
|
-
const url = `${this.config.url}/v1.0/${this.config.network}/order/submit
|
|
15
|
-
return this.httpClient.post(url, params)
|
|
14
|
+
const url = `${this.config.url}/v1.0/${this.config.network}/order/submit`;
|
|
15
|
+
return this.httpClient.post(url, params);
|
|
16
16
|
}
|
|
17
17
|
submitBatch(params) {
|
|
18
|
-
const url = `${this.config.url}/v1.0/${this.config.network}/order/submit/many
|
|
19
|
-
return this.httpClient.post(url, params)
|
|
18
|
+
const url = `${this.config.url}/v1.0/${this.config.network}/order/submit/many`;
|
|
19
|
+
return this.httpClient.post(url, params);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
exports.RelayerApi = RelayerApi
|
|
23
|
-
//# sourceMappingURL=relayer.api.js.map
|
|
22
|
+
exports.RelayerApi = RelayerApi;
|
|
23
|
+
//# sourceMappingURL=relayer.api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export {};
|
|
@@ -1,102 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
const tslib_1 = require(
|
|
4
|
-
const relayer_api_1 = require(
|
|
5
|
-
const relayer_request_1 = require(
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const relayer_api_1 = require("./relayer.api");
|
|
5
|
+
const relayer_request_1 = require("./relayer.request");
|
|
6
6
|
describe('Relayer API', () => {
|
|
7
7
|
const httpProvider = {
|
|
8
8
|
get: jest.fn().mockImplementationOnce(() => {
|
|
9
|
-
return Promise.resolve()
|
|
9
|
+
return Promise.resolve();
|
|
10
10
|
}),
|
|
11
11
|
post: jest.fn().mockImplementation(() => {
|
|
12
|
-
return Promise.resolve()
|
|
12
|
+
return Promise.resolve();
|
|
13
13
|
})
|
|
14
|
-
}
|
|
15
|
-
it('should submit one order', () =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
takingAmount: '1420000000'
|
|
87
|
-
},
|
|
88
|
-
signature: '0x123signature-2-here789',
|
|
89
|
-
quoteId: '1a36c861-ffd7-45b9-1cb6-403d3bdfa084'
|
|
90
|
-
}
|
|
91
|
-
const params = [
|
|
92
|
-
relayer_request_1.RelayerRequest.new(orderData1),
|
|
93
|
-
relayer_request_1.RelayerRequest.new(orderData2)
|
|
94
|
-
]
|
|
95
|
-
yield quoter.submitBatch(params)
|
|
96
|
-
expect(httpProvider.post).toHaveBeenCalledWith(
|
|
97
|
-
'https://test.com/relayer/v1.0/1/order/submit/many',
|
|
98
|
-
params
|
|
99
|
-
)
|
|
100
|
-
}))
|
|
101
|
-
})
|
|
102
|
-
//# sourceMappingURL=relayer.api.spec.js.map
|
|
14
|
+
};
|
|
15
|
+
it('should submit one order', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const quoter = relayer_api_1.RelayerApi.new({
|
|
17
|
+
url: 'https://test.com/relayer',
|
|
18
|
+
network: 1
|
|
19
|
+
}, httpProvider);
|
|
20
|
+
const orderData = {
|
|
21
|
+
order: {
|
|
22
|
+
allowedSender: '0x0000000000000000000000000000000000000000',
|
|
23
|
+
interactions: '0x000c004e200000000000000000219ab540356cbb839cbe05303d7705faf486570009',
|
|
24
|
+
maker: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
25
|
+
makerAsset: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
26
|
+
makingAmount: '1000000000000000000',
|
|
27
|
+
offsets: '0',
|
|
28
|
+
receiver: '0x0000000000000000000000000000000000000000',
|
|
29
|
+
salt: '45118768841948961586167738353692277076075522015101619148498725069326976558864',
|
|
30
|
+
takerAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
31
|
+
takingAmount: '1420000000'
|
|
32
|
+
},
|
|
33
|
+
signature: '0x123signature-here789',
|
|
34
|
+
quoteId: '9a43c86d-f3d7-45b9-8cb6-803d2bdfa08b'
|
|
35
|
+
};
|
|
36
|
+
const params = relayer_request_1.RelayerRequest.new(orderData);
|
|
37
|
+
yield quoter.submit(params);
|
|
38
|
+
expect(httpProvider.post).toHaveBeenCalledWith('https://test.com/relayer/v1.0/1/order/submit', orderData);
|
|
39
|
+
}));
|
|
40
|
+
it('should submit two orders order', () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const quoter = relayer_api_1.RelayerApi.new({
|
|
42
|
+
url: 'https://test.com/relayer',
|
|
43
|
+
network: 1
|
|
44
|
+
}, httpProvider);
|
|
45
|
+
const orderData1 = {
|
|
46
|
+
order: {
|
|
47
|
+
allowedSender: '0x0000000000000000000000000000000000000000',
|
|
48
|
+
interactions: '0x000c004e200000000000000000219ab540356cbb839cbe05303d7705faf486570009',
|
|
49
|
+
maker: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
50
|
+
makerAsset: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
51
|
+
makingAmount: '1000000000000000000',
|
|
52
|
+
offsets: '0',
|
|
53
|
+
receiver: '0x0000000000000000000000000000000000000000',
|
|
54
|
+
salt: '45118768841948961586167738353692277076075522015101619148498725069326976558864',
|
|
55
|
+
takerAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
56
|
+
takingAmount: '1420000000'
|
|
57
|
+
},
|
|
58
|
+
signature: '0x123signature-here789',
|
|
59
|
+
quoteId: '9a43c86d-f3d7-45b9-8cb6-803d2bdfa08b'
|
|
60
|
+
};
|
|
61
|
+
const orderData2 = {
|
|
62
|
+
order: {
|
|
63
|
+
allowedSender: '0x0000000000000000000000000000000000000000',
|
|
64
|
+
interactions: '0x000c004e200000000000000000219ab540356cbb839cbe05303d7705faf486570009',
|
|
65
|
+
maker: '0x12345678219ab540356cbb839cbe05303d771111',
|
|
66
|
+
makerAsset: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
67
|
+
makingAmount: '1000000000000000000',
|
|
68
|
+
offsets: '0',
|
|
69
|
+
receiver: '0x0000000000000000000000000000000000000000',
|
|
70
|
+
salt: '45118768841948961586167738353692277076075522015101619148498725069326976558864',
|
|
71
|
+
takerAsset: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
72
|
+
takingAmount: '1420000000'
|
|
73
|
+
},
|
|
74
|
+
signature: '0x123signature-2-here789',
|
|
75
|
+
quoteId: '1a36c861-ffd7-45b9-1cb6-403d3bdfa084'
|
|
76
|
+
};
|
|
77
|
+
const params = [
|
|
78
|
+
relayer_request_1.RelayerRequest.new(orderData1),
|
|
79
|
+
relayer_request_1.RelayerRequest.new(orderData2)
|
|
80
|
+
];
|
|
81
|
+
yield quoter.submitBatch(params);
|
|
82
|
+
expect(httpProvider.post).toHaveBeenCalledWith('https://test.com/relayer/v1.0/1/order/submit/many', params);
|
|
83
|
+
}));
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=relayer.api.spec.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {RelayerRequestParams} from './types'
|
|
2
|
-
import {LimitOrderV3Struct} from '../../limit-order'
|
|
1
|
+
import { RelayerRequestParams } from './types';
|
|
2
|
+
import { LimitOrderV3Struct } from '../../limit-order';
|
|
3
3
|
export declare class RelayerRequest {
|
|
4
|
-
readonly order: LimitOrderV3Struct
|
|
5
|
-
readonly signature: string
|
|
6
|
-
readonly quoteId: string
|
|
7
|
-
constructor(params: RelayerRequestParams)
|
|
8
|
-
static new(params: RelayerRequestParams): RelayerRequest
|
|
9
|
-
build(): RelayerRequestParams
|
|
4
|
+
readonly order: LimitOrderV3Struct;
|
|
5
|
+
readonly signature: string;
|
|
6
|
+
readonly quoteId: string;
|
|
7
|
+
constructor(params: RelayerRequestParams);
|
|
8
|
+
static new(params: RelayerRequestParams): RelayerRequest;
|
|
9
|
+
build(): RelayerRequestParams;
|
|
10
10
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.RelayerRequest = void 0
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RelayerRequest = void 0;
|
|
4
4
|
class RelayerRequest {
|
|
5
5
|
constructor(params) {
|
|
6
|
-
this.order = params.order
|
|
7
|
-
this.signature = params.signature
|
|
8
|
-
this.quoteId = params.quoteId
|
|
6
|
+
this.order = params.order;
|
|
7
|
+
this.signature = params.signature;
|
|
8
|
+
this.quoteId = params.quoteId;
|
|
9
9
|
}
|
|
10
10
|
static new(params) {
|
|
11
|
-
return new RelayerRequest(params)
|
|
11
|
+
return new RelayerRequest(params);
|
|
12
12
|
}
|
|
13
13
|
build() {
|
|
14
14
|
return {
|
|
15
15
|
order: this.order,
|
|
16
16
|
signature: this.signature,
|
|
17
17
|
quoteId: this.quoteId
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
exports.RelayerRequest = RelayerRequest
|
|
22
|
-
//# sourceMappingURL=relayer.request.js.map
|
|
21
|
+
exports.RelayerRequest = RelayerRequest;
|
|
22
|
+
//# sourceMappingURL=relayer.request.js.map
|
package/api/relayer/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {NetworkEnum} from '../../constants'
|
|
2
|
-
import {LimitOrderV3Struct} from '../../limit-order'
|
|
1
|
+
import { NetworkEnum } from '../../constants';
|
|
2
|
+
import { LimitOrderV3Struct } from '../../limit-order';
|
|
3
3
|
export declare type RelayerRequestParams = {
|
|
4
|
-
order: LimitOrderV3Struct
|
|
5
|
-
signature: string
|
|
6
|
-
quoteId: string
|
|
7
|
-
}
|
|
4
|
+
order: LimitOrderV3Struct;
|
|
5
|
+
signature: string;
|
|
6
|
+
quoteId: string;
|
|
7
|
+
};
|
|
8
8
|
export declare type RelayerApiConfig = {
|
|
9
|
-
network: NetworkEnum
|
|
10
|
-
url: string
|
|
11
|
-
}
|
|
9
|
+
network: NetworkEnum;
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
package/api/relayer/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/api/types.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {NetworkEnum} from '../constants'
|
|
2
|
-
import {HttpProviderConnector} from '../connector'
|
|
1
|
+
import { NetworkEnum } from '../constants';
|
|
2
|
+
import { HttpProviderConnector } from '../connector';
|
|
3
3
|
export declare type FusionApiConfig = {
|
|
4
|
-
url: string
|
|
5
|
-
network: NetworkEnum
|
|
6
|
-
httpProvider?: HttpProviderConnector
|
|
7
|
-
}
|
|
4
|
+
url: string;
|
|
5
|
+
network: NetworkEnum;
|
|
6
|
+
httpProvider?: HttpProviderConnector;
|
|
7
|
+
};
|
|
8
8
|
export declare type PaginationMeta = {
|
|
9
|
-
totalItems: number
|
|
10
|
-
itemsPerPage: number
|
|
11
|
-
totalPages: number
|
|
12
|
-
currentPage: number
|
|
13
|
-
}
|
|
14
|
-
export declare type PaginationOutput<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
items: T[]
|
|
19
|
-
}
|
|
9
|
+
totalItems: number;
|
|
10
|
+
itemsPerPage: number;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
currentPage: number;
|
|
13
|
+
};
|
|
14
|
+
export declare type PaginationOutput<T extends Record<string, any> = Record<string, any>> = {
|
|
15
|
+
meta: PaginationMeta;
|
|
16
|
+
items: T[];
|
|
17
|
+
};
|
package/api/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
|