@1inch/fusion-sdk 2.4.3 → 2.4.5-rc.0
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/dist/cjs/amount-calculator/amount-calculator.js +1 -1
- package/dist/cjs/amount-calculator/amount-calculator.spec.js +44 -2
- package/dist/cjs/api/quoter/quote/quote.js +20 -6
- package/dist/cjs/api/quoter/quoter.api.spec.js +101 -5
- package/dist/cjs/api/quoter/quoter.request.js +1 -4
- package/dist/cjs/api/quoter/quoter.request.spec.js +2 -8
- package/dist/esm/amount-calculator/amount-calculator.js +2 -2
- package/dist/esm/amount-calculator/amount-calculator.spec.js +44 -2
- package/dist/esm/api/quoter/quote/quote.js +20 -6
- package/dist/esm/api/quoter/quote/types.js +15 -3
- package/dist/esm/api/quoter/quoter.api.spec.js +101 -5
- package/dist/esm/api/quoter/quoter.request.js +1 -4
- package/dist/esm/api/quoter/quoter.request.spec.js +2 -8
- package/dist/esm/package.json +1 -1
- package/dist/types/src/api/quoter/quote/quote.d.ts +3 -2
- package/dist/types/src/api/quoter/quote/types.d.ts +6 -1
- package/dist/types/src/api/quoter/quoter.request.d.ts +3 -3
- package/dist/types/src/api/quoter/types.d.ts +2 -2
- package/dist/types/src/sdk/types.d.ts +3 -3
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,6 @@ describe(__filename, function() {
|
|
|
9
9
|
amount: '1000000000000000000000',
|
|
10
10
|
walletAddress: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
11
11
|
integratorFee: {
|
|
12
|
-
share: Bps.fromPercent(50),
|
|
13
12
|
receiver: Address.fromBigInt(10n),
|
|
14
13
|
value: new Bps(1n)
|
|
15
14
|
}
|
|
@@ -22,7 +21,6 @@ describe(__filename, function() {
|
|
|
22
21
|
amount: '1000000000000000000000',
|
|
23
22
|
walletAddress: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
24
23
|
integratorFee: {
|
|
25
|
-
share: Bps.fromPercent(50),
|
|
26
24
|
receiver: Address.fromBigInt(10n),
|
|
27
25
|
value: new Bps(1n)
|
|
28
26
|
}
|
|
@@ -37,7 +35,6 @@ describe(__filename, function() {
|
|
|
37
35
|
amount: '1000000000000000000000',
|
|
38
36
|
walletAddress: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
39
37
|
integratorFee: {
|
|
40
|
-
share: Bps.fromPercent(50),
|
|
41
38
|
receiver: Address.fromBigInt(10n),
|
|
42
39
|
value: new Bps(1n)
|
|
43
40
|
}
|
|
@@ -52,7 +49,6 @@ describe(__filename, function() {
|
|
|
52
49
|
amount: '1000000000000000000000',
|
|
53
50
|
walletAddress: '0x0000000019ab540356cbb839be05303d7705fa1',
|
|
54
51
|
integratorFee: {
|
|
55
|
-
share: Bps.fromPercent(50),
|
|
56
52
|
receiver: Address.fromBigInt(10n),
|
|
57
53
|
value: new Bps(1n)
|
|
58
54
|
}
|
|
@@ -67,14 +63,13 @@ describe(__filename, function() {
|
|
|
67
63
|
amount: 'dasdad',
|
|
68
64
|
walletAddress: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
69
65
|
integratorFee: {
|
|
70
|
-
share: Bps.fromPercent(50),
|
|
71
66
|
receiver: Address.fromBigInt(10n),
|
|
72
67
|
value: new Bps(1n)
|
|
73
68
|
}
|
|
74
69
|
});
|
|
75
70
|
}).toThrow(/is invalid amount/);
|
|
76
71
|
});
|
|
77
|
-
it('
|
|
72
|
+
it('allows fee without source', function() {
|
|
78
73
|
expect(function() {
|
|
79
74
|
return QuoterRequest.new({
|
|
80
75
|
fromTokenAddress: '0x6b175474e89094c44da98b954eedeac495271d0f',
|
|
@@ -82,11 +77,10 @@ describe(__filename, function() {
|
|
|
82
77
|
amount: '1000000',
|
|
83
78
|
walletAddress: '0x00000000219ab540356cbb839cbe05303d7705fa',
|
|
84
79
|
integratorFee: {
|
|
85
|
-
share: Bps.fromPercent(50),
|
|
86
80
|
receiver: Address.fromBigInt(10n),
|
|
87
81
|
value: new Bps(1n)
|
|
88
82
|
}
|
|
89
83
|
});
|
|
90
|
-
}).toThrow(
|
|
84
|
+
}).not.toThrow();
|
|
91
85
|
});
|
|
92
86
|
});
|
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@1inch/fusion-sdk","version":"2.4.
|
|
1
|
+
{"name":"@1inch/fusion-sdk","version":"2.4.5-rc.0","type":"module"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, ProxyFactory } from '@1inch/limit-order-sdk';
|
|
2
|
-
import { FusionOrderParamsData,
|
|
2
|
+
import { FusionOrderParamsData, IntegratorFeeResponse, ResolverFeePreset } from './types.js';
|
|
3
3
|
import { Cost, PresetEnum, QuoterResponse } from '../types.js';
|
|
4
4
|
import { Preset } from '../preset.js';
|
|
5
5
|
import { FusionOrder } from '../../../fusion-order/index.js';
|
|
@@ -25,10 +25,11 @@ export declare class Quote {
|
|
|
25
25
|
readonly slippage: number;
|
|
26
26
|
readonly resolverFeePreset: ResolverFeePreset;
|
|
27
27
|
readonly surplusFee?: number;
|
|
28
|
-
readonly integratorFeeParams?:
|
|
28
|
+
readonly integratorFeeParams?: IntegratorFeeResponse;
|
|
29
29
|
constructor(params: QuoterRequest, response: QuoterResponse);
|
|
30
30
|
createFusionOrder(paramsData: Omit<FusionOrderParamsData, 'permit' | 'isPermit2'>): FusionOrder;
|
|
31
31
|
getPreset(type?: PresetEnum): Preset;
|
|
32
32
|
private getWhitelist;
|
|
33
33
|
private _createOrder;
|
|
34
|
+
private parseIntegratorFee;
|
|
34
35
|
}
|
|
@@ -13,11 +13,16 @@ export type FusionOrderParamsData = {
|
|
|
13
13
|
delayAuctionStartTimeBy?: bigint;
|
|
14
14
|
orderExpirationDelay?: bigint;
|
|
15
15
|
};
|
|
16
|
-
export type
|
|
16
|
+
export type IntegratorFeeRequest = {
|
|
17
|
+
receiver: Address;
|
|
18
|
+
value: Bps;
|
|
19
|
+
};
|
|
20
|
+
export type IntegratorFeeResponse = {
|
|
17
21
|
receiver: Address;
|
|
18
22
|
value: Bps;
|
|
19
23
|
share: Bps;
|
|
20
24
|
};
|
|
25
|
+
export type IntegratorFeeParams = IntegratorFeeResponse;
|
|
21
26
|
export type ResolverFeePreset = {
|
|
22
27
|
receiver: Address;
|
|
23
28
|
bps: Bps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { QuoterRequestParams, QuoterRequestParamsRaw } from './types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { IntegratorFeeRequest } from './quote/index.js';
|
|
4
4
|
export declare class QuoterRequest {
|
|
5
5
|
readonly fromTokenAddress: Address;
|
|
6
6
|
readonly toTokenAddress: Address;
|
|
@@ -8,8 +8,8 @@ export declare class QuoterRequest {
|
|
|
8
8
|
readonly walletAddress: Address;
|
|
9
9
|
readonly enableEstimate: boolean;
|
|
10
10
|
readonly permit: string | undefined;
|
|
11
|
-
readonly integratorFee?:
|
|
12
|
-
readonly source
|
|
11
|
+
readonly integratorFee?: IntegratorFeeRequest;
|
|
12
|
+
readonly source?: string;
|
|
13
13
|
readonly isPermit2: boolean;
|
|
14
14
|
readonly slippage?: number;
|
|
15
15
|
constructor(params: QuoterRequestParams);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IntegratorFeeRequest } from './quote/index.js';
|
|
2
2
|
import { NetworkEnum } from '../../constants.js';
|
|
3
3
|
export type QuoterRequestParams = {
|
|
4
4
|
fromTokenAddress: string;
|
|
@@ -7,7 +7,7 @@ export type QuoterRequestParams = {
|
|
|
7
7
|
walletAddress: string;
|
|
8
8
|
enableEstimate?: boolean;
|
|
9
9
|
permit?: string;
|
|
10
|
-
integratorFee?:
|
|
10
|
+
integratorFee?: IntegratorFeeRequest;
|
|
11
11
|
source?: string;
|
|
12
12
|
isPermit2?: boolean;
|
|
13
13
|
slippage?: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address, LimitOrderV4Struct } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { BlockchainProviderConnector, HttpProviderConnector } from '../connector/index.js';
|
|
3
3
|
import { NetworkEnum } from '../constants.js';
|
|
4
|
-
import { CustomPreset,
|
|
4
|
+
import { CustomPreset, IntegratorFeeRequest, PresetEnum } from '../api/index.js';
|
|
5
5
|
import { FusionOrder } from '../fusion-order/index.js';
|
|
6
6
|
export type FusionSDKConfigParams = {
|
|
7
7
|
url: string;
|
|
@@ -17,7 +17,7 @@ export type QuoteParams = {
|
|
|
17
17
|
walletAddress?: string;
|
|
18
18
|
enableEstimate?: boolean;
|
|
19
19
|
permit?: string;
|
|
20
|
-
integratorFee?:
|
|
20
|
+
integratorFee?: IntegratorFeeRequest;
|
|
21
21
|
source?: string;
|
|
22
22
|
isPermit2?: boolean;
|
|
23
23
|
slippage?: number;
|
|
@@ -40,7 +40,7 @@ export type OrderParams = {
|
|
|
40
40
|
orderExpirationDelay?: bigint;
|
|
41
41
|
allowPartialFills?: boolean;
|
|
42
42
|
allowMultipleFills?: boolean;
|
|
43
|
-
integratorFee?:
|
|
43
|
+
integratorFee?: IntegratorFeeRequest;
|
|
44
44
|
slippage?: number;
|
|
45
45
|
};
|
|
46
46
|
export type OrderInfo = {
|