@1inch/fusion-sdk 2.2.3 → 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 +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './fusion-order';
|
|
2
|
-
export * from './auction-details';
|
|
3
|
-
export * from './whitelist';
|
|
4
|
-
export * from './fusion-extension';
|
|
5
|
-
export { CHAIN_TO_WRAPPER } from './constants';
|
|
1
|
+
export * from './fusion-order.js';
|
|
2
|
+
export * from './auction-details/index.js';
|
|
3
|
+
export * from './whitelist/index.js';
|
|
4
|
+
export * from './fusion-extension.js';
|
|
5
|
+
export { CHAIN_TO_WRAPPER } from './constants.js';
|
|
6
6
|
export { FeeTakerExt } from '@1inch/limit-order-sdk';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function injectTrackCode(salt: bigint, source?: string): bigint;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BitMask, BN } from '@1inch/byte-utils';
|
|
2
2
|
import { id } from 'ethers';
|
|
3
|
-
import { add0x } from '../utils';
|
|
4
|
-
import { isHexString } from '../validations';
|
|
3
|
+
import { add0x } from '../utils.js';
|
|
4
|
+
import { isHexString } from '../validations.js';
|
|
5
5
|
const TRACK_CODE_MASK = new BitMask(224n, 256n);
|
|
6
6
|
function getTrackCodeForSource(source) {
|
|
7
7
|
if (!isHexString(source)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './whitelist';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './whitelist';
|
|
1
|
+
export * from './whitelist.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Address } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { BytesBuilder, BytesIter } from '@1inch/byte-utils';
|
|
3
|
+
import { WhitelistItem } from './types';
|
|
4
|
+
export declare class Whitelist {
|
|
5
|
+
readonly resolvingStartTime: bigint;
|
|
6
|
+
readonly whitelist: WhitelistItem[];
|
|
7
|
+
private constructor();
|
|
8
|
+
get length(): number;
|
|
9
|
+
static decodeFrom<T extends string | bigint>(bytes: BytesIter<T>): Whitelist;
|
|
10
|
+
static decode(bytes: string): Whitelist;
|
|
11
|
+
static new(resolvingStartTime: bigint, whitelist: {
|
|
12
|
+
address: Address;
|
|
13
|
+
allowFrom: bigint;
|
|
14
|
+
}[]): Whitelist;
|
|
15
|
+
static fromNow(whitelist: {
|
|
16
|
+
address: Address;
|
|
17
|
+
allowFrom: bigint;
|
|
18
|
+
}[]): Whitelist;
|
|
19
|
+
canExecuteAt(executor: Address, executionTime: bigint): boolean;
|
|
20
|
+
isExclusivityPeriod(time?: bigint): boolean;
|
|
21
|
+
isExclusiveResolver(wallet: Address): boolean;
|
|
22
|
+
isWhitelisted(address: Address): boolean;
|
|
23
|
+
encodeInto(builder?: BytesBuilder): BytesBuilder;
|
|
24
|
+
encode(): string;
|
|
25
|
+
equal(other: Whitelist): boolean;
|
|
26
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BytesBuilder, BytesIter } from '@1inch/byte-utils';
|
|
2
2
|
import assert from 'assert';
|
|
3
|
-
import { UINT_16_MAX } from '../../constants';
|
|
4
|
-
import { now } from '../../utils/time';
|
|
5
|
-
import { add0x } from '../../utils';
|
|
3
|
+
import { UINT_16_MAX } from '../../constants.js';
|
|
4
|
+
import { now } from '../../utils/time.js';
|
|
5
|
+
import { add0x } from '../../utils.js';
|
|
6
6
|
export class Whitelist {
|
|
7
7
|
constructor(resolvingStartTime, whitelist) {
|
|
8
8
|
this.resolvingStartTime = resolvingStartTime;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { Address, LimitOrderV4Struct, Extension, randBigInt, getLimitOrderContract, Interaction, TakerTraits, ExtensionBuilder, AmountMode, getLimitOrderV4Domain, LimitOrderContract, OrderInfoData, EIP712TypedData, MakerTraits } from '@1inch/limit-order-sdk';
|
|
2
|
+
export * from './fusion-order/index';
|
|
3
|
+
export * from './amount-calculator/';
|
|
4
|
+
export * from './connector/index';
|
|
5
|
+
export * from './sdk/index';
|
|
6
|
+
export * from './constants';
|
|
7
|
+
export * from './utils';
|
|
8
|
+
export * from './utils/amounts';
|
|
9
|
+
export * from './utils/time';
|
|
10
|
+
export * from './validations';
|
|
11
|
+
export * from './ws-api';
|
|
12
|
+
export * from './errors';
|
|
13
|
+
export { QuoterRequest, QuoterResponse, RelayerRequest, QuoterCustomPresetRequest, PresetEnum, Preset, Quote, OrderStatusResponse, OrderStatus } from './api/index';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export { Address, Extension, randBigInt, getLimitOrderContract, Interaction, TakerTraits, ExtensionBuilder, AmountMode, getLimitOrderV4Domain, LimitOrderContract, MakerTraits } from '@1inch/limit-order-sdk';
|
|
2
|
-
export * from './fusion-order/index';
|
|
3
|
-
export * from './amount-calculator/';
|
|
4
|
-
export * from './connector/index';
|
|
5
|
-
export * from './sdk/index';
|
|
6
|
-
export * from './constants';
|
|
7
|
-
export * from './utils';
|
|
8
|
-
export * from './utils/amounts';
|
|
9
|
-
export * from './utils/time';
|
|
10
|
-
export * from './validations';
|
|
11
|
-
export * from './ws-api';
|
|
12
|
-
export * from './errors';
|
|
13
|
-
export { QuoterRequest, RelayerRequest, QuoterCustomPresetRequest, PresetEnum, Preset, Quote, OrderStatus } from './api/index';
|
|
2
|
+
export * from './fusion-order/index.js';
|
|
3
|
+
export * from './amount-calculator/index.js';
|
|
4
|
+
export * from './connector/index.js';
|
|
5
|
+
export * from './sdk/index.js';
|
|
6
|
+
export * from './constants.js';
|
|
7
|
+
export * from './utils.js';
|
|
8
|
+
export * from './utils/amounts.js';
|
|
9
|
+
export * from './utils/time.js';
|
|
10
|
+
export * from './validations.js';
|
|
11
|
+
export * from './ws-api/index.js';
|
|
12
|
+
export * from './errors.js';
|
|
13
|
+
export { QuoterRequest, RelayerRequest, QuoterCustomPresetRequest, PresetEnum, Preset, Quote, OrderStatus } from './api/index.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Interface } from 'ethers';
|
|
2
2
|
import assert from 'assert';
|
|
3
3
|
import LimitOrderABI from '../../abi/AggregationRouterV6.abi.json';
|
|
4
|
-
import { isHexBytes } from '../../validations';
|
|
4
|
+
import { isHexBytes } from '../../validations.js';
|
|
5
5
|
const lopAbi = new Interface(LimitOrderABI);
|
|
6
6
|
export function encodeCancelOrder(hash, makerTraits) {
|
|
7
7
|
assert(isHexBytes(hash), 'Invalid order hash');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cancel-order.encoder';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './cancel-order.encoder';
|
|
1
|
+
export * from './cancel-order.encoder.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/sdk/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './sdk';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export * from './encoders';
|
|
4
|
-
export * from './utils';
|
|
1
|
+
export * from './sdk.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './encoders/index.js';
|
|
4
|
+
export * from './utils.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FusionSDKConfigParams, OrderInfo, OrderParams, PreparedOrder, QuoteParams, QuoteCustomPresetParams } from './types';
|
|
2
|
+
import { FusionApi, Quote } from '../api';
|
|
3
|
+
import { ActiveOrdersRequestParams, ActiveOrdersResponse, OrdersByMakerParams, OrdersByMakerResponse, OrderStatusResponse } from '../api/orders';
|
|
4
|
+
import { FusionOrder } from '../fusion-order';
|
|
5
|
+
export declare class FusionSDK {
|
|
6
|
+
private readonly config;
|
|
7
|
+
readonly api: FusionApi;
|
|
8
|
+
constructor(config: FusionSDKConfigParams);
|
|
9
|
+
getActiveOrders({ page, limit }?: ActiveOrdersRequestParams): Promise<ActiveOrdersResponse>;
|
|
10
|
+
getOrderStatus(orderHash: string): Promise<OrderStatusResponse>;
|
|
11
|
+
getOrdersByMaker({ limit, page, address }: OrdersByMakerParams): Promise<OrdersByMakerResponse>;
|
|
12
|
+
getQuote(params: QuoteParams): Promise<Quote>;
|
|
13
|
+
getQuoteWithCustomPreset(params: QuoteParams, body: QuoteCustomPresetParams): Promise<Quote>;
|
|
14
|
+
createOrder(params: OrderParams): Promise<PreparedOrder>;
|
|
15
|
+
submitOrder(order: FusionOrder, quoteId: string): Promise<OrderInfo>;
|
|
16
|
+
placeOrder(params: OrderParams): Promise<OrderInfo>;
|
|
17
|
+
buildCancelOrderCallData(orderHash: string): Promise<string>;
|
|
18
|
+
signOrder(order: FusionOrder): Promise<string>;
|
|
19
|
+
private getQuoteResult;
|
|
20
|
+
}
|
package/dist/esm/sdk/sdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Address, MakerTraits } from '@1inch/limit-order-sdk';
|
|
2
|
-
import { encodeCancelOrder } from './encoders';
|
|
3
|
-
import { FusionApi, QuoterRequest, RelayerRequest, QuoterCustomPresetRequest } from '../api';
|
|
4
|
-
import { ActiveOrdersRequest, OrdersByMakerRequest, OrderStatusRequest } from '../api/orders';
|
|
2
|
+
import { encodeCancelOrder } from './encoders/index.js';
|
|
3
|
+
import { FusionApi, QuoterRequest, RelayerRequest, QuoterCustomPresetRequest } from '../api/index.js';
|
|
4
|
+
import { ActiveOrdersRequest, OrdersByMakerRequest, OrderStatusRequest } from '../api/orders/index.js';
|
|
5
5
|
export class FusionSDK {
|
|
6
6
|
constructor(config) {
|
|
7
7
|
this.config = config;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { LimitOrderV4Struct } from '@1inch/limit-order-sdk';
|
|
2
|
+
import { BlockchainProviderConnector, HttpProviderConnector } from '../connector';
|
|
3
|
+
import { NetworkEnum } from '../constants';
|
|
4
|
+
import { CustomPreset, IntegratorFeeParams, PresetEnum } from '../api';
|
|
5
|
+
import { FusionOrder } from '../fusion-order';
|
|
6
|
+
export type FusionSDKConfigParams = {
|
|
7
|
+
url: string;
|
|
8
|
+
network: NetworkEnum;
|
|
9
|
+
authKey?: string;
|
|
10
|
+
blockchainProvider?: BlockchainProviderConnector;
|
|
11
|
+
httpProvider?: HttpProviderConnector;
|
|
12
|
+
};
|
|
13
|
+
export type QuoteParams = {
|
|
14
|
+
fromTokenAddress: string;
|
|
15
|
+
toTokenAddress: string;
|
|
16
|
+
amount: string;
|
|
17
|
+
walletAddress?: string;
|
|
18
|
+
enableEstimate?: boolean;
|
|
19
|
+
permit?: string;
|
|
20
|
+
integratorFee?: IntegratorFeeParams;
|
|
21
|
+
source?: string;
|
|
22
|
+
isPermit2?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type QuoteCustomPresetParams = {
|
|
25
|
+
customPreset: CustomPreset;
|
|
26
|
+
};
|
|
27
|
+
export type OrderParams = {
|
|
28
|
+
fromTokenAddress: string;
|
|
29
|
+
toTokenAddress: string;
|
|
30
|
+
amount: string;
|
|
31
|
+
walletAddress: string;
|
|
32
|
+
permit?: string;
|
|
33
|
+
receiver?: string;
|
|
34
|
+
preset?: PresetEnum;
|
|
35
|
+
nonce?: bigint;
|
|
36
|
+
source?: string;
|
|
37
|
+
isPermit2?: boolean;
|
|
38
|
+
customPreset?: CustomPreset;
|
|
39
|
+
orderExpirationDelay?: bigint;
|
|
40
|
+
allowPartialFills?: boolean;
|
|
41
|
+
allowMultipleFills?: boolean;
|
|
42
|
+
integratorFee?: IntegratorFeeParams;
|
|
43
|
+
};
|
|
44
|
+
export type OrderInfo = {
|
|
45
|
+
order: LimitOrderV4Struct;
|
|
46
|
+
signature: string;
|
|
47
|
+
quoteId: string;
|
|
48
|
+
orderHash: string;
|
|
49
|
+
extension: string;
|
|
50
|
+
};
|
|
51
|
+
export type PreparedOrder = {
|
|
52
|
+
order: FusionOrder;
|
|
53
|
+
hash: string;
|
|
54
|
+
quoteId: string;
|
|
55
|
+
};
|