@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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +253 -0
  3. package/bin/layerswap-mcp.js +2 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +137 -0
  6. package/build/index.js.map +1 -0
  7. package/build/lib/config.d.ts +4 -0
  8. package/build/lib/config.js +9 -0
  9. package/build/lib/config.js.map +1 -0
  10. package/build/lib/utils/apiClient.d.ts +8 -0
  11. package/build/lib/utils/apiClient.js +41 -0
  12. package/build/lib/utils/apiClient.js.map +1 -0
  13. package/build/schemas/index.d.ts +242 -0
  14. package/build/schemas/index.js +207 -0
  15. package/build/schemas/index.js.map +1 -0
  16. package/build/tools/read/getAllSwaps.d.ts +4 -0
  17. package/build/tools/read/getAllSwaps.js +26 -0
  18. package/build/tools/read/getAllSwaps.js.map +1 -0
  19. package/build/tools/read/getDepositActions.d.ts +4 -0
  20. package/build/tools/read/getDepositActions.js +22 -0
  21. package/build/tools/read/getDepositActions.js.map +1 -0
  22. package/build/tools/read/getDestinations.d.ts +4 -0
  23. package/build/tools/read/getDestinations.js +39 -0
  24. package/build/tools/read/getDestinations.js.map +1 -0
  25. package/build/tools/read/getDetailedQuote.d.ts +4 -0
  26. package/build/tools/read/getDetailedQuote.js +33 -0
  27. package/build/tools/read/getDetailedQuote.js.map +1 -0
  28. package/build/tools/read/getNetworks.d.ts +4 -0
  29. package/build/tools/read/getNetworks.js +23 -0
  30. package/build/tools/read/getNetworks.js.map +1 -0
  31. package/build/tools/read/getQuote.d.ts +4 -0
  32. package/build/tools/read/getQuote.js +35 -0
  33. package/build/tools/read/getQuote.js.map +1 -0
  34. package/build/tools/read/getSources.d.ts +4 -0
  35. package/build/tools/read/getSources.js +42 -0
  36. package/build/tools/read/getSources.js.map +1 -0
  37. package/build/tools/read/getSwapDetails.d.ts +4 -0
  38. package/build/tools/read/getSwapDetails.js +25 -0
  39. package/build/tools/read/getSwapDetails.js.map +1 -0
  40. package/build/tools/read/getSwapRouteLimits.d.ts +4 -0
  41. package/build/tools/read/getSwapRouteLimits.js +26 -0
  42. package/build/tools/read/getSwapRouteLimits.js.map +1 -0
  43. package/build/tools/read/getTransactionStatus.d.ts +4 -0
  44. package/build/tools/read/getTransactionStatus.js +20 -0
  45. package/build/tools/read/getTransactionStatus.js.map +1 -0
  46. package/build/tools/write/createSwap.d.ts +4 -0
  47. package/build/tools/write/createSwap.js +121 -0
  48. package/build/tools/write/createSwap.js.map +1 -0
  49. package/package.json +42 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Kasar Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,253 @@
1
+ # Layerswap MCP
2
+
3
+ MCP server for Layerswap cross-chain bridge operations on Starknet. Layerswap enables seamless asset transfers between multiple blockchains including Ethereum, Starknet, Solana, Cosmos, and many others.
4
+
5
+ ## About Layerswap
6
+
7
+ Layerswap is a cross-chain bridge protocol that allows users to transfer assets between different blockchain networks. It supports a wide range of networks including EVM chains, Starknet, Solana, Cosmos, StarkEx, zkSync Lite, TON, Paradex, Tron, Fuel, Bitcoin, and Hyperliquid.
8
+
9
+ ## Features
10
+
11
+ This MCP provides **11 tools** for interacting with Layerswap:
12
+
13
+ ### Read Operations
14
+
15
+ #### `get_networks`
16
+
17
+ Get all available networks supported by Layerswap.
18
+
19
+ **Parameters:**
20
+
21
+ - `network_types` (optional): Filter networks by type. Possible values: `evm`, `starknet`, `solana`, `cosmos`, `starkex`, `zksynclite`, `ton`, `paradex`, `tron`, `fuel`, `bitcoin`, `hyperliquid`
22
+
23
+ **Example:**
24
+
25
+ ```
26
+ "Get all available networks on Layerswap"
27
+ "Show me all EVM networks supported by Layerswap"
28
+ ```
29
+
30
+ #### `get_sources`
31
+
32
+ Get available sources (networks/tokens) for transfers. Useful for discovering what assets can be sent from.
33
+
34
+ **Parameters:**
35
+
36
+ - `destination_network` (optional): Filter by destination network name (e.g., `ETHEREUM_MAINNET`, `BASE_MAINNET`)
37
+ - `destination_token` (optional): Filter by destination token symbol (e.g., `ETH`)
38
+ - `include_swaps` (optional): Whether to include swaps in the response
39
+ - `include_unavailable` (optional): Whether to include unavailable sources
40
+ - `include_unmatched` (optional): Whether to include unmatched sources
41
+ - `has_deposit_address` (optional): Filter sources that have deposit addresses
42
+ - `network_types` (optional): Filter by network type array
43
+
44
+ **Example:**
45
+
46
+ ```
47
+ "Get available sources for transferring to Starknet"
48
+ "What tokens can I send to Ethereum mainnet?"
49
+ ```
50
+
51
+ #### `get_destinations`
52
+
53
+ Get available destinations (networks/tokens) for transfers. Useful for discovering where assets can be sent to.
54
+
55
+ **Parameters:**
56
+
57
+ - `source_network` (optional): Filter by source network name
58
+ - `source_token` (optional): Filter by source token symbol
59
+ - `include_swaps` (optional): Whether to include swaps in the response
60
+ - `include_unavailable` (optional): Whether to include unavailable destinations
61
+ - `include_unmatched` (optional): Whether to include unmatched destinations
62
+ - `network_types` (optional): Filter by network type array
63
+
64
+ **Example:**
65
+
66
+ ```
67
+ "Get available destinations from Starknet"
68
+ "Where can I send ETH from Ethereum?"
69
+ ```
70
+
71
+ #### `get_swap_route_limits`
72
+
73
+ Get swap route limits (minimum and maximum amounts) for a specific source and destination route.
74
+
75
+ **Parameters:**
76
+
77
+ - `source_network` (required): Source network name (e.g., `ETHEREUM_MAINNET`)
78
+ - `source_token` (required): Source token symbol (e.g., `ETH`)
79
+ - `destination_network` (required): Destination network name
80
+ - `destination_token` (required): Destination token symbol
81
+ - `use_deposit_address` (optional): Whether to use deposit address
82
+ - `refuel` (optional): Whether to include refuel
83
+
84
+ **Example:**
85
+
86
+ ```
87
+ "Get swap limits for ETH from Ethereum to Starknet"
88
+ "What are the min and max amounts for USDC transfers from Base to Starknet?"
89
+ ```
90
+
91
+ #### `get_quote`
92
+
93
+ Get a quote for a specific swap, including the amount you'll receive and estimated fees.
94
+
95
+ **Parameters:**
96
+
97
+ - `source_network` (required): Source network name
98
+ - `source_token` (required): Source token symbol
99
+ - `destination_network` (required): Destination network name
100
+ - `destination_token` (required): Destination token symbol
101
+ - `amount` (required): Amount to swap
102
+ - `source_address` (optional): Source address
103
+ - `slippage` (optional): Slippage tolerance in percentage format (e.g., `10` = 10%)
104
+ - `use_deposit_address` (optional): Whether to use deposit address
105
+ - `refuel` (optional): Whether to include refuel
106
+
107
+ **Example:**
108
+
109
+ ```
110
+ "Get a quote for swapping 1 ETH from Ethereum to Starknet"
111
+ "How much USDC will I get if I swap 100 USDC from Base to Starknet?"
112
+ ```
113
+
114
+ #### `get_detailed_quote`
115
+
116
+ Get a detailed quote for a specific swap with comprehensive information about the transfer.
117
+
118
+ **Parameters:**
119
+
120
+ - `source_network` (required): Source network name
121
+ - `source_token` (required): Source token symbol
122
+ - `destination_network` (required): Destination network name
123
+ - `destination_token` (required): Destination token symbol
124
+ - `use_deposit_address` (optional): Whether to use deposit address
125
+ - `refuel` (optional): Whether to include refuel
126
+ - `source_address` (optional): Source address
127
+ - `slippage` (optional): Slippage tolerance in percentage format
128
+
129
+ **Example:**
130
+
131
+ ```
132
+ "Get a detailed quote for transferring ETH from Ethereum to Starknet"
133
+ "Show me detailed information about swapping USDC from Base to Starknet"
134
+ ```
135
+
136
+ #### `get_transaction_status`
137
+
138
+ Get the status of a transaction on a specific network.
139
+
140
+ **Parameters:**
141
+
142
+ - `network` (required): Network name (e.g., `ETHEREUM_MAINNET`, `STARKNET_MAINNET`)
143
+ - `transaction_id` (required): Transaction ID to check status
144
+
145
+ **Example:**
146
+
147
+ ```
148
+ "Check the status of transaction 0x123... on Ethereum"
149
+ "What's the status of my Starknet transaction?"
150
+ ```
151
+
152
+ #### `get_swap_details`
153
+
154
+ Get details of a specific swap by its swap ID.
155
+
156
+ **Parameters:**
157
+
158
+ - `swap_id` (required): Swap ID (UUID) to get details
159
+ - `exclude_deposit_actions` (optional): Whether to exclude deposit actions from the response
160
+ - `source_address` (optional): Source address to filter swap details
161
+
162
+ **Example:**
163
+
164
+ ```
165
+ "Get details for swap abc-123-def-456"
166
+ "Show me information about my swap"
167
+ ```
168
+
169
+ #### `get_deposit_actions`
170
+
171
+ Get deposit actions for a swap. These are the on-chain transactions that need to be executed to initiate the swap.
172
+
173
+ **Parameters:**
174
+
175
+ - `swap_id` (required): Swap ID (UUID) to get deposit actions
176
+ - `source_address` (optional): Source address
177
+
178
+ **Example:**
179
+
180
+ ```
181
+ "Get deposit actions for swap abc-123-def-456"
182
+ "What transactions do I need to execute for my swap?"
183
+ ```
184
+
185
+ #### `get_all_swaps`
186
+
187
+ Get all swaps for a specific destination address with optional pagination.
188
+
189
+ **Parameters:**
190
+
191
+ - `address` (required): Destination address to retrieve swaps for
192
+ - `page` (optional): Page number for pagination
193
+ - `include_expired` (optional): Include expired swaps
194
+
195
+ **Example:**
196
+
197
+ ```
198
+ "Get all my swaps for address 0x123..."
199
+ "Show me my swap history"
200
+ ```
201
+
202
+ ### Write Operations
203
+
204
+ #### `create_swap`
205
+
206
+ Create a new cross-chain swap via Layerswap and optionally execute the deposit transaction on-chain if the source address matches the environment account address.
207
+
208
+ **Parameters:**
209
+
210
+ - `destination_address` (required): Destination address where the swap will be received
211
+ - `source_network` (required): Source network name (e.g., `ETHEREUM_MAINNET`)
212
+ - `source_token` (required): Source token symbol (e.g., `ETH`)
213
+ - `destination_network` (required): Destination network name
214
+ - `destination_token` (required): Destination token symbol
215
+ - `amount` (required): Amount to swap in human decimal format (e.g., `1` = 1 ETH or 1 USDC)
216
+ - `refund_address` (required): Address to receive refunds if the swap fails
217
+ - `reference_id` (optional): Optional reference ID for tracking the swap
218
+ - `source_exchange` (optional): Source exchange name if applicable
219
+ - `destination_exchange` (optional): Destination exchange name if applicable
220
+ - `refuel` (optional): Whether to include refuel
221
+ - `use_deposit_address` (optional): Whether to use deposit address
222
+ - `use_new_deposit_address` (optional): Whether to use a new deposit address
223
+ - `source_address` (optional): Source address (defaults to environment account if available)
224
+ - `slippage` (optional): Slippage tolerance in percentage format (e.g., `10` = 10%)
225
+
226
+ **Note:** If a Starknet account is configured and the `source_address` matches the environment account address, the tool will automatically execute the deposit transaction on-chain and return the transaction hash in the response.
227
+
228
+ **Example:**
229
+
230
+ ```
231
+ "Create a swap to transfer 1 ETH from Ethereum to Starknet"
232
+ "Swap 100 USDC from Base to Starknet, send to address 0x123..."
233
+ ```
234
+
235
+ ## Environment Variables
236
+
237
+ - `LAYERSWAP_API_KEY`: Your Layerswap API key (optional - a public API key is used by default)
238
+ - `LAYERSWAP_API_URL`: Layerswap API base URL (optional, defaults to `https://api.layerswap.io`)
239
+ - `STARKNET_RPC_URL`: Starknet RPC URL (required for on-chain operations)
240
+ - `STARKNET_PRIVATE_KEY`: Starknet private key (required for executing deposit transactions)
241
+
242
+ **Note:** The package includes a public API key by default for basic usage. For production use with higher rate limits and analytics, set `LAYERSWAP_API_KEY` environment variable. Get your API key at [layerswap.io/dashboard](https://layerswap.io/dashboard).
243
+
244
+ ## Installation
245
+
246
+ ```bash
247
+ pnpm install
248
+ pnpm run build
249
+ ```
250
+
251
+ ## Development
252
+
253
+ To extend this MCP, add new tools in the `src/tools` directory and register them in the `registerTools` function in `src/index.ts`.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import('../build/index.js').catch(console.error);
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare const RegisterToolInServer: () => Promise<void>;
package/build/index.js ADDED
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { registerToolsWithServer, getOnchainWrite, } from '@kasarlabs/ask-starknet-core';
5
+ import dotenv from 'dotenv';
6
+ import { getNetworksSchema, getSourcesSchema, getDestinationsSchema, getSwapRouteLimitsSchema, getQuoteSchema, getDetailedQuoteSchema, getTransactionStatusSchema, getSwapDetailsSchema, getDepositActionsSchema, getAllSwapsSchema, createSwapSchema, } from './schemas/index.js';
7
+ import { getNetworks } from './tools/read/getNetworks.js';
8
+ import { getSources } from './tools/read/getSources.js';
9
+ import { getDestinations } from './tools/read/getDestinations.js';
10
+ import { getSwapRouteLimits } from './tools/read/getSwapRouteLimits.js';
11
+ import { getQuote } from './tools/read/getQuote.js';
12
+ import { getDetailedQuote } from './tools/read/getDetailedQuote.js';
13
+ import { getTransactionStatus } from './tools/read/getTransactionStatus.js';
14
+ import { getSwapDetails } from './tools/read/getSwapDetails.js';
15
+ import { getDepositActions } from './tools/read/getDepositActions.js';
16
+ import { getAllSwaps } from './tools/read/getAllSwaps.js';
17
+ import { createSwap } from './tools/write/createSwap.js';
18
+ import { LayerswapApiClient } from './lib/utils/apiClient.js';
19
+ import { getApiKey, getApiUrl } from './lib/config.js';
20
+ dotenv.config();
21
+ const server = new McpServer({
22
+ name: 'starknet-layerswap-mcp',
23
+ version: '0.1.0',
24
+ });
25
+ const getApiClient = () => {
26
+ const apiKey = getApiKey();
27
+ const apiUrl = getApiUrl();
28
+ return new LayerswapApiClient(apiKey, apiUrl);
29
+ };
30
+ const registerTools = (LayerswapToolRegistry) => {
31
+ const apiClient = getApiClient();
32
+ LayerswapToolRegistry.push({
33
+ name: 'get_networks',
34
+ description: 'Get all available networks supported by Layerswap',
35
+ schema: getNetworksSchema,
36
+ execute: async (params) => {
37
+ return await getNetworks(apiClient, params);
38
+ },
39
+ });
40
+ LayerswapToolRegistry.push({
41
+ name: 'get_sources',
42
+ description: 'Get available sources for transfers',
43
+ schema: getSourcesSchema,
44
+ execute: async (params) => {
45
+ return await getSources(apiClient, params);
46
+ },
47
+ });
48
+ LayerswapToolRegistry.push({
49
+ name: 'get_destinations',
50
+ description: 'Get available destinations for transfers',
51
+ schema: getDestinationsSchema,
52
+ execute: async (params) => {
53
+ return await getDestinations(apiClient, params);
54
+ },
55
+ });
56
+ LayerswapToolRegistry.push({
57
+ name: 'get_swap_route_limits',
58
+ description: 'Get swap route limits for a specific source and destination',
59
+ schema: getSwapRouteLimitsSchema,
60
+ execute: async (params) => {
61
+ return await getSwapRouteLimits(apiClient, params);
62
+ },
63
+ });
64
+ LayerswapToolRegistry.push({
65
+ name: 'get_quote',
66
+ description: 'Get a quote for a specific swap',
67
+ schema: getQuoteSchema,
68
+ execute: async (params) => {
69
+ return await getQuote(apiClient, params);
70
+ },
71
+ });
72
+ LayerswapToolRegistry.push({
73
+ name: 'get_detailed_quote',
74
+ description: 'Get a detailed quote for a specific swap',
75
+ schema: getDetailedQuoteSchema,
76
+ execute: async (params) => {
77
+ return await getDetailedQuote(apiClient, params);
78
+ },
79
+ });
80
+ LayerswapToolRegistry.push({
81
+ name: 'get_transaction_status',
82
+ description: 'Get the status of a transaction',
83
+ schema: getTransactionStatusSchema,
84
+ execute: async (params) => {
85
+ return await getTransactionStatus(apiClient, params);
86
+ },
87
+ });
88
+ LayerswapToolRegistry.push({
89
+ name: 'get_swap_details',
90
+ description: 'Get details of a specific swap',
91
+ schema: getSwapDetailsSchema,
92
+ execute: async (params) => {
93
+ return await getSwapDetails(apiClient, params);
94
+ },
95
+ });
96
+ LayerswapToolRegistry.push({
97
+ name: 'get_deposit_actions',
98
+ description: 'Get deposit actions for a swap',
99
+ schema: getDepositActionsSchema,
100
+ execute: async (params) => {
101
+ return await getDepositActions(apiClient, params);
102
+ },
103
+ });
104
+ LayerswapToolRegistry.push({
105
+ name: 'get_all_swaps',
106
+ description: 'Get all swaps for a specific destination address with optional pagination and expired swaps inclusion',
107
+ schema: getAllSwapsSchema,
108
+ execute: async (params) => {
109
+ return await getAllSwaps(apiClient, params);
110
+ },
111
+ });
112
+ LayerswapToolRegistry.push({
113
+ name: 'create_swap',
114
+ description: 'Create a new cross-chain swap via Layerswap and optionally execute the deposit transaction on-chain if the source address matches the environment account address.',
115
+ schema: createSwapSchema,
116
+ execute: async (params) => {
117
+ const onchainWrite = getOnchainWrite();
118
+ return await createSwap(apiClient, params, onchainWrite);
119
+ },
120
+ });
121
+ };
122
+ export const RegisterToolInServer = async () => {
123
+ const tools = [];
124
+ registerTools(tools);
125
+ await registerToolsWithServer(server, tools);
126
+ };
127
+ async function main() {
128
+ const transport = new StdioServerTransport();
129
+ await RegisterToolInServer();
130
+ await server.connect(transport);
131
+ console.error('Starknet Layerswap MCP Server running on stdio');
132
+ }
133
+ main().catch((error) => {
134
+ console.error('Fatal error in main():', error);
135
+ process.exit(1);
136
+ });
137
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAEL,uBAAuB,EACvB,eAAe,GAChB,MAAM,8BAA8B,CAAC;AACtC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QWlgnNFHnwH/4W+zHOcRoM5D3Sne3eCXRqUzHTMXBt0hrd+lO4ASw";
2
+ export declare const DEFAULT_API_URL = "https://api.layerswap.io";
3
+ export declare const getApiKey: () => string;
4
+ export declare const getApiUrl: () => string;
@@ -0,0 +1,9 @@
1
+ export const DEFAULT_PUBLIC_API_KEY = 'bwDJw8c1mesRyWfO3WrOB7iE48xAkVEI5QWlgnNFHnwH/4W+zHOcRoM5D3Sne3eCXRqUzHTMXBt0hrd+lO4ASw';
2
+ export const DEFAULT_API_URL = 'https://api.layerswap.io';
3
+ export const getApiKey = () => {
4
+ return process.env.LAYERSWAP_API_KEY || DEFAULT_PUBLIC_API_KEY;
5
+ };
6
+ export const getApiUrl = () => {
7
+ return process.env.LAYERSWAP_API_URL || DEFAULT_API_URL;
8
+ };
9
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAaA,MAAM,CAAC,MAAM,sBAAsB,GACjC,wFAAwF,CAAC;AAM3F,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAK1D,MAAM,CAAC,MAAM,SAAS,GAAG,GAAW,EAAE;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,sBAAsB,CAAC;AACjE,CAAC,CAAC;AAKF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAW,EAAE;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,eAAe,CAAC;AAC1D,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare class LayerswapApiClient {
2
+ private apiKey?;
3
+ private baseUrl;
4
+ constructor(apiKey?: string, baseUrl?: string);
5
+ private request;
6
+ get<T = any>(endpoint: string): Promise<T>;
7
+ post<T>(endpoint: string, body: any): Promise<T>;
8
+ }
@@ -0,0 +1,41 @@
1
+ export class LayerswapApiClient {
2
+ constructor(apiKey, baseUrl = 'https://api.layerswap.io') {
3
+ this.apiKey = apiKey;
4
+ this.baseUrl = baseUrl;
5
+ }
6
+ async request(method, endpoint, body) {
7
+ const url = `${this.baseUrl}${endpoint}`;
8
+ const headers = {
9
+ 'Content-Type': 'application/json',
10
+ };
11
+ if (this.apiKey) {
12
+ headers['X-LS-APIKEY'] = this.apiKey;
13
+ }
14
+ const options = {
15
+ method,
16
+ headers,
17
+ };
18
+ if (body && method === 'POST') {
19
+ options.body = JSON.stringify(body);
20
+ }
21
+ const response = await fetch(url, options);
22
+ if (!response.ok) {
23
+ const errorText = await response.text();
24
+ throw new Error(`Layerswap API error: ${response.status} ${response.statusText} - ${errorText}`);
25
+ }
26
+ try {
27
+ return (await response.json());
28
+ }
29
+ catch (error) {
30
+ throw new Error(`Failed to parse response as JSON: ${error}`);
31
+ }
32
+ }
33
+ async get(endpoint) {
34
+ const result = await this.request('GET', endpoint);
35
+ return result;
36
+ }
37
+ async post(endpoint, body) {
38
+ return this.request('POST', endpoint, body);
39
+ }
40
+ }
41
+ //# sourceMappingURL=apiClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../../src/lib/utils/apiClient.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,kBAAkB;IAI7B,YAAY,MAAe,EAAE,UAAkB,0BAA0B;QACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEO,KAAK,CAAC,OAAO,CACnB,MAAsB,EACtB,QAAgB,EAChB,IAAU;QAEV,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;QACzC,MAAM,OAAO,GAA2B;YACtC,cAAc,EAAE,kBAAkB;SACnC,CAAC;QAGF,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC;QACvC,CAAC;QAED,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