@longdotxyz/shared 0.0.101 → 0.0.103
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/contracts/index.d.ts +81 -17
- package/dist/contracts/pathfinding.contract.d.ts +143 -33
- package/dist/contracts/pathfinding.contract.js +45 -21
- package/dist/contracts/pathfinding.contract.js.map +1 -1
- package/dist/graphql/generated.d.ts +313 -0
- package/dist/graphql/generated.js +92 -1
- package/dist/graphql/generated.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +185 -137
|
@@ -5679,19 +5679,44 @@ export declare const rootContract: {
|
|
|
5679
5679
|
}, {
|
|
5680
5680
|
tokenInAddress: string;
|
|
5681
5681
|
}>;
|
|
5682
|
+
query: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
5683
|
+
amount: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5684
|
+
tokenOut: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5685
|
+
slippage: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5686
|
+
sender: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5687
|
+
recipient: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5688
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
5689
|
+
amount?: string | undefined;
|
|
5690
|
+
tokenOut?: string | undefined;
|
|
5691
|
+
slippage?: string | undefined;
|
|
5692
|
+
sender?: string | undefined;
|
|
5693
|
+
recipient?: string | undefined;
|
|
5694
|
+
}, {
|
|
5695
|
+
amount?: string | undefined;
|
|
5696
|
+
tokenOut?: string | undefined;
|
|
5697
|
+
slippage?: string | undefined;
|
|
5698
|
+
sender?: string | undefined;
|
|
5699
|
+
recipient?: string | undefined;
|
|
5700
|
+
}>>;
|
|
5682
5701
|
method: "GET";
|
|
5683
5702
|
path: "/paths/:tokenInAddress";
|
|
5684
5703
|
responses: {
|
|
5685
|
-
200: import("zod").ZodObject<{
|
|
5704
|
+
200: import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
5686
5705
|
token_address: import("zod").ZodString;
|
|
5687
5706
|
paths_count: import("zod").ZodNumber;
|
|
5688
5707
|
paths: import("zod").ZodArray<import("zod").ZodObject<{
|
|
5708
|
+
source: import("zod").ZodEnum<["codex", "kyber"]>;
|
|
5689
5709
|
start_token_address: import("zod").ZodString;
|
|
5690
5710
|
end_token_address: import("zod").ZodString;
|
|
5691
5711
|
score: import("zod").ZodNumber;
|
|
5692
|
-
total_liquidity_usd: import("zod").ZodNumber
|
|
5693
|
-
total_volume_usd: import("zod").ZodNumber
|
|
5694
|
-
bottleneck_liquidity_usd: import("zod").ZodNumber
|
|
5712
|
+
total_liquidity_usd: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
5713
|
+
total_volume_usd: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
5714
|
+
bottleneck_liquidity_usd: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
5715
|
+
encoded_calldata: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5716
|
+
router_address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5717
|
+
amount_in: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5718
|
+
amount_out: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5719
|
+
gas_estimate: import("zod").ZodOptional<import("zod").ZodString>;
|
|
5695
5720
|
hops: import("zod").ZodArray<import("zod").ZodObject<{
|
|
5696
5721
|
pool_address: import("zod").ZodString;
|
|
5697
5722
|
token_in_address: import("zod").ZodString;
|
|
@@ -5724,12 +5749,10 @@ export declare const rootContract: {
|
|
|
5724
5749
|
liquidity_usd: number | null;
|
|
5725
5750
|
}>, "many">;
|
|
5726
5751
|
}, "strip", import("zod").ZodTypeAny, {
|
|
5752
|
+
source: "codex" | "kyber";
|
|
5727
5753
|
start_token_address: string;
|
|
5728
5754
|
end_token_address: string;
|
|
5729
5755
|
score: number;
|
|
5730
|
-
total_liquidity_usd: number;
|
|
5731
|
-
total_volume_usd: number;
|
|
5732
|
-
bottleneck_liquidity_usd: number;
|
|
5733
5756
|
hops: {
|
|
5734
5757
|
fee: number | null;
|
|
5735
5758
|
hooks: string | null;
|
|
@@ -5741,13 +5764,19 @@ export declare const rootContract: {
|
|
|
5741
5764
|
tick_spacing: number | null;
|
|
5742
5765
|
liquidity_usd: number | null;
|
|
5743
5766
|
}[];
|
|
5767
|
+
total_liquidity_usd?: number | undefined;
|
|
5768
|
+
total_volume_usd?: number | undefined;
|
|
5769
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
5770
|
+
encoded_calldata?: string | undefined;
|
|
5771
|
+
router_address?: string | undefined;
|
|
5772
|
+
amount_in?: string | undefined;
|
|
5773
|
+
amount_out?: string | undefined;
|
|
5774
|
+
gas_estimate?: string | undefined;
|
|
5744
5775
|
}, {
|
|
5776
|
+
source: "codex" | "kyber";
|
|
5745
5777
|
start_token_address: string;
|
|
5746
5778
|
end_token_address: string;
|
|
5747
5779
|
score: number;
|
|
5748
|
-
total_liquidity_usd: number;
|
|
5749
|
-
total_volume_usd: number;
|
|
5750
|
-
bottleneck_liquidity_usd: number;
|
|
5751
5780
|
hops: {
|
|
5752
5781
|
fee: number | null;
|
|
5753
5782
|
hooks: string | null;
|
|
@@ -5759,17 +5788,23 @@ export declare const rootContract: {
|
|
|
5759
5788
|
tick_spacing: number | null;
|
|
5760
5789
|
liquidity_usd: number | null;
|
|
5761
5790
|
}[];
|
|
5791
|
+
total_liquidity_usd?: number | undefined;
|
|
5792
|
+
total_volume_usd?: number | undefined;
|
|
5793
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
5794
|
+
encoded_calldata?: string | undefined;
|
|
5795
|
+
router_address?: string | undefined;
|
|
5796
|
+
amount_in?: string | undefined;
|
|
5797
|
+
amount_out?: string | undefined;
|
|
5798
|
+
gas_estimate?: string | undefined;
|
|
5762
5799
|
}>, "many">;
|
|
5763
5800
|
}, "strip", import("zod").ZodTypeAny, {
|
|
5764
5801
|
token_address: string;
|
|
5765
5802
|
paths_count: number;
|
|
5766
5803
|
paths: {
|
|
5804
|
+
source: "codex" | "kyber";
|
|
5767
5805
|
start_token_address: string;
|
|
5768
5806
|
end_token_address: string;
|
|
5769
5807
|
score: number;
|
|
5770
|
-
total_liquidity_usd: number;
|
|
5771
|
-
total_volume_usd: number;
|
|
5772
|
-
bottleneck_liquidity_usd: number;
|
|
5773
5808
|
hops: {
|
|
5774
5809
|
fee: number | null;
|
|
5775
5810
|
hooks: string | null;
|
|
@@ -5781,17 +5816,23 @@ export declare const rootContract: {
|
|
|
5781
5816
|
tick_spacing: number | null;
|
|
5782
5817
|
liquidity_usd: number | null;
|
|
5783
5818
|
}[];
|
|
5819
|
+
total_liquidity_usd?: number | undefined;
|
|
5820
|
+
total_volume_usd?: number | undefined;
|
|
5821
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
5822
|
+
encoded_calldata?: string | undefined;
|
|
5823
|
+
router_address?: string | undefined;
|
|
5824
|
+
amount_in?: string | undefined;
|
|
5825
|
+
amount_out?: string | undefined;
|
|
5826
|
+
gas_estimate?: string | undefined;
|
|
5784
5827
|
}[];
|
|
5785
5828
|
}, {
|
|
5786
5829
|
token_address: string;
|
|
5787
5830
|
paths_count: number;
|
|
5788
5831
|
paths: {
|
|
5832
|
+
source: "codex" | "kyber";
|
|
5789
5833
|
start_token_address: string;
|
|
5790
5834
|
end_token_address: string;
|
|
5791
5835
|
score: number;
|
|
5792
|
-
total_liquidity_usd: number;
|
|
5793
|
-
total_volume_usd: number;
|
|
5794
|
-
bottleneck_liquidity_usd: number;
|
|
5795
5836
|
hops: {
|
|
5796
5837
|
fee: number | null;
|
|
5797
5838
|
hooks: string | null;
|
|
@@ -5803,8 +5844,31 @@ export declare const rootContract: {
|
|
|
5803
5844
|
tick_spacing: number | null;
|
|
5804
5845
|
liquidity_usd: number | null;
|
|
5805
5846
|
}[];
|
|
5847
|
+
total_liquidity_usd?: number | undefined;
|
|
5848
|
+
total_volume_usd?: number | undefined;
|
|
5849
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
5850
|
+
encoded_calldata?: string | undefined;
|
|
5851
|
+
router_address?: string | undefined;
|
|
5852
|
+
amount_in?: string | undefined;
|
|
5853
|
+
amount_out?: string | undefined;
|
|
5854
|
+
gas_estimate?: string | undefined;
|
|
5806
5855
|
}[];
|
|
5807
|
-
}
|
|
5856
|
+
}>, import("zod").ZodObject<{
|
|
5857
|
+
amountOut: import("zod").ZodString;
|
|
5858
|
+
data: import("zod").ZodString;
|
|
5859
|
+
routerAddress: import("zod").ZodString;
|
|
5860
|
+
transactionValue: import("zod").ZodString;
|
|
5861
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
5862
|
+
amountOut: string;
|
|
5863
|
+
data: string;
|
|
5864
|
+
routerAddress: string;
|
|
5865
|
+
transactionValue: string;
|
|
5866
|
+
}, {
|
|
5867
|
+
amountOut: string;
|
|
5868
|
+
data: string;
|
|
5869
|
+
routerAddress: string;
|
|
5870
|
+
transactionValue: string;
|
|
5871
|
+
}>]>;
|
|
5808
5872
|
};
|
|
5809
5873
|
};
|
|
5810
5874
|
};
|
|
@@ -3,12 +3,18 @@ declare const FetchTokensPathsResponseSchema: z.ZodObject<{
|
|
|
3
3
|
token_address: z.ZodString;
|
|
4
4
|
paths_count: z.ZodNumber;
|
|
5
5
|
paths: z.ZodArray<z.ZodObject<{
|
|
6
|
+
source: z.ZodEnum<["codex", "kyber"]>;
|
|
6
7
|
start_token_address: z.ZodString;
|
|
7
8
|
end_token_address: z.ZodString;
|
|
8
9
|
score: z.ZodNumber;
|
|
9
|
-
total_liquidity_usd: z.ZodNumber
|
|
10
|
-
total_volume_usd: z.ZodNumber
|
|
11
|
-
bottleneck_liquidity_usd: z.ZodNumber
|
|
10
|
+
total_liquidity_usd: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
total_volume_usd: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
bottleneck_liquidity_usd: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
encoded_calldata: z.ZodOptional<z.ZodString>;
|
|
14
|
+
router_address: z.ZodOptional<z.ZodString>;
|
|
15
|
+
amount_in: z.ZodOptional<z.ZodString>;
|
|
16
|
+
amount_out: z.ZodOptional<z.ZodString>;
|
|
17
|
+
gas_estimate: z.ZodOptional<z.ZodString>;
|
|
12
18
|
hops: z.ZodArray<z.ZodObject<{
|
|
13
19
|
pool_address: z.ZodString;
|
|
14
20
|
token_in_address: z.ZodString;
|
|
@@ -41,12 +47,10 @@ declare const FetchTokensPathsResponseSchema: z.ZodObject<{
|
|
|
41
47
|
liquidity_usd: number | null;
|
|
42
48
|
}>, "many">;
|
|
43
49
|
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
source: "codex" | "kyber";
|
|
44
51
|
start_token_address: string;
|
|
45
52
|
end_token_address: string;
|
|
46
53
|
score: number;
|
|
47
|
-
total_liquidity_usd: number;
|
|
48
|
-
total_volume_usd: number;
|
|
49
|
-
bottleneck_liquidity_usd: number;
|
|
50
54
|
hops: {
|
|
51
55
|
fee: number | null;
|
|
52
56
|
hooks: string | null;
|
|
@@ -58,13 +62,19 @@ declare const FetchTokensPathsResponseSchema: z.ZodObject<{
|
|
|
58
62
|
tick_spacing: number | null;
|
|
59
63
|
liquidity_usd: number | null;
|
|
60
64
|
}[];
|
|
65
|
+
total_liquidity_usd?: number | undefined;
|
|
66
|
+
total_volume_usd?: number | undefined;
|
|
67
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
68
|
+
encoded_calldata?: string | undefined;
|
|
69
|
+
router_address?: string | undefined;
|
|
70
|
+
amount_in?: string | undefined;
|
|
71
|
+
amount_out?: string | undefined;
|
|
72
|
+
gas_estimate?: string | undefined;
|
|
61
73
|
}, {
|
|
74
|
+
source: "codex" | "kyber";
|
|
62
75
|
start_token_address: string;
|
|
63
76
|
end_token_address: string;
|
|
64
77
|
score: number;
|
|
65
|
-
total_liquidity_usd: number;
|
|
66
|
-
total_volume_usd: number;
|
|
67
|
-
bottleneck_liquidity_usd: number;
|
|
68
78
|
hops: {
|
|
69
79
|
fee: number | null;
|
|
70
80
|
hooks: string | null;
|
|
@@ -76,17 +86,23 @@ declare const FetchTokensPathsResponseSchema: z.ZodObject<{
|
|
|
76
86
|
tick_spacing: number | null;
|
|
77
87
|
liquidity_usd: number | null;
|
|
78
88
|
}[];
|
|
89
|
+
total_liquidity_usd?: number | undefined;
|
|
90
|
+
total_volume_usd?: number | undefined;
|
|
91
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
92
|
+
encoded_calldata?: string | undefined;
|
|
93
|
+
router_address?: string | undefined;
|
|
94
|
+
amount_in?: string | undefined;
|
|
95
|
+
amount_out?: string | undefined;
|
|
96
|
+
gas_estimate?: string | undefined;
|
|
79
97
|
}>, "many">;
|
|
80
98
|
}, "strip", z.ZodTypeAny, {
|
|
81
99
|
token_address: string;
|
|
82
100
|
paths_count: number;
|
|
83
101
|
paths: {
|
|
102
|
+
source: "codex" | "kyber";
|
|
84
103
|
start_token_address: string;
|
|
85
104
|
end_token_address: string;
|
|
86
105
|
score: number;
|
|
87
|
-
total_liquidity_usd: number;
|
|
88
|
-
total_volume_usd: number;
|
|
89
|
-
bottleneck_liquidity_usd: number;
|
|
90
106
|
hops: {
|
|
91
107
|
fee: number | null;
|
|
92
108
|
hooks: string | null;
|
|
@@ -98,17 +114,23 @@ declare const FetchTokensPathsResponseSchema: z.ZodObject<{
|
|
|
98
114
|
tick_spacing: number | null;
|
|
99
115
|
liquidity_usd: number | null;
|
|
100
116
|
}[];
|
|
117
|
+
total_liquidity_usd?: number | undefined;
|
|
118
|
+
total_volume_usd?: number | undefined;
|
|
119
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
120
|
+
encoded_calldata?: string | undefined;
|
|
121
|
+
router_address?: string | undefined;
|
|
122
|
+
amount_in?: string | undefined;
|
|
123
|
+
amount_out?: string | undefined;
|
|
124
|
+
gas_estimate?: string | undefined;
|
|
101
125
|
}[];
|
|
102
126
|
}, {
|
|
103
127
|
token_address: string;
|
|
104
128
|
paths_count: number;
|
|
105
129
|
paths: {
|
|
130
|
+
source: "codex" | "kyber";
|
|
106
131
|
start_token_address: string;
|
|
107
132
|
end_token_address: string;
|
|
108
133
|
score: number;
|
|
109
|
-
total_liquidity_usd: number;
|
|
110
|
-
total_volume_usd: number;
|
|
111
|
-
bottleneck_liquidity_usd: number;
|
|
112
134
|
hops: {
|
|
113
135
|
fee: number | null;
|
|
114
136
|
hooks: string | null;
|
|
@@ -120,8 +142,32 @@ declare const FetchTokensPathsResponseSchema: z.ZodObject<{
|
|
|
120
142
|
tick_spacing: number | null;
|
|
121
143
|
liquidity_usd: number | null;
|
|
122
144
|
}[];
|
|
145
|
+
total_liquidity_usd?: number | undefined;
|
|
146
|
+
total_volume_usd?: number | undefined;
|
|
147
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
148
|
+
encoded_calldata?: string | undefined;
|
|
149
|
+
router_address?: string | undefined;
|
|
150
|
+
amount_in?: string | undefined;
|
|
151
|
+
amount_out?: string | undefined;
|
|
152
|
+
gas_estimate?: string | undefined;
|
|
123
153
|
}[];
|
|
124
154
|
}>;
|
|
155
|
+
declare const KyberSwapResponseSchema: z.ZodObject<{
|
|
156
|
+
amountOut: z.ZodString;
|
|
157
|
+
data: z.ZodString;
|
|
158
|
+
routerAddress: z.ZodString;
|
|
159
|
+
transactionValue: z.ZodString;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
amountOut: string;
|
|
162
|
+
data: string;
|
|
163
|
+
routerAddress: string;
|
|
164
|
+
transactionValue: string;
|
|
165
|
+
}, {
|
|
166
|
+
amountOut: string;
|
|
167
|
+
data: string;
|
|
168
|
+
routerAddress: string;
|
|
169
|
+
transactionValue: string;
|
|
170
|
+
}>;
|
|
125
171
|
declare const pathfindingContract: {
|
|
126
172
|
fetchTokenPaths: {
|
|
127
173
|
pathParams: z.ZodObject<{
|
|
@@ -131,19 +177,44 @@ declare const pathfindingContract: {
|
|
|
131
177
|
}, {
|
|
132
178
|
tokenInAddress: string;
|
|
133
179
|
}>;
|
|
180
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
amount: z.ZodOptional<z.ZodString>;
|
|
182
|
+
tokenOut: z.ZodOptional<z.ZodString>;
|
|
183
|
+
slippage: z.ZodOptional<z.ZodString>;
|
|
184
|
+
sender: z.ZodOptional<z.ZodString>;
|
|
185
|
+
recipient: z.ZodOptional<z.ZodString>;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
amount?: string | undefined;
|
|
188
|
+
tokenOut?: string | undefined;
|
|
189
|
+
slippage?: string | undefined;
|
|
190
|
+
sender?: string | undefined;
|
|
191
|
+
recipient?: string | undefined;
|
|
192
|
+
}, {
|
|
193
|
+
amount?: string | undefined;
|
|
194
|
+
tokenOut?: string | undefined;
|
|
195
|
+
slippage?: string | undefined;
|
|
196
|
+
sender?: string | undefined;
|
|
197
|
+
recipient?: string | undefined;
|
|
198
|
+
}>>;
|
|
134
199
|
method: "GET";
|
|
135
200
|
path: "/paths/:tokenInAddress";
|
|
136
201
|
responses: {
|
|
137
|
-
200: z.ZodObject<{
|
|
202
|
+
200: z.ZodUnion<[z.ZodObject<{
|
|
138
203
|
token_address: z.ZodString;
|
|
139
204
|
paths_count: z.ZodNumber;
|
|
140
205
|
paths: z.ZodArray<z.ZodObject<{
|
|
206
|
+
source: z.ZodEnum<["codex", "kyber"]>;
|
|
141
207
|
start_token_address: z.ZodString;
|
|
142
208
|
end_token_address: z.ZodString;
|
|
143
209
|
score: z.ZodNumber;
|
|
144
|
-
total_liquidity_usd: z.ZodNumber
|
|
145
|
-
total_volume_usd: z.ZodNumber
|
|
146
|
-
bottleneck_liquidity_usd: z.ZodNumber
|
|
210
|
+
total_liquidity_usd: z.ZodOptional<z.ZodNumber>;
|
|
211
|
+
total_volume_usd: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
bottleneck_liquidity_usd: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
encoded_calldata: z.ZodOptional<z.ZodString>;
|
|
214
|
+
router_address: z.ZodOptional<z.ZodString>;
|
|
215
|
+
amount_in: z.ZodOptional<z.ZodString>;
|
|
216
|
+
amount_out: z.ZodOptional<z.ZodString>;
|
|
217
|
+
gas_estimate: z.ZodOptional<z.ZodString>;
|
|
147
218
|
hops: z.ZodArray<z.ZodObject<{
|
|
148
219
|
pool_address: z.ZodString;
|
|
149
220
|
token_in_address: z.ZodString;
|
|
@@ -176,12 +247,10 @@ declare const pathfindingContract: {
|
|
|
176
247
|
liquidity_usd: number | null;
|
|
177
248
|
}>, "many">;
|
|
178
249
|
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
source: "codex" | "kyber";
|
|
179
251
|
start_token_address: string;
|
|
180
252
|
end_token_address: string;
|
|
181
253
|
score: number;
|
|
182
|
-
total_liquidity_usd: number;
|
|
183
|
-
total_volume_usd: number;
|
|
184
|
-
bottleneck_liquidity_usd: number;
|
|
185
254
|
hops: {
|
|
186
255
|
fee: number | null;
|
|
187
256
|
hooks: string | null;
|
|
@@ -193,13 +262,19 @@ declare const pathfindingContract: {
|
|
|
193
262
|
tick_spacing: number | null;
|
|
194
263
|
liquidity_usd: number | null;
|
|
195
264
|
}[];
|
|
265
|
+
total_liquidity_usd?: number | undefined;
|
|
266
|
+
total_volume_usd?: number | undefined;
|
|
267
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
268
|
+
encoded_calldata?: string | undefined;
|
|
269
|
+
router_address?: string | undefined;
|
|
270
|
+
amount_in?: string | undefined;
|
|
271
|
+
amount_out?: string | undefined;
|
|
272
|
+
gas_estimate?: string | undefined;
|
|
196
273
|
}, {
|
|
274
|
+
source: "codex" | "kyber";
|
|
197
275
|
start_token_address: string;
|
|
198
276
|
end_token_address: string;
|
|
199
277
|
score: number;
|
|
200
|
-
total_liquidity_usd: number;
|
|
201
|
-
total_volume_usd: number;
|
|
202
|
-
bottleneck_liquidity_usd: number;
|
|
203
278
|
hops: {
|
|
204
279
|
fee: number | null;
|
|
205
280
|
hooks: string | null;
|
|
@@ -211,17 +286,23 @@ declare const pathfindingContract: {
|
|
|
211
286
|
tick_spacing: number | null;
|
|
212
287
|
liquidity_usd: number | null;
|
|
213
288
|
}[];
|
|
289
|
+
total_liquidity_usd?: number | undefined;
|
|
290
|
+
total_volume_usd?: number | undefined;
|
|
291
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
292
|
+
encoded_calldata?: string | undefined;
|
|
293
|
+
router_address?: string | undefined;
|
|
294
|
+
amount_in?: string | undefined;
|
|
295
|
+
amount_out?: string | undefined;
|
|
296
|
+
gas_estimate?: string | undefined;
|
|
214
297
|
}>, "many">;
|
|
215
298
|
}, "strip", z.ZodTypeAny, {
|
|
216
299
|
token_address: string;
|
|
217
300
|
paths_count: number;
|
|
218
301
|
paths: {
|
|
302
|
+
source: "codex" | "kyber";
|
|
219
303
|
start_token_address: string;
|
|
220
304
|
end_token_address: string;
|
|
221
305
|
score: number;
|
|
222
|
-
total_liquidity_usd: number;
|
|
223
|
-
total_volume_usd: number;
|
|
224
|
-
bottleneck_liquidity_usd: number;
|
|
225
306
|
hops: {
|
|
226
307
|
fee: number | null;
|
|
227
308
|
hooks: string | null;
|
|
@@ -233,17 +314,23 @@ declare const pathfindingContract: {
|
|
|
233
314
|
tick_spacing: number | null;
|
|
234
315
|
liquidity_usd: number | null;
|
|
235
316
|
}[];
|
|
317
|
+
total_liquidity_usd?: number | undefined;
|
|
318
|
+
total_volume_usd?: number | undefined;
|
|
319
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
320
|
+
encoded_calldata?: string | undefined;
|
|
321
|
+
router_address?: string | undefined;
|
|
322
|
+
amount_in?: string | undefined;
|
|
323
|
+
amount_out?: string | undefined;
|
|
324
|
+
gas_estimate?: string | undefined;
|
|
236
325
|
}[];
|
|
237
326
|
}, {
|
|
238
327
|
token_address: string;
|
|
239
328
|
paths_count: number;
|
|
240
329
|
paths: {
|
|
330
|
+
source: "codex" | "kyber";
|
|
241
331
|
start_token_address: string;
|
|
242
332
|
end_token_address: string;
|
|
243
333
|
score: number;
|
|
244
|
-
total_liquidity_usd: number;
|
|
245
|
-
total_volume_usd: number;
|
|
246
|
-
bottleneck_liquidity_usd: number;
|
|
247
334
|
hops: {
|
|
248
335
|
fee: number | null;
|
|
249
336
|
hooks: string | null;
|
|
@@ -255,9 +342,32 @@ declare const pathfindingContract: {
|
|
|
255
342
|
tick_spacing: number | null;
|
|
256
343
|
liquidity_usd: number | null;
|
|
257
344
|
}[];
|
|
345
|
+
total_liquidity_usd?: number | undefined;
|
|
346
|
+
total_volume_usd?: number | undefined;
|
|
347
|
+
bottleneck_liquidity_usd?: number | undefined;
|
|
348
|
+
encoded_calldata?: string | undefined;
|
|
349
|
+
router_address?: string | undefined;
|
|
350
|
+
amount_in?: string | undefined;
|
|
351
|
+
amount_out?: string | undefined;
|
|
352
|
+
gas_estimate?: string | undefined;
|
|
258
353
|
}[];
|
|
259
|
-
}
|
|
354
|
+
}>, z.ZodObject<{
|
|
355
|
+
amountOut: z.ZodString;
|
|
356
|
+
data: z.ZodString;
|
|
357
|
+
routerAddress: z.ZodString;
|
|
358
|
+
transactionValue: z.ZodString;
|
|
359
|
+
}, "strip", z.ZodTypeAny, {
|
|
360
|
+
amountOut: string;
|
|
361
|
+
data: string;
|
|
362
|
+
routerAddress: string;
|
|
363
|
+
transactionValue: string;
|
|
364
|
+
}, {
|
|
365
|
+
amountOut: string;
|
|
366
|
+
data: string;
|
|
367
|
+
routerAddress: string;
|
|
368
|
+
transactionValue: string;
|
|
369
|
+
}>]>;
|
|
260
370
|
};
|
|
261
371
|
};
|
|
262
372
|
};
|
|
263
|
-
export { pathfindingContract, FetchTokensPathsResponseSchema };
|
|
373
|
+
export { pathfindingContract, FetchTokensPathsResponseSchema, KyberSwapResponseSchema };
|
|
@@ -3,35 +3,50 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FetchTokensPathsResponseSchema = exports.pathfindingContract = void 0;
|
|
6
|
+
exports.KyberSwapResponseSchema = exports.FetchTokensPathsResponseSchema = exports.pathfindingContract = void 0;
|
|
7
7
|
const core_1 = require("@ts-rest/core");
|
|
8
8
|
const zod_1 = __importDefault(require("zod"));
|
|
9
9
|
const types_1 = require("../types");
|
|
10
10
|
const contract = (0, core_1.initContract)();
|
|
11
|
+
const PathHopSchema = zod_1.default.object({
|
|
12
|
+
pool_address: zod_1.default.string(),
|
|
13
|
+
token_in_address: zod_1.default.string(),
|
|
14
|
+
token_out_address: zod_1.default.string(),
|
|
15
|
+
protocol: zod_1.default.string(),
|
|
16
|
+
fee: zod_1.default.number().nullable(),
|
|
17
|
+
tick_spacing: zod_1.default.number().nullable(),
|
|
18
|
+
hooks: zod_1.default.string().nullable(),
|
|
19
|
+
liquidity_usd: zod_1.default.number().nullable(),
|
|
20
|
+
volume_usd: zod_1.default.number().nullable(),
|
|
21
|
+
});
|
|
22
|
+
const PathSchema = zod_1.default.object({
|
|
23
|
+
source: zod_1.default.enum(["codex", "kyber"]),
|
|
24
|
+
start_token_address: zod_1.default.string(),
|
|
25
|
+
end_token_address: zod_1.default.string(),
|
|
26
|
+
score: zod_1.default.number().describe("Path score (sum of liquidity × volume for each hop)"),
|
|
27
|
+
total_liquidity_usd: zod_1.default.number().optional().describe("Total liquidity in USD"),
|
|
28
|
+
total_volume_usd: zod_1.default.number().optional().describe("Total volume in USD for the past 24 hours"),
|
|
29
|
+
bottleneck_liquidity_usd: zod_1.default.number().optional().describe("Liquidity of the bottleneck token in USD"),
|
|
30
|
+
encoded_calldata: zod_1.default.string().optional(),
|
|
31
|
+
router_address: zod_1.default.string().optional(),
|
|
32
|
+
amount_in: zod_1.default.string().optional(),
|
|
33
|
+
amount_out: zod_1.default.string().optional(),
|
|
34
|
+
gas_estimate: zod_1.default.string().optional(),
|
|
35
|
+
hops: zod_1.default.array(PathHopSchema),
|
|
36
|
+
});
|
|
11
37
|
const FetchTokensPathsResponseSchema = zod_1.default.object({
|
|
12
38
|
token_address: zod_1.default.string(),
|
|
13
39
|
paths_count: zod_1.default.number(),
|
|
14
|
-
paths: zod_1.default.array(
|
|
15
|
-
start_token_address: zod_1.default.string(),
|
|
16
|
-
end_token_address: zod_1.default.string(),
|
|
17
|
-
score: zod_1.default.number().describe("Path score (sum of liquidity × volume for each hop)"),
|
|
18
|
-
total_liquidity_usd: zod_1.default.number().describe("Total liquidity in USD"),
|
|
19
|
-
total_volume_usd: zod_1.default.number().describe("Total volume in USD for the past 24 hours"),
|
|
20
|
-
bottleneck_liquidity_usd: zod_1.default.number().describe("Liquidity of the bottleneck token in USD"),
|
|
21
|
-
hops: zod_1.default.array(zod_1.default.object({
|
|
22
|
-
pool_address: zod_1.default.string(),
|
|
23
|
-
token_in_address: zod_1.default.string(),
|
|
24
|
-
token_out_address: zod_1.default.string(),
|
|
25
|
-
protocol: zod_1.default.string(),
|
|
26
|
-
fee: zod_1.default.number().nullable(),
|
|
27
|
-
tick_spacing: zod_1.default.number().nullable(),
|
|
28
|
-
hooks: zod_1.default.string().nullable(),
|
|
29
|
-
liquidity_usd: zod_1.default.number().nullable(),
|
|
30
|
-
volume_usd: zod_1.default.number().nullable(),
|
|
31
|
-
})),
|
|
32
|
-
})),
|
|
40
|
+
paths: zod_1.default.array(PathSchema),
|
|
33
41
|
});
|
|
34
42
|
exports.FetchTokensPathsResponseSchema = FetchTokensPathsResponseSchema;
|
|
43
|
+
const KyberSwapResponseSchema = zod_1.default.object({
|
|
44
|
+
amountOut: zod_1.default.string(),
|
|
45
|
+
data: zod_1.default.string(),
|
|
46
|
+
routerAddress: zod_1.default.string(),
|
|
47
|
+
transactionValue: zod_1.default.string(),
|
|
48
|
+
});
|
|
49
|
+
exports.KyberSwapResponseSchema = KyberSwapResponseSchema;
|
|
35
50
|
const pathfindingContract = contract.router({
|
|
36
51
|
fetchTokenPaths: {
|
|
37
52
|
method: "GET",
|
|
@@ -39,8 +54,17 @@ const pathfindingContract = contract.router({
|
|
|
39
54
|
pathParams: zod_1.default.object({
|
|
40
55
|
tokenInAddress: types_1.hex,
|
|
41
56
|
}),
|
|
57
|
+
query: zod_1.default
|
|
58
|
+
.object({
|
|
59
|
+
amount: zod_1.default.string().optional(),
|
|
60
|
+
tokenOut: zod_1.default.string().optional(),
|
|
61
|
+
slippage: zod_1.default.string().optional(),
|
|
62
|
+
sender: zod_1.default.string().optional(),
|
|
63
|
+
recipient: zod_1.default.string().optional(),
|
|
64
|
+
})
|
|
65
|
+
.optional(),
|
|
42
66
|
responses: {
|
|
43
|
-
200: FetchTokensPathsResponseSchema,
|
|
67
|
+
200: zod_1.default.union([FetchTokensPathsResponseSchema, KyberSwapResponseSchema]),
|
|
44
68
|
},
|
|
45
69
|
},
|
|
46
70
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathfinding.contract.js","sourceRoot":"","sources":["../../src/contracts/pathfinding.contract.ts"],"names":[],"mappings":";;;;;;AAAA,wCAA6C;AAC7C,8CAAoB;AAEpB,oCAA+B;AAE/B,MAAM,QAAQ,GAAG,IAAA,mBAAY,GAAE,CAAC;AAEhC,MAAM,
|
|
1
|
+
{"version":3,"file":"pathfinding.contract.js","sourceRoot":"","sources":["../../src/contracts/pathfinding.contract.ts"],"names":[],"mappings":";;;;;;AAAA,wCAA6C;AAC7C,8CAAoB;AAEpB,oCAA+B;AAE/B,MAAM,QAAQ,GAAG,IAAA,mBAAY,GAAE,CAAC;AAEhC,MAAM,aAAa,GAAG,aAAC,CAAC,MAAM,CAAC;IAC3B,YAAY,EAAE,aAAC,CAAC,MAAM,EAAE;IACxB,gBAAgB,EAAE,aAAC,CAAC,MAAM,EAAE;IAC5B,iBAAiB,EAAE,aAAC,CAAC,MAAM,EAAE;IAC7B,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE;IACpB,GAAG,EAAE,aAAC,CAAC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