@1inch/fusion-sdk 2.2.4-rc.2 → 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.
Files changed (52) hide show
  1. package/dist/cjs/amount-calculator/amount-calculator.js +23 -4
  2. package/dist/cjs/amount-calculator/amount-calculator.js.map +1 -1
  3. package/dist/cjs/api/quoter/quote/quote.js +4 -1
  4. package/dist/cjs/api/quoter/quote/quote.js.map +1 -1
  5. package/dist/cjs/api/quoter/types.js.map +1 -1
  6. package/dist/cjs/constants.js +0 -2
  7. package/dist/cjs/constants.js.map +1 -1
  8. package/dist/cjs/fusion-order/constants.js +1 -3
  9. package/dist/cjs/fusion-order/constants.js.map +1 -1
  10. package/dist/cjs/fusion-order/fusion-extension.js +8 -3
  11. package/dist/cjs/fusion-order/fusion-extension.js.map +1 -1
  12. package/dist/cjs/fusion-order/fusion-order.js +10 -5
  13. package/dist/cjs/fusion-order/fusion-order.js.map +1 -1
  14. package/dist/cjs/fusion-order/index.js +1 -0
  15. package/dist/cjs/fusion-order/index.js.map +1 -1
  16. package/dist/cjs/fusion-order/surplus-params.js +22 -0
  17. package/dist/cjs/fusion-order/surplus-params.js.map +1 -0
  18. package/dist/cjs/fusion-order/whitelist/index.js +0 -1
  19. package/dist/cjs/fusion-order/whitelist/index.js.map +1 -1
  20. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  21. package/dist/esm/amount-calculator/amount-calculator.js +23 -4
  22. package/dist/esm/amount-calculator/amount-calculator.js.map +1 -1
  23. package/dist/esm/api/quoter/quote/quote.js +5 -2
  24. package/dist/esm/api/quoter/quote/quote.js.map +1 -1
  25. package/dist/esm/api/quoter/types.js.map +1 -1
  26. package/dist/esm/constants.js +0 -2
  27. package/dist/esm/constants.js.map +1 -1
  28. package/dist/esm/fusion-order/constants.js +1 -3
  29. package/dist/esm/fusion-order/constants.js.map +1 -1
  30. package/dist/esm/fusion-order/fusion-extension.js +8 -3
  31. package/dist/esm/fusion-order/fusion-extension.js.map +1 -1
  32. package/dist/esm/fusion-order/fusion-order.js +10 -5
  33. package/dist/esm/fusion-order/fusion-order.js.map +1 -1
  34. package/dist/esm/fusion-order/index.js +1 -0
  35. package/dist/esm/fusion-order/index.js.map +1 -1
  36. package/dist/esm/fusion-order/surplus-params.js +17 -0
  37. package/dist/esm/fusion-order/surplus-params.js.map +1 -0
  38. package/dist/esm/fusion-order/whitelist/index.js +0 -1
  39. package/dist/esm/fusion-order/whitelist/index.js.map +1 -1
  40. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  41. package/dist/types/src/amount-calculator/amount-calculator.d.ts +6 -3
  42. package/dist/types/src/api/quoter/quote/quote.d.ts +2 -0
  43. package/dist/types/src/api/quoter/types.d.ts +2 -0
  44. package/dist/types/src/constants.d.ts +1 -3
  45. package/dist/types/src/fusion-order/constants.d.ts +0 -2
  46. package/dist/types/src/fusion-order/fusion-extension.d.ts +3 -1
  47. package/dist/types/src/fusion-order/fusion-order.d.ts +4 -1
  48. package/dist/types/src/fusion-order/index.d.ts +1 -0
  49. package/dist/types/src/fusion-order/surplus-params.d.ts +9 -0
  50. package/dist/types/src/fusion-order/whitelist/index.d.ts +0 -1
  51. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  52. 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
- constructor(auctionCalculator: AuctionCalculator, feeCalculator?: FeeCalculator | undefined);
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
- getUserTakingAmountAmount(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
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;
@@ -34,6 +34,8 @@ export type QuoterResponse = {
34
34
  quoteId: string | null;
35
35
  autoK: number;
36
36
  fee: ResolverFeePresetRaw;
37
+ surplusFee?: number;
38
+ marketAmount: string;
37
39
  };
38
40
  export type QuoterPresets = {
39
41
  fast: PresetData;
@@ -10,9 +10,7 @@ export declare enum NetworkEnum {
10
10
  FANTOM = 250,
11
11
  GNOSIS = 100,
12
12
  COINBASE = 8453,
13
- LINEA = 59144,
14
- SONIC = 146,
15
- UNICHAIN = 130
13
+ LINEA = 59144
16
14
  }
17
15
  export declare const ONE_INCH_LIMIT_ORDER_V4 = "0x111111125421ca6dc452d289314280a0f8842a65";
18
16
  export declare const UINT_160_MAX: bigint;
@@ -11,6 +11,4 @@ export declare const CHAIN_TO_WRAPPER: {
11
11
  250: Address;
12
12
  324: Address;
13
13
  59144: Address;
14
- 130: Address;
15
- 146: Address;
16
14
  };
@@ -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;
@@ -4,3 +4,4 @@ export * from './whitelist';
4
4
  export * from './fusion-extension';
5
5
  export { CHAIN_TO_WRAPPER } from './constants';
6
6
  export { FeeTakerExt } from '@1inch/limit-order-sdk';
7
+ export * from './surplus-params';
@@ -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
+ }
@@ -1,2 +1 @@
1
1
  export * from './whitelist';
2
- export * from './types';