@kasarlabs/layerswap-mcp 0.1.1
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/LICENSE +21 -0
- package/README.md +253 -0
- package/bin/layerswap-mcp.js +2 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +137 -0
- package/build/index.js.map +1 -0
- package/build/lib/config.d.ts +4 -0
- package/build/lib/config.js +9 -0
- package/build/lib/config.js.map +1 -0
- package/build/lib/utils/apiClient.d.ts +8 -0
- package/build/lib/utils/apiClient.js +41 -0
- package/build/lib/utils/apiClient.js.map +1 -0
- package/build/schemas/index.d.ts +242 -0
- package/build/schemas/index.js +207 -0
- package/build/schemas/index.js.map +1 -0
- package/build/tools/read/getAllSwaps.d.ts +4 -0
- package/build/tools/read/getAllSwaps.js +26 -0
- package/build/tools/read/getAllSwaps.js.map +1 -0
- package/build/tools/read/getDepositActions.d.ts +4 -0
- package/build/tools/read/getDepositActions.js +22 -0
- package/build/tools/read/getDepositActions.js.map +1 -0
- package/build/tools/read/getDestinations.d.ts +4 -0
- package/build/tools/read/getDestinations.js +39 -0
- package/build/tools/read/getDestinations.js.map +1 -0
- package/build/tools/read/getDetailedQuote.d.ts +4 -0
- package/build/tools/read/getDetailedQuote.js +33 -0
- package/build/tools/read/getDetailedQuote.js.map +1 -0
- package/build/tools/read/getNetworks.d.ts +4 -0
- package/build/tools/read/getNetworks.js +23 -0
- package/build/tools/read/getNetworks.js.map +1 -0
- package/build/tools/read/getQuote.d.ts +4 -0
- package/build/tools/read/getQuote.js +35 -0
- package/build/tools/read/getQuote.js.map +1 -0
- package/build/tools/read/getSources.d.ts +4 -0
- package/build/tools/read/getSources.js +42 -0
- package/build/tools/read/getSources.js.map +1 -0
- package/build/tools/read/getSwapDetails.d.ts +4 -0
- package/build/tools/read/getSwapDetails.js +25 -0
- package/build/tools/read/getSwapDetails.js.map +1 -0
- package/build/tools/read/getSwapRouteLimits.d.ts +4 -0
- package/build/tools/read/getSwapRouteLimits.js +26 -0
- package/build/tools/read/getSwapRouteLimits.js.map +1 -0
- package/build/tools/read/getTransactionStatus.d.ts +4 -0
- package/build/tools/read/getTransactionStatus.js +20 -0
- package/build/tools/read/getTransactionStatus.js.map +1 -0
- package/build/tools/write/createSwap.d.ts +4 -0
- package/build/tools/write/createSwap.js +121 -0
- package/build/tools/write/createSwap.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getNetworksSchema: z.ZodObject<{
|
|
3
|
+
network_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
network_types?: string[] | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
network_types?: string[] | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const getSourcesSchema: z.ZodObject<{
|
|
10
|
+
destination_network: z.ZodOptional<z.ZodString>;
|
|
11
|
+
destination_token: z.ZodOptional<z.ZodString>;
|
|
12
|
+
include_swaps: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
include_unavailable: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
include_unmatched: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
has_deposit_address: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
network_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
network_types?: string[] | undefined;
|
|
19
|
+
destination_network?: string | undefined;
|
|
20
|
+
destination_token?: string | undefined;
|
|
21
|
+
include_swaps?: boolean | undefined;
|
|
22
|
+
include_unavailable?: boolean | undefined;
|
|
23
|
+
include_unmatched?: boolean | undefined;
|
|
24
|
+
has_deposit_address?: boolean | undefined;
|
|
25
|
+
}, {
|
|
26
|
+
network_types?: string[] | undefined;
|
|
27
|
+
destination_network?: string | undefined;
|
|
28
|
+
destination_token?: string | undefined;
|
|
29
|
+
include_swaps?: boolean | undefined;
|
|
30
|
+
include_unavailable?: boolean | undefined;
|
|
31
|
+
include_unmatched?: boolean | undefined;
|
|
32
|
+
has_deposit_address?: boolean | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const getDestinationsSchema: z.ZodObject<{
|
|
35
|
+
source_network: z.ZodOptional<z.ZodString>;
|
|
36
|
+
source_token: z.ZodOptional<z.ZodString>;
|
|
37
|
+
include_swaps: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
include_unavailable: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
include_unmatched: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
network_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
network_types?: string[] | undefined;
|
|
43
|
+
include_swaps?: boolean | undefined;
|
|
44
|
+
include_unavailable?: boolean | undefined;
|
|
45
|
+
include_unmatched?: boolean | undefined;
|
|
46
|
+
source_network?: string | undefined;
|
|
47
|
+
source_token?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
network_types?: string[] | undefined;
|
|
50
|
+
include_swaps?: boolean | undefined;
|
|
51
|
+
include_unavailable?: boolean | undefined;
|
|
52
|
+
include_unmatched?: boolean | undefined;
|
|
53
|
+
source_network?: string | undefined;
|
|
54
|
+
source_token?: string | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const getSwapRouteLimitsSchema: z.ZodObject<{
|
|
57
|
+
source_network: z.ZodString;
|
|
58
|
+
source_token: z.ZodString;
|
|
59
|
+
destination_network: z.ZodString;
|
|
60
|
+
destination_token: z.ZodString;
|
|
61
|
+
use_deposit_address: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
refuel: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
destination_network: string;
|
|
65
|
+
destination_token: string;
|
|
66
|
+
source_network: string;
|
|
67
|
+
source_token: string;
|
|
68
|
+
use_deposit_address?: boolean | undefined;
|
|
69
|
+
refuel?: boolean | undefined;
|
|
70
|
+
}, {
|
|
71
|
+
destination_network: string;
|
|
72
|
+
destination_token: string;
|
|
73
|
+
source_network: string;
|
|
74
|
+
source_token: string;
|
|
75
|
+
use_deposit_address?: boolean | undefined;
|
|
76
|
+
refuel?: boolean | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
export declare const getQuoteSchema: z.ZodObject<{
|
|
79
|
+
source_network: z.ZodString;
|
|
80
|
+
source_token: z.ZodString;
|
|
81
|
+
destination_network: z.ZodString;
|
|
82
|
+
destination_token: z.ZodString;
|
|
83
|
+
amount: z.ZodNumber;
|
|
84
|
+
source_address: z.ZodOptional<z.ZodString>;
|
|
85
|
+
slippage: z.ZodOptional<z.ZodString>;
|
|
86
|
+
use_deposit_address: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
refuel: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
destination_network: string;
|
|
90
|
+
destination_token: string;
|
|
91
|
+
source_network: string;
|
|
92
|
+
source_token: string;
|
|
93
|
+
amount: number;
|
|
94
|
+
use_deposit_address?: boolean | undefined;
|
|
95
|
+
refuel?: boolean | undefined;
|
|
96
|
+
source_address?: string | undefined;
|
|
97
|
+
slippage?: string | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
destination_network: string;
|
|
100
|
+
destination_token: string;
|
|
101
|
+
source_network: string;
|
|
102
|
+
source_token: string;
|
|
103
|
+
amount: number;
|
|
104
|
+
use_deposit_address?: boolean | undefined;
|
|
105
|
+
refuel?: boolean | undefined;
|
|
106
|
+
source_address?: string | undefined;
|
|
107
|
+
slippage?: string | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
export declare const getDetailedQuoteSchema: z.ZodObject<{
|
|
110
|
+
source_network: z.ZodString;
|
|
111
|
+
source_token: z.ZodString;
|
|
112
|
+
destination_network: z.ZodString;
|
|
113
|
+
destination_token: z.ZodString;
|
|
114
|
+
use_deposit_address: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
refuel: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
source_address: z.ZodOptional<z.ZodString>;
|
|
117
|
+
slippage: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
destination_network: string;
|
|
120
|
+
destination_token: string;
|
|
121
|
+
source_network: string;
|
|
122
|
+
source_token: string;
|
|
123
|
+
use_deposit_address?: boolean | undefined;
|
|
124
|
+
refuel?: boolean | undefined;
|
|
125
|
+
source_address?: string | undefined;
|
|
126
|
+
slippage?: string | undefined;
|
|
127
|
+
}, {
|
|
128
|
+
destination_network: string;
|
|
129
|
+
destination_token: string;
|
|
130
|
+
source_network: string;
|
|
131
|
+
source_token: string;
|
|
132
|
+
use_deposit_address?: boolean | undefined;
|
|
133
|
+
refuel?: boolean | undefined;
|
|
134
|
+
source_address?: string | undefined;
|
|
135
|
+
slippage?: string | undefined;
|
|
136
|
+
}>;
|
|
137
|
+
export declare const getTransactionStatusSchema: z.ZodObject<{
|
|
138
|
+
network: z.ZodString;
|
|
139
|
+
transaction_id: z.ZodString;
|
|
140
|
+
}, "strip", z.ZodTypeAny, {
|
|
141
|
+
network: string;
|
|
142
|
+
transaction_id: string;
|
|
143
|
+
}, {
|
|
144
|
+
network: string;
|
|
145
|
+
transaction_id: string;
|
|
146
|
+
}>;
|
|
147
|
+
export declare const getSwapDetailsSchema: z.ZodObject<{
|
|
148
|
+
swap_id: z.ZodString;
|
|
149
|
+
exclude_deposit_actions: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
source_address: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, "strip", z.ZodTypeAny, {
|
|
152
|
+
swap_id: string;
|
|
153
|
+
source_address?: string | undefined;
|
|
154
|
+
exclude_deposit_actions?: boolean | undefined;
|
|
155
|
+
}, {
|
|
156
|
+
swap_id: string;
|
|
157
|
+
source_address?: string | undefined;
|
|
158
|
+
exclude_deposit_actions?: boolean | undefined;
|
|
159
|
+
}>;
|
|
160
|
+
export declare const getDepositActionsSchema: z.ZodObject<{
|
|
161
|
+
swap_id: z.ZodString;
|
|
162
|
+
source_address: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
swap_id: string;
|
|
165
|
+
source_address?: string | undefined;
|
|
166
|
+
}, {
|
|
167
|
+
swap_id: string;
|
|
168
|
+
source_address?: string | undefined;
|
|
169
|
+
}>;
|
|
170
|
+
export declare const getAllSwapsSchema: z.ZodObject<{
|
|
171
|
+
address: z.ZodString;
|
|
172
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
include_expired: z.ZodOptional<z.ZodBoolean>;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
address: string;
|
|
176
|
+
page?: number | undefined;
|
|
177
|
+
include_expired?: boolean | undefined;
|
|
178
|
+
}, {
|
|
179
|
+
address: string;
|
|
180
|
+
page?: number | undefined;
|
|
181
|
+
include_expired?: boolean | undefined;
|
|
182
|
+
}>;
|
|
183
|
+
export declare const createSwapSchema: z.ZodObject<{
|
|
184
|
+
destination_address: z.ZodString;
|
|
185
|
+
source_network: z.ZodString;
|
|
186
|
+
source_token: z.ZodString;
|
|
187
|
+
destination_network: z.ZodString;
|
|
188
|
+
destination_token: z.ZodString;
|
|
189
|
+
reference_id: z.ZodOptional<z.ZodString>;
|
|
190
|
+
source_exchange: z.ZodOptional<z.ZodString>;
|
|
191
|
+
destination_exchange: z.ZodOptional<z.ZodString>;
|
|
192
|
+
refuel: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
use_deposit_address: z.ZodOptional<z.ZodBoolean>;
|
|
194
|
+
use_new_deposit_address: z.ZodOptional<z.ZodBoolean>;
|
|
195
|
+
amount: z.ZodNumber;
|
|
196
|
+
source_address: z.ZodOptional<z.ZodString>;
|
|
197
|
+
slippage: z.ZodOptional<z.ZodString>;
|
|
198
|
+
refund_address: z.ZodString;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
destination_network: string;
|
|
201
|
+
destination_token: string;
|
|
202
|
+
source_network: string;
|
|
203
|
+
source_token: string;
|
|
204
|
+
amount: number;
|
|
205
|
+
destination_address: string;
|
|
206
|
+
refund_address: string;
|
|
207
|
+
use_deposit_address?: boolean | undefined;
|
|
208
|
+
refuel?: boolean | undefined;
|
|
209
|
+
source_address?: string | undefined;
|
|
210
|
+
slippage?: string | undefined;
|
|
211
|
+
reference_id?: string | undefined;
|
|
212
|
+
source_exchange?: string | undefined;
|
|
213
|
+
destination_exchange?: string | undefined;
|
|
214
|
+
use_new_deposit_address?: boolean | undefined;
|
|
215
|
+
}, {
|
|
216
|
+
destination_network: string;
|
|
217
|
+
destination_token: string;
|
|
218
|
+
source_network: string;
|
|
219
|
+
source_token: string;
|
|
220
|
+
amount: number;
|
|
221
|
+
destination_address: string;
|
|
222
|
+
refund_address: string;
|
|
223
|
+
use_deposit_address?: boolean | undefined;
|
|
224
|
+
refuel?: boolean | undefined;
|
|
225
|
+
source_address?: string | undefined;
|
|
226
|
+
slippage?: string | undefined;
|
|
227
|
+
reference_id?: string | undefined;
|
|
228
|
+
source_exchange?: string | undefined;
|
|
229
|
+
destination_exchange?: string | undefined;
|
|
230
|
+
use_new_deposit_address?: boolean | undefined;
|
|
231
|
+
}>;
|
|
232
|
+
export type GetNetworksSchemaType = z.infer<typeof getNetworksSchema>;
|
|
233
|
+
export type GetSourcesSchemaType = z.infer<typeof getSourcesSchema>;
|
|
234
|
+
export type GetDestinationsSchemaType = z.infer<typeof getDestinationsSchema>;
|
|
235
|
+
export type GetSwapRouteLimitsSchemaType = z.infer<typeof getSwapRouteLimitsSchema>;
|
|
236
|
+
export type GetQuoteSchemaType = z.infer<typeof getQuoteSchema>;
|
|
237
|
+
export type GetDetailedQuoteSchemaType = z.infer<typeof getDetailedQuoteSchema>;
|
|
238
|
+
export type GetTransactionStatusSchemaType = z.infer<typeof getTransactionStatusSchema>;
|
|
239
|
+
export type GetSwapDetailsSchemaType = z.infer<typeof getSwapDetailsSchema>;
|
|
240
|
+
export type GetDepositActionsSchemaType = z.infer<typeof getDepositActionsSchema>;
|
|
241
|
+
export type GetAllSwapsSchemaType = z.infer<typeof getAllSwapsSchema>;
|
|
242
|
+
export type CreateSwapSchemaType = z.infer<typeof createSwapSchema>;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const getNetworksSchema = z.object({
|
|
3
|
+
network_types: z
|
|
4
|
+
.array(z.string())
|
|
5
|
+
.optional()
|
|
6
|
+
.describe('Filter networks by type. Possible values: evm, starknet, solana, cosmos, starkex, zksynclite, ton, paradex, tron, fuel, bitcoin, hyperliquid'),
|
|
7
|
+
});
|
|
8
|
+
export const getSourcesSchema = z.object({
|
|
9
|
+
destination_network: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe('Destination network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
13
|
+
destination_token: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Destination token symbol - use the token symbol property (e.g., ETH)'),
|
|
17
|
+
include_swaps: z
|
|
18
|
+
.boolean()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe('Whether to include swaps in the response'),
|
|
21
|
+
include_unavailable: z
|
|
22
|
+
.boolean()
|
|
23
|
+
.optional()
|
|
24
|
+
.describe('Whether to include unavailable sources'),
|
|
25
|
+
include_unmatched: z
|
|
26
|
+
.boolean()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Whether to include unmatched sources'),
|
|
29
|
+
has_deposit_address: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('Whether to filter sources that have deposit addresses'),
|
|
33
|
+
network_types: z
|
|
34
|
+
.array(z.string())
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Filter sources by network type. Possible values: evm, starknet, solana, cosmos, starkex, zksynclite, ton, paradex, tron, fuel, bitcoin, hyperliquid'),
|
|
37
|
+
});
|
|
38
|
+
export const getDestinationsSchema = z.object({
|
|
39
|
+
source_network: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Source network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
43
|
+
source_token: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Source token symbol - use the token symbol property (e.g., ETH)'),
|
|
47
|
+
include_swaps: z
|
|
48
|
+
.boolean()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Whether to include swaps in the response'),
|
|
51
|
+
include_unavailable: z
|
|
52
|
+
.boolean()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('Whether to include unavailable destinations'),
|
|
55
|
+
include_unmatched: z
|
|
56
|
+
.boolean()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Whether to include unmatched destinations'),
|
|
59
|
+
network_types: z
|
|
60
|
+
.array(z.string())
|
|
61
|
+
.optional()
|
|
62
|
+
.describe('Filter destinations by network type. Possible values: evm, starknet, solana, cosmos, starkex, zksynclite, ton, paradex, tron, fuel, bitcoin, hyperliquid'),
|
|
63
|
+
});
|
|
64
|
+
export const getSwapRouteLimitsSchema = z.object({
|
|
65
|
+
source_network: z
|
|
66
|
+
.string()
|
|
67
|
+
.describe('Source network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
68
|
+
source_token: z
|
|
69
|
+
.string()
|
|
70
|
+
.describe('Source token symbol - use the token symbol property (e.g., ETH)'),
|
|
71
|
+
destination_network: z
|
|
72
|
+
.string()
|
|
73
|
+
.describe('Destination network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
74
|
+
destination_token: z
|
|
75
|
+
.string()
|
|
76
|
+
.describe('Destination token symbol - use the token symbol property (e.g., ETH)'),
|
|
77
|
+
use_deposit_address: z
|
|
78
|
+
.boolean()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe('Whether to use deposit address'),
|
|
81
|
+
refuel: z.boolean().optional().describe('Whether to include refuel'),
|
|
82
|
+
});
|
|
83
|
+
export const getQuoteSchema = z.object({
|
|
84
|
+
source_network: z
|
|
85
|
+
.string()
|
|
86
|
+
.describe('Source network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
87
|
+
source_token: z
|
|
88
|
+
.string()
|
|
89
|
+
.describe('Source token symbol - use the token symbol property (e.g., ETH)'),
|
|
90
|
+
destination_network: z
|
|
91
|
+
.string()
|
|
92
|
+
.describe('Destination network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
93
|
+
destination_token: z
|
|
94
|
+
.string()
|
|
95
|
+
.describe('Destination token symbol - use the token symbol property (e.g., ETH)'),
|
|
96
|
+
amount: z.number().describe('Amount to swap'),
|
|
97
|
+
source_address: z.string().optional().describe('Source address'),
|
|
98
|
+
slippage: z
|
|
99
|
+
.string()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Slippage tolerance in percentage format (e.g., 10 = 10%)'),
|
|
102
|
+
use_deposit_address: z
|
|
103
|
+
.boolean()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe('Whether to use deposit address'),
|
|
106
|
+
refuel: z.boolean().optional().describe('Whether to include refuel'),
|
|
107
|
+
});
|
|
108
|
+
export const getDetailedQuoteSchema = z.object({
|
|
109
|
+
source_network: z
|
|
110
|
+
.string()
|
|
111
|
+
.describe('Source network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
112
|
+
source_token: z
|
|
113
|
+
.string()
|
|
114
|
+
.describe('Source token symbol - use the token symbol property (e.g., ETH)'),
|
|
115
|
+
destination_network: z
|
|
116
|
+
.string()
|
|
117
|
+
.describe('Destination network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
118
|
+
destination_token: z
|
|
119
|
+
.string()
|
|
120
|
+
.describe('Destination token symbol - use the token symbol property (e.g., ETH)'),
|
|
121
|
+
use_deposit_address: z
|
|
122
|
+
.boolean()
|
|
123
|
+
.optional()
|
|
124
|
+
.describe('Whether to use deposit address'),
|
|
125
|
+
refuel: z.boolean().optional().describe('Whether to include refuel'),
|
|
126
|
+
source_address: z.string().optional().describe('Source address'),
|
|
127
|
+
slippage: z
|
|
128
|
+
.string()
|
|
129
|
+
.optional()
|
|
130
|
+
.describe('Slippage tolerance in percentage format (e.g., 10 = 10%)'),
|
|
131
|
+
});
|
|
132
|
+
export const getTransactionStatusSchema = z.object({
|
|
133
|
+
network: z
|
|
134
|
+
.string()
|
|
135
|
+
.describe('Network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
136
|
+
transaction_id: z.string().describe('Transaction ID to check status'),
|
|
137
|
+
});
|
|
138
|
+
export const getSwapDetailsSchema = z.object({
|
|
139
|
+
swap_id: z.string().uuid().describe('Swap ID (UUID) to get details'),
|
|
140
|
+
exclude_deposit_actions: z
|
|
141
|
+
.boolean()
|
|
142
|
+
.optional()
|
|
143
|
+
.describe('Whether to exclude deposit actions from the response'),
|
|
144
|
+
source_address: z
|
|
145
|
+
.string()
|
|
146
|
+
.optional()
|
|
147
|
+
.describe('Source address to filter swap details'),
|
|
148
|
+
});
|
|
149
|
+
export const getDepositActionsSchema = z.object({
|
|
150
|
+
swap_id: z.string().uuid().describe('Swap ID (UUID) to get deposit actions'),
|
|
151
|
+
source_address: z.string().optional().describe('Source address'),
|
|
152
|
+
});
|
|
153
|
+
export const getAllSwapsSchema = z.object({
|
|
154
|
+
address: z.string().describe('Destination address to retrieve swaps for'),
|
|
155
|
+
page: z.number().optional().describe('Page number for pagination'),
|
|
156
|
+
include_expired: z.boolean().optional().describe('Include expired swaps'),
|
|
157
|
+
});
|
|
158
|
+
export const createSwapSchema = z.object({
|
|
159
|
+
destination_address: z
|
|
160
|
+
.string()
|
|
161
|
+
.describe('Destination address where the swap will be received'),
|
|
162
|
+
source_network: z
|
|
163
|
+
.string()
|
|
164
|
+
.describe('Source network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
165
|
+
source_token: z
|
|
166
|
+
.string()
|
|
167
|
+
.describe('Source token symbol - use the token symbol property (e.g., ETH)'),
|
|
168
|
+
destination_network: z
|
|
169
|
+
.string()
|
|
170
|
+
.describe('Destination network name - use the network name property (e.g., ETHEREUM_MAINNET, BASE_MAINNET)'),
|
|
171
|
+
destination_token: z
|
|
172
|
+
.string()
|
|
173
|
+
.describe('Destination token symbol - use the token symbol property (e.g., ETH)'),
|
|
174
|
+
reference_id: z
|
|
175
|
+
.string()
|
|
176
|
+
.optional()
|
|
177
|
+
.describe('Optional reference ID for tracking the swap'),
|
|
178
|
+
source_exchange: z
|
|
179
|
+
.string()
|
|
180
|
+
.optional()
|
|
181
|
+
.describe('Source exchange name if applicable'),
|
|
182
|
+
destination_exchange: z
|
|
183
|
+
.string()
|
|
184
|
+
.optional()
|
|
185
|
+
.describe('Destination exchange name if applicable'),
|
|
186
|
+
refuel: z.boolean().optional().describe('Whether to include refuel'),
|
|
187
|
+
use_deposit_address: z
|
|
188
|
+
.boolean()
|
|
189
|
+
.optional()
|
|
190
|
+
.describe('Whether to use deposit address'),
|
|
191
|
+
use_new_deposit_address: z
|
|
192
|
+
.boolean()
|
|
193
|
+
.optional()
|
|
194
|
+
.describe('Whether to use a new deposit address'),
|
|
195
|
+
amount: z
|
|
196
|
+
.number()
|
|
197
|
+
.describe('Amount to swap in human decimal format (e.g., 1 = 1 ETH or 1 USDC)'),
|
|
198
|
+
source_address: z.string().optional().describe('Source address'),
|
|
199
|
+
slippage: z
|
|
200
|
+
.string()
|
|
201
|
+
.optional()
|
|
202
|
+
.describe('Slippage tolerance in percentage format (e.g., 10 = 10%)'),
|
|
203
|
+
refund_address: z
|
|
204
|
+
.string()
|
|
205
|
+
.describe('Address to receive refunds if the swap fails'),
|
|
206
|
+
});
|
|
207
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,CAAC;SACb,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,8IAA8I,CAC/I;CACJ,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,mBAAmB,EAAE,CAAC;SACnB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iGAAiG,CAClG;IACH,iBAAiB,EAAE,CAAC;SACjB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,sEAAsE,CACvE;IACH,aAAa,EAAE,CAAC;SACb,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0C,CAAC;IACvD,mBAAmB,EAAE,CAAC;SACnB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,wCAAwC,CAAC;IACrD,iBAAiB,EAAE,CAAC;SACjB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,sCAAsC,CAAC;IACnD,mBAAmB,EAAE,CAAC;SACnB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;IACpE,aAAa,EAAE,CAAC;SACb,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,qJAAqJ,CACtJ;CACJ,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C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,QAAQ,CAAC,sCAAsC,CAAC;IACnD,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CACP,oEAAoE,CACrE;IACH,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAChE,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IACvE,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,QAAQ,CAAC,8CAA8C,CAAC;CAC5D,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
|
+
import { LayerswapApiClient } from '../../lib/utils/apiClient.js';
|
|
3
|
+
import { GetAllSwapsSchemaType } from '../../schemas/index.js';
|
|
4
|
+
export declare const getAllSwaps: (apiClient: LayerswapApiClient, params: GetAllSwapsSchemaType) => Promise<toolResult>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const getAllSwaps = async (apiClient, params) => {
|
|
2
|
+
try {
|
|
3
|
+
const queryParams = new URLSearchParams();
|
|
4
|
+
queryParams.append('address', params.address);
|
|
5
|
+
if (params.page) {
|
|
6
|
+
queryParams.append('page', params.page.toString());
|
|
7
|
+
}
|
|
8
|
+
if (params.include_expired !== undefined) {
|
|
9
|
+
queryParams.append('include_expired', params.include_expired.toString());
|
|
10
|
+
}
|
|
11
|
+
const queryString = queryParams.toString();
|
|
12
|
+
const endpoint = `/api/v2/swaps?${queryString}`;
|
|
13
|
+
const swaps = await apiClient.get(endpoint);
|
|
14
|
+
return {
|
|
15
|
+
status: 'success',
|
|
16
|
+
data: swaps,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
status: 'failure',
|
|
22
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=getAllSwaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllSwaps.js","sourceRoot":"","sources":["../../../src/tools/read/getAllSwaps.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,SAA6B,EAC7B,MAA6B,EACR,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACzC,WAAW,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC3E,CAAC;QACD,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,iBAAiB,WAAW,EAAE,CAAC;QAChD,MAAM,KAAK,GAAQ,MAAM,SAAS,CAAC,GAAG,CAAM,QAAQ,CAAC,CAAC;QACtD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,KAAK;SACE,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
|
+
import { LayerswapApiClient } from '../../lib/utils/apiClient.js';
|
|
3
|
+
import { GetDepositActionsSchemaType } from '../../schemas/index.js';
|
|
4
|
+
export declare const getDepositActions: (apiClient: LayerswapApiClient, params: GetDepositActionsSchemaType) => Promise<toolResult>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const getDepositActions = async (apiClient, params) => {
|
|
2
|
+
try {
|
|
3
|
+
const queryParams = new URLSearchParams();
|
|
4
|
+
if (params.source_address) {
|
|
5
|
+
queryParams.append('source_address', params.source_address);
|
|
6
|
+
}
|
|
7
|
+
const queryString = queryParams.toString();
|
|
8
|
+
const endpoint = `/api/v2/swaps/${params.swap_id}/deposit_actions${queryString ? `?${queryString}` : ''}`;
|
|
9
|
+
const depositActions = await apiClient.get(endpoint);
|
|
10
|
+
return {
|
|
11
|
+
status: 'success',
|
|
12
|
+
data: depositActions,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return {
|
|
17
|
+
status: 'failure',
|
|
18
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=getDepositActions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDepositActions.js","sourceRoot":"","sources":["../../../src/tools/read/getDepositActions.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,SAA6B,EAC7B,MAAmC,EACd,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1B,WAAW,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,iBAAiB,MAAM,CAAC,OAAO,mBAC9C,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,EACpC,EAAE,CAAC;QACH,MAAM,cAAc,GAAQ,MAAM,SAAS,CAAC,GAAG,CAAM,QAAQ,CAAC,CAAC;QAC/D,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,cAAc;SACP,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
|
+
import { LayerswapApiClient } from '../../lib/utils/apiClient.js';
|
|
3
|
+
import { GetDestinationsSchemaType } from '../../schemas/index.js';
|
|
4
|
+
export declare const getDestinations: (apiClient: LayerswapApiClient, params?: GetDestinationsSchemaType) => Promise<toolResult>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const getDestinations = async (apiClient, params) => {
|
|
2
|
+
try {
|
|
3
|
+
const queryParams = new URLSearchParams();
|
|
4
|
+
if (params?.source_network) {
|
|
5
|
+
queryParams.append('source_network', params.source_network.toUpperCase());
|
|
6
|
+
}
|
|
7
|
+
if (params?.source_token) {
|
|
8
|
+
queryParams.append('source_token', params.source_token.toUpperCase());
|
|
9
|
+
}
|
|
10
|
+
if (params?.include_swaps !== undefined) {
|
|
11
|
+
queryParams.append('include_swaps', params.include_swaps.toString());
|
|
12
|
+
}
|
|
13
|
+
if (params?.include_unavailable !== undefined) {
|
|
14
|
+
queryParams.append('include_unavailable', params.include_unavailable.toString());
|
|
15
|
+
}
|
|
16
|
+
if (params?.include_unmatched !== undefined) {
|
|
17
|
+
queryParams.append('include_unmatched', params.include_unmatched.toString());
|
|
18
|
+
}
|
|
19
|
+
if (params?.network_types && params.network_types.length > 0) {
|
|
20
|
+
params.network_types.forEach((type) => {
|
|
21
|
+
queryParams.append('network_types', type);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const queryString = queryParams.toString();
|
|
25
|
+
const endpoint = `/api/v2/destinations${queryString ? `?${queryString}` : ''}`;
|
|
26
|
+
const destinations = await apiClient.get(endpoint);
|
|
27
|
+
return {
|
|
28
|
+
status: 'success',
|
|
29
|
+
data: destinations,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
return {
|
|
34
|
+
status: 'failure',
|
|
35
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=getDestinations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDestinations.js","sourceRoot":"","sources":["../../../src/tools/read/getDestinations.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,SAA6B,EAC7B,MAAkC,EACb,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,MAAM,EAAE,cAAc,EAAE,CAAC;YAC3B,WAAW,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,MAAM,EAAE,YAAY,EAAE,CAAC;YACzB,WAAW,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,MAAM,EAAE,aAAa,KAAK,SAAS,EAAE,CAAC;YACxC,WAAW,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,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
import { LayerswapApiClient } from '../../lib/utils/apiClient.js';
|
|
3
|
+
import { GetDetailedQuoteSchemaType } from '../../schemas/index.js';
|
|
4
|
+
export declare const getDetailedQuote: (apiClient: LayerswapApiClient, params: GetDetailedQuoteSchemaType) => Promise<toolResult>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const getDetailedQuote = async (apiClient, params) => {
|
|
2
|
+
try {
|
|
3
|
+
const queryParams = new URLSearchParams();
|
|
4
|
+
queryParams.append('source_network', params.source_network.toUpperCase());
|
|
5
|
+
queryParams.append('source_token', params.source_token.toUpperCase());
|
|
6
|
+
queryParams.append('destination_network', params.destination_network.toUpperCase());
|
|
7
|
+
queryParams.append('destination_token', params.destination_token.toUpperCase());
|
|
8
|
+
queryParams.append('use_deposit_address', (params.use_deposit_address ?? false).toString());
|
|
9
|
+
if (params.refuel !== undefined) {
|
|
10
|
+
queryParams.append('refuel', params.refuel.toString());
|
|
11
|
+
}
|
|
12
|
+
if (params.source_address) {
|
|
13
|
+
queryParams.append('source_address', params.source_address);
|
|
14
|
+
}
|
|
15
|
+
if (params.slippage) {
|
|
16
|
+
const slippageDecimal = (parseFloat(params.slippage) / 100).toString();
|
|
17
|
+
queryParams.append('slippage', slippageDecimal);
|
|
18
|
+
}
|
|
19
|
+
const endpoint = `/api/v2/detailed_quote?${queryParams.toString()}`;
|
|
20
|
+
const quote = await apiClient.get(endpoint);
|
|
21
|
+
return {
|
|
22
|
+
status: 'success',
|
|
23
|
+
data: quote,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return {
|
|
28
|
+
status: 'failure',
|
|
29
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=getDetailedQuote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDetailedQuote.js","sourceRoot":"","sources":["../../../src/tools/read/getDetail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AE,EAAE,CAAC;QACpE,MAAM,KAAK,GAAQ,MAAM,SAAS,CAAC,GAAG,CAAM,QAAQ,CAAC,CAAC;QACtD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,KAAK;SACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { toolResult } from '@kasarlabs/ask-starknet-core';
|
|
2
|
+
import { LayerswapApiClient } from '../../lib/utils/apiClient.js';
|
|
3
|
+
import { GetNetworksSchemaType } from '../../schemas/index.js';
|
|
4
|
+
export declare const getNetworks: (apiClient: LayerswapApiClient, params?: GetNetworksSchemaType) => Promise<toolResult>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const getNetworks = async (apiClient, params) => {
|
|
2
|
+
try {
|
|
3
|
+
const queryParams = new URLSearchParams();
|
|
4
|
+
if (params?.network_types && params.network_types.length > 0) {
|
|
5
|
+
params.network_types.forEach((type) => {
|
|
6
|
+
queryParams.append('network_types', type);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
const endpoint = `/api/v2/networks${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
10
|
+
const result = await apiClient.get(endpoint);
|
|
11
|
+
return {
|
|
12
|
+
status: 'success',
|
|
13
|
+
data: result,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return {
|
|
18
|
+
status: 'failure',
|
|
19
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=getNetworks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNetworks.js","sourceRoot":"","sources":["../../../src/tools/read/getNetworks.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,SAA6B,EAC7B,MAA8B,EACT,EAAE;IACvB,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;QAC1C,IAAI,MAAM,EAAE,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7D,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;gBACpC,WAAW,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,QAAQ,GAAG,mBAAmB,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACjG,MAAM,MAAM,GAAQ,MAAM,SAAS,CAAC,GAAG,CAAM,QAAQ,CAAC,CAAC;QACvD,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,MAAM;SACC,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;SAChE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|