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