UNPKG

rango-sdk-basic

Version:
852 lines (839 loc) 31.7 kB
import uuid from 'uuid-random'; import axios from 'axios'; function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); } function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } function _regeneratorRuntime() { _regeneratorRuntime = function () { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function (t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function (t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; 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; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; 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); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function (e) { 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); }, stop: function () { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function (e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function (t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function (t, e) { if ("throw" === t.type) throw t.arg; 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; }, finish: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function (e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; } function assetToString(asset) { return "" + asset.blockchain + (asset.symbol ? '.' + asset.symbol : '') + (asset.address ? '--' + asset.address : ''); } var isEvmBlockchain = function isEvmBlockchain(blockchainMeta) { return blockchainMeta.type === 'EVM'; }; var isCosmosBlockchain = function isCosmosBlockchain(blockchainMeta) { return blockchainMeta.type === 'COSMOS'; }; var isSolanaBlockchain = function isSolanaBlockchain(blockchainMeta) { return blockchainMeta.type === 'SOLANA'; }; var isTronBlockchain = function isTronBlockchain(blockchainMeta) { return blockchainMeta.type === 'TRON'; }; var isTransferBlockchain = function isTransferBlockchain(blockchainMeta) { return blockchainMeta.type === 'TRANSFER'; }; var isStarknetBlockchain = function isStarknetBlockchain(blockchainMeta) { return blockchainMeta.type === 'STARKNET'; }; var isTonBlockchain = function isTonBlockchain(blockchainMeta) { return blockchainMeta.type === 'TON'; }; var evmBlockchains = function evmBlockchains(blockchains) { return blockchains.filter(isEvmBlockchain); }; var solanaBlockchain = function solanaBlockchain(blockchains) { return blockchains.filter(isSolanaBlockchain); }; var starknetBlockchain = function starknetBlockchain(blockchains) { return blockchains.filter(isStarknetBlockchain); }; var tronBlockchain = function tronBlockchain(blockchains) { return blockchains.filter(isTronBlockchain); }; var cosmosBlockchains = function cosmosBlockchains(blockchains) { return blockchains.filter(isCosmosBlockchain); }; var transferBlockchains = function transferBlockchains(blockchains) { return blockchains.filter(isTransferBlockchain); }; var tonBlockchain = function tonBlockchain(blockchains) { return blockchains.filter(isTonBlockchain); }; /** * Routing Result Type * */ var RoutingResultType; (function (RoutingResultType) { RoutingResultType["OK"] = "OK"; RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT"; RoutingResultType["NO_ROUTE"] = "NO_ROUTE"; RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE"; RoutingResultType["HIGH_IMPACT_FOR_CREATE_TX"] = "HIGH_IMPACT_FOR_CREATE_TX"; })(RoutingResultType || (RoutingResultType = {})); /** * The type of transaction */ var TransactionType; (function (TransactionType) { TransactionType["EVM"] = "EVM"; TransactionType["TRANSFER"] = "TRANSFER"; TransactionType["COSMOS"] = "COSMOS"; TransactionType["SOLANA"] = "SOLANA"; TransactionType["TRON"] = "TRON"; TransactionType["STARKNET"] = "STARKNET"; TransactionType["TON"] = "TON"; TransactionType["SUI"] = "SUI"; })(TransactionType || (TransactionType = {})); /** * The type of transaction * @deprecated use TransactionType instead */ var GenericTransactionType; (function (GenericTransactionType) { GenericTransactionType["EVM"] = "EVM"; GenericTransactionType["TRANSFER"] = "TRANSFER"; GenericTransactionType["COSMOS"] = "COSMOS"; GenericTransactionType["SOLANA"] = "SOLANA"; })(GenericTransactionType || (GenericTransactionType = {})); /** * The status of transaction in tracking */ var TransactionStatus; (function (TransactionStatus) { TransactionStatus["FAILED"] = "failed"; TransactionStatus["RUNNING"] = "running"; TransactionStatus["SUCCESS"] = "success"; })(TransactionStatus || (TransactionStatus = {})); var isCosmosTransaction = function isCosmosTransaction(transaction) { return transaction.type === TransactionType.COSMOS; }; var isSolanaTransaction = function isSolanaTransaction(transaction) { return transaction.type === TransactionType.SOLANA; }; var isTransferTransaction = function isTransferTransaction(transaction) { return transaction.type === TransactionType.TRANSFER; }; var TonChainID; (function (TonChainID) { TonChainID["MAINNET"] = "-239"; TonChainID["TESTNET"] = "-3"; })(TonChainID || (TonChainID = {})); var isEvmTransaction = function isEvmTransaction(transaction) { return transaction.type === TransactionType.EVM; }; var RangoClient = /*#__PURE__*/function () { function RangoClient(apiKey, debug, apiUrl) { if (debug === void 0) { debug = false; } this.apiUrl = apiUrl || 'https://api.rango.exchange'; this.apiKey = apiKey; try { if (typeof window !== 'undefined') { var deviceId = localStorage.getItem('deviceId'); if (deviceId) { this.deviceId = deviceId; } else { var generatedId = uuid(); localStorage.setItem('deviceId', generatedId); this.deviceId = generatedId; } } else { this.deviceId = uuid(); } } catch (e) { this.deviceId = uuid(); } this.httpService = axios.create({ baseURL: this.apiUrl }); if (debug) { this.httpService.interceptors.request.use(function (request) { console.log('Starting Request', JSON.stringify(request, null, 2)); return request; }); this.httpService.interceptors.response.use(function (response) { console.log('Response:', JSON.stringify(response, null, 2)); return response; }); } } var _proto = RangoClient.prototype; _proto.meta = /*#__PURE__*/function () { var _meta = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(metaRequest, options) { var _metaRequest$blockcha, _metaRequest$swappers, _metaRequest$swappers2, _metaRequest$transact; var params, axiosResponse; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: params = _extends({}, metaRequest, { blockchains: metaRequest == null || (_metaRequest$blockcha = metaRequest.blockchains) == null ? void 0 : _metaRequest$blockcha.join(), swappers: metaRequest == null || (_metaRequest$swappers = metaRequest.swappers) == null ? void 0 : _metaRequest$swappers.join(), swappersGroups: metaRequest == null || (_metaRequest$swappers2 = metaRequest.swappersGroups) == null ? void 0 : _metaRequest$swappers2.join(), transactionTypes: metaRequest == null || (_metaRequest$transact = metaRequest.transactionTypes) == null ? void 0 : _metaRequest$transact.join() }); _context.next = 3; return this.httpService.get("/basic/meta?apiKey=" + this.apiKey, _extends({ params: params }, options)); case 3: axiosResponse = _context.sent; return _context.abrupt("return", axiosResponse.data); case 5: case "end": return _context.stop(); } }, _callee, this); })); function meta(_x, _x2) { return _meta.apply(this, arguments); } return meta; }(); _proto.chains = /*#__PURE__*/function () { var _chains = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.next = 2; return this.httpService.get("/basic/meta/blockchains?apiKey=" + this.apiKey, _extends({}, options)); case 2: axiosResponse = _context2.sent; return _context2.abrupt("return", axiosResponse.data); case 4: case "end": return _context2.stop(); } }, _callee2, this); })); function chains(_x3) { return _chains.apply(this, arguments); } return chains; }(); _proto.swappers = /*#__PURE__*/function () { var _swappers = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.next = 2; return this.httpService.get("/basic/meta/swappers?apiKey=" + this.apiKey, _extends({}, options)); case 2: axiosResponse = _context3.sent; return _context3.abrupt("return", axiosResponse.data); case 4: case "end": return _context3.stop(); } }, _callee3, this); })); function swappers(_x4) { return _swappers.apply(this, arguments); } return swappers; }(); _proto.messagingProtocols = /*#__PURE__*/function () { var _messagingProtocols = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee4$(_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: _context4.next = 2; return this.httpService.get("/basic/meta/messaging-protocols?apiKey=" + this.apiKey, _extends({}, options)); case 2: axiosResponse = _context4.sent; return _context4.abrupt("return", axiosResponse.data); case 4: case "end": return _context4.stop(); } }, _callee4, this); })); function messagingProtocols(_x5) { return _messagingProtocols.apply(this, arguments); } return messagingProtocols; }(); _proto.token = /*#__PURE__*/function () { var _token = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(customTokenRequest, options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee5$(_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: _context5.next = 2; return this.httpService.get("/basic/meta/custom-token?apiKey=" + this.apiKey, _extends({ params: customTokenRequest }, options)); case 2: axiosResponse = _context5.sent; return _context5.abrupt("return", axiosResponse.data); case 4: case "end": return _context5.stop(); } }, _callee5, this); })); function token(_x6, _x7) { return _token.apply(this, arguments); } return token; }(); _proto.quote = /*#__PURE__*/function () { var _quote = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(quoteRequest, options) { var body, axiosResponse; return _regeneratorRuntime().wrap(function _callee6$(_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: body = _extends({}, quoteRequest, { from: assetToString(quoteRequest.from), to: assetToString(quoteRequest.to), swappers: !!quoteRequest.swappers && quoteRequest.swappers.length > 0 ? quoteRequest.swappers.join(',') : undefined, swapperGroups: !!quoteRequest.swapperGroups && quoteRequest.swapperGroups.length > 0 ? quoteRequest.swapperGroups.join(',') : undefined, messagingProtocols: !!quoteRequest.messagingProtocols && quoteRequest.messagingProtocols.length > 0 ? quoteRequest.messagingProtocols.join(',') : undefined }); _context6.next = 3; return this.httpService.get("/basic/quote?apiKey=" + this.apiKey, _extends({ params: body, headers: { 'X-Rango-Id': this.deviceId } }, options)); case 3: axiosResponse = _context6.sent; return _context6.abrupt("return", axiosResponse.data); case 5: case "end": return _context6.stop(); } }, _callee6, this); })); function quote(_x8, _x9) { return _quote.apply(this, arguments); } return quote; }(); _proto.isApproved = /*#__PURE__*/function () { var _isApproved = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(requestId, txId, options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee7$(_context7) { while (1) switch (_context7.prev = _context7.next) { case 0: _context7.next = 2; return this.httpService.get("/basic/is-approved?apiKey=" + this.apiKey, _extends({ params: { requestId: requestId, txId: txId }, headers: { 'X-Rango-Id': this.deviceId } }, options)); case 2: axiosResponse = _context7.sent; return _context7.abrupt("return", axiosResponse.data); case 4: case "end": return _context7.stop(); } }, _callee7, this); })); function isApproved(_x10, _x11, _x12) { return _isApproved.apply(this, arguments); } return isApproved; }(); _proto.status = /*#__PURE__*/function () { var _status = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(statusRequest, options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee8$(_context8) { while (1) switch (_context8.prev = _context8.next) { case 0: _context8.next = 2; return this.httpService.get("/basic/status?apiKey=" + this.apiKey, _extends({ params: statusRequest, headers: { 'X-Rango-Id': this.deviceId } }, options)); case 2: axiosResponse = _context8.sent; return _context8.abrupt("return", axiosResponse.data); case 4: case "end": return _context8.stop(); } }, _callee8, this); })); function status(_x13, _x14) { return _status.apply(this, arguments); } return status; }(); _proto.swap = /*#__PURE__*/function () { var _swap = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(swapRequest, options) { var body, axiosResponse; return _regeneratorRuntime().wrap(function _callee9$(_context9) { while (1) switch (_context9.prev = _context9.next) { case 0: body = _extends({}, swapRequest, { from: assetToString(swapRequest.from), to: assetToString(swapRequest.to), referrerAddress: swapRequest.referrerAddress || null, referrerFee: swapRequest.referrerFee || null, disableEstimate: swapRequest.disableEstimate || false, swappers: !!swapRequest.swappers && swapRequest.swappers.length > 0 ? swapRequest.swappers.join(',') : undefined, swapperGroups: !!swapRequest.swapperGroups && swapRequest.swapperGroups.length > 0 ? swapRequest.swapperGroups.join(',') : undefined, messagingProtocols: !!swapRequest.messagingProtocols && swapRequest.messagingProtocols.length > 0 ? swapRequest.messagingProtocols.join(',') : undefined }); _context9.next = 3; return this.httpService.get("/basic/swap?apiKey=" + this.apiKey, _extends({ params: body, headers: { 'X-Rango-Id': this.deviceId } }, options)); case 3: axiosResponse = _context9.sent; return _context9.abrupt("return", axiosResponse.data); case 5: case "end": return _context9.stop(); } }, _callee9, this); })); function swap(_x15, _x16) { return _swap.apply(this, arguments); } return swap; }(); _proto.reportFailure = /*#__PURE__*/function () { var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) { return _regeneratorRuntime().wrap(function _callee10$(_context10) { while (1) switch (_context10.prev = _context10.next) { case 0: _context10.next = 2; return this.httpService.post("/basic/report-tx?apiKey=" + this.apiKey, requestBody, _extends({ headers: { 'X-Rango-Id': this.deviceId } }, options)); case 2: case "end": return _context10.stop(); } }, _callee10, this); })); function reportFailure(_x17, _x18) { return _reportFailure.apply(this, arguments); } return reportFailure; }(); _proto.balance = /*#__PURE__*/function () { var _balance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(walletAddress, options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee11$(_context11) { while (1) switch (_context11.prev = _context11.next) { case 0: _context11.next = 2; return this.httpService.get("/basic/balance?apiKey=" + this.apiKey, _extends({ params: walletAddress, headers: { 'X-Rango-Id': this.deviceId } }, options)); case 2: axiosResponse = _context11.sent; return _context11.abrupt("return", axiosResponse.data); case 4: case "end": return _context11.stop(); } }, _callee11, this); })); function balance(_x19, _x20) { return _balance.apply(this, arguments); } return balance; }(); _proto.tokenBalance = /*#__PURE__*/function () { var _tokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(tokenBalanceRequest, options) { var axiosResponse; return _regeneratorRuntime().wrap(function _callee12$(_context12) { while (1) switch (_context12.prev = _context12.next) { case 0: _context12.next = 2; return this.httpService.get("/basic/token-balance?apiKey=" + this.apiKey, _extends({ params: tokenBalanceRequest }, options)); case 2: axiosResponse = _context12.sent; return _context12.abrupt("return", axiosResponse.data); case 4: case "end": return _context12.stop(); } }, _callee12, this); })); function tokenBalance(_x21, _x22) { return _tokenBalance.apply(this, arguments); } return tokenBalance; }(); _proto.connectedAssets = /*#__PURE__*/function () { var _connectedAssets = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(connectedAssetsRequest, options) { var body, axiosResponse; return _regeneratorRuntime().wrap(function _callee13$(_context13) { while (1) switch (_context13.prev = _context13.next) { case 0: body = { from: assetToString(connectedAssetsRequest.from) }; _context13.next = 3; return this.httpService.get("/basic/connected-assets?apiKey=" + this.apiKey, _extends({ params: body, headers: { 'X-Rango-Id': this.deviceId } }, options)); case 3: axiosResponse = _context13.sent; return _context13.abrupt("return", axiosResponse.data); case 5: case "end": return _context13.stop(); } }, _callee13, this); })); function connectedAssets(_x23, _x24) { return _connectedAssets.apply(this, arguments); } return connectedAssets; }(); return RangoClient; }(); export { GenericTransactionType, RangoClient, RoutingResultType, TransactionStatus, TransactionType, assetToString, cosmosBlockchains, evmBlockchains, isCosmosBlockchain, isCosmosTransaction, isEvmBlockchain, isEvmTransaction, isSolanaBlockchain, isSolanaTransaction, isStarknetBlockchain, isTonBlockchain, isTransferBlockchain, isTransferTransaction, isTronBlockchain, solanaBlockchain, starknetBlockchain, tonBlockchain, transferBlockchains, tronBlockchain }; //# sourceMappingURL=rango-sdk-basic.esm.js.map