@1inch/fusion-sdk 2.2.3-rc.1 → 2.2.4-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/connector/ws/websocket-client.connector.js +8 -0
- package/dist/cjs/connector/ws/websocket-client.connector.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/amount-calculator/amount-calculator.d.ts +21 -0
- package/dist/esm/amount-calculator/amount-calculator.js +1 -1
- package/dist/esm/amount-calculator/auction-calculator/auction-calculator.d.ts +22 -0
- package/dist/esm/amount-calculator/auction-calculator/index.d.ts +1 -0
- package/dist/esm/amount-calculator/auction-calculator/index.js +1 -1
- package/dist/esm/amount-calculator/index.d.ts +3 -0
- package/dist/esm/amount-calculator/index.js +2 -2
- package/dist/esm/api/fusion-api.d.ts +19 -0
- package/dist/esm/api/fusion-api.js +5 -5
- package/dist/esm/api/index.d.ts +8 -0
- package/dist/esm/api/index.js +8 -8
- package/dist/esm/api/orders/index.d.ts +3 -0
- package/dist/esm/api/orders/index.js +3 -3
- package/dist/esm/api/orders/orders.api.d.ts +14 -0
- package/dist/esm/api/orders/orders.api.js +2 -2
- package/dist/esm/api/orders/orders.request.d.ts +24 -0
- package/dist/esm/api/orders/orders.request.js +2 -2
- package/dist/esm/api/orders/types.d.ts +79 -0
- package/dist/esm/api/ordersVersion.d.ts +5 -0
- package/dist/esm/api/pagination.d.ts +10 -0
- package/dist/esm/api/params.d.ts +2 -0
- package/dist/esm/api/params.js +1 -1
- package/dist/esm/api/quoter/index.d.ts +6 -0
- package/dist/esm/api/quoter/index.js +6 -6
- package/dist/esm/api/quoter/preset.d.ts +23 -0
- package/dist/esm/api/quoter/preset.js +1 -1
- package/dist/esm/api/quoter/quote/index.d.ts +3 -0
- package/dist/esm/api/quoter/quote/index.js +3 -3
- package/dist/esm/api/quoter/quote/order-params.d.ts +13 -0
- package/dist/esm/api/quoter/quote/order-params.js +1 -1
- package/dist/esm/api/quoter/quote/quote.d.ts +29 -0
- package/dist/esm/api/quoter/quote/quote.js +5 -5
- package/dist/esm/api/quoter/quote/types.d.ts +25 -0
- package/dist/esm/api/quoter/quoter-custom-preset.request.d.ts +10 -0
- package/dist/esm/api/quoter/quoter-custom-preset.request.js +1 -1
- package/dist/esm/api/quoter/quoter.api.d.ts +14 -0
- package/dist/esm/api/quoter/quoter.api.js +3 -3
- package/dist/esm/api/quoter/quoter.request.d.ts +17 -0
- package/dist/esm/api/quoter/quoter.request.js +1 -1
- package/dist/esm/api/quoter/types.d.ts +91 -0
- package/dist/esm/api/relayer/index.d.ts +3 -0
- package/dist/esm/api/relayer/index.js +3 -3
- package/dist/esm/api/relayer/relayer.api.d.ts +12 -0
- package/dist/esm/api/relayer/relayer.api.js +1 -1
- package/dist/esm/api/relayer/relayer.request.d.ts +11 -0
- package/dist/esm/api/relayer/types.d.ts +13 -0
- package/dist/esm/api/types.d.ts +18 -0
- package/dist/esm/api-ext.d.ts +1 -0
- package/dist/esm/api-ext.js +1 -1
- package/dist/esm/connector/blockchain/blockchain-provider.connector.d.ts +5 -0
- package/dist/esm/connector/blockchain/index.d.ts +3 -0
- package/dist/esm/connector/blockchain/index.js +3 -3
- package/dist/esm/connector/blockchain/private-key-provider.connector.d.ts +11 -0
- package/dist/esm/connector/blockchain/private-key-provider.connector.js +1 -1
- package/dist/esm/connector/blockchain/web3-provider-connector.d.ts +19 -0
- package/dist/esm/connector/http/axios-provider.connector.d.ts +7 -0
- package/dist/esm/connector/http/axios-provider.connector.js +1 -1
- package/dist/esm/connector/http/http-provider.connector.d.ts +4 -0
- package/dist/esm/connector/http/index.d.ts +2 -0
- package/dist/esm/connector/http/index.js +2 -2
- package/dist/esm/connector/index.d.ts +3 -0
- package/dist/esm/connector/index.js +3 -3
- package/dist/esm/connector/ws/index.d.ts +3 -0
- package/dist/esm/connector/ws/index.js +3 -3
- package/dist/esm/connector/ws/types.d.ts +10 -0
- package/dist/esm/connector/ws/websocket-client.connector.d.ts +22 -0
- package/dist/esm/connector/ws/websocket-client.connector.js +8 -0
- package/dist/esm/connector/ws/websocket-client.connector.js.map +1 -1
- package/dist/esm/connector/ws/websocket-provider.connector.d.ts +14 -0
- package/dist/esm/constants.d.ts +22 -0
- package/dist/esm/errors.d.ts +3 -0
- package/dist/esm/fusion-order/auction-details/auction-details.d.ts +25 -0
- package/dist/esm/fusion-order/auction-details/auction-details.js +3 -3
- package/dist/esm/fusion-order/auction-details/index.d.ts +2 -0
- package/dist/esm/fusion-order/auction-details/index.js +2 -2
- package/dist/esm/fusion-order/auction-details/types.d.ts +8 -0
- package/dist/esm/fusion-order/constants.d.ts +14 -0
- package/dist/esm/fusion-order/constants.js +1 -1
- package/dist/esm/fusion-order/fusion-extension.d.ts +26 -0
- package/dist/esm/fusion-order/fusion-extension.js +3 -3
- package/dist/esm/fusion-order/fusion-order.d.ts +70 -0
- package/dist/esm/fusion-order/fusion-order.js +7 -7
- package/dist/esm/fusion-order/index.d.ts +6 -0
- package/dist/esm/fusion-order/index.js +5 -5
- package/dist/esm/fusion-order/source-track.d.ts +1 -0
- package/dist/esm/fusion-order/source-track.js +2 -2
- package/dist/esm/fusion-order/whitelist/index.d.ts +1 -0
- package/dist/esm/fusion-order/whitelist/index.js +1 -1
- package/dist/esm/fusion-order/whitelist/types.d.ts +4 -0
- package/dist/esm/fusion-order/whitelist/whitelist.d.ts +26 -0
- package/dist/esm/fusion-order/whitelist/whitelist.js +3 -3
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +12 -12
- package/dist/esm/sdk/encoders/cancel-order.encoder.d.ts +2 -0
- package/dist/esm/sdk/encoders/cancel-order.encoder.js +1 -1
- package/dist/esm/sdk/encoders/index.d.ts +1 -0
- package/dist/esm/sdk/encoders/index.js +1 -1
- package/dist/esm/sdk/index.d.ts +4 -0
- package/dist/esm/sdk/index.js +4 -4
- package/dist/esm/sdk/sdk.d.ts +20 -0
- package/dist/esm/sdk/sdk.js +3 -3
- package/dist/esm/sdk/types.d.ts +55 -0
- package/dist/esm/sdk/utils.d.ts +2 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/amounts.d.ts +2 -0
- package/dist/esm/utils/time.d.ts +1 -0
- package/dist/esm/utils/types.d.ts +3 -0
- package/dist/esm/utils.d.ts +2 -0
- package/dist/esm/validations.d.ts +4 -0
- package/dist/esm/ws-api/active-websocket-orders-api.d.ts +13 -0
- package/dist/esm/ws-api/active-websocket-orders-api.js +1 -1
- package/dist/esm/ws-api/constants.d.ts +2 -0
- package/dist/esm/ws-api/index.d.ts +5 -0
- package/dist/esm/ws-api/index.js +5 -5
- package/dist/esm/ws-api/rpc-websocket-api.d.ts +13 -0
- package/dist/esm/ws-api/rpc-websocket-api.js +1 -1
- package/dist/esm/ws-api/types.d.ts +62 -0
- package/dist/esm/ws-api/url.d.ts +1 -0
- package/dist/esm/ws-api/ws-api.d.ts +21 -0
- package/dist/esm/ws-api/ws-api.js +4 -4
- package/dist/types/src/connector/ws/types.d.ts +1 -0
- package/dist/types/src/connector/ws/websocket-client.connector.d.ts +3 -1
- package/dist/types/src/connector/ws/websocket-provider.connector.d.ts +3 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Address, Bps } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { FeeCalculator } from '@1inch/limit-order-sdk/extensions/fee-taker';
|
|
3
|
+
import { AuctionCalculator } from './auction-calculator';
|
|
4
|
+
import { FusionExtension } from '../fusion-order';
|
|
5
|
+
export declare class AmountCalculator {
|
|
6
|
+
private readonly auctionCalculator;
|
|
7
|
+
private readonly feeCalculator?;
|
|
8
|
+
constructor(auctionCalculator: AuctionCalculator, feeCalculator?: FeeCalculator | undefined);
|
|
9
|
+
static fromExtension(ext: FusionExtension): AmountCalculator;
|
|
10
|
+
static calcAuctionTakingAmount(baseTakingAmount: bigint, rate: number, fee?: Bps): bigint;
|
|
11
|
+
static extractFeeAmount(requiredTakingAmount: bigint, fee: Bps): bigint;
|
|
12
|
+
getRequiredTakingAmount(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
13
|
+
getRequiredMakingAmount(taker: Address, makingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
14
|
+
getTotalFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
15
|
+
getUserTakingAmountAmount(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
16
|
+
getResolverFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
17
|
+
getIntegratorFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
18
|
+
getProtocolShareOfIntegratorFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
19
|
+
getProtocolFee(taker: Address, takingAmount: bigint, time: bigint, blockBaseFee?: bigint): bigint;
|
|
20
|
+
private getAuctionBumpedAmount;
|
|
21
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bps, FeeTakerExt, mulDiv, Rounding } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { Fees } from '@1inch/limit-order-sdk/extensions/fee-taker';
|
|
3
|
-
import { AuctionCalculator } from './auction-calculator';
|
|
3
|
+
import { AuctionCalculator } from './auction-calculator/index.js';
|
|
4
4
|
export class AmountCalculator {
|
|
5
5
|
constructor(auctionCalculator, feeCalculator) {
|
|
6
6
|
this.auctionCalculator = auctionCalculator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuctionDetails, AuctionPoint, AuctionGasCostInfo } from '../../fusion-order';
|
|
2
|
+
export declare class AuctionCalculator {
|
|
3
|
+
private readonly startTime;
|
|
4
|
+
private readonly duration;
|
|
5
|
+
private readonly initialRateBump;
|
|
6
|
+
private readonly points;
|
|
7
|
+
private readonly gasCost;
|
|
8
|
+
static RATE_BUMP_DENOMINATOR: bigint;
|
|
9
|
+
private static GAS_PRICE_BASE;
|
|
10
|
+
constructor(startTime: bigint, duration: bigint, initialRateBump: bigint, points: AuctionPoint[], gasCost?: AuctionGasCostInfo);
|
|
11
|
+
get finishTime(): bigint;
|
|
12
|
+
static fromAuctionData(details: AuctionDetails): AuctionCalculator;
|
|
13
|
+
static calcInitialRateBump(startAmount: bigint, endAmount: bigint): number;
|
|
14
|
+
static calcAuctionTakingAmount(takingAmount: bigint, rate: number): bigint;
|
|
15
|
+
static calcAuctionMakingAmount(makingAmount: bigint, rate: number): bigint;
|
|
16
|
+
static baseFeeToGasPriceEstimate(baseFee: bigint): bigint;
|
|
17
|
+
static calcGasBumpEstimate(endTakingAmount: bigint, gasCostInToToken: bigint): bigint;
|
|
18
|
+
calcAuctionTakingAmount(takingAmount: bigint, rate: number): bigint;
|
|
19
|
+
calcRateBump(time: bigint, blockBaseFee?: bigint): number;
|
|
20
|
+
private getGasPriceBump;
|
|
21
|
+
private getAuctionBump;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auction-calculator';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './auction-calculator';
|
|
1
|
+
export * from './auction-calculator.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './auction-calculator';
|
|
2
|
-
export { AmountCalculator } from './amount-calculator';
|
|
1
|
+
export * from './auction-calculator/index.js';
|
|
2
|
+
export { AmountCalculator } from './amount-calculator.js';
|
|
3
3
|
export { FeeCalculator } from '@1inch/limit-order-sdk/extensions/fee-taker';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FusionApiConfig } from './types';
|
|
2
|
+
import { QuoterRequest, QuoterCustomPresetRequest, Quote } from './quoter';
|
|
3
|
+
import { RelayerRequest } from './relayer';
|
|
4
|
+
import { ActiveOrdersRequest, ActiveOrdersResponse, OrdersByMakerRequest, OrderStatusRequest, OrderStatusResponse, OrdersByMakerResponse } from './orders';
|
|
5
|
+
import { OrdersVersion } from './ordersVersion';
|
|
6
|
+
export declare class FusionApi {
|
|
7
|
+
private readonly quoterApi;
|
|
8
|
+
private readonly relayerApi;
|
|
9
|
+
private readonly ordersApi;
|
|
10
|
+
constructor(config: FusionApiConfig);
|
|
11
|
+
static new(config: FusionApiConfig): FusionApi;
|
|
12
|
+
getQuote(params: QuoterRequest): Promise<Quote>;
|
|
13
|
+
getQuoteWithCustomPreset(params: QuoterRequest, body: QuoterCustomPresetRequest): Promise<Quote>;
|
|
14
|
+
getActiveOrders(params?: ActiveOrdersRequest, ordersVersion?: OrdersVersion): Promise<ActiveOrdersResponse>;
|
|
15
|
+
getOrderStatus(params: OrderStatusRequest): Promise<OrderStatusResponse>;
|
|
16
|
+
getOrdersByMaker(params: OrdersByMakerRequest, ordersVersion?: OrdersVersion): Promise<OrdersByMakerResponse>;
|
|
17
|
+
submitOrder(params: RelayerRequest): Promise<void>;
|
|
18
|
+
submitOrderBatch(params: RelayerRequest[]): Promise<void>;
|
|
19
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QuoterApi } from './quoter';
|
|
2
|
-
import { RelayerApi } from './relayer';
|
|
3
|
-
import { ActiveOrdersRequest, OrdersApi } from './orders';
|
|
4
|
-
import { OrdersVersion } from './ordersVersion';
|
|
5
|
-
import { AxiosProviderConnector } from '../connector';
|
|
1
|
+
import { QuoterApi } from './quoter/index.js';
|
|
2
|
+
import { RelayerApi } from './relayer/index.js';
|
|
3
|
+
import { ActiveOrdersRequest, OrdersApi } from './orders/index.js';
|
|
4
|
+
import { OrdersVersion } from './ordersVersion.js';
|
|
5
|
+
import { AxiosProviderConnector } from '../connector/index.js';
|
|
6
6
|
export class FusionApi {
|
|
7
7
|
constructor(config) {
|
|
8
8
|
this.quoterApi = QuoterApi.new({
|
package/dist/esm/api/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './params';
|
|
2
|
-
export * from './quoter/index';
|
|
3
|
-
export * from './relayer/index';
|
|
4
|
-
export * from './orders/index';
|
|
5
|
-
export * from './fusion-api';
|
|
6
|
-
export * from './pagination';
|
|
7
|
-
export * from './types';
|
|
8
|
-
export * from './ordersVersion';
|
|
1
|
+
export * from './params.js';
|
|
2
|
+
export * from './quoter/index.js';
|
|
3
|
+
export * from './relayer/index.js';
|
|
4
|
+
export * from './orders/index.js';
|
|
5
|
+
export * from './fusion-api.js';
|
|
6
|
+
export * from './pagination.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './ordersVersion.js';
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './orders.api';
|
|
2
|
-
export * from './orders.request';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './orders.api.js';
|
|
2
|
+
export * from './orders.request.js';
|
|
3
|
+
export * from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActiveOrdersRequest, OrdersByMakerRequest, OrderStatusRequest } from './orders.request';
|
|
2
|
+
import { ActiveOrdersResponse, OrdersApiConfig, OrdersByMakerResponse, OrderStatusResponse } from './types';
|
|
3
|
+
import { HttpProviderConnector } from '../../connector';
|
|
4
|
+
import { OrdersVersion } from '../ordersVersion';
|
|
5
|
+
export declare class OrdersApi {
|
|
6
|
+
private readonly config;
|
|
7
|
+
private readonly httpClient;
|
|
8
|
+
private static Version;
|
|
9
|
+
constructor(config: OrdersApiConfig, httpClient: HttpProviderConnector);
|
|
10
|
+
static new(config: OrdersApiConfig, httpClient?: HttpProviderConnector): OrdersApi;
|
|
11
|
+
getActiveOrders(params: ActiveOrdersRequest, ordersVersion: OrdersVersion): Promise<ActiveOrdersResponse>;
|
|
12
|
+
getOrderStatus(params: OrderStatusRequest): Promise<OrderStatusResponse>;
|
|
13
|
+
getOrdersByMaker(params: OrdersByMakerRequest, ordersVersion: OrdersVersion): Promise<OrdersByMakerResponse>;
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AxiosProviderConnector } from '../../connector';
|
|
2
|
-
import { concatQueryParams } from '../params';
|
|
1
|
+
import { AxiosProviderConnector } from '../../connector/index.js';
|
|
2
|
+
import { concatQueryParams } from '../params.js';
|
|
3
3
|
export class OrdersApi {
|
|
4
4
|
constructor(config, httpClient) {
|
|
5
5
|
this.config = config;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ActiveOrdersRequestParams, OrdersByMakerParams, OrderStatusParams } from './types';
|
|
2
|
+
import { PaginationParams, PaginationRequest } from '../pagination';
|
|
3
|
+
export declare class ActiveOrdersRequest {
|
|
4
|
+
readonly pagination: PaginationRequest;
|
|
5
|
+
constructor(params?: ActiveOrdersRequestParams);
|
|
6
|
+
static new(params?: ActiveOrdersRequestParams): ActiveOrdersRequest;
|
|
7
|
+
validate(): string | null;
|
|
8
|
+
build(): ActiveOrdersRequestParams;
|
|
9
|
+
}
|
|
10
|
+
export declare class OrderStatusRequest {
|
|
11
|
+
readonly orderHash: string;
|
|
12
|
+
constructor(params: OrderStatusParams);
|
|
13
|
+
static new(params: OrderStatusParams): OrderStatusRequest;
|
|
14
|
+
validate(): string | null;
|
|
15
|
+
build(): OrderStatusParams;
|
|
16
|
+
}
|
|
17
|
+
export declare class OrdersByMakerRequest {
|
|
18
|
+
readonly address: string;
|
|
19
|
+
readonly pagination: PaginationRequest;
|
|
20
|
+
constructor(params: OrdersByMakerParams);
|
|
21
|
+
static new(params: OrdersByMakerParams): OrdersByMakerRequest;
|
|
22
|
+
validate(): string | null;
|
|
23
|
+
buildQueryParams(): PaginationParams;
|
|
24
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isHexString, isValidAddress } from '../../validations';
|
|
2
|
-
import { PaginationRequest } from '../pagination';
|
|
1
|
+
import { isHexString, isValidAddress } from '../../validations.js';
|
|
2
|
+
import { PaginationRequest } from '../pagination.js';
|
|
3
3
|
export class ActiveOrdersRequest {
|
|
4
4
|
constructor(params = {}) {
|
|
5
5
|
this.pagination = new PaginationRequest(params.page, params.limit);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { LimitOrderV4Struct } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { NetworkEnum } from '../../constants';
|
|
3
|
+
import { PaginationOutput } from '../types';
|
|
4
|
+
import { AuctionPoint } from '../quoter';
|
|
5
|
+
import { PaginationParams } from '../pagination';
|
|
6
|
+
export type OrdersApiConfig = {
|
|
7
|
+
network: NetworkEnum;
|
|
8
|
+
url: string;
|
|
9
|
+
authKey?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ActiveOrdersRequestParams = PaginationParams;
|
|
12
|
+
export type ActiveOrder = {
|
|
13
|
+
quoteId: string;
|
|
14
|
+
orderHash: string;
|
|
15
|
+
signature: string;
|
|
16
|
+
deadline: string;
|
|
17
|
+
auctionStartDate: string;
|
|
18
|
+
auctionEndDate: string;
|
|
19
|
+
remainingMakerAmount: string;
|
|
20
|
+
order: LimitOrderV4Struct;
|
|
21
|
+
extension: string;
|
|
22
|
+
version: '2.0' | '2.1';
|
|
23
|
+
};
|
|
24
|
+
export type ActiveOrdersResponse = PaginationOutput<ActiveOrder>;
|
|
25
|
+
export type OrderStatusParams = {
|
|
26
|
+
orderHash: string;
|
|
27
|
+
};
|
|
28
|
+
export declare enum OrderStatus {
|
|
29
|
+
Pending = "pending",
|
|
30
|
+
Filled = "filled",
|
|
31
|
+
FalsePredicate = "false-predicate",
|
|
32
|
+
NotEnoughBalanceOrAllowance = "not-enough-balance-or-allowance",
|
|
33
|
+
Expired = "expired",
|
|
34
|
+
PartiallyFilled = "partially-filled",
|
|
35
|
+
WrongPermit = "wrong-permit",
|
|
36
|
+
Cancelled = "cancelled",
|
|
37
|
+
InvalidSignature = "invalid-signature"
|
|
38
|
+
}
|
|
39
|
+
export type Fill = {
|
|
40
|
+
txHash: string;
|
|
41
|
+
filledMakerAmount: string;
|
|
42
|
+
filledAuctionTakerAmount: string;
|
|
43
|
+
takerFeeAmount: string | null;
|
|
44
|
+
};
|
|
45
|
+
export type OrderStatusResponse = {
|
|
46
|
+
status: OrderStatus;
|
|
47
|
+
order: LimitOrderV4Struct;
|
|
48
|
+
extension: string;
|
|
49
|
+
points: AuctionPoint[] | null;
|
|
50
|
+
cancelTx: string | null;
|
|
51
|
+
fills: Fill[];
|
|
52
|
+
createdAt: string;
|
|
53
|
+
auctionStartDate: number;
|
|
54
|
+
auctionDuration: number;
|
|
55
|
+
initialRateBump: number;
|
|
56
|
+
isNativeCurrency: boolean;
|
|
57
|
+
fromTokenToUsdPrice: string;
|
|
58
|
+
toTokenToUsdPrice: string;
|
|
59
|
+
};
|
|
60
|
+
export type OrdersByMakerParams = {
|
|
61
|
+
address: string;
|
|
62
|
+
} & PaginationParams;
|
|
63
|
+
export type OrderFillsByMakerOutput = {
|
|
64
|
+
orderHash: string;
|
|
65
|
+
status: OrderStatus;
|
|
66
|
+
makerAsset: string;
|
|
67
|
+
makerAmount: string;
|
|
68
|
+
minTakerAmount: string;
|
|
69
|
+
takerAsset: string;
|
|
70
|
+
cancelTx: string | null;
|
|
71
|
+
fills: Fill[];
|
|
72
|
+
points: AuctionPoint[] | null;
|
|
73
|
+
auctionStartDate: number;
|
|
74
|
+
auctionDuration: number;
|
|
75
|
+
initialRateBump: number;
|
|
76
|
+
isNativeCurrency: boolean;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
};
|
|
79
|
+
export type OrdersByMakerResponse = PaginationOutput<OrderFillsByMakerOutput>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type PaginationParams = {
|
|
2
|
+
page?: number;
|
|
3
|
+
limit?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare class PaginationRequest {
|
|
6
|
+
page: number | undefined;
|
|
7
|
+
limit: number | undefined;
|
|
8
|
+
constructor(page: number | undefined, limit: number | undefined);
|
|
9
|
+
validate(): string | null;
|
|
10
|
+
}
|
package/dist/esm/api/params.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './quote/index';
|
|
2
|
-
export * from './quoter.request';
|
|
3
|
-
export * from './quoter.api';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export * from './preset';
|
|
6
|
-
export * from './quoter-custom-preset.request';
|
|
1
|
+
export * from './quote/index.js';
|
|
2
|
+
export * from './quoter.request.js';
|
|
3
|
+
export * from './quoter.api.js';
|
|
4
|
+
export * from './types.js';
|
|
5
|
+
export * from './preset.js';
|
|
6
|
+
export * from './quoter-custom-preset.request.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { AuctionPoint, PresetData } from './types';
|
|
3
|
+
import { AuctionDetails } from '../../fusion-order';
|
|
4
|
+
export declare class Preset {
|
|
5
|
+
readonly auctionDuration: bigint;
|
|
6
|
+
readonly startAuctionIn: bigint;
|
|
7
|
+
readonly bankFee: bigint;
|
|
8
|
+
readonly initialRateBump: number;
|
|
9
|
+
readonly auctionStartAmount: bigint;
|
|
10
|
+
readonly auctionEndAmount: bigint;
|
|
11
|
+
readonly tokenFee: bigint;
|
|
12
|
+
readonly points: AuctionPoint[];
|
|
13
|
+
readonly gasCostInfo: {
|
|
14
|
+
gasBumpEstimate: bigint;
|
|
15
|
+
gasPriceEstimate: bigint;
|
|
16
|
+
};
|
|
17
|
+
readonly exclusiveResolver?: Address;
|
|
18
|
+
readonly allowPartialFills: boolean;
|
|
19
|
+
readonly allowMultipleFills: boolean;
|
|
20
|
+
constructor(preset: PresetData);
|
|
21
|
+
createAuctionDetails(additionalWaitPeriod?: bigint): AuctionDetails;
|
|
22
|
+
private calcAuctionStartTime;
|
|
23
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
-
import { AuctionDetails } from '../../fusion-order';
|
|
2
|
+
import { AuctionDetails } from '../../fusion-order/index.js';
|
|
3
3
|
export class Preset {
|
|
4
4
|
constructor(preset) {
|
|
5
5
|
this.auctionDuration = BigInt(preset.auctionDuration);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './order-params';
|
|
2
|
-
export * from './quote';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * from './order-params.js';
|
|
2
|
+
export * from './quote.js';
|
|
3
|
+
export * from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { FusionOrderParamsData } from './types';
|
|
3
|
+
import { PresetEnum } from '../types';
|
|
4
|
+
export declare class FusionOrderParams {
|
|
5
|
+
readonly preset: PresetEnum;
|
|
6
|
+
readonly receiver: Address;
|
|
7
|
+
readonly permit: string | undefined;
|
|
8
|
+
readonly nonce: bigint | undefined;
|
|
9
|
+
readonly delayAuctionStartTimeBy: bigint;
|
|
10
|
+
readonly isPermit2?: boolean;
|
|
11
|
+
constructor(params: FusionOrderParamsData);
|
|
12
|
+
static new(params: FusionOrderParamsData): FusionOrderParams;
|
|
13
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { FusionOrderParamsData, ResolverFeePreset } from './types';
|
|
3
|
+
import { Cost, PresetEnum, QuoterResponse } from '../types';
|
|
4
|
+
import { Preset } from '../preset';
|
|
5
|
+
import { FusionOrder } from '../../../fusion-order';
|
|
6
|
+
import { QuoterRequest } from '../quoter.request';
|
|
7
|
+
export declare class Quote {
|
|
8
|
+
private readonly params;
|
|
9
|
+
readonly settlementAddress: Address;
|
|
10
|
+
readonly fromTokenAmount: bigint;
|
|
11
|
+
readonly presets: {
|
|
12
|
+
[PresetEnum.fast]: Preset;
|
|
13
|
+
[PresetEnum.slow]: Preset;
|
|
14
|
+
[PresetEnum.medium]: Preset;
|
|
15
|
+
[PresetEnum.custom]?: Preset;
|
|
16
|
+
};
|
|
17
|
+
readonly recommendedPreset: PresetEnum;
|
|
18
|
+
readonly toTokenAmount: string;
|
|
19
|
+
readonly prices: Cost;
|
|
20
|
+
readonly volume: Cost;
|
|
21
|
+
readonly whitelist: Address[];
|
|
22
|
+
readonly quoteId: string | null;
|
|
23
|
+
readonly slippage: number;
|
|
24
|
+
readonly resolverFeePreset: ResolverFeePreset;
|
|
25
|
+
constructor(params: QuoterRequest, response: QuoterResponse);
|
|
26
|
+
createFusionOrder(paramsData: Omit<FusionOrderParamsData, 'permit' | 'isPermit2'>): FusionOrder;
|
|
27
|
+
getPreset(type?: PresetEnum): Preset;
|
|
28
|
+
private getWhitelist;
|
|
29
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Address, Bps, randBigInt } from '@1inch/limit-order-sdk';
|
|
2
2
|
import { UINT_40_MAX } from '@1inch/byte-utils';
|
|
3
3
|
import { Fees, IntegratorFee, ResolverFee } from '@1inch/limit-order-sdk/extensions/fee-taker';
|
|
4
|
-
import { FusionOrderParams } from './order-params';
|
|
5
|
-
import { PresetEnum } from '../types';
|
|
6
|
-
import { Preset } from '../preset';
|
|
7
|
-
import { FusionOrder, Whitelist } from '../../../fusion-order';
|
|
8
|
-
import { CHAIN_TO_WRAPPER } from '../../../fusion-order/constants';
|
|
4
|
+
import { FusionOrderParams } from './order-params.js';
|
|
5
|
+
import { PresetEnum } from '../types.js';
|
|
6
|
+
import { Preset } from '../preset.js';
|
|
7
|
+
import { FusionOrder, Whitelist } from '../../../fusion-order/index.js';
|
|
8
|
+
import { CHAIN_TO_WRAPPER } from '../../../fusion-order/constants.js';
|
|
9
9
|
export class Quote {
|
|
10
10
|
constructor(params, response) {
|
|
11
11
|
this.params = params;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Address, Bps } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { PresetEnum } from '../types';
|
|
3
|
+
import { NetworkEnum } from '../../../constants';
|
|
4
|
+
export type FusionOrderParamsData = {
|
|
5
|
+
network: NetworkEnum;
|
|
6
|
+
preset?: PresetEnum;
|
|
7
|
+
receiver?: Address;
|
|
8
|
+
nonce?: bigint;
|
|
9
|
+
permit?: string;
|
|
10
|
+
isPermit2?: boolean;
|
|
11
|
+
allowPartialFills?: boolean;
|
|
12
|
+
allowMultipleFills?: boolean;
|
|
13
|
+
delayAuctionStartTimeBy?: bigint;
|
|
14
|
+
orderExpirationDelay?: bigint;
|
|
15
|
+
};
|
|
16
|
+
export type IntegratorFeeParams = {
|
|
17
|
+
receiver: Address;
|
|
18
|
+
value: Bps;
|
|
19
|
+
share: Bps;
|
|
20
|
+
};
|
|
21
|
+
export type ResolverFeePreset = {
|
|
22
|
+
receiver: Address;
|
|
23
|
+
bps: Bps;
|
|
24
|
+
whitelistDiscountPercent: Bps;
|
|
25
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CustomPreset, QuoterCustomPresetRequestParams } from './types';
|
|
2
|
+
export declare class QuoterCustomPresetRequest {
|
|
3
|
+
readonly customPreset: CustomPreset;
|
|
4
|
+
constructor(params: QuoterCustomPresetRequestParams);
|
|
5
|
+
static new(params: QuoterCustomPresetRequestParams): QuoterCustomPresetRequest;
|
|
6
|
+
build(): CustomPreset;
|
|
7
|
+
validate(): string | null;
|
|
8
|
+
private validateAuctionDuration;
|
|
9
|
+
private validatePoints;
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { QuoterRequest } from './quoter.request';
|
|
2
|
+
import { QuoterApiConfig } from './types';
|
|
3
|
+
import { Quote } from './quote';
|
|
4
|
+
import { QuoterCustomPresetRequest } from './quoter-custom-preset.request';
|
|
5
|
+
import { HttpProviderConnector } from '../../connector';
|
|
6
|
+
export declare class QuoterApi {
|
|
7
|
+
private readonly config;
|
|
8
|
+
private readonly httpClient;
|
|
9
|
+
private static Version;
|
|
10
|
+
constructor(config: QuoterApiConfig, httpClient: HttpProviderConnector);
|
|
11
|
+
static new(config: QuoterApiConfig, httpClient?: HttpProviderConnector): QuoterApi;
|
|
12
|
+
getQuote(params: QuoterRequest): Promise<Quote>;
|
|
13
|
+
getQuoteWithCustomPreset(params: QuoterRequest, body: QuoterCustomPresetRequest): Promise<Quote>;
|
|
14
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Quote } from './quote';
|
|
2
|
-
import { concatQueryParams } from '../params';
|
|
3
|
-
import { AxiosProviderConnector } from '../../connector';
|
|
1
|
+
import { Quote } from './quote/index.js';
|
|
2
|
+
import { concatQueryParams } from '../params.js';
|
|
3
|
+
import { AxiosProviderConnector } from '../../connector/index.js';
|
|
4
4
|
export class QuoterApi {
|
|
5
5
|
constructor(config, httpClient) {
|
|
6
6
|
this.config = config;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { QuoterRequestParams, QuoterRequestParamsRaw } from './types';
|
|
3
|
+
import { IntegratorFeeParams } from './quote';
|
|
4
|
+
export declare class QuoterRequest {
|
|
5
|
+
readonly fromTokenAddress: Address;
|
|
6
|
+
readonly toTokenAddress: Address;
|
|
7
|
+
readonly amount: string;
|
|
8
|
+
readonly walletAddress: Address;
|
|
9
|
+
readonly enableEstimate: boolean;
|
|
10
|
+
readonly permit: string | undefined;
|
|
11
|
+
readonly integratorFee?: IntegratorFeeParams;
|
|
12
|
+
readonly source: string;
|
|
13
|
+
readonly isPermit2: boolean;
|
|
14
|
+
constructor(params: QuoterRequestParams);
|
|
15
|
+
static new(params: QuoterRequestParams): QuoterRequest;
|
|
16
|
+
build(): QuoterRequestParamsRaw;
|
|
17
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
-
import { isValidAmount } from '../../validations';
|
|
2
|
+
import { isValidAmount } from '../../validations.js';
|
|
3
3
|
export class QuoterRequest {
|
|
4
4
|
constructor(params) {
|
|
5
5
|
this.fromTokenAddress = new Address(params.fromTokenAddress);
|