ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic 0.1.78

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 (55) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +24 -0
  3. package/lib/index.d.ts +3 -0
  4. package/lib/index.d.ts.map +1 -0
  5. package/lib/index.js +8 -0
  6. package/lib/services/client.d.ts +27 -0
  7. package/lib/services/client.d.ts.map +1 -0
  8. package/lib/services/index.d.ts +2 -0
  9. package/lib/services/index.d.ts.map +1 -0
  10. package/lib/ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.cjs.development.js +884 -0
  11. package/lib/ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.cjs.development.js.map +1 -0
  12. package/lib/ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.cjs.production.min.js +2 -0
  13. package/lib/ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.cjs.production.min.js.map +1 -0
  14. package/lib/ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.esm.js +866 -0
  15. package/lib/ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.esm.js.map +1 -0
  16. package/lib/types/api/balance.d.ts +2 -0
  17. package/lib/types/api/balance.d.ts.map +1 -0
  18. package/lib/types/api/common.d.ts +4 -0
  19. package/lib/types/api/common.d.ts.map +1 -0
  20. package/lib/types/api/meta.d.ts +4 -0
  21. package/lib/types/api/meta.d.ts.map +1 -0
  22. package/lib/types/api/routing.d.ts +2 -0
  23. package/lib/types/api/routing.d.ts.map +1 -0
  24. package/lib/types/api/transactions.d.ts +2 -0
  25. package/lib/types/api/transactions.d.ts.map +1 -0
  26. package/lib/types/api/txs/cosmos.d.ts +2 -0
  27. package/lib/types/api/txs/cosmos.d.ts.map +1 -0
  28. package/lib/types/api/txs/evm.d.ts +2 -0
  29. package/lib/types/api/txs/evm.d.ts.map +1 -0
  30. package/lib/types/api/txs/index.d.ts +5 -0
  31. package/lib/types/api/txs/index.d.ts.map +1 -0
  32. package/lib/types/api/txs/solana.d.ts +2 -0
  33. package/lib/types/api/txs/solana.d.ts.map +1 -0
  34. package/lib/types/api/txs/transfer.d.ts +2 -0
  35. package/lib/types/api/txs/transfer.d.ts.map +1 -0
  36. package/lib/types/configs.d.ts +5 -0
  37. package/lib/types/configs.d.ts.map +1 -0
  38. package/lib/types/index.d.ts +8 -0
  39. package/lib/types/index.d.ts.map +1 -0
  40. package/package.json +46 -0
  41. package/src/index.ts +2 -0
  42. package/src/services/client.ts +289 -0
  43. package/src/services/index.ts +1 -0
  44. package/src/types/api/balance.ts +1 -0
  45. package/src/types/api/common.ts +8 -0
  46. package/src/types/api/meta.ts +3 -0
  47. package/src/types/api/routing.ts +1 -0
  48. package/src/types/api/transactions.ts +1 -0
  49. package/src/types/api/txs/cosmos.ts +1 -0
  50. package/src/types/api/txs/evm.ts +1 -0
  51. package/src/types/api/txs/index.ts +4 -0
  52. package/src/types/api/txs/solana.ts +1 -0
  53. package/src/types/api/txs/transfer.ts +1 -0
  54. package/src/types/configs.ts +5 -0
  55. package/src/types/index.ts +7 -0
@@ -0,0 +1,866 @@
1
+ import uuid from 'uuid-random';
2
+ import axios from 'axios';
3
+
4
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
5
+ try {
6
+ var i = n[a](c),
7
+ u = i.value;
8
+ } catch (n) {
9
+ return void e(n);
10
+ }
11
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
12
+ }
13
+ function _asyncToGenerator(n) {
14
+ return function () {
15
+ var t = this,
16
+ e = arguments;
17
+ return new Promise(function (r, o) {
18
+ var a = n.apply(t, e);
19
+ function _next(n) {
20
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
21
+ }
22
+ function _throw(n) {
23
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
24
+ }
25
+ _next(void 0);
26
+ });
27
+ };
28
+ }
29
+ function _extends() {
30
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
31
+ for (var e = 1; e < arguments.length; e++) {
32
+ var t = arguments[e];
33
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
34
+ }
35
+ return n;
36
+ }, _extends.apply(null, arguments);
37
+ }
38
+ function _regeneratorRuntime() {
39
+ _regeneratorRuntime = function () {
40
+ return e;
41
+ };
42
+ var t,
43
+ e = {},
44
+ r = Object.prototype,
45
+ n = r.hasOwnProperty,
46
+ o = Object.defineProperty || function (t, e, r) {
47
+ t[e] = r.value;
48
+ },
49
+ i = "function" == typeof Symbol ? Symbol : {},
50
+ a = i.iterator || "@@iterator",
51
+ c = i.asyncIterator || "@@asyncIterator",
52
+ u = i.toStringTag || "@@toStringTag";
53
+ function define(t, e, r) {
54
+ return Object.defineProperty(t, e, {
55
+ value: r,
56
+ enumerable: !0,
57
+ configurable: !0,
58
+ writable: !0
59
+ }), t[e];
60
+ }
61
+ try {
62
+ define({}, "");
63
+ } catch (t) {
64
+ define = function (t, e, r) {
65
+ return t[e] = r;
66
+ };
67
+ }
68
+ function wrap(t, e, r, n) {
69
+ var i = e && e.prototype instanceof Generator ? e : Generator,
70
+ a = Object.create(i.prototype),
71
+ c = new Context(n || []);
72
+ return o(a, "_invoke", {
73
+ value: makeInvokeMethod(t, r, c)
74
+ }), a;
75
+ }
76
+ function tryCatch(t, e, r) {
77
+ try {
78
+ return {
79
+ type: "normal",
80
+ arg: t.call(e, r)
81
+ };
82
+ } catch (t) {
83
+ return {
84
+ type: "throw",
85
+ arg: t
86
+ };
87
+ }
88
+ }
89
+ e.wrap = wrap;
90
+ var h = "suspendedStart",
91
+ l = "suspendedYield",
92
+ f = "executing",
93
+ s = "completed",
94
+ y = {};
95
+ function Generator() {}
96
+ function GeneratorFunction() {}
97
+ function GeneratorFunctionPrototype() {}
98
+ var p = {};
99
+ define(p, a, function () {
100
+ return this;
101
+ });
102
+ var d = Object.getPrototypeOf,
103
+ v = d && d(d(values([])));
104
+ v && v !== r && n.call(v, a) && (p = v);
105
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
106
+ function defineIteratorMethods(t) {
107
+ ["next", "throw", "return"].forEach(function (e) {
108
+ define(t, e, function (t) {
109
+ return this._invoke(e, t);
110
+ });
111
+ });
112
+ }
113
+ function AsyncIterator(t, e) {
114
+ function invoke(r, o, i, a) {
115
+ var c = tryCatch(t[r], t, o);
116
+ if ("throw" !== c.type) {
117
+ var u = c.arg,
118
+ h = u.value;
119
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
120
+ invoke("next", t, i, a);
121
+ }, function (t) {
122
+ invoke("throw", t, i, a);
123
+ }) : e.resolve(h).then(function (t) {
124
+ u.value = t, i(u);
125
+ }, function (t) {
126
+ return invoke("throw", t, i, a);
127
+ });
128
+ }
129
+ a(c.arg);
130
+ }
131
+ var r;
132
+ o(this, "_invoke", {
133
+ value: function (t, n) {
134
+ function callInvokeWithMethodAndArg() {
135
+ return new e(function (e, r) {
136
+ invoke(t, n, e, r);
137
+ });
138
+ }
139
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
140
+ }
141
+ });
142
+ }
143
+ function makeInvokeMethod(e, r, n) {
144
+ var o = h;
145
+ return function (i, a) {
146
+ if (o === f) throw Error("Generator is already running");
147
+ if (o === s) {
148
+ if ("throw" === i) throw a;
149
+ return {
150
+ value: t,
151
+ done: !0
152
+ };
153
+ }
154
+ for (n.method = i, n.arg = a;;) {
155
+ var c = n.delegate;
156
+ if (c) {
157
+ var u = maybeInvokeDelegate(c, n);
158
+ if (u) {
159
+ if (u === y) continue;
160
+ return u;
161
+ }
162
+ }
163
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
164
+ if (o === h) throw o = s, n.arg;
165
+ n.dispatchException(n.arg);
166
+ } else "return" === n.method && n.abrupt("return", n.arg);
167
+ o = f;
168
+ var p = tryCatch(e, r, n);
169
+ if ("normal" === p.type) {
170
+ if (o = n.done ? s : l, p.arg === y) continue;
171
+ return {
172
+ value: p.arg,
173
+ done: n.done
174
+ };
175
+ }
176
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
177
+ }
178
+ };
179
+ }
180
+ function maybeInvokeDelegate(e, r) {
181
+ var n = r.method,
182
+ o = e.iterator[n];
183
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
184
+ var i = tryCatch(o, e.iterator, r.arg);
185
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
186
+ var a = i.arg;
187
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
188
+ }
189
+ function pushTryEntry(t) {
190
+ var e = {
191
+ tryLoc: t[0]
192
+ };
193
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
194
+ }
195
+ function resetTryEntry(t) {
196
+ var e = t.completion || {};
197
+ e.type = "normal", delete e.arg, t.completion = e;
198
+ }
199
+ function Context(t) {
200
+ this.tryEntries = [{
201
+ tryLoc: "root"
202
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
203
+ }
204
+ function values(e) {
205
+ if (e || "" === e) {
206
+ var r = e[a];
207
+ if (r) return r.call(e);
208
+ if ("function" == typeof e.next) return e;
209
+ if (!isNaN(e.length)) {
210
+ var o = -1,
211
+ i = function next() {
212
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
213
+ return next.value = t, next.done = !0, next;
214
+ };
215
+ return i.next = i;
216
+ }
217
+ }
218
+ throw new TypeError(typeof e + " is not iterable");
219
+ }
220
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
221
+ value: GeneratorFunctionPrototype,
222
+ configurable: !0
223
+ }), o(GeneratorFunctionPrototype, "constructor", {
224
+ value: GeneratorFunction,
225
+ configurable: !0
226
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
227
+ var e = "function" == typeof t && t.constructor;
228
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
229
+ }, e.mark = function (t) {
230
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
231
+ }, e.awrap = function (t) {
232
+ return {
233
+ __await: t
234
+ };
235
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
236
+ return this;
237
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
238
+ void 0 === i && (i = Promise);
239
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
240
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
241
+ return t.done ? t.value : a.next();
242
+ });
243
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
244
+ return this;
245
+ }), define(g, "toString", function () {
246
+ return "[object Generator]";
247
+ }), e.keys = function (t) {
248
+ var e = Object(t),
249
+ r = [];
250
+ for (var n in e) r.push(n);
251
+ return r.reverse(), function next() {
252
+ for (; r.length;) {
253
+ var t = r.pop();
254
+ if (t in e) return next.value = t, next.done = !1, next;
255
+ }
256
+ return next.done = !0, next;
257
+ };
258
+ }, e.values = values, Context.prototype = {
259
+ constructor: Context,
260
+ reset: function (e) {
261
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
262
+ },
263
+ stop: function () {
264
+ this.done = !0;
265
+ var t = this.tryEntries[0].completion;
266
+ if ("throw" === t.type) throw t.arg;
267
+ return this.rval;
268
+ },
269
+ dispatchException: function (e) {
270
+ if (this.done) throw e;
271
+ var r = this;
272
+ function handle(n, o) {
273
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
274
+ }
275
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
276
+ var i = this.tryEntries[o],
277
+ a = i.completion;
278
+ if ("root" === i.tryLoc) return handle("end");
279
+ if (i.tryLoc <= this.prev) {
280
+ var c = n.call(i, "catchLoc"),
281
+ u = n.call(i, "finallyLoc");
282
+ if (c && u) {
283
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
284
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
285
+ } else if (c) {
286
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
287
+ } else {
288
+ if (!u) throw Error("try statement without catch or finally");
289
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
290
+ }
291
+ }
292
+ }
293
+ },
294
+ abrupt: function (t, e) {
295
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
296
+ var o = this.tryEntries[r];
297
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
298
+ var i = o;
299
+ break;
300
+ }
301
+ }
302
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
303
+ var a = i ? i.completion : {};
304
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
305
+ },
306
+ complete: function (t, e) {
307
+ if ("throw" === t.type) throw t.arg;
308
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
309
+ },
310
+ finish: function (t) {
311
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
312
+ var r = this.tryEntries[e];
313
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
314
+ }
315
+ },
316
+ catch: function (t) {
317
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
318
+ var r = this.tryEntries[e];
319
+ if (r.tryLoc === t) {
320
+ var n = r.completion;
321
+ if ("throw" === n.type) {
322
+ var o = n.arg;
323
+ resetTryEntry(r);
324
+ }
325
+ return o;
326
+ }
327
+ }
328
+ throw Error("illegal catch attempt");
329
+ },
330
+ delegateYield: function (e, r, n) {
331
+ return this.delegate = {
332
+ iterator: values(e),
333
+ resultName: r,
334
+ nextLoc: n
335
+ }, "next" === this.method && (this.arg = t), y;
336
+ }
337
+ }, e;
338
+ }
339
+
340
+ function assetToString(asset) {
341
+ return "" + asset.blockchain + (asset.symbol ? '.' + asset.symbol : '') + (asset.address ? '--' + asset.address : '');
342
+ }
343
+
344
+ var isEvmBlockchain = function isEvmBlockchain(blockchainMeta) {
345
+ return blockchainMeta.type === 'EVM';
346
+ };
347
+ var isCosmosBlockchain = function isCosmosBlockchain(blockchainMeta) {
348
+ return blockchainMeta.type === 'COSMOS';
349
+ };
350
+ var isSolanaBlockchain = function isSolanaBlockchain(blockchainMeta) {
351
+ return blockchainMeta.type === 'SOLANA';
352
+ };
353
+ var isTronBlockchain = function isTronBlockchain(blockchainMeta) {
354
+ return blockchainMeta.type === 'TRON';
355
+ };
356
+ var isTransferBlockchain = function isTransferBlockchain(blockchainMeta) {
357
+ return blockchainMeta.type === 'TRANSFER';
358
+ };
359
+ var isStarknetBlockchain = function isStarknetBlockchain(blockchainMeta) {
360
+ return blockchainMeta.type === 'STARKNET';
361
+ };
362
+ var isTonBlockchain = function isTonBlockchain(blockchainMeta) {
363
+ return blockchainMeta.type === 'TON';
364
+ };
365
+ var isXrplBlockchain = function isXrplBlockchain(blockchainMeta) {
366
+ return blockchainMeta.type === 'XRPL';
367
+ };
368
+ var isHyperliquidBlockchain = function isHyperliquidBlockchain(blockchainMeta) {
369
+ return blockchainMeta.type === 'HYPERLIQUID';
370
+ };
371
+ var evmBlockchains = function evmBlockchains(blockchains) {
372
+ return blockchains.filter(isEvmBlockchain);
373
+ };
374
+ var solanaBlockchain = function solanaBlockchain(blockchains) {
375
+ return blockchains.filter(isSolanaBlockchain);
376
+ };
377
+ var starknetBlockchain = function starknetBlockchain(blockchains) {
378
+ return blockchains.filter(isStarknetBlockchain);
379
+ };
380
+ var tronBlockchain = function tronBlockchain(blockchains) {
381
+ return blockchains.filter(isTronBlockchain);
382
+ };
383
+ var cosmosBlockchains = function cosmosBlockchains(blockchains) {
384
+ return blockchains.filter(isCosmosBlockchain);
385
+ };
386
+ var transferBlockchains = function transferBlockchains(blockchains) {
387
+ return blockchains.filter(isTransferBlockchain);
388
+ };
389
+ var tonBlockchain = function tonBlockchain(blockchains) {
390
+ return blockchains.filter(isTonBlockchain);
391
+ };
392
+ var xrplBlockchain = function xrplBlockchain(blockchains) {
393
+ return blockchains.filter(isXrplBlockchain);
394
+ };
395
+ var hyperliquidBlockchain = function hyperliquidBlockchain(blockchains) {
396
+ return blockchains.filter(isHyperliquidBlockchain);
397
+ };
398
+
399
+ /**
400
+ * Routing Result Type
401
+ *
402
+ */
403
+ var RoutingResultType;
404
+ (function (RoutingResultType) {
405
+ RoutingResultType["OK"] = "OK";
406
+ RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT";
407
+ RoutingResultType["NO_ROUTE"] = "NO_ROUTE";
408
+ RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE";
409
+ RoutingResultType["HIGH_IMPACT_FOR_CREATE_TX"] = "HIGH_IMPACT_FOR_CREATE_TX";
410
+ })(RoutingResultType || (RoutingResultType = {}));
411
+
412
+ /**
413
+ * The type of transaction
414
+ */
415
+ var TransactionType;
416
+ (function (TransactionType) {
417
+ TransactionType["EVM"] = "EVM";
418
+ TransactionType["TRANSFER"] = "TRANSFER";
419
+ TransactionType["COSMOS"] = "COSMOS";
420
+ TransactionType["SOLANA"] = "SOLANA";
421
+ TransactionType["TRON"] = "TRON";
422
+ TransactionType["STARKNET"] = "STARKNET";
423
+ TransactionType["TON"] = "TON";
424
+ TransactionType["SUI"] = "SUI";
425
+ TransactionType["XRPL"] = "XRPL";
426
+ TransactionType["STELLAR"] = "STELLAR";
427
+ TransactionType["HYPERLIQUID"] = "HYPERLIQUID";
428
+ })(TransactionType || (TransactionType = {}));
429
+ /**
430
+ * The type of transaction
431
+ * @deprecated use TransactionType instead
432
+ */
433
+ var GenericTransactionType;
434
+ (function (GenericTransactionType) {
435
+ GenericTransactionType["EVM"] = "EVM";
436
+ GenericTransactionType["TRANSFER"] = "TRANSFER";
437
+ GenericTransactionType["COSMOS"] = "COSMOS";
438
+ GenericTransactionType["SOLANA"] = "SOLANA";
439
+ })(GenericTransactionType || (GenericTransactionType = {}));
440
+ /**
441
+ * The status of transaction in tracking
442
+ */
443
+ var TransactionStatus;
444
+ (function (TransactionStatus) {
445
+ TransactionStatus["FAILED"] = "failed";
446
+ TransactionStatus["RUNNING"] = "running";
447
+ TransactionStatus["SUCCESS"] = "success";
448
+ })(TransactionStatus || (TransactionStatus = {}));
449
+
450
+ var isCosmosTransaction = function isCosmosTransaction(transaction) {
451
+ return transaction.type === TransactionType.COSMOS;
452
+ };
453
+
454
+ var isSolanaTransaction = function isSolanaTransaction(transaction) {
455
+ return transaction.type === TransactionType.SOLANA;
456
+ };
457
+
458
+ var isTransferTransaction = function isTransferTransaction(transaction) {
459
+ return transaction.type === TransactionType.TRANSFER;
460
+ };
461
+
462
+ var TonChainID;
463
+ (function (TonChainID) {
464
+ TonChainID["MAINNET"] = "-239";
465
+ TonChainID["TESTNET"] = "-3";
466
+ })(TonChainID || (TonChainID = {}));
467
+
468
+ var isEvmTransaction = function isEvmTransaction(transaction) {
469
+ return transaction.type === TransactionType.EVM;
470
+ };
471
+
472
+ var RangoClient = /*#__PURE__*/function () {
473
+ function RangoClient(apiKey, debug, apiUrl) {
474
+ if (debug === void 0) {
475
+ debug = false;
476
+ }
477
+ this.apiUrl = apiUrl || 'https://api.rango.exchange';
478
+ this.apiKey = apiKey;
479
+ try {
480
+ if (typeof window !== 'undefined') {
481
+ var deviceId = localStorage.getItem('deviceId');
482
+ if (deviceId) {
483
+ this.deviceId = deviceId;
484
+ } else {
485
+ var generatedId = uuid();
486
+ localStorage.setItem('deviceId', generatedId);
487
+ this.deviceId = generatedId;
488
+ }
489
+ } else {
490
+ this.deviceId = uuid();
491
+ }
492
+ } catch (e) {
493
+ this.deviceId = uuid();
494
+ }
495
+ this.httpService = axios.create({
496
+ baseURL: this.apiUrl
497
+ });
498
+ if (debug) {
499
+ this.httpService.interceptors.request.use(function (request) {
500
+ console.log('Starting Request', JSON.stringify(request, null, 2));
501
+ return request;
502
+ });
503
+ this.httpService.interceptors.response.use(function (response) {
504
+ console.log('Response:', JSON.stringify(response, null, 2));
505
+ return response;
506
+ });
507
+ }
508
+ }
509
+ var _proto = RangoClient.prototype;
510
+ _proto.meta = /*#__PURE__*/function () {
511
+ var _meta = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(metaRequest, options) {
512
+ var _metaRequest$blockcha, _metaRequest$swappers, _metaRequest$swappers2, _metaRequest$transact;
513
+ var params, axiosResponse;
514
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
515
+ while (1) switch (_context.prev = _context.next) {
516
+ case 0:
517
+ params = _extends({}, metaRequest, {
518
+ blockchains: metaRequest == null || (_metaRequest$blockcha = metaRequest.blockchains) == null ? void 0 : _metaRequest$blockcha.join(),
519
+ swappers: metaRequest == null || (_metaRequest$swappers = metaRequest.swappers) == null ? void 0 : _metaRequest$swappers.join(),
520
+ swappersGroups: metaRequest == null || (_metaRequest$swappers2 = metaRequest.swappersGroups) == null ? void 0 : _metaRequest$swappers2.join(),
521
+ transactionTypes: metaRequest == null || (_metaRequest$transact = metaRequest.transactionTypes) == null ? void 0 : _metaRequest$transact.join()
522
+ });
523
+ _context.next = 3;
524
+ return this.httpService.get("/basic/meta?apiKey=" + this.apiKey, _extends({
525
+ params: params
526
+ }, options));
527
+ case 3:
528
+ axiosResponse = _context.sent;
529
+ return _context.abrupt("return", axiosResponse.data);
530
+ case 5:
531
+ case "end":
532
+ return _context.stop();
533
+ }
534
+ }, _callee, this);
535
+ }));
536
+ function meta(_x, _x2) {
537
+ return _meta.apply(this, arguments);
538
+ }
539
+ return meta;
540
+ }();
541
+ _proto.chains = /*#__PURE__*/function () {
542
+ var _chains = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
543
+ var axiosResponse;
544
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
545
+ while (1) switch (_context2.prev = _context2.next) {
546
+ case 0:
547
+ _context2.next = 2;
548
+ return this.httpService.get("/basic/meta/blockchains?apiKey=" + this.apiKey, _extends({}, options));
549
+ case 2:
550
+ axiosResponse = _context2.sent;
551
+ return _context2.abrupt("return", axiosResponse.data);
552
+ case 4:
553
+ case "end":
554
+ return _context2.stop();
555
+ }
556
+ }, _callee2, this);
557
+ }));
558
+ function chains(_x3) {
559
+ return _chains.apply(this, arguments);
560
+ }
561
+ return chains;
562
+ }();
563
+ _proto.swappers = /*#__PURE__*/function () {
564
+ var _swappers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
565
+ var axiosResponse;
566
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
567
+ while (1) switch (_context3.prev = _context3.next) {
568
+ case 0:
569
+ _context3.next = 2;
570
+ return this.httpService.get("/basic/meta/swappers?apiKey=" + this.apiKey, _extends({}, options));
571
+ case 2:
572
+ axiosResponse = _context3.sent;
573
+ return _context3.abrupt("return", axiosResponse.data);
574
+ case 4:
575
+ case "end":
576
+ return _context3.stop();
577
+ }
578
+ }, _callee3, this);
579
+ }));
580
+ function swappers(_x4) {
581
+ return _swappers.apply(this, arguments);
582
+ }
583
+ return swappers;
584
+ }();
585
+ _proto.messagingProtocols = /*#__PURE__*/function () {
586
+ var _messagingProtocols = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) {
587
+ var axiosResponse;
588
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
589
+ while (1) switch (_context4.prev = _context4.next) {
590
+ case 0:
591
+ _context4.next = 2;
592
+ return this.httpService.get("/basic/meta/messaging-protocols?apiKey=" + this.apiKey, _extends({}, options));
593
+ case 2:
594
+ axiosResponse = _context4.sent;
595
+ return _context4.abrupt("return", axiosResponse.data);
596
+ case 4:
597
+ case "end":
598
+ return _context4.stop();
599
+ }
600
+ }, _callee4, this);
601
+ }));
602
+ function messagingProtocols(_x5) {
603
+ return _messagingProtocols.apply(this, arguments);
604
+ }
605
+ return messagingProtocols;
606
+ }();
607
+ _proto.token = /*#__PURE__*/function () {
608
+ var _token = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(customTokenRequest, options) {
609
+ var axiosResponse;
610
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
611
+ while (1) switch (_context5.prev = _context5.next) {
612
+ case 0:
613
+ _context5.next = 2;
614
+ return this.httpService.get("/basic/meta/custom-token?apiKey=" + this.apiKey, _extends({
615
+ params: customTokenRequest
616
+ }, options));
617
+ case 2:
618
+ axiosResponse = _context5.sent;
619
+ return _context5.abrupt("return", axiosResponse.data);
620
+ case 4:
621
+ case "end":
622
+ return _context5.stop();
623
+ }
624
+ }, _callee5, this);
625
+ }));
626
+ function token(_x6, _x7) {
627
+ return _token.apply(this, arguments);
628
+ }
629
+ return token;
630
+ }();
631
+ _proto.quote = /*#__PURE__*/function () {
632
+ var _quote = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(quoteRequest, options) {
633
+ var body, axiosResponse;
634
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
635
+ while (1) switch (_context6.prev = _context6.next) {
636
+ case 0:
637
+ body = _extends({}, quoteRequest, {
638
+ from: assetToString(quoteRequest.from),
639
+ to: assetToString(quoteRequest.to),
640
+ swappers: !!quoteRequest.swappers && quoteRequest.swappers.length > 0 ? quoteRequest.swappers.join(',') : undefined,
641
+ swapperGroups: !!quoteRequest.swapperGroups && quoteRequest.swapperGroups.length > 0 ? quoteRequest.swapperGroups.join(',') : undefined,
642
+ messagingProtocols: !!quoteRequest.messagingProtocols && quoteRequest.messagingProtocols.length > 0 ? quoteRequest.messagingProtocols.join(',') : undefined
643
+ });
644
+ _context6.next = 3;
645
+ return this.httpService.get("/basic/quote?apiKey=" + this.apiKey, _extends({
646
+ params: body,
647
+ headers: {
648
+ 'X-Rango-Id': this.deviceId
649
+ }
650
+ }, options));
651
+ case 3:
652
+ axiosResponse = _context6.sent;
653
+ return _context6.abrupt("return", axiosResponse.data);
654
+ case 5:
655
+ case "end":
656
+ return _context6.stop();
657
+ }
658
+ }, _callee6, this);
659
+ }));
660
+ function quote(_x8, _x9) {
661
+ return _quote.apply(this, arguments);
662
+ }
663
+ return quote;
664
+ }();
665
+ _proto.isApproved = /*#__PURE__*/function () {
666
+ var _isApproved = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(requestId, txId, options) {
667
+ var axiosResponse;
668
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
669
+ while (1) switch (_context7.prev = _context7.next) {
670
+ case 0:
671
+ _context7.next = 2;
672
+ return this.httpService.get("/basic/is-approved?apiKey=" + this.apiKey, _extends({
673
+ params: {
674
+ requestId: requestId,
675
+ txId: txId
676
+ },
677
+ headers: {
678
+ 'X-Rango-Id': this.deviceId
679
+ }
680
+ }, options));
681
+ case 2:
682
+ axiosResponse = _context7.sent;
683
+ return _context7.abrupt("return", axiosResponse.data);
684
+ case 4:
685
+ case "end":
686
+ return _context7.stop();
687
+ }
688
+ }, _callee7, this);
689
+ }));
690
+ function isApproved(_x10, _x11, _x12) {
691
+ return _isApproved.apply(this, arguments);
692
+ }
693
+ return isApproved;
694
+ }();
695
+ _proto.status = /*#__PURE__*/function () {
696
+ var _status = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(statusRequest, options) {
697
+ var axiosResponse;
698
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
699
+ while (1) switch (_context8.prev = _context8.next) {
700
+ case 0:
701
+ _context8.next = 2;
702
+ return this.httpService.get("/basic/status?apiKey=" + this.apiKey, _extends({
703
+ params: statusRequest,
704
+ headers: {
705
+ 'X-Rango-Id': this.deviceId
706
+ }
707
+ }, options));
708
+ case 2:
709
+ axiosResponse = _context8.sent;
710
+ return _context8.abrupt("return", axiosResponse.data);
711
+ case 4:
712
+ case "end":
713
+ return _context8.stop();
714
+ }
715
+ }, _callee8, this);
716
+ }));
717
+ function status(_x13, _x14) {
718
+ return _status.apply(this, arguments);
719
+ }
720
+ return status;
721
+ }();
722
+ _proto.swap = /*#__PURE__*/function () {
723
+ var _swap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(swapRequest, options) {
724
+ var body, axiosResponse;
725
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
726
+ while (1) switch (_context9.prev = _context9.next) {
727
+ case 0:
728
+ body = _extends({}, swapRequest, {
729
+ from: assetToString(swapRequest.from),
730
+ to: assetToString(swapRequest.to),
731
+ referrerAddress: swapRequest.referrerAddress || null,
732
+ referrerFee: swapRequest.referrerFee || null,
733
+ disableEstimate: swapRequest.disableEstimate || false,
734
+ swappers: !!swapRequest.swappers && swapRequest.swappers.length > 0 ? swapRequest.swappers.join(',') : undefined,
735
+ swapperGroups: !!swapRequest.swapperGroups && swapRequest.swapperGroups.length > 0 ? swapRequest.swapperGroups.join(',') : undefined,
736
+ messagingProtocols: !!swapRequest.messagingProtocols && swapRequest.messagingProtocols.length > 0 ? swapRequest.messagingProtocols.join(',') : undefined
737
+ });
738
+ _context9.next = 3;
739
+ return this.httpService.get("/basic/swap?apiKey=" + this.apiKey, _extends({
740
+ params: body,
741
+ headers: {
742
+ 'X-Rango-Id': this.deviceId
743
+ }
744
+ }, options));
745
+ case 3:
746
+ axiosResponse = _context9.sent;
747
+ return _context9.abrupt("return", axiosResponse.data);
748
+ case 5:
749
+ case "end":
750
+ return _context9.stop();
751
+ }
752
+ }, _callee9, this);
753
+ }));
754
+ function swap(_x15, _x16) {
755
+ return _swap.apply(this, arguments);
756
+ }
757
+ return swap;
758
+ }();
759
+ _proto.reportFailure = /*#__PURE__*/function () {
760
+ var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
761
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
762
+ while (1) switch (_context10.prev = _context10.next) {
763
+ case 0:
764
+ _context10.next = 2;
765
+ return this.httpService.post("/basic/report-tx?apiKey=" + this.apiKey, requestBody, _extends({
766
+ headers: {
767
+ 'X-Rango-Id': this.deviceId
768
+ }
769
+ }, options));
770
+ case 2:
771
+ case "end":
772
+ return _context10.stop();
773
+ }
774
+ }, _callee10, this);
775
+ }));
776
+ function reportFailure(_x17, _x18) {
777
+ return _reportFailure.apply(this, arguments);
778
+ }
779
+ return reportFailure;
780
+ }();
781
+ _proto.balance = /*#__PURE__*/function () {
782
+ var _balance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(walletAddress, options) {
783
+ var axiosResponse;
784
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
785
+ while (1) switch (_context11.prev = _context11.next) {
786
+ case 0:
787
+ _context11.next = 2;
788
+ return this.httpService.get("/basic/balance?apiKey=" + this.apiKey, _extends({
789
+ params: walletAddress,
790
+ headers: {
791
+ 'X-Rango-Id': this.deviceId
792
+ }
793
+ }, options));
794
+ case 2:
795
+ axiosResponse = _context11.sent;
796
+ return _context11.abrupt("return", axiosResponse.data);
797
+ case 4:
798
+ case "end":
799
+ return _context11.stop();
800
+ }
801
+ }, _callee11, this);
802
+ }));
803
+ function balance(_x19, _x20) {
804
+ return _balance.apply(this, arguments);
805
+ }
806
+ return balance;
807
+ }();
808
+ _proto.tokenBalance = /*#__PURE__*/function () {
809
+ var _tokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(tokenBalanceRequest, options) {
810
+ var axiosResponse;
811
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
812
+ while (1) switch (_context12.prev = _context12.next) {
813
+ case 0:
814
+ _context12.next = 2;
815
+ return this.httpService.get("/basic/token-balance?apiKey=" + this.apiKey, _extends({
816
+ params: tokenBalanceRequest
817
+ }, options));
818
+ case 2:
819
+ axiosResponse = _context12.sent;
820
+ return _context12.abrupt("return", axiosResponse.data);
821
+ case 4:
822
+ case "end":
823
+ return _context12.stop();
824
+ }
825
+ }, _callee12, this);
826
+ }));
827
+ function tokenBalance(_x21, _x22) {
828
+ return _tokenBalance.apply(this, arguments);
829
+ }
830
+ return tokenBalance;
831
+ }();
832
+ _proto.connectedAssets = /*#__PURE__*/function () {
833
+ var _connectedAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(connectedAssetsRequest, options) {
834
+ var body, axiosResponse;
835
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
836
+ while (1) switch (_context13.prev = _context13.next) {
837
+ case 0:
838
+ body = {
839
+ from: assetToString(connectedAssetsRequest.from)
840
+ };
841
+ _context13.next = 3;
842
+ return this.httpService.get("/basic/connected-assets?apiKey=" + this.apiKey, _extends({
843
+ params: body,
844
+ headers: {
845
+ 'X-Rango-Id': this.deviceId
846
+ }
847
+ }, options));
848
+ case 3:
849
+ axiosResponse = _context13.sent;
850
+ return _context13.abrupt("return", axiosResponse.data);
851
+ case 5:
852
+ case "end":
853
+ return _context13.stop();
854
+ }
855
+ }, _callee13, this);
856
+ }));
857
+ function connectedAssets(_x23, _x24) {
858
+ return _connectedAssets.apply(this, arguments);
859
+ }
860
+ return connectedAssets;
861
+ }();
862
+ return RangoClient;
863
+ }();
864
+
865
+ export { GenericTransactionType, RangoClient, RoutingResultType, TransactionStatus, TransactionType, assetToString, cosmosBlockchains, evmBlockchains, hyperliquidBlockchain, isCosmosBlockchain, isCosmosTransaction, isEvmBlockchain, isEvmTransaction, isHyperliquidBlockchain, isSolanaBlockchain, isSolanaTransaction, isStarknetBlockchain, isTonBlockchain, isTransferBlockchain, isTransferTransaction, isTronBlockchain, isXrplBlockchain, solanaBlockchain, starknetBlockchain, tonBlockchain, transferBlockchains, tronBlockchain, xrplBlockchain };
866
+ //# sourceMappingURL=ssfdfsgdfsgfdgfsdgdsgfdfgs-sdk-basic.esm.js.map