stableflow-ai-sdk 1.0.0

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/index.js ADDED
@@ -0,0 +1,626 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __typeError = (msg) => {
9
+ throw TypeError(msg);
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
33
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
34
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
35
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
36
+
37
+ // src/index.ts
38
+ var index_exports = {};
39
+ __export(index_exports, {
40
+ ApiError: () => ApiError,
41
+ CancelError: () => CancelError,
42
+ CancelablePromise: () => CancelablePromise,
43
+ GetExecutionStatusResponse: () => GetExecutionStatusResponse,
44
+ OpenAPI: () => OpenAPI,
45
+ QuoteRequest: () => QuoteRequest,
46
+ SFA: () => SFA,
47
+ SubmitDepositTxResponse: () => SubmitDepositTxResponse,
48
+ TokenResponse: () => TokenResponse
49
+ });
50
+ module.exports = __toCommonJS(index_exports);
51
+
52
+ // src/core/ApiError.ts
53
+ var ApiError = class extends Error {
54
+ constructor(request2, response, message) {
55
+ super(message);
56
+ this.name = "ApiError";
57
+ this.url = response.url;
58
+ this.status = response.status;
59
+ this.statusText = response.statusText;
60
+ this.body = response.body;
61
+ this.request = request2;
62
+ }
63
+ };
64
+
65
+ // src/core/CancelablePromise.ts
66
+ var CancelError = class extends Error {
67
+ constructor(message) {
68
+ super(message);
69
+ this.name = "CancelError";
70
+ }
71
+ get isCancelled() {
72
+ return true;
73
+ }
74
+ };
75
+ var _isResolved, _isRejected, _isCancelled, _cancelHandlers, _promise, _resolve, _reject;
76
+ var CancelablePromise = class {
77
+ constructor(executor) {
78
+ __privateAdd(this, _isResolved);
79
+ __privateAdd(this, _isRejected);
80
+ __privateAdd(this, _isCancelled);
81
+ __privateAdd(this, _cancelHandlers);
82
+ __privateAdd(this, _promise);
83
+ __privateAdd(this, _resolve);
84
+ __privateAdd(this, _reject);
85
+ __privateSet(this, _isResolved, false);
86
+ __privateSet(this, _isRejected, false);
87
+ __privateSet(this, _isCancelled, false);
88
+ __privateSet(this, _cancelHandlers, []);
89
+ __privateSet(this, _promise, new Promise((resolve2, reject) => {
90
+ __privateSet(this, _resolve, resolve2);
91
+ __privateSet(this, _reject, reject);
92
+ const onResolve = (value) => {
93
+ if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
94
+ return;
95
+ }
96
+ __privateSet(this, _isResolved, true);
97
+ if (__privateGet(this, _resolve)) __privateGet(this, _resolve).call(this, value);
98
+ };
99
+ const onReject = (reason) => {
100
+ if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
101
+ return;
102
+ }
103
+ __privateSet(this, _isRejected, true);
104
+ if (__privateGet(this, _reject)) __privateGet(this, _reject).call(this, reason);
105
+ };
106
+ const onCancel = (cancelHandler) => {
107
+ if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
108
+ return;
109
+ }
110
+ __privateGet(this, _cancelHandlers).push(cancelHandler);
111
+ };
112
+ Object.defineProperty(onCancel, "isResolved", {
113
+ get: () => __privateGet(this, _isResolved)
114
+ });
115
+ Object.defineProperty(onCancel, "isRejected", {
116
+ get: () => __privateGet(this, _isRejected)
117
+ });
118
+ Object.defineProperty(onCancel, "isCancelled", {
119
+ get: () => __privateGet(this, _isCancelled)
120
+ });
121
+ return executor(onResolve, onReject, onCancel);
122
+ }));
123
+ }
124
+ get [Symbol.toStringTag]() {
125
+ return "Cancellable Promise";
126
+ }
127
+ then(onFulfilled, onRejected) {
128
+ return __privateGet(this, _promise).then(onFulfilled, onRejected);
129
+ }
130
+ catch(onRejected) {
131
+ return __privateGet(this, _promise).catch(onRejected);
132
+ }
133
+ finally(onFinally) {
134
+ return __privateGet(this, _promise).finally(onFinally);
135
+ }
136
+ cancel() {
137
+ if (__privateGet(this, _isResolved) || __privateGet(this, _isRejected) || __privateGet(this, _isCancelled)) {
138
+ return;
139
+ }
140
+ __privateSet(this, _isCancelled, true);
141
+ if (__privateGet(this, _cancelHandlers).length) {
142
+ try {
143
+ for (const cancelHandler of __privateGet(this, _cancelHandlers)) {
144
+ cancelHandler();
145
+ }
146
+ } catch (error) {
147
+ console.warn("Cancellation threw an error", error);
148
+ return;
149
+ }
150
+ }
151
+ __privateGet(this, _cancelHandlers).length = 0;
152
+ if (__privateGet(this, _reject)) __privateGet(this, _reject).call(this, new CancelError("Request aborted"));
153
+ }
154
+ get isCancelled() {
155
+ return __privateGet(this, _isCancelled);
156
+ }
157
+ };
158
+ _isResolved = new WeakMap();
159
+ _isRejected = new WeakMap();
160
+ _isCancelled = new WeakMap();
161
+ _cancelHandlers = new WeakMap();
162
+ _promise = new WeakMap();
163
+ _resolve = new WeakMap();
164
+ _reject = new WeakMap();
165
+
166
+ // src/core/OpenAPI.ts
167
+ var OpenAPI = {
168
+ BASE: "https://api.stableflow.ai",
169
+ VERSION: "1.0.0",
170
+ WITH_CREDENTIALS: false,
171
+ CREDENTIALS: "include",
172
+ TOKEN: void 0,
173
+ USERNAME: void 0,
174
+ PASSWORD: void 0,
175
+ HEADERS: void 0,
176
+ ENCODE_PATH: void 0
177
+ };
178
+
179
+ // src/models/GetExecutionStatusResponse.ts
180
+ var GetExecutionStatusResponse;
181
+ ((GetExecutionStatusResponse2) => {
182
+ let status;
183
+ ((status2) => {
184
+ status2["KNOWN_DEPOSIT_TX"] = "KNOWN_DEPOSIT_TX";
185
+ status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT";
186
+ status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT";
187
+ status2["PROCESSING"] = "PROCESSING";
188
+ status2["SUCCESS"] = "SUCCESS";
189
+ status2["REFUNDED"] = "REFUNDED";
190
+ status2["FAILED"] = "FAILED";
191
+ })(status = GetExecutionStatusResponse2.status || (GetExecutionStatusResponse2.status = {}));
192
+ })(GetExecutionStatusResponse || (GetExecutionStatusResponse = {}));
193
+
194
+ // src/models/QuoteRequest.ts
195
+ var QuoteRequest;
196
+ ((QuoteRequest2) => {
197
+ let depositMode;
198
+ ((depositMode2) => {
199
+ depositMode2["SIMPLE"] = "SIMPLE";
200
+ depositMode2["MEMO"] = "MEMO";
201
+ })(depositMode = QuoteRequest2.depositMode || (QuoteRequest2.depositMode = {}));
202
+ let swapType;
203
+ ((swapType2) => {
204
+ swapType2["EXACT_INPUT"] = "EXACT_INPUT";
205
+ swapType2["EXACT_OUTPUT"] = "EXACT_OUTPUT";
206
+ swapType2["FLEX_INPUT"] = "FLEX_INPUT";
207
+ })(swapType = QuoteRequest2.swapType || (QuoteRequest2.swapType = {}));
208
+ let depositType;
209
+ ((depositType2) => {
210
+ depositType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN";
211
+ depositType2["INTENTS"] = "INTENTS";
212
+ })(depositType = QuoteRequest2.depositType || (QuoteRequest2.depositType = {}));
213
+ let refundType;
214
+ ((refundType2) => {
215
+ refundType2["ORIGIN_CHAIN"] = "ORIGIN_CHAIN";
216
+ refundType2["INTENTS"] = "INTENTS";
217
+ })(refundType = QuoteRequest2.refundType || (QuoteRequest2.refundType = {}));
218
+ let recipientType;
219
+ ((recipientType2) => {
220
+ recipientType2["DESTINATION_CHAIN"] = "DESTINATION_CHAIN";
221
+ recipientType2["INTENTS"] = "INTENTS";
222
+ })(recipientType = QuoteRequest2.recipientType || (QuoteRequest2.recipientType = {}));
223
+ })(QuoteRequest || (QuoteRequest = {}));
224
+
225
+ // src/models/SubmitDepositTxResponse.ts
226
+ var SubmitDepositTxResponse;
227
+ ((SubmitDepositTxResponse2) => {
228
+ let status;
229
+ ((status2) => {
230
+ status2["KNOWN_DEPOSIT_TX"] = "KNOWN_DEPOSIT_TX";
231
+ status2["PENDING_DEPOSIT"] = "PENDING_DEPOSIT";
232
+ status2["INCOMPLETE_DEPOSIT"] = "INCOMPLETE_DEPOSIT";
233
+ status2["PROCESSING"] = "PROCESSING";
234
+ status2["SUCCESS"] = "SUCCESS";
235
+ status2["REFUNDED"] = "REFUNDED";
236
+ status2["FAILED"] = "FAILED";
237
+ })(status = SubmitDepositTxResponse2.status || (SubmitDepositTxResponse2.status = {}));
238
+ })(SubmitDepositTxResponse || (SubmitDepositTxResponse = {}));
239
+
240
+ // src/models/TokenResponse.ts
241
+ var TokenResponse;
242
+ ((TokenResponse2) => {
243
+ let blockchain;
244
+ ((blockchain2) => {
245
+ blockchain2["NEAR"] = "near";
246
+ blockchain2["ETH"] = "eth";
247
+ blockchain2["BASE"] = "base";
248
+ blockchain2["ARB"] = "arb";
249
+ blockchain2["BTC"] = "btc";
250
+ blockchain2["SOL"] = "sol";
251
+ blockchain2["TON"] = "ton";
252
+ blockchain2["DOGE"] = "doge";
253
+ blockchain2["XRP"] = "xrp";
254
+ blockchain2["ZEC"] = "zec";
255
+ blockchain2["GNOSIS"] = "gnosis";
256
+ blockchain2["BERA"] = "bera";
257
+ blockchain2["BSC"] = "bsc";
258
+ blockchain2["POL"] = "pol";
259
+ blockchain2["TRON"] = "tron";
260
+ blockchain2["SUI"] = "sui";
261
+ blockchain2["OP"] = "op";
262
+ blockchain2["AVAX"] = "avax";
263
+ blockchain2["CARDANO"] = "cardano";
264
+ })(blockchain = TokenResponse2.blockchain || (TokenResponse2.blockchain = {}));
265
+ })(TokenResponse || (TokenResponse = {}));
266
+
267
+ // src/core/request.ts
268
+ var import_axios = __toESM(require("axios"));
269
+ var import_form_data = __toESM(require("form-data"));
270
+ var isDefined = (value) => {
271
+ return value !== void 0 && value !== null;
272
+ };
273
+ var isString = (value) => {
274
+ return typeof value === "string";
275
+ };
276
+ var isStringWithValue = (value) => {
277
+ return isString(value) && value !== "";
278
+ };
279
+ var isBlob = (value) => {
280
+ return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
281
+ };
282
+ var isFormData = (value) => {
283
+ return value instanceof import_form_data.default;
284
+ };
285
+ var isSuccess = (status) => {
286
+ return status >= 200 && status < 300;
287
+ };
288
+ var base64 = (str) => {
289
+ try {
290
+ return btoa(str);
291
+ } catch (err) {
292
+ return Buffer.from(str).toString("base64");
293
+ }
294
+ };
295
+ var getQueryString = (params) => {
296
+ const qs = [];
297
+ const append = (key, value) => {
298
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
299
+ };
300
+ const process = (key, value) => {
301
+ if (isDefined(value)) {
302
+ if (Array.isArray(value)) {
303
+ value.forEach((v) => {
304
+ process(key, v);
305
+ });
306
+ } else if (typeof value === "object") {
307
+ Object.entries(value).forEach(([k, v]) => {
308
+ process(`${key}[${k}]`, v);
309
+ });
310
+ } else {
311
+ append(key, value);
312
+ }
313
+ }
314
+ };
315
+ Object.entries(params).forEach(([key, value]) => {
316
+ process(key, value);
317
+ });
318
+ if (qs.length > 0) {
319
+ return `?${qs.join("&")}`;
320
+ }
321
+ return "";
322
+ };
323
+ var getUrl = (config, options) => {
324
+ const encoder = config.ENCODE_PATH || encodeURI;
325
+ const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
326
+ if (options.path?.hasOwnProperty(group)) {
327
+ return encoder(String(options.path[group]));
328
+ }
329
+ return substring;
330
+ });
331
+ const url = `${config.BASE}${path}`;
332
+ if (options.query) {
333
+ return `${url}${getQueryString(options.query)}`;
334
+ }
335
+ return url;
336
+ };
337
+ var getFormData = (options) => {
338
+ if (options.formData) {
339
+ const formData = new import_form_data.default();
340
+ const process = (key, value) => {
341
+ if (isString(value) || isBlob(value)) {
342
+ formData.append(key, value);
343
+ } else {
344
+ formData.append(key, JSON.stringify(value));
345
+ }
346
+ };
347
+ Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
348
+ if (Array.isArray(value)) {
349
+ value.forEach((v) => process(key, v));
350
+ } else {
351
+ process(key, value);
352
+ }
353
+ });
354
+ return formData;
355
+ }
356
+ return void 0;
357
+ };
358
+ var resolve = async (options, resolver) => {
359
+ if (typeof resolver === "function") {
360
+ return resolver(options);
361
+ }
362
+ return resolver;
363
+ };
364
+ var getHeaders = async (config, options, formData) => {
365
+ const [token, username, password, additionalHeaders] = await Promise.all([
366
+ resolve(options, config.TOKEN),
367
+ resolve(options, config.USERNAME),
368
+ resolve(options, config.PASSWORD),
369
+ resolve(options, config.HEADERS)
370
+ ]);
371
+ const formHeaders = typeof formData?.getHeaders === "function" && formData?.getHeaders() || {};
372
+ const headers = Object.entries({
373
+ Accept: "application/json",
374
+ ...additionalHeaders,
375
+ ...options.headers,
376
+ ...formHeaders
377
+ }).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
378
+ ...headers2,
379
+ [key]: String(value)
380
+ }), {});
381
+ if (isStringWithValue(token)) {
382
+ headers["Authorization"] = `Bearer ${token}`;
383
+ }
384
+ if (isStringWithValue(username) && isStringWithValue(password)) {
385
+ const credentials = base64(`${username}:${password}`);
386
+ headers["Authorization"] = `Basic ${credentials}`;
387
+ }
388
+ if (options.body !== void 0) {
389
+ if (options.mediaType) {
390
+ headers["Content-Type"] = options.mediaType;
391
+ } else if (isBlob(options.body)) {
392
+ headers["Content-Type"] = options.body.type || "application/octet-stream";
393
+ } else if (isString(options.body)) {
394
+ headers["Content-Type"] = "text/plain";
395
+ } else if (!isFormData(options.body)) {
396
+ headers["Content-Type"] = "application/json";
397
+ }
398
+ }
399
+ return headers;
400
+ };
401
+ var getRequestBody = (options) => {
402
+ if (options.body) {
403
+ return options.body;
404
+ }
405
+ return void 0;
406
+ };
407
+ var sendRequest = async (config, options, url, body, formData, headers, onCancel, axiosClient) => {
408
+ const source = import_axios.default.CancelToken.source();
409
+ const requestConfig = {
410
+ url,
411
+ headers,
412
+ data: body ?? formData,
413
+ method: options.method,
414
+ withCredentials: config.WITH_CREDENTIALS,
415
+ withXSRFToken: config.CREDENTIALS === "include" ? config.WITH_CREDENTIALS : false,
416
+ cancelToken: source.token
417
+ };
418
+ onCancel(() => source.cancel("The user aborted a request."));
419
+ try {
420
+ return await axiosClient.request(requestConfig);
421
+ } catch (error) {
422
+ const axiosError = error;
423
+ if (axiosError.response) {
424
+ return axiosError.response;
425
+ }
426
+ throw error;
427
+ }
428
+ };
429
+ var getResponseHeader = (response, responseHeader) => {
430
+ if (responseHeader) {
431
+ const content = response.headers[responseHeader];
432
+ if (isString(content)) {
433
+ return content;
434
+ }
435
+ }
436
+ return void 0;
437
+ };
438
+ var getResponseBody = (response) => {
439
+ if (response.status !== 204) {
440
+ return response.data;
441
+ }
442
+ return void 0;
443
+ };
444
+ var catchErrorCodes = (options, result) => {
445
+ const errors = {
446
+ 400: "Bad Request",
447
+ 401: "Unauthorized",
448
+ 403: "Forbidden",
449
+ 404: "Not Found",
450
+ 500: "Internal Server Error",
451
+ 502: "Bad Gateway",
452
+ 503: "Service Unavailable",
453
+ ...options.errors
454
+ };
455
+ const error = errors[result.status];
456
+ if (error) {
457
+ throw new ApiError(options, result, error);
458
+ }
459
+ if (!result.ok) {
460
+ const errorStatus = result.status ?? "unknown";
461
+ const errorStatusText = result.statusText ?? "unknown";
462
+ const errorBody = (() => {
463
+ try {
464
+ return JSON.stringify(result.body, null, 2);
465
+ } catch (e) {
466
+ return void 0;
467
+ }
468
+ })();
469
+ throw new ApiError(
470
+ options,
471
+ result,
472
+ `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
473
+ );
474
+ }
475
+ };
476
+ var request = (config, options, axiosClient = import_axios.default) => {
477
+ return new CancelablePromise(async (resolve2, reject, onCancel) => {
478
+ try {
479
+ const url = getUrl(config, options);
480
+ const formData = getFormData(options);
481
+ const body = getRequestBody(options);
482
+ const headers = await getHeaders(config, options, formData);
483
+ console.log("\n\u{1F535} ========== API Request ==========");
484
+ console.log("Method:", options.method);
485
+ console.log("URL:", url);
486
+ console.log("Headers:", JSON.stringify(headers, null, 2));
487
+ if (body) {
488
+ console.log("Body:", JSON.stringify(body, null, 2));
489
+ }
490
+ if (formData) {
491
+ console.log("FormData:", formData);
492
+ }
493
+ console.log("====================================\n");
494
+ if (!onCancel.isCancelled) {
495
+ const response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient);
496
+ const responseBody = getResponseBody(response);
497
+ const responseHeader = getResponseHeader(response, options.responseHeader);
498
+ const result = {
499
+ url,
500
+ ok: isSuccess(response.status),
501
+ status: response.status,
502
+ statusText: response.statusText,
503
+ body: responseHeader ?? responseBody
504
+ };
505
+ console.log("\n\u{1F7E2} ========== API Response ==========");
506
+ console.log("Status:", response.status, response.statusText);
507
+ console.log("Response Headers:", JSON.stringify(response.headers, null, 2));
508
+ console.log("Response Body:", JSON.stringify(responseBody, null, 2));
509
+ console.log("=====================================\n");
510
+ catchErrorCodes(options, result);
511
+ resolve2(result.body);
512
+ }
513
+ } catch (error) {
514
+ console.log("\n\u{1F534} ========== API Error ==========");
515
+ console.log("Error:", error);
516
+ if (error instanceof ApiError) {
517
+ console.log("Status:", error.status);
518
+ console.log("Status Text:", error.statusText);
519
+ console.log("URL:", error.url);
520
+ console.log("Body:", JSON.stringify(error.body, null, 2));
521
+ }
522
+ console.log("==================================\n");
523
+ reject(error);
524
+ }
525
+ });
526
+ };
527
+
528
+ // src/services/SFA.ts
529
+ var SFA = class {
530
+ /**
531
+ * Get supported tokens
532
+ * Retrieves a list of tokens currently supported by the StableFlow AI API for asset swaps.
533
+ *
534
+ * Each token entry includes its blockchain, contract address (if available), price in USD, and other metadata such as symbol and decimals.
535
+ * @returns TokenResponse
536
+ * @throws ApiError
537
+ */
538
+ static getTokens() {
539
+ return request(OpenAPI, {
540
+ method: "GET",
541
+ url: "/v0/tokens"
542
+ });
543
+ }
544
+ /**
545
+ * Request a swap quote
546
+ * Generates a swap quote based on input parameters such as the assets, amount, slippage tolerance, and recipient/refund information.
547
+ *
548
+ * Returns pricing details, estimated time, and a unique **deposit address** to which tokens must be transferred to initiate the swap.
549
+ *
550
+ * You can set the `dry` parameter to `true` to simulate the quote request **without generating a deposit address** or initiating the swap process. This is useful for previewing swap parameters or validating input data without committing to an actual swap.
551
+ *
552
+ * This endpoint is the first required step in the swap process.
553
+ * @param requestBody
554
+ * @returns QuoteResponse
555
+ * @throws ApiError
556
+ */
557
+ static getQuote(requestBody) {
558
+ return request(OpenAPI, {
559
+ method: "POST",
560
+ url: "/v0/quote",
561
+ body: requestBody,
562
+ mediaType: "application/json",
563
+ errors: {
564
+ 400: `Bad Request - Invalid input data`,
565
+ 401: `Unauthorized - JWT token is invalid`
566
+ }
567
+ });
568
+ }
569
+ /**
570
+ * Check swap execution status
571
+ * Retrieves the current status of a swap using the unique deposit address from the quote, if quote response included deposit memo, it is required as well.
572
+ *
573
+ * The response includes the state of the swap (e.g., pending, processing, success, refunded) and any associated swap and transaction details.
574
+ * @param depositAddress
575
+ * @param depositMemo
576
+ * @returns GetExecutionStatusResponse
577
+ * @throws ApiError
578
+ */
579
+ static getExecutionStatus(depositAddress, depositMemo) {
580
+ return request(OpenAPI, {
581
+ method: "GET",
582
+ url: "/v0/status",
583
+ query: {
584
+ "depositAddress": depositAddress,
585
+ "depositMemo": depositMemo
586
+ },
587
+ errors: {
588
+ 401: `Unauthorized - JWT token is invalid`,
589
+ 404: `Deposit address not found`
590
+ }
591
+ });
592
+ }
593
+ /**
594
+ * Submit deposit transaction hash
595
+ * Optionally notifies the StableFlow AI service that a deposit has been sent to the specified address, using the blockchain transaction hash.
596
+ *
597
+ * This step can speed up swap processing by allowing the system to preemptively verify the deposit.
598
+ * @param requestBody
599
+ * @returns SubmitDepositTxResponse
600
+ * @throws ApiError
601
+ */
602
+ static submitDepositTx(requestBody) {
603
+ return request(OpenAPI, {
604
+ method: "POST",
605
+ url: "/v0/deposit/submit",
606
+ body: requestBody,
607
+ mediaType: "application/json",
608
+ errors: {
609
+ 400: `Bad Request - Invalid input data`,
610
+ 401: `Unauthorized - JWT token is invalid`
611
+ }
612
+ });
613
+ }
614
+ };
615
+ // Annotate the CommonJS export names for ESM import in node:
616
+ 0 && (module.exports = {
617
+ ApiError,
618
+ CancelError,
619
+ CancelablePromise,
620
+ GetExecutionStatusResponse,
621
+ OpenAPI,
622
+ QuoteRequest,
623
+ SFA,
624
+ SubmitDepositTxResponse,
625
+ TokenResponse
626
+ });