@lendasat/lendaswap-sdk-pure 0.0.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/README.md +297 -0
- package/dist/api/client.d.ts +34 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +12 -0
- package/dist/api/client.js.map +1 -0
- package/dist/client.d.ts +585 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1200 -0
- package/dist/client.js.map +1 -0
- package/dist/create/arkade.d.ts +28 -0
- package/dist/create/arkade.d.ts.map +1 -0
- package/dist/create/arkade.js +83 -0
- package/dist/create/arkade.js.map +1 -0
- package/dist/create/bitcoin.d.ts +28 -0
- package/dist/create/bitcoin.d.ts.map +1 -0
- package/dist/create/bitcoin.js +81 -0
- package/dist/create/bitcoin.js.map +1 -0
- package/dist/create/evm-to-arkade.d.ts +35 -0
- package/dist/create/evm-to-arkade.d.ts.map +1 -0
- package/dist/create/evm-to-arkade.js +90 -0
- package/dist/create/evm-to-arkade.js.map +1 -0
- package/dist/create/evm-to-lightning.d.ts +34 -0
- package/dist/create/evm-to-lightning.d.ts.map +1 -0
- package/dist/create/evm-to-lightning.js +83 -0
- package/dist/create/evm-to-lightning.js.map +1 -0
- package/dist/create/index.d.ts +17 -0
- package/dist/create/index.d.ts.map +1 -0
- package/dist/create/index.js +16 -0
- package/dist/create/index.js.map +1 -0
- package/dist/create/lightning.d.ts +28 -0
- package/dist/create/lightning.d.ts.map +1 -0
- package/dist/create/lightning.js +81 -0
- package/dist/create/lightning.js.map +1 -0
- package/dist/create/types.d.ts +110 -0
- package/dist/create/types.d.ts.map +1 -0
- package/dist/create/types.js +5 -0
- package/dist/create/types.js.map +1 -0
- package/dist/esplora.d.ts +38 -0
- package/dist/esplora.d.ts.map +1 -0
- package/dist/esplora.js +46 -0
- package/dist/esplora.js.map +1 -0
- package/dist/evm/htlc.d.ts +145 -0
- package/dist/evm/htlc.d.ts.map +1 -0
- package/dist/evm/htlc.js +187 -0
- package/dist/evm/htlc.js.map +1 -0
- package/dist/evm/index.d.ts +7 -0
- package/dist/evm/index.d.ts.map +1 -0
- package/dist/evm/index.js +7 -0
- package/dist/evm/index.js.map +1 -0
- package/dist/generated/api.d.ts +2673 -0
- package/dist/generated/api.d.ts.map +1 -0
- package/dist/generated/api.js +6 -0
- package/dist/generated/api.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +19 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +19 -0
- package/dist/node.js.map +1 -0
- package/dist/redeem/arkade.d.ts +65 -0
- package/dist/redeem/arkade.d.ts.map +1 -0
- package/dist/redeem/arkade.js +217 -0
- package/dist/redeem/arkade.js.map +1 -0
- package/dist/redeem/ethereum.d.ts +36 -0
- package/dist/redeem/ethereum.d.ts.map +1 -0
- package/dist/redeem/ethereum.js +121 -0
- package/dist/redeem/ethereum.js.map +1 -0
- package/dist/redeem/gasless.d.ts +22 -0
- package/dist/redeem/gasless.d.ts.map +1 -0
- package/dist/redeem/gasless.js +64 -0
- package/dist/redeem/gasless.js.map +1 -0
- package/dist/redeem/index.d.ts +52 -0
- package/dist/redeem/index.d.ts.map +1 -0
- package/dist/redeem/index.js +110 -0
- package/dist/redeem/index.js.map +1 -0
- package/dist/redeem/types.d.ts +74 -0
- package/dist/redeem/types.d.ts.map +1 -0
- package/dist/redeem/types.js +23 -0
- package/dist/redeem/types.js.map +1 -0
- package/dist/refund/arkade.d.ts +62 -0
- package/dist/refund/arkade.d.ts.map +1 -0
- package/dist/refund/arkade.js +212 -0
- package/dist/refund/arkade.js.map +1 -0
- package/dist/refund/index.d.ts +10 -0
- package/dist/refund/index.d.ts.map +1 -0
- package/dist/refund/index.js +10 -0
- package/dist/refund/index.js.map +1 -0
- package/dist/refund/onchain.d.ts +83 -0
- package/dist/refund/onchain.d.ts.map +1 -0
- package/dist/refund/onchain.js +236 -0
- package/dist/refund/onchain.js.map +1 -0
- package/dist/signer/index.d.ts +106 -0
- package/dist/signer/index.d.ts.map +1 -0
- package/dist/signer/index.js +179 -0
- package/dist/signer/index.js.map +1 -0
- package/dist/storage/idb.d.ts +63 -0
- package/dist/storage/idb.d.ts.map +1 -0
- package/dist/storage/idb.js +148 -0
- package/dist/storage/idb.js.map +1 -0
- package/dist/storage/index.d.ts +152 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +98 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/sqlite.d.ts +95 -0
- package/dist/storage/sqlite.d.ts.map +1 -0
- package/dist/storage/sqlite.js +206 -0
- package/dist/storage/sqlite.js.map +1 -0
- package/dist/storage/types.d.ts +55 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +9 -0
- package/dist/storage/types.js.map +1 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Lendaswap Pure TypeScript SDK
|
|
2
|
+
|
|
3
|
+
A pure TypeScript SDK for interacting with the Lendaswap API. This SDK is designed to work in all JavaScript
|
|
4
|
+
environments, including React Native.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @lendasat/lendaswap-sdk-pure
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Supported Swaps
|
|
13
|
+
|
|
14
|
+
This SDK currently supports the following swap directions:
|
|
15
|
+
|
|
16
|
+
| Source | Target | Status |
|
|
17
|
+
| ------------ | --------------------- | --------- |
|
|
18
|
+
| Lightning | Polygon (USDC, USDT) | Supported |
|
|
19
|
+
| Lightning | Arbitrum (USDC, USDT) | Supported |
|
|
20
|
+
| Arkade | Polygon (USDC, USDT) | Supported |
|
|
21
|
+
| Arkade | Arbitrum (USDC, USDT) | Supported |
|
|
22
|
+
| On-chain BTC | Polygon (USDC, USDT) | Supported |
|
|
23
|
+
| On-chain BTC | Arbitrum (USDC, USDT) | Supported |
|
|
24
|
+
|
|
25
|
+
**Refund support:**
|
|
26
|
+
|
|
27
|
+
- Lightning swaps: Auto-expire, no refund needed
|
|
28
|
+
- Arkade swaps: Off-chain refund via Arkade protocol
|
|
29
|
+
- On-chain BTC swaps: On-chain refund transaction after timelock
|
|
30
|
+
|
|
31
|
+
> More swap directions (e.g., EVM to BTC) will be added in future versions.
|
|
32
|
+
|
|
33
|
+
## Usage
|
|
34
|
+
|
|
35
|
+
### Setup
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Client, IdbWalletStorage, IdbSwapStorage } from "@lendasat/lendaswap-sdk-pure";
|
|
39
|
+
|
|
40
|
+
// Create a client with persistent storage (browser)
|
|
41
|
+
const client = await Client.builder()
|
|
42
|
+
.withSignerStorage(new IdbWalletStorage())
|
|
43
|
+
.withSwapStorage(new IdbSwapStorage())
|
|
44
|
+
.withApiKey("your-api-key")
|
|
45
|
+
.build();
|
|
46
|
+
|
|
47
|
+
// Or import an existing wallet
|
|
48
|
+
const client = await Client.builder()
|
|
49
|
+
.withSignerStorage(new IdbWalletStorage())
|
|
50
|
+
.withSwapStorage(new IdbSwapStorage())
|
|
51
|
+
.withMnemonic("abandon abandon abandon ...")
|
|
52
|
+
.build();
|
|
53
|
+
|
|
54
|
+
// Get the mnemonic (for backup)
|
|
55
|
+
const mnemonic = client.getMnemonic();
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Get a Quote
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
// Get available asset pairs
|
|
62
|
+
const pairs = await client.getAssetPairs();
|
|
63
|
+
|
|
64
|
+
// Get a quote for swapping 100k sats to USDC on Polygon
|
|
65
|
+
const quote = await client.getQuote("btc_arkade", "usdc_pol", 100000);
|
|
66
|
+
console.log(`You'll receive: ${quote.target_amount} USDC`);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Create a Swap
|
|
70
|
+
|
|
71
|
+
#### Lightning to EVM
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
const result = await client.createLightningToEvmSwap({
|
|
75
|
+
targetAddress: "0x1234567890abcdef1234567890abcdef12345678",
|
|
76
|
+
targetToken: "usdc_pol", // or "usdc_arb", "usdt_pol", "usdt_arb"
|
|
77
|
+
targetChain: "polygon", // or "arbitrum"
|
|
78
|
+
sourceAmount: 100000, // Amount in sats
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Pay the Lightning invoice to complete the swap
|
|
82
|
+
console.log(`Pay this invoice: ${result.response.ln_invoice}`);
|
|
83
|
+
console.log(`Swap ID: ${result.response.id}`);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### Arkade to EVM
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const result = await client.createArkadeToEvmSwap({
|
|
90
|
+
targetAddress: "0x1234567890abcdef1234567890abcdef12345678",
|
|
91
|
+
targetToken: "usdc_arb",
|
|
92
|
+
targetChain: "arbitrum",
|
|
93
|
+
sourceAmount: 100000,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Send BTC to the Arkade VHTLC address
|
|
97
|
+
console.log(`Send BTC to: ${result.response.htlc_address_arkade}`);
|
|
98
|
+
console.log(`Swap ID: ${result.response.id}`);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### On-chain BTC to EVM
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const result = await client.createBitcoinToEvmSwap({
|
|
105
|
+
targetAddress: "0x1234567890abcdef1234567890abcdef12345678",
|
|
106
|
+
targetToken: "usdc_pol",
|
|
107
|
+
targetChain: "polygon",
|
|
108
|
+
sourceAmount: 100000,
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Send BTC to the on-chain HTLC address
|
|
112
|
+
console.log(`Send BTC to: ${result.response.btc_htlc_address}`);
|
|
113
|
+
console.log(`Swap ID: ${result.response.id}`);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Monitor Swap Status
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// Get current swap status
|
|
120
|
+
const swap = await client.getSwap("swap-uuid");
|
|
121
|
+
console.log(`Status: ${swap.status}`);
|
|
122
|
+
|
|
123
|
+
// Status flow: pending -> clientfunded -> serverfunded -> clientredeemed -> serverredeemed
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Claim EVM Tokens
|
|
127
|
+
|
|
128
|
+
Once the server has funded the EVM HTLC (`serverfunded` status), claim your tokens:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
const claimResult = await client.claimEvmSwap("swap-uuid");
|
|
132
|
+
console.log(`Claim tx: ${claimResult.tx_hash}`);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Refund (if swap times out)
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
// For on-chain BTC swaps
|
|
139
|
+
const refundResult = await client.refundSwap("swap-uuid", {
|
|
140
|
+
destinationAddress: "bc1q...", // Your Bitcoin address
|
|
141
|
+
feeRateSatPerVb: 5,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// For Arkade swaps
|
|
145
|
+
const refundResult = await client.refundSwap("swap-uuid", {
|
|
146
|
+
destinationAddress: "ark1...", // Your Arkade address
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Storage
|
|
151
|
+
|
|
152
|
+
The SDK provides pluggable storage interfaces for persisting wallet and swap data.
|
|
153
|
+
Browser storage uses [Dexie](https://dexie.org/) for IndexedDB access with the database name `lendaswap-v3`.
|
|
154
|
+
|
|
155
|
+
**Storage Types:**
|
|
156
|
+
|
|
157
|
+
- `WalletStorage` - Stores mnemonic and key derivation index
|
|
158
|
+
- `SwapStorage` - Stores `StoredSwap` records (API response + client-side params)
|
|
159
|
+
|
|
160
|
+
**StoredSwap Structure:**
|
|
161
|
+
|
|
162
|
+
Each swap is stored with both the API response and client-side parameters needed for claim/refund operations:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
interface StoredSwap {
|
|
166
|
+
version: number; // Schema version for migrations
|
|
167
|
+
swapId: string; // Primary key
|
|
168
|
+
keyIndex: number; // Key derivation index
|
|
169
|
+
response: GetSwapResponse; // Full API response
|
|
170
|
+
publicKey: string; // Hex-encoded compressed public key
|
|
171
|
+
preimage: string; // Hex-encoded preimage for claiming HTLCs
|
|
172
|
+
preimageHash: string; // Hex-encoded hash lock
|
|
173
|
+
secretKey: string; // Hex-encoded secret key for signing
|
|
174
|
+
storedAt: number; // Timestamp when first stored
|
|
175
|
+
updatedAt: number; // Timestamp when last updated
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Usage:**
|
|
180
|
+
|
|
181
|
+
```typescript
|
|
182
|
+
import {
|
|
183
|
+
InMemoryWalletStorage,
|
|
184
|
+
InMemorySwapStorage,
|
|
185
|
+
IdbWalletStorage, // Browser only (IndexedDB via Dexie)
|
|
186
|
+
IdbSwapStorage, // Browser only (IndexedDB via Dexie)
|
|
187
|
+
idbStorageFactory, // Factory for creating IDB storage
|
|
188
|
+
inMemoryStorageFactory,
|
|
189
|
+
SWAP_STORAGE_VERSION,
|
|
190
|
+
type StoredSwap,
|
|
191
|
+
} from "@lendasat/lendaswap-sdk-pure";
|
|
192
|
+
|
|
193
|
+
// In-memory storage (for testing or temporary sessions)
|
|
194
|
+
const walletStorage = new InMemoryWalletStorage();
|
|
195
|
+
const swapStorage = new InMemorySwapStorage();
|
|
196
|
+
|
|
197
|
+
// IndexedDB storage (for browser persistence)
|
|
198
|
+
// Uses shared "lendaswap-v3" database with "wallet" and "swaps" tables
|
|
199
|
+
const walletStorage = new IdbWalletStorage();
|
|
200
|
+
const swapStorage = new IdbSwapStorage();
|
|
201
|
+
|
|
202
|
+
// Store a swap
|
|
203
|
+
await swapStorage.store({
|
|
204
|
+
version: SWAP_STORAGE_VERSION,
|
|
205
|
+
swapId: "uuid",
|
|
206
|
+
keyIndex: 0,
|
|
207
|
+
response: apiResponse,
|
|
208
|
+
publicKey: "02...",
|
|
209
|
+
preimage: "...",
|
|
210
|
+
preimageHash: "...",
|
|
211
|
+
secretKey: "...",
|
|
212
|
+
storedAt: Date.now(),
|
|
213
|
+
updatedAt: Date.now(),
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Update swap response (e.g., after polling for status)
|
|
217
|
+
await swapStorage.update("uuid", newApiResponse);
|
|
218
|
+
|
|
219
|
+
// Custom storage (implement the WalletStorage/SwapStorage interfaces)
|
|
220
|
+
// For React Native, you might use AsyncStorage or SQLite
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Development
|
|
224
|
+
|
|
225
|
+
### Project Structure
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
src/
|
|
229
|
+
├── api/
|
|
230
|
+
│ └── client.ts # Low-level API client wrapper
|
|
231
|
+
├── generated/
|
|
232
|
+
│ └── api.ts # Auto-generated types from OpenAPI spec
|
|
233
|
+
├── signer/
|
|
234
|
+
│ └── index.ts # HD wallet key derivation (BIP39/BIP32)
|
|
235
|
+
├── storage/
|
|
236
|
+
│ ├── index.ts # Storage interfaces and in-memory implementations
|
|
237
|
+
│ ├── idb.ts # IndexedDB storage for browsers
|
|
238
|
+
│ └── types.ts # StoredSwap type definition
|
|
239
|
+
├── client.ts # High-level Client class with convenience methods
|
|
240
|
+
└── index.ts # Public exports
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Auto-generated API Types
|
|
244
|
+
|
|
245
|
+
The TypeScript types in `src/generated/api.ts` are **auto-generated** from the OpenAPI specification. Do not edit this
|
|
246
|
+
file manually.
|
|
247
|
+
|
|
248
|
+
#### How it works
|
|
249
|
+
|
|
250
|
+
1. The Lendaswap backend generates an OpenAPI 3.0 specification (`openapi.json`)
|
|
251
|
+
using [utoipa](https://github.com/juhaku/utoipa)
|
|
252
|
+
2. We use [openapi-typescript](https://github.com/openapi-ts/openapi-typescript) to generate TypeScript types from the
|
|
253
|
+
spec
|
|
254
|
+
3. The [openapi-fetch](https://github.com/openapi-ts/openapi-typescript/tree/main/packages/openapi-fetch) library
|
|
255
|
+
provides a type-safe HTTP client
|
|
256
|
+
|
|
257
|
+
#### Regenerating the API client
|
|
258
|
+
|
|
259
|
+
When the backend API changes:
|
|
260
|
+
|
|
261
|
+
1. Download the latest OpenAPI spec from the backend:
|
|
262
|
+
```bash
|
|
263
|
+
curl -o openapi.json https://apilendaswap.lendasat.com/api-docs/openapi.json
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
2. Run the generate command:
|
|
267
|
+
```bash
|
|
268
|
+
npm run generate:api
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
This will regenerate `src/generated/api.ts` with the updated types.
|
|
272
|
+
|
|
273
|
+
### Scripts
|
|
274
|
+
|
|
275
|
+
| Command | Description |
|
|
276
|
+
| ---------------------- | -------------------------------------- |
|
|
277
|
+
| `npm run build` | Compile TypeScript to JavaScript |
|
|
278
|
+
| `npm run test` | Run tests with Vitest |
|
|
279
|
+
| `npm run lint` | Run Biome linter |
|
|
280
|
+
| `npm run lint:fix` | Fix linting issues |
|
|
281
|
+
| `npm run generate:api` | Regenerate API types from OpenAPI spec |
|
|
282
|
+
|
|
283
|
+
### Adding New Features
|
|
284
|
+
|
|
285
|
+
When adding new functionality:
|
|
286
|
+
|
|
287
|
+
1. **API methods**: Add convenience methods to `src/client.ts` that wrap the low-level API calls
|
|
288
|
+
2. **New types**: If the backend adds new endpoints, regenerate the API types first
|
|
289
|
+
3. **Exports**: Update `src/index.ts` to export any new public types or classes
|
|
290
|
+
|
|
291
|
+
### Dependencies
|
|
292
|
+
|
|
293
|
+
- `openapi-fetch` - Type-safe HTTP client for OpenAPI specs
|
|
294
|
+
- `@noble/hashes` - Cryptographic hash functions
|
|
295
|
+
- `@scure/bip32` - BIP32 HD wallet derivation
|
|
296
|
+
- `@scure/bip39` - BIP39 mnemonic phrase handling
|
|
297
|
+
- `dexie` - IndexedDB wrapper for browser storage
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import createClient from "openapi-fetch";
|
|
2
|
+
import type { components, paths } from "../generated/api.js";
|
|
3
|
+
export type ApiClient = ReturnType<typeof createClient<paths>>;
|
|
4
|
+
export type { paths, components };
|
|
5
|
+
export type TokenId = components["schemas"]["TokenId"];
|
|
6
|
+
export type TokenInfo = components["schemas"]["TokenInfo"];
|
|
7
|
+
export type AssetPair = components["schemas"]["AssetPair"];
|
|
8
|
+
export type SwapStatus = components["schemas"]["SwapStatus"];
|
|
9
|
+
export type QuoteResponse = components["schemas"]["QuoteResponse"];
|
|
10
|
+
export type GetSwapResponse = components["schemas"]["GetSwapResponse"];
|
|
11
|
+
export type BtcToEvmSwapResponse = components["schemas"]["BtcToEvmSwapResponse"];
|
|
12
|
+
export type OnchainToEvmSwapResponse = components["schemas"]["OnchainToEvmSwapResponse"];
|
|
13
|
+
export type EvmToBtcSwapResponse = components["schemas"]["EvmToBtcSwapResponse"];
|
|
14
|
+
export type BtcToArkadeSwapResponse = components["schemas"]["BtcToArkadeSwapResponse"];
|
|
15
|
+
export type ArkadeToPolygonSwapRequest = components["schemas"]["ArkadeToPolygonSwapRequest"];
|
|
16
|
+
export type ArkadeToEthereumSwapRequest = components["schemas"]["ArkadeToEthereumSwapRequest"];
|
|
17
|
+
export type ArkadeToArbitrumSwapRequest = components["schemas"]["ArkadeToArbitrumSwapRequest"];
|
|
18
|
+
export type LightningToPolygonSwapRequest = components["schemas"]["LightningToPolygonSwapRequest"];
|
|
19
|
+
export type LightningToEthereumSwapRequest = components["schemas"]["LightningToEthereumSwapRequest"];
|
|
20
|
+
export type LightningToArbitrumSwapRequest = components["schemas"]["LightningToArbitrumSwapRequest"];
|
|
21
|
+
export type BitcoinToPolygonSwapRequest = components["schemas"]["BitcoinToPolygonSwapRequest"];
|
|
22
|
+
export type BitcoinToEthereumSwapRequest = components["schemas"]["BitcoinToEthereumSwapRequest"];
|
|
23
|
+
export type BitcoinToArbitrumSwapRequest = components["schemas"]["BitcoinToArbitrumSwapRequest"];
|
|
24
|
+
export type PolygonToArkadeSwapRequest = components["schemas"]["PolygonToArkadeSwapRequest"];
|
|
25
|
+
export type ArbitrumToArkadeSwapRequest = components["schemas"]["ArbitrumToArkadeSwapRequest"];
|
|
26
|
+
export type EthereumToArkadeSwapRequest = components["schemas"]["EthereumToArkadeSwapRequest"];
|
|
27
|
+
export type ClaimGelatoRequest = components["schemas"]["ClaimGelatoRequest"];
|
|
28
|
+
export type ClaimGelatoResponse = components["schemas"]["ClaimGelatoResponse"];
|
|
29
|
+
export interface ApiClientOptions {
|
|
30
|
+
baseUrl: string;
|
|
31
|
+
apiKey?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function createApiClient(options: ApiClientOptions): ApiClient;
|
|
34
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import createClient from "openapi-fetch";
|
|
2
|
+
export function createApiClient(options) {
|
|
3
|
+
const headers = {};
|
|
4
|
+
if (options.apiKey) {
|
|
5
|
+
headers["X-API-Key"] = options.apiKey;
|
|
6
|
+
}
|
|
7
|
+
return createClient({
|
|
8
|
+
baseUrl: options.baseUrl,
|
|
9
|
+
headers,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AA2DzC,MAAM,UAAU,eAAe,CAAC,OAAyB;IACvD,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IACxC,CAAC;IAED,OAAO,YAAY,CAAQ;QACzB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|