@1inch/fusion-sdk 2.2.4 → 2.2.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 +23 -4
- package/dist/cjs/amount-calculator/amount-calculator.js.map +1 -1
- package/dist/cjs/api/quoter/quote/quote.js +4 -1
- package/dist/cjs/api/quoter/quote/quote.js.map +1 -1
- package/dist/cjs/api/quoter/types.js.map +1 -1
- package/dist/cjs/connector/ws/websocket-client.connector.js.map +1 -1
- package/dist/cjs/fusion-order/fusion-extension.js +8 -3
- package/dist/cjs/fusion-order/fusion-extension.js.map +1 -1
- package/dist/cjs/fusion-order/fusion-order.js +10 -5
- package/dist/cjs/fusion-order/fusion-order.js.map +1 -1
- package/dist/cjs/fusion-order/index.js +1 -0
- package/dist/cjs/fusion-order/index.js.map +1 -1
- package/dist/cjs/fusion-order/surplus-params.js +22 -0
- package/dist/cjs/fusion-order/surplus-params.js.map +1 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/amount-calculator/amount-calculator.js +23 -4
- package/dist/esm/amount-calculator/amount-calculator.js.map +1 -1
- package/dist/esm/api/quoter/quote/quote.js +5 -2
- package/dist/esm/api/quoter/quote/quote.js.map +1 -1
- package/dist/esm/api/quoter/types.js.map +1 -1
- package/dist/esm/connector/ws/websocket-client.connector.js.map +1 -1
- package/dist/esm/fusion-order/fusion-extension.js +8 -3
- package/dist/esm/fusion-order/fusion-extension.js.map +1 -1
- package/dist/esm/fusion-order/fusion-order.js +10 -5
- package/dist/esm/fusion-order/fusion-order.js.map +1 -1
- package/dist/esm/fusion-order/index.js +1 -0
- package/dist/esm/fusion-order/index.js.map +1 -1
- package/dist/esm/fusion-order/surplus-params.js +17 -0
- package/dist/esm/fusion-order/surplus-params.js.map +1 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/amount-calculator/amount-calculator.d.ts +6 -3
- package/dist/types/src/api/quoter/quote/quote.d.ts +2 -0
- package/dist/types/src/api/quoter/types.d.ts +2 -0
- package/dist/types/src/fusion-order/fusion-extension.d.ts +3 -1
- package/dist/types/src/fusion-order/fusion-order.d.ts +4 -1
- package/dist/types/src/fusion-order/index.d.ts +1 -0
- package/dist/types/src/fusion-order/surplus-params.d.ts +9 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +16 -16
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { Address, Bps } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { FeeCalculator } from '@1inch/limit-order-sdk/extensions/fee-taker';
|
|
3
3
|
import { AuctionCalculator } from './auction-calculator';
|
|
4
|
-
import { FusionExtension } from '../fusion-order';
|
|
4
|
+
import { FusionExtension, SurplusParams } from '../fusion-order';
|
|
5
5
|
export declare class AmountCalculator {
|
|
6
6
|
private readonly auctionCalculator;
|
|
7
7
|
private readonly feeCalculator?;
|
|
8
|
-
|
|
8
|
+
private readonly surplus;
|
|
9
|
+
constructor(auctionCalculator: AuctionCalculator, feeCalculator?: FeeCalculator | undefined, surplus?: SurplusParams);
|
|
9
10
|
static fromExtension(ext: FusionExtension): AmountCalculator;
|
|
10
11
|
static calcAuctionTakingAmount(baseTakingAmount: bigint, rate: number, fee?: Bps): bigint;
|
|
11
12
|
static extractFeeAmount(requiredTakingAmount: bigint, fee: Bps): bigint;
|
|
12
13
|
getRequiredTakingAmount(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
13
14
|
getRequiredMakingAmount(taker: Address, makingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
14
15
|
getTotalFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
15
|
-
|
|
16
|
+
getUserTakingAmount(taker: Address, makingAmount: bigint, takingAmount: bigint, orderMakingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
17
|
+
getSurplusFee(taker: Address, makingAmount: bigint, takingAmount: bigint, orderMakingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
16
18
|
getResolverFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
17
19
|
getIntegratorFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
18
20
|
getProtocolShareOfIntegratorFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
19
21
|
getProtocolFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
22
|
+
private _getSurplusFee;
|
|
20
23
|
private getAuctionBumpedAmount;
|
|
21
24
|
}
|
|
@@ -16,12 +16,14 @@ export declare class Quote {
|
|
|
16
16
|
};
|
|
17
17
|
readonly recommendedPreset: PresetEnum;
|
|
18
18
|
readonly toTokenAmount: string;
|
|
19
|
+
readonly marketReturn: bigint;
|
|
19
20
|
readonly prices: Cost;
|
|
20
21
|
readonly volume: Cost;
|
|
21
22
|
readonly whitelist: Address[];
|
|
22
23
|
readonly quoteId: string | null;
|
|
23
24
|
readonly slippage: number;
|
|
24
25
|
readonly resolverFeePreset: ResolverFeePreset;
|
|
26
|
+
readonly surplusFee?: number;
|
|
25
27
|
constructor(params: QuoterRequest, response: QuoterResponse);
|
|
26
28
|
createFusionOrder(paramsData: Omit<FusionOrderParamsData, 'permit' | 'isPermit2'>): FusionOrder;
|
|
27
29
|
getPreset(type?: PresetEnum): Preset;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { Address, Extension, Interaction, FeeTakerExt } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { AuctionDetails } from './auction-details';
|
|
3
3
|
import { Whitelist } from './whitelist/whitelist';
|
|
4
|
+
import { SurplusParams } from './surplus-params';
|
|
4
5
|
export declare class FusionExtension {
|
|
5
6
|
readonly address: Address;
|
|
6
7
|
readonly auctionDetails: AuctionDetails;
|
|
7
8
|
readonly whitelist: Whitelist;
|
|
9
|
+
readonly surplus: SurplusParams;
|
|
8
10
|
readonly extra?: {
|
|
9
11
|
makerPermit?: Interaction;
|
|
10
12
|
customReceiver?: Address;
|
|
11
13
|
fees?: FeeTakerExt.Fees;
|
|
12
14
|
} | undefined;
|
|
13
15
|
private static CUSTOM_RECEIVER_FLAG_BIT;
|
|
14
|
-
constructor(address: Address, auctionDetails: AuctionDetails, whitelist: Whitelist, extra?: {
|
|
16
|
+
constructor(address: Address, auctionDetails: AuctionDetails, whitelist: Whitelist, surplus: SurplusParams, extra?: {
|
|
15
17
|
makerPermit?: Interaction;
|
|
16
18
|
customReceiver?: Address;
|
|
17
19
|
fees?: FeeTakerExt.Fees;
|
|
@@ -3,6 +3,7 @@ import { Fees } from '@1inch/limit-order-sdk/extensions/fee-taker';
|
|
|
3
3
|
import { FusionExtension } from './fusion-extension';
|
|
4
4
|
import { AuctionDetails } from './auction-details';
|
|
5
5
|
import { Whitelist } from './whitelist/whitelist';
|
|
6
|
+
import { SurplusParams } from './surplus-params';
|
|
6
7
|
import { AuctionCalculator } from '../amount-calculator/auction-calculator';
|
|
7
8
|
import { AmountCalculator } from '../amount-calculator/amount-calculator';
|
|
8
9
|
export declare class FusionOrder {
|
|
@@ -10,7 +11,7 @@ export declare class FusionOrder {
|
|
|
10
11
|
private static defaultExtra;
|
|
11
12
|
readonly fusionExtension: FusionExtension;
|
|
12
13
|
private inner;
|
|
13
|
-
protected constructor(settlementExtensionContract: Address, orderInfo: OrderInfoData, auctionDetails: AuctionDetails, whitelist: Whitelist, extra?: {
|
|
14
|
+
protected constructor(settlementExtensionContract: Address, orderInfo: OrderInfoData, auctionDetails: AuctionDetails, whitelist: Whitelist, surplusParams?: SurplusParams, extra?: {
|
|
14
15
|
unwrapWETH?: boolean;
|
|
15
16
|
nonce?: bigint;
|
|
16
17
|
permit?: string;
|
|
@@ -40,6 +41,7 @@ export declare class FusionOrder {
|
|
|
40
41
|
static new(settlementExtension: Address, orderInfo: OrderInfoData, details: {
|
|
41
42
|
auction: AuctionDetails;
|
|
42
43
|
whitelist: Whitelist;
|
|
44
|
+
surplus?: SurplusParams;
|
|
43
45
|
}, extra?: {
|
|
44
46
|
unwrapWETH?: boolean;
|
|
45
47
|
nonce?: bigint;
|
|
@@ -58,6 +60,7 @@ export declare class FusionOrder {
|
|
|
58
60
|
getCalculator(): AuctionCalculator;
|
|
59
61
|
calcTakingAmount(taker: Address, makingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
60
62
|
getUserReceiveAmount(taker: Address, makingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
63
|
+
getSurplusFee(taker: Address, makingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
61
64
|
getResolverFee(taker: Address, time: bigint, blockBaseFee?: bigint, makingAmount?: bigint): bigint;
|
|
62
65
|
getIntegratorFee(taker: Address, time: bigint, blockBaseFee?: bigint, makingAmount?: bigint): bigint;
|
|
63
66
|
getProtocolShareOfIntegratorFee(taker: Address, time: bigint, blockBaseFee?: bigint, makingAmount?: bigint): bigint;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BytesIter } from '@1inch/byte-utils';
|
|
2
|
+
import { Bps } from '@1inch/limit-order-sdk';
|
|
3
|
+
export declare class SurplusParams {
|
|
4
|
+
readonly estimatedTakerAmount: bigint;
|
|
5
|
+
readonly protocolFee: Bps;
|
|
6
|
+
static NO_FEE: SurplusParams;
|
|
7
|
+
constructor(estimatedTakerAmount: bigint, protocolFee: Bps);
|
|
8
|
+
static decodeFrom<T extends string | bigint>(bytes: BytesIter<T>): SurplusParams;
|
|
9
|
+
}
|