rango-sdk 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/index.d.ts +3 -0
- package/lib/dist/index.d.ts.map +1 -0
- package/lib/dist/index.js +8 -0
- package/lib/dist/rango-sdk.cjs.development.js +631 -0
- package/lib/dist/rango-sdk.cjs.development.js.map +1 -0
- package/lib/dist/rango-sdk.cjs.production.min.js +2 -0
- package/lib/dist/rango-sdk.cjs.production.min.js.map +1 -0
- package/lib/dist/rango-sdk.esm.js +624 -0
- package/lib/dist/rango-sdk.esm.js.map +1 -0
- package/lib/dist/services/client.d.ts +21 -0
- package/lib/dist/services/client.d.ts.map +1 -0
- package/lib/dist/services/index.d.ts +2 -0
- package/lib/dist/services/index.d.ts.map +1 -0
- package/lib/dist/types/api/balance.d.ts +2 -0
- package/lib/dist/types/api/balance.d.ts.map +1 -0
- package/lib/dist/types/api/common.d.ts +2 -0
- package/lib/dist/types/api/common.d.ts.map +1 -0
- package/lib/dist/types/api/meta.d.ts +3 -0
- package/lib/dist/types/api/meta.d.ts.map +1 -0
- package/lib/dist/types/api/routing.d.ts +2 -0
- package/lib/dist/types/api/routing.d.ts.map +1 -0
- package/lib/dist/types/api/transactions.d.ts +2 -0
- package/lib/dist/types/api/transactions.d.ts.map +1 -0
- package/lib/dist/types/api/txs/cosmos.d.ts +2 -0
- package/lib/dist/types/api/txs/cosmos.d.ts.map +1 -0
- package/lib/dist/types/api/txs/evm.d.ts +2 -0
- package/lib/dist/types/api/txs/evm.d.ts.map +1 -0
- package/lib/dist/types/api/txs/index.d.ts +7 -0
- package/lib/dist/types/api/txs/index.d.ts.map +1 -0
- package/lib/dist/types/api/txs/solana.d.ts +2 -0
- package/lib/dist/types/api/txs/solana.d.ts.map +1 -0
- package/lib/dist/types/api/txs/starknet.d.ts +2 -0
- package/lib/dist/types/api/txs/starknet.d.ts.map +1 -0
- package/lib/dist/types/api/txs/transfer.d.ts +2 -0
- package/lib/dist/types/api/txs/transfer.d.ts.map +1 -0
- package/lib/dist/types/api/txs/tron.d.ts +2 -0
- package/lib/dist/types/api/txs/tron.d.ts.map +1 -0
- package/lib/dist/types/configs.d.ts +5 -0
- package/lib/dist/types/configs.d.ts.map +1 -0
- package/lib/dist/types/index.d.ts +8 -0
- package/lib/dist/types/index.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/index.ts +2 -0
- package/src/services/client.ts +135 -0
- package/src/services/index.ts +1 -0
- package/src/types/api/balance.ts +1 -0
- package/src/types/api/common.ts +1 -0
- package/src/types/api/meta.ts +2 -0
- package/src/types/api/routing.ts +1 -0
- package/src/types/api/transactions.ts +1 -0
- package/src/types/api/txs/cosmos.ts +1 -0
- package/src/types/api/txs/evm.ts +1 -0
- package/src/types/api/txs/index.ts +6 -0
- package/src/types/api/txs/solana.ts +1 -0
- package/src/types/api/txs/starknet.ts +1 -0
- package/src/types/api/txs/transfer.ts +1 -0
- package/src/types/api/txs/tron.ts +1 -0
- package/src/types/configs.ts +5 -0
- package/src/types/index.ts +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,631 @@
|
|
|
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 _regeneratorRuntime() {
|
|
11
|
+
_regeneratorRuntime = function () {
|
|
12
|
+
return exports;
|
|
13
|
+
};
|
|
14
|
+
var exports = {},
|
|
15
|
+
Op = Object.prototype,
|
|
16
|
+
hasOwn = Op.hasOwnProperty,
|
|
17
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
18
|
+
obj[key] = desc.value;
|
|
19
|
+
},
|
|
20
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
21
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
22
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
23
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
24
|
+
function define(obj, key, value) {
|
|
25
|
+
return Object.defineProperty(obj, key, {
|
|
26
|
+
value: value,
|
|
27
|
+
enumerable: !0,
|
|
28
|
+
configurable: !0,
|
|
29
|
+
writable: !0
|
|
30
|
+
}), obj[key];
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
define({}, "");
|
|
34
|
+
} catch (err) {
|
|
35
|
+
define = function (obj, key, value) {
|
|
36
|
+
return obj[key] = value;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
40
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
41
|
+
generator = Object.create(protoGenerator.prototype),
|
|
42
|
+
context = new Context(tryLocsList || []);
|
|
43
|
+
return defineProperty(generator, "_invoke", {
|
|
44
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
45
|
+
}), generator;
|
|
46
|
+
}
|
|
47
|
+
function tryCatch(fn, obj, arg) {
|
|
48
|
+
try {
|
|
49
|
+
return {
|
|
50
|
+
type: "normal",
|
|
51
|
+
arg: fn.call(obj, arg)
|
|
52
|
+
};
|
|
53
|
+
} catch (err) {
|
|
54
|
+
return {
|
|
55
|
+
type: "throw",
|
|
56
|
+
arg: err
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.wrap = wrap;
|
|
61
|
+
var ContinueSentinel = {};
|
|
62
|
+
function Generator() {}
|
|
63
|
+
function GeneratorFunction() {}
|
|
64
|
+
function GeneratorFunctionPrototype() {}
|
|
65
|
+
var IteratorPrototype = {};
|
|
66
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
67
|
+
return this;
|
|
68
|
+
});
|
|
69
|
+
var getProto = Object.getPrototypeOf,
|
|
70
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
71
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
72
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
73
|
+
function defineIteratorMethods(prototype) {
|
|
74
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
75
|
+
define(prototype, method, function (arg) {
|
|
76
|
+
return this._invoke(method, arg);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
81
|
+
function invoke(method, arg, resolve, reject) {
|
|
82
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
83
|
+
if ("throw" !== record.type) {
|
|
84
|
+
var result = record.arg,
|
|
85
|
+
value = result.value;
|
|
86
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
87
|
+
invoke("next", value, resolve, reject);
|
|
88
|
+
}, function (err) {
|
|
89
|
+
invoke("throw", err, resolve, reject);
|
|
90
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
91
|
+
result.value = unwrapped, resolve(result);
|
|
92
|
+
}, function (error) {
|
|
93
|
+
return invoke("throw", error, resolve, reject);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
reject(record.arg);
|
|
97
|
+
}
|
|
98
|
+
var previousPromise;
|
|
99
|
+
defineProperty(this, "_invoke", {
|
|
100
|
+
value: function (method, arg) {
|
|
101
|
+
function callInvokeWithMethodAndArg() {
|
|
102
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
103
|
+
invoke(method, arg, resolve, reject);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
111
|
+
var state = "suspendedStart";
|
|
112
|
+
return function (method, arg) {
|
|
113
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
114
|
+
if ("completed" === state) {
|
|
115
|
+
if ("throw" === method) throw arg;
|
|
116
|
+
return doneResult();
|
|
117
|
+
}
|
|
118
|
+
for (context.method = method, context.arg = arg;;) {
|
|
119
|
+
var delegate = context.delegate;
|
|
120
|
+
if (delegate) {
|
|
121
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
122
|
+
if (delegateResult) {
|
|
123
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
124
|
+
return delegateResult;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
128
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
129
|
+
context.dispatchException(context.arg);
|
|
130
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
131
|
+
state = "executing";
|
|
132
|
+
var record = tryCatch(innerFn, self, context);
|
|
133
|
+
if ("normal" === record.type) {
|
|
134
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
135
|
+
return {
|
|
136
|
+
value: record.arg,
|
|
137
|
+
done: context.done
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
145
|
+
var methodName = context.method,
|
|
146
|
+
method = delegate.iterator[methodName];
|
|
147
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
148
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
149
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
150
|
+
var info = record.arg;
|
|
151
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
152
|
+
}
|
|
153
|
+
function pushTryEntry(locs) {
|
|
154
|
+
var entry = {
|
|
155
|
+
tryLoc: locs[0]
|
|
156
|
+
};
|
|
157
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
158
|
+
}
|
|
159
|
+
function resetTryEntry(entry) {
|
|
160
|
+
var record = entry.completion || {};
|
|
161
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
162
|
+
}
|
|
163
|
+
function Context(tryLocsList) {
|
|
164
|
+
this.tryEntries = [{
|
|
165
|
+
tryLoc: "root"
|
|
166
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
167
|
+
}
|
|
168
|
+
function values(iterable) {
|
|
169
|
+
if (iterable) {
|
|
170
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
171
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
172
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
173
|
+
if (!isNaN(iterable.length)) {
|
|
174
|
+
var i = -1,
|
|
175
|
+
next = function next() {
|
|
176
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
177
|
+
return next.value = undefined, next.done = !0, next;
|
|
178
|
+
};
|
|
179
|
+
return next.next = next;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
next: doneResult
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function doneResult() {
|
|
187
|
+
return {
|
|
188
|
+
value: undefined,
|
|
189
|
+
done: !0
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
193
|
+
value: GeneratorFunctionPrototype,
|
|
194
|
+
configurable: !0
|
|
195
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
196
|
+
value: GeneratorFunction,
|
|
197
|
+
configurable: !0
|
|
198
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
199
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
200
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
201
|
+
}, exports.mark = function (genFun) {
|
|
202
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
203
|
+
}, exports.awrap = function (arg) {
|
|
204
|
+
return {
|
|
205
|
+
__await: arg
|
|
206
|
+
};
|
|
207
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
208
|
+
return this;
|
|
209
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
210
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
211
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
212
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
213
|
+
return result.done ? result.value : iter.next();
|
|
214
|
+
});
|
|
215
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
216
|
+
return this;
|
|
217
|
+
}), define(Gp, "toString", function () {
|
|
218
|
+
return "[object Generator]";
|
|
219
|
+
}), exports.keys = function (val) {
|
|
220
|
+
var object = Object(val),
|
|
221
|
+
keys = [];
|
|
222
|
+
for (var key in object) keys.push(key);
|
|
223
|
+
return keys.reverse(), function next() {
|
|
224
|
+
for (; keys.length;) {
|
|
225
|
+
var key = keys.pop();
|
|
226
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
227
|
+
}
|
|
228
|
+
return next.done = !0, next;
|
|
229
|
+
};
|
|
230
|
+
}, exports.values = values, Context.prototype = {
|
|
231
|
+
constructor: Context,
|
|
232
|
+
reset: function (skipTempReset) {
|
|
233
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
234
|
+
},
|
|
235
|
+
stop: function () {
|
|
236
|
+
this.done = !0;
|
|
237
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
238
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
239
|
+
return this.rval;
|
|
240
|
+
},
|
|
241
|
+
dispatchException: function (exception) {
|
|
242
|
+
if (this.done) throw exception;
|
|
243
|
+
var context = this;
|
|
244
|
+
function handle(loc, caught) {
|
|
245
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
246
|
+
}
|
|
247
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
248
|
+
var entry = this.tryEntries[i],
|
|
249
|
+
record = entry.completion;
|
|
250
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
251
|
+
if (entry.tryLoc <= this.prev) {
|
|
252
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
253
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
254
|
+
if (hasCatch && hasFinally) {
|
|
255
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
256
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
257
|
+
} else if (hasCatch) {
|
|
258
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
259
|
+
} else {
|
|
260
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
261
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
abrupt: function (type, arg) {
|
|
267
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
268
|
+
var entry = this.tryEntries[i];
|
|
269
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
270
|
+
var finallyEntry = entry;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
275
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
276
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
277
|
+
},
|
|
278
|
+
complete: function (record, afterLoc) {
|
|
279
|
+
if ("throw" === record.type) throw record.arg;
|
|
280
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
281
|
+
},
|
|
282
|
+
finish: function (finallyLoc) {
|
|
283
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
284
|
+
var entry = this.tryEntries[i];
|
|
285
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
catch: function (tryLoc) {
|
|
289
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
290
|
+
var entry = this.tryEntries[i];
|
|
291
|
+
if (entry.tryLoc === tryLoc) {
|
|
292
|
+
var record = entry.completion;
|
|
293
|
+
if ("throw" === record.type) {
|
|
294
|
+
var thrown = record.arg;
|
|
295
|
+
resetTryEntry(entry);
|
|
296
|
+
}
|
|
297
|
+
return thrown;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
throw new Error("illegal catch attempt");
|
|
301
|
+
},
|
|
302
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
303
|
+
return this.delegate = {
|
|
304
|
+
iterator: values(iterable),
|
|
305
|
+
resultName: resultName,
|
|
306
|
+
nextLoc: nextLoc
|
|
307
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
308
|
+
}
|
|
309
|
+
}, exports;
|
|
310
|
+
}
|
|
311
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
312
|
+
try {
|
|
313
|
+
var info = gen[key](arg);
|
|
314
|
+
var value = info.value;
|
|
315
|
+
} catch (error) {
|
|
316
|
+
reject(error);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (info.done) {
|
|
320
|
+
resolve(value);
|
|
321
|
+
} else {
|
|
322
|
+
Promise.resolve(value).then(_next, _throw);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
function _asyncToGenerator(fn) {
|
|
326
|
+
return function () {
|
|
327
|
+
var self = this,
|
|
328
|
+
args = arguments;
|
|
329
|
+
return new Promise(function (resolve, reject) {
|
|
330
|
+
var gen = fn.apply(self, args);
|
|
331
|
+
function _next(value) {
|
|
332
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
333
|
+
}
|
|
334
|
+
function _throw(err) {
|
|
335
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
336
|
+
}
|
|
337
|
+
_next(undefined);
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function _extends() {
|
|
342
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
343
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
344
|
+
var source = arguments[i];
|
|
345
|
+
for (var key in source) {
|
|
346
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
347
|
+
target[key] = source[key];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return target;
|
|
352
|
+
};
|
|
353
|
+
return _extends.apply(this, arguments);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
var RangoClient = /*#__PURE__*/function () {
|
|
357
|
+
function RangoClient(apiKey, apiUrl) {
|
|
358
|
+
this.apiUrl = apiUrl || 'https://api.rango.exchange';
|
|
359
|
+
this.apiKey = apiKey;
|
|
360
|
+
try {
|
|
361
|
+
if (typeof window !== 'undefined') {
|
|
362
|
+
var deviceId = localStorage.getItem('deviceId');
|
|
363
|
+
if (deviceId) {
|
|
364
|
+
this.deviceId = deviceId;
|
|
365
|
+
} else {
|
|
366
|
+
var generatedId = uuid();
|
|
367
|
+
localStorage.setItem('deviceId', generatedId);
|
|
368
|
+
this.deviceId = generatedId;
|
|
369
|
+
}
|
|
370
|
+
} else {
|
|
371
|
+
this.deviceId = uuid();
|
|
372
|
+
}
|
|
373
|
+
} catch (e) {
|
|
374
|
+
this.deviceId = uuid();
|
|
375
|
+
}
|
|
376
|
+
this.httpService = axios.create({
|
|
377
|
+
baseURL: this.apiUrl
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
var _proto = RangoClient.prototype;
|
|
381
|
+
_proto.getAllMetadata = /*#__PURE__*/function () {
|
|
382
|
+
var _getAllMetadata = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
383
|
+
var axiosResponse;
|
|
384
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
385
|
+
while (1) switch (_context.prev = _context.next) {
|
|
386
|
+
case 0:
|
|
387
|
+
_context.next = 2;
|
|
388
|
+
return this.httpService.get("/meta?apiKey=" + this.apiKey, _extends({}, options));
|
|
389
|
+
case 2:
|
|
390
|
+
axiosResponse = _context.sent;
|
|
391
|
+
return _context.abrupt("return", axiosResponse.data);
|
|
392
|
+
case 4:
|
|
393
|
+
case "end":
|
|
394
|
+
return _context.stop();
|
|
395
|
+
}
|
|
396
|
+
}, _callee, this);
|
|
397
|
+
}));
|
|
398
|
+
function getAllMetadata(_x) {
|
|
399
|
+
return _getAllMetadata.apply(this, arguments);
|
|
400
|
+
}
|
|
401
|
+
return getAllMetadata;
|
|
402
|
+
}();
|
|
403
|
+
_proto.getBestRoute = /*#__PURE__*/function () {
|
|
404
|
+
var _getBestRoute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(requestBody, options) {
|
|
405
|
+
var axiosResponse;
|
|
406
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
407
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
408
|
+
case 0:
|
|
409
|
+
_context2.next = 2;
|
|
410
|
+
return this.httpService.post("/routing/best?apiKey=" + this.apiKey, requestBody, _extends({
|
|
411
|
+
headers: {
|
|
412
|
+
'X-Rango-Id': this.deviceId
|
|
413
|
+
}
|
|
414
|
+
}, options));
|
|
415
|
+
case 2:
|
|
416
|
+
axiosResponse = _context2.sent;
|
|
417
|
+
return _context2.abrupt("return", axiosResponse.data);
|
|
418
|
+
case 4:
|
|
419
|
+
case "end":
|
|
420
|
+
return _context2.stop();
|
|
421
|
+
}
|
|
422
|
+
}, _callee2, this);
|
|
423
|
+
}));
|
|
424
|
+
function getBestRoute(_x2, _x3) {
|
|
425
|
+
return _getBestRoute.apply(this, arguments);
|
|
426
|
+
}
|
|
427
|
+
return getBestRoute;
|
|
428
|
+
}();
|
|
429
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
430
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(requestId, txId, options) {
|
|
431
|
+
var axiosResponse;
|
|
432
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
433
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
434
|
+
case 0:
|
|
435
|
+
_context3.next = 2;
|
|
436
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
437
|
+
params: {
|
|
438
|
+
txId: txId
|
|
439
|
+
}
|
|
440
|
+
}, options));
|
|
441
|
+
case 2:
|
|
442
|
+
axiosResponse = _context3.sent;
|
|
443
|
+
return _context3.abrupt("return", axiosResponse.data);
|
|
444
|
+
case 4:
|
|
445
|
+
case "end":
|
|
446
|
+
return _context3.stop();
|
|
447
|
+
}
|
|
448
|
+
}, _callee3, this);
|
|
449
|
+
}));
|
|
450
|
+
function checkApproval(_x4, _x5, _x6) {
|
|
451
|
+
return _checkApproval.apply(this, arguments);
|
|
452
|
+
}
|
|
453
|
+
return checkApproval;
|
|
454
|
+
}();
|
|
455
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
456
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(requestBody, options) {
|
|
457
|
+
var axiosResponse;
|
|
458
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
459
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
460
|
+
case 0:
|
|
461
|
+
_context4.next = 2;
|
|
462
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
463
|
+
case 2:
|
|
464
|
+
axiosResponse = _context4.sent;
|
|
465
|
+
return _context4.abrupt("return", axiosResponse.data);
|
|
466
|
+
case 4:
|
|
467
|
+
case "end":
|
|
468
|
+
return _context4.stop();
|
|
469
|
+
}
|
|
470
|
+
}, _callee4, this);
|
|
471
|
+
}));
|
|
472
|
+
function checkStatus(_x7, _x8) {
|
|
473
|
+
return _checkStatus.apply(this, arguments);
|
|
474
|
+
}
|
|
475
|
+
return checkStatus;
|
|
476
|
+
}();
|
|
477
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
478
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(requestBody, options) {
|
|
479
|
+
var axiosResponse;
|
|
480
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
481
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
482
|
+
case 0:
|
|
483
|
+
_context5.next = 2;
|
|
484
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
485
|
+
case 2:
|
|
486
|
+
axiosResponse = _context5.sent;
|
|
487
|
+
return _context5.abrupt("return", axiosResponse.data);
|
|
488
|
+
case 4:
|
|
489
|
+
case "end":
|
|
490
|
+
return _context5.stop();
|
|
491
|
+
}
|
|
492
|
+
}, _callee5, this);
|
|
493
|
+
}));
|
|
494
|
+
function createTransaction(_x9, _x10) {
|
|
495
|
+
return _createTransaction.apply(this, arguments);
|
|
496
|
+
}
|
|
497
|
+
return createTransaction;
|
|
498
|
+
}();
|
|
499
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
500
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(requestBody, options) {
|
|
501
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
502
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
503
|
+
case 0:
|
|
504
|
+
_context6.next = 2;
|
|
505
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
506
|
+
case 2:
|
|
507
|
+
case "end":
|
|
508
|
+
return _context6.stop();
|
|
509
|
+
}
|
|
510
|
+
}, _callee6, this);
|
|
511
|
+
}));
|
|
512
|
+
function reportFailure(_x11, _x12) {
|
|
513
|
+
return _reportFailure.apply(this, arguments);
|
|
514
|
+
}
|
|
515
|
+
return reportFailure;
|
|
516
|
+
}();
|
|
517
|
+
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
518
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(walletAddresses, options) {
|
|
519
|
+
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
520
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
521
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
522
|
+
case 0:
|
|
523
|
+
walletAddressesQueryParams = '';
|
|
524
|
+
for (i = 0; i < walletAddresses.length; i++) {
|
|
525
|
+
walletAddress = walletAddresses[i];
|
|
526
|
+
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
527
|
+
}
|
|
528
|
+
_context7.next = 4;
|
|
529
|
+
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
530
|
+
case 4:
|
|
531
|
+
axiosResponse = _context7.sent;
|
|
532
|
+
return _context7.abrupt("return", axiosResponse.data);
|
|
533
|
+
case 6:
|
|
534
|
+
case "end":
|
|
535
|
+
return _context7.stop();
|
|
536
|
+
}
|
|
537
|
+
}, _callee7, this);
|
|
538
|
+
}));
|
|
539
|
+
function getWalletsDetails(_x13, _x14) {
|
|
540
|
+
return _getWalletsDetails.apply(this, arguments);
|
|
541
|
+
}
|
|
542
|
+
return getWalletsDetails;
|
|
543
|
+
}();
|
|
544
|
+
return RangoClient;
|
|
545
|
+
}();
|
|
546
|
+
|
|
547
|
+
var isEvmBlockchain = function isEvmBlockchain(blockchainMeta) {
|
|
548
|
+
return blockchainMeta.type === 'EVM';
|
|
549
|
+
};
|
|
550
|
+
var isCosmosBlockchain = function isCosmosBlockchain(blockchainMeta) {
|
|
551
|
+
return blockchainMeta.type === 'COSMOS';
|
|
552
|
+
};
|
|
553
|
+
var isSolanaBlockchain = function isSolanaBlockchain(blockchainMeta) {
|
|
554
|
+
return blockchainMeta.type === 'SOLANA';
|
|
555
|
+
};
|
|
556
|
+
var isTronBlockchain = function isTronBlockchain(blockchainMeta) {
|
|
557
|
+
return blockchainMeta.type === 'TRON';
|
|
558
|
+
};
|
|
559
|
+
var isTransferBlockchain = function isTransferBlockchain(blockchainMeta) {
|
|
560
|
+
return blockchainMeta.type === 'TRANSFER';
|
|
561
|
+
};
|
|
562
|
+
var isStarknetBlockchain = function isStarknetBlockchain(blockchainMeta) {
|
|
563
|
+
return blockchainMeta.type === 'STARKNET';
|
|
564
|
+
};
|
|
565
|
+
var evmBlockchains = function evmBlockchains(blockchains) {
|
|
566
|
+
return blockchains.filter(isEvmBlockchain);
|
|
567
|
+
};
|
|
568
|
+
var solanaBlockchain = function solanaBlockchain(blockchains) {
|
|
569
|
+
return blockchains.filter(isSolanaBlockchain);
|
|
570
|
+
};
|
|
571
|
+
var starknetBlockchain = function starknetBlockchain(blockchains) {
|
|
572
|
+
return blockchains.filter(isStarknetBlockchain);
|
|
573
|
+
};
|
|
574
|
+
var tronBlockchain = function tronBlockchain(blockchains) {
|
|
575
|
+
return blockchains.filter(isTronBlockchain);
|
|
576
|
+
};
|
|
577
|
+
var cosmosBlockchains = function cosmosBlockchains(blockchains) {
|
|
578
|
+
return blockchains.filter(isCosmosBlockchain);
|
|
579
|
+
};
|
|
580
|
+
var transferBlockchains = function transferBlockchains(blockchains) {
|
|
581
|
+
return blockchains.filter(isTransferBlockchain);
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Routing Result Type
|
|
586
|
+
*
|
|
587
|
+
*/
|
|
588
|
+
(function (RoutingResultType) {
|
|
589
|
+
RoutingResultType["OK"] = "OK";
|
|
590
|
+
RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT";
|
|
591
|
+
RoutingResultType["NO_ROUTE"] = "NO_ROUTE";
|
|
592
|
+
RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE";
|
|
593
|
+
})(exports.RoutingResultType || (exports.RoutingResultType = {}));
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* The type of transaction
|
|
597
|
+
*/
|
|
598
|
+
(function (TransactionType) {
|
|
599
|
+
TransactionType["EVM"] = "EVM";
|
|
600
|
+
TransactionType["TRANSFER"] = "TRANSFER";
|
|
601
|
+
TransactionType["COSMOS"] = "COSMOS";
|
|
602
|
+
TransactionType["SOLANA"] = "SOLANA";
|
|
603
|
+
TransactionType["TRON"] = "TRON";
|
|
604
|
+
TransactionType["STARKNET"] = "STARKNET";
|
|
605
|
+
})(exports.TransactionType || (exports.TransactionType = {}));
|
|
606
|
+
(function (GenericTransactionType) {
|
|
607
|
+
GenericTransactionType["EVM"] = "EVM";
|
|
608
|
+
GenericTransactionType["TRANSFER"] = "TRANSFER";
|
|
609
|
+
GenericTransactionType["COSMOS"] = "COSMOS";
|
|
610
|
+
GenericTransactionType["SOLANA"] = "SOLANA";
|
|
611
|
+
})(exports.GenericTransactionType || (exports.GenericTransactionType = {}));
|
|
612
|
+
(function (TransactionStatus) {
|
|
613
|
+
TransactionStatus["FAILED"] = "failed";
|
|
614
|
+
TransactionStatus["RUNNING"] = "running";
|
|
615
|
+
TransactionStatus["SUCCESS"] = "success";
|
|
616
|
+
})(exports.TransactionStatus || (exports.TransactionStatus = {}));
|
|
617
|
+
|
|
618
|
+
exports.RangoClient = RangoClient;
|
|
619
|
+
exports.cosmosBlockchains = cosmosBlockchains;
|
|
620
|
+
exports.evmBlockchains = evmBlockchains;
|
|
621
|
+
exports.isCosmosBlockchain = isCosmosBlockchain;
|
|
622
|
+
exports.isEvmBlockchain = isEvmBlockchain;
|
|
623
|
+
exports.isSolanaBlockchain = isSolanaBlockchain;
|
|
624
|
+
exports.isStarknetBlockchain = isStarknetBlockchain;
|
|
625
|
+
exports.isTransferBlockchain = isTransferBlockchain;
|
|
626
|
+
exports.isTronBlockchain = isTronBlockchain;
|
|
627
|
+
exports.solanaBlockchain = solanaBlockchain;
|
|
628
|
+
exports.starknetBlockchain = starknetBlockchain;
|
|
629
|
+
exports.transferBlockchains = transferBlockchains;
|
|
630
|
+
exports.tronBlockchain = tronBlockchain;
|
|
631
|
+
//# sourceMappingURL=rango-sdk.cjs.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rango-sdk.cjs.development.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(options?: RequestOptions): Promise<MetaResponse> {\n const axiosResponse = await this.httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} step - Step number in which failure happened\n * @property {string} reason - Reason or message for the error\n * @property {[key: string]: string} data - A list of key-value for extra details\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n}\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","getAllMetadata","options","get","axiosResponse","data","getBestRoute","requestBody","post","headers","checkApproval","requestId","txId","params","checkStatus","createTransaction","reportFailure","getWalletsDetails","walletAddresses","walletAddressesQueryParams","i","length","walletAddress","blockchain","address","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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