-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.ts
56 lines (47 loc) · 1.32 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { TokenAmount } from '../tokenAmount';
import { Slippage } from '../..';
import { SwapKind } from '../../types';
import { Address, Hex } from 'viem';
import { SwapBuildCallInputBaseV2 } from './swaps/v2';
import { Path } from './paths/types';
export type SwapInput = {
chainId: number;
paths: Path[];
swapKind: SwapKind;
userData?: Hex;
};
export type SwapBuildCallInputBase = {
deadline?: bigint;
slippage: Slippage;
wethIsEth?: boolean;
queryOutput: ExactInQueryOutput | ExactOutQueryOutput;
};
export type SwapBuildCallInput =
| SwapBuildCallInputBase
| (SwapBuildCallInputBase & SwapBuildCallInputBaseV2);
type SwapBuildOutputBase = {
to: Address;
callData: Hex;
value: bigint;
};
export type SwapBuildOutputExactIn = SwapBuildOutputBase & {
minAmountOut: TokenAmount;
};
export type SwapBuildOutputExactOut = SwapBuildOutputBase & {
maxAmountIn: TokenAmount;
};
export type QueryOutputBase = {
swapKind: SwapKind;
pathAmounts?: bigint[];
to: Address;
};
export type ExactInQueryOutput = QueryOutputBase & {
swapKind: SwapKind.GivenIn;
amountIn: TokenAmount;
expectedAmountOut: TokenAmount;
};
export type ExactOutQueryOutput = QueryOutputBase & {
swapKind: SwapKind.GivenOut;
amountOut: TokenAmount;
expectedAmountIn: TokenAmount;
};