@paraspell/sdk 3.0.5 → 3.0.7
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/README.md +3 -3
- package/dist/index.cjs +680 -228
- package/dist/index.d.ts +137 -170
- package/dist/index.mjs +679 -229
- package/package.json +33 -28
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,324 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('@polkadot/api');
|
|
3
|
+
var api = require('@polkadot/api');
|
|
4
4
|
var ethers = require('ethers');
|
|
5
5
|
var endpoints = require('@polkadot/apps-config/endpoints');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
function _regeneratorRuntime() {
|
|
8
|
+
_regeneratorRuntime = function () {
|
|
9
|
+
return e;
|
|
10
|
+
};
|
|
11
|
+
var t,
|
|
12
|
+
e = {},
|
|
13
|
+
r = Object.prototype,
|
|
14
|
+
n = r.hasOwnProperty,
|
|
15
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
16
|
+
t[e] = r.value;
|
|
17
|
+
},
|
|
18
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
19
|
+
a = i.iterator || "@@iterator",
|
|
20
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
21
|
+
u = i.toStringTag || "@@toStringTag";
|
|
22
|
+
function define(t, e, r) {
|
|
23
|
+
return Object.defineProperty(t, e, {
|
|
24
|
+
value: r,
|
|
25
|
+
enumerable: !0,
|
|
26
|
+
configurable: !0,
|
|
27
|
+
writable: !0
|
|
28
|
+
}), t[e];
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
define({}, "");
|
|
32
|
+
} catch (t) {
|
|
33
|
+
define = function (t, e, r) {
|
|
34
|
+
return t[e] = r;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function wrap(t, e, r, n) {
|
|
38
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
39
|
+
a = Object.create(i.prototype),
|
|
40
|
+
c = new Context(n || []);
|
|
41
|
+
return o(a, "_invoke", {
|
|
42
|
+
value: makeInvokeMethod(t, r, c)
|
|
43
|
+
}), a;
|
|
44
|
+
}
|
|
45
|
+
function tryCatch(t, e, r) {
|
|
46
|
+
try {
|
|
47
|
+
return {
|
|
48
|
+
type: "normal",
|
|
49
|
+
arg: t.call(e, r)
|
|
50
|
+
};
|
|
51
|
+
} catch (t) {
|
|
52
|
+
return {
|
|
53
|
+
type: "throw",
|
|
54
|
+
arg: t
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
e.wrap = wrap;
|
|
59
|
+
var h = "suspendedStart",
|
|
60
|
+
l = "suspendedYield",
|
|
61
|
+
f = "executing",
|
|
62
|
+
s = "completed",
|
|
63
|
+
y = {};
|
|
64
|
+
function Generator() {}
|
|
65
|
+
function GeneratorFunction() {}
|
|
66
|
+
function GeneratorFunctionPrototype() {}
|
|
67
|
+
var p = {};
|
|
68
|
+
define(p, a, function () {
|
|
69
|
+
return this;
|
|
70
|
+
});
|
|
71
|
+
var d = Object.getPrototypeOf,
|
|
72
|
+
v = d && d(d(values([])));
|
|
73
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
74
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
75
|
+
function defineIteratorMethods(t) {
|
|
76
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
77
|
+
define(t, e, function (t) {
|
|
78
|
+
return this._invoke(e, t);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function AsyncIterator(t, e) {
|
|
83
|
+
function invoke(r, o, i, a) {
|
|
84
|
+
var c = tryCatch(t[r], t, o);
|
|
85
|
+
if ("throw" !== c.type) {
|
|
86
|
+
var u = c.arg,
|
|
87
|
+
h = u.value;
|
|
88
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
89
|
+
invoke("next", t, i, a);
|
|
90
|
+
}, function (t) {
|
|
91
|
+
invoke("throw", t, i, a);
|
|
92
|
+
}) : e.resolve(h).then(function (t) {
|
|
93
|
+
u.value = t, i(u);
|
|
94
|
+
}, function (t) {
|
|
95
|
+
return invoke("throw", t, i, a);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
a(c.arg);
|
|
99
|
+
}
|
|
100
|
+
var r;
|
|
101
|
+
o(this, "_invoke", {
|
|
102
|
+
value: function (t, n) {
|
|
103
|
+
function callInvokeWithMethodAndArg() {
|
|
104
|
+
return new e(function (e, r) {
|
|
105
|
+
invoke(t, n, e, r);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function makeInvokeMethod(e, r, n) {
|
|
113
|
+
var o = h;
|
|
114
|
+
return function (i, a) {
|
|
115
|
+
if (o === f) throw new Error("Generator is already running");
|
|
116
|
+
if (o === s) {
|
|
117
|
+
if ("throw" === i) throw a;
|
|
118
|
+
return {
|
|
119
|
+
value: t,
|
|
120
|
+
done: !0
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
for (n.method = i, n.arg = a;;) {
|
|
124
|
+
var c = n.delegate;
|
|
125
|
+
if (c) {
|
|
126
|
+
var u = maybeInvokeDelegate(c, n);
|
|
127
|
+
if (u) {
|
|
128
|
+
if (u === y) continue;
|
|
129
|
+
return u;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
133
|
+
if (o === h) throw o = s, n.arg;
|
|
134
|
+
n.dispatchException(n.arg);
|
|
135
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
136
|
+
o = f;
|
|
137
|
+
var p = tryCatch(e, r, n);
|
|
138
|
+
if ("normal" === p.type) {
|
|
139
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
140
|
+
return {
|
|
141
|
+
value: p.arg,
|
|
142
|
+
done: n.done
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function maybeInvokeDelegate(e, r) {
|
|
150
|
+
var n = r.method,
|
|
151
|
+
o = e.iterator[n];
|
|
152
|
+
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;
|
|
153
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
154
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
155
|
+
var a = i.arg;
|
|
156
|
+
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);
|
|
157
|
+
}
|
|
158
|
+
function pushTryEntry(t) {
|
|
159
|
+
var e = {
|
|
160
|
+
tryLoc: t[0]
|
|
161
|
+
};
|
|
162
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
163
|
+
}
|
|
164
|
+
function resetTryEntry(t) {
|
|
165
|
+
var e = t.completion || {};
|
|
166
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
167
|
+
}
|
|
168
|
+
function Context(t) {
|
|
169
|
+
this.tryEntries = [{
|
|
170
|
+
tryLoc: "root"
|
|
171
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
172
|
+
}
|
|
173
|
+
function values(e) {
|
|
174
|
+
if (e || "" === e) {
|
|
175
|
+
var r = e[a];
|
|
176
|
+
if (r) return r.call(e);
|
|
177
|
+
if ("function" == typeof e.next) return e;
|
|
178
|
+
if (!isNaN(e.length)) {
|
|
179
|
+
var o = -1,
|
|
180
|
+
i = function next() {
|
|
181
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
182
|
+
return next.value = t, next.done = !0, next;
|
|
183
|
+
};
|
|
184
|
+
return i.next = i;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
188
|
+
}
|
|
189
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
190
|
+
value: GeneratorFunctionPrototype,
|
|
191
|
+
configurable: !0
|
|
192
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
193
|
+
value: GeneratorFunction,
|
|
194
|
+
configurable: !0
|
|
195
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
196
|
+
var e = "function" == typeof t && t.constructor;
|
|
197
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
198
|
+
}, e.mark = function (t) {
|
|
199
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
200
|
+
}, e.awrap = function (t) {
|
|
201
|
+
return {
|
|
202
|
+
__await: t
|
|
203
|
+
};
|
|
204
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
205
|
+
return this;
|
|
206
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
207
|
+
void 0 === i && (i = Promise);
|
|
208
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
209
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
210
|
+
return t.done ? t.value : a.next();
|
|
211
|
+
});
|
|
212
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
213
|
+
return this;
|
|
214
|
+
}), define(g, "toString", function () {
|
|
215
|
+
return "[object Generator]";
|
|
216
|
+
}), e.keys = function (t) {
|
|
217
|
+
var e = Object(t),
|
|
218
|
+
r = [];
|
|
219
|
+
for (var n in e) r.push(n);
|
|
220
|
+
return r.reverse(), function next() {
|
|
221
|
+
for (; r.length;) {
|
|
222
|
+
var t = r.pop();
|
|
223
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
224
|
+
}
|
|
225
|
+
return next.done = !0, next;
|
|
226
|
+
};
|
|
227
|
+
}, e.values = values, Context.prototype = {
|
|
228
|
+
constructor: Context,
|
|
229
|
+
reset: function (e) {
|
|
230
|
+
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);
|
|
231
|
+
},
|
|
232
|
+
stop: function () {
|
|
233
|
+
this.done = !0;
|
|
234
|
+
var t = this.tryEntries[0].completion;
|
|
235
|
+
if ("throw" === t.type) throw t.arg;
|
|
236
|
+
return this.rval;
|
|
237
|
+
},
|
|
238
|
+
dispatchException: function (e) {
|
|
239
|
+
if (this.done) throw e;
|
|
240
|
+
var r = this;
|
|
241
|
+
function handle(n, o) {
|
|
242
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
243
|
+
}
|
|
244
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
245
|
+
var i = this.tryEntries[o],
|
|
246
|
+
a = i.completion;
|
|
247
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
248
|
+
if (i.tryLoc <= this.prev) {
|
|
249
|
+
var c = n.call(i, "catchLoc"),
|
|
250
|
+
u = n.call(i, "finallyLoc");
|
|
251
|
+
if (c && u) {
|
|
252
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
253
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
254
|
+
} else if (c) {
|
|
255
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
256
|
+
} else {
|
|
257
|
+
if (!u) throw new Error("try statement without catch or finally");
|
|
258
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
abrupt: function (t, e) {
|
|
264
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
265
|
+
var o = this.tryEntries[r];
|
|
266
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
267
|
+
var i = o;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
272
|
+
var a = i ? i.completion : {};
|
|
273
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
274
|
+
},
|
|
275
|
+
complete: function (t, e) {
|
|
276
|
+
if ("throw" === t.type) throw t.arg;
|
|
277
|
+
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;
|
|
278
|
+
},
|
|
279
|
+
finish: function (t) {
|
|
280
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
281
|
+
var r = this.tryEntries[e];
|
|
282
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
catch: function (t) {
|
|
286
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
287
|
+
var r = this.tryEntries[e];
|
|
288
|
+
if (r.tryLoc === t) {
|
|
289
|
+
var n = r.completion;
|
|
290
|
+
if ("throw" === n.type) {
|
|
291
|
+
var o = n.arg;
|
|
292
|
+
resetTryEntry(r);
|
|
293
|
+
}
|
|
294
|
+
return o;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
throw new Error("illegal catch attempt");
|
|
298
|
+
},
|
|
299
|
+
delegateYield: function (e, r, n) {
|
|
300
|
+
return this.delegate = {
|
|
301
|
+
iterator: values(e),
|
|
302
|
+
resultName: r,
|
|
303
|
+
nextLoc: n
|
|
304
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
305
|
+
}
|
|
306
|
+
}, e;
|
|
307
|
+
}
|
|
308
|
+
function _toPrimitive(t, r) {
|
|
309
|
+
if ("object" != typeof t || !t) return t;
|
|
310
|
+
var e = t[Symbol.toPrimitive];
|
|
311
|
+
if (void 0 !== e) {
|
|
312
|
+
var i = e.call(t, r || "default");
|
|
313
|
+
if ("object" != typeof i) return i;
|
|
314
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
315
|
+
}
|
|
316
|
+
return ("string" === r ? String : Number)(t);
|
|
317
|
+
}
|
|
318
|
+
function _toPropertyKey(t) {
|
|
319
|
+
var i = _toPrimitive(t, "string");
|
|
320
|
+
return "symbol" == typeof i ? i : String(i);
|
|
321
|
+
}
|
|
14
322
|
function _classCallCheck(instance, Constructor) {
|
|
15
323
|
if (!(instance instanceof Constructor)) {
|
|
16
324
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -188,71 +496,6 @@ function _arrayLikeToArray(arr, len) {
|
|
|
188
496
|
function _nonIterableSpread() {
|
|
189
497
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
190
498
|
}
|
|
191
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
192
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
193
|
-
if (!it) {
|
|
194
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
195
|
-
if (it) o = it;
|
|
196
|
-
var i = 0;
|
|
197
|
-
var F = function () {};
|
|
198
|
-
return {
|
|
199
|
-
s: F,
|
|
200
|
-
n: function () {
|
|
201
|
-
if (i >= o.length) return {
|
|
202
|
-
done: true
|
|
203
|
-
};
|
|
204
|
-
return {
|
|
205
|
-
done: false,
|
|
206
|
-
value: o[i++]
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
e: function (e) {
|
|
210
|
-
throw e;
|
|
211
|
-
},
|
|
212
|
-
f: F
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
216
|
-
}
|
|
217
|
-
var normalCompletion = true,
|
|
218
|
-
didErr = false,
|
|
219
|
-
err;
|
|
220
|
-
return {
|
|
221
|
-
s: function () {
|
|
222
|
-
it = it.call(o);
|
|
223
|
-
},
|
|
224
|
-
n: function () {
|
|
225
|
-
var step = it.next();
|
|
226
|
-
normalCompletion = step.done;
|
|
227
|
-
return step;
|
|
228
|
-
},
|
|
229
|
-
e: function (e) {
|
|
230
|
-
didErr = true;
|
|
231
|
-
err = e;
|
|
232
|
-
},
|
|
233
|
-
f: function () {
|
|
234
|
-
try {
|
|
235
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
236
|
-
} finally {
|
|
237
|
-
if (didErr) throw err;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function _toPrimitive(input, hint) {
|
|
243
|
-
if (typeof input !== "object" || input === null) return input;
|
|
244
|
-
var prim = input[Symbol.toPrimitive];
|
|
245
|
-
if (prim !== undefined) {
|
|
246
|
-
var res = prim.call(input, hint || "default");
|
|
247
|
-
if (typeof res !== "object") return res;
|
|
248
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
249
|
-
}
|
|
250
|
-
return (hint === "string" ? String : Number)(input);
|
|
251
|
-
}
|
|
252
|
-
function _toPropertyKey(arg) {
|
|
253
|
-
var key = _toPrimitive(arg, "string");
|
|
254
|
-
return typeof key === "symbol" ? key : String(key);
|
|
255
|
-
}
|
|
256
499
|
|
|
257
500
|
/******************************************************************************
|
|
258
501
|
Copyright (c) Microsoft Corporation.
|
|
@@ -271,11 +514,28 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
271
514
|
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
272
515
|
|
|
273
516
|
|
|
517
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
518
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
519
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
520
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
521
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
522
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
523
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
274
527
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
275
528
|
var e = new Error(message);
|
|
276
529
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
277
530
|
};
|
|
278
531
|
|
|
532
|
+
// derrived from https://github.com/kodadot/packages/blob/main/minimark/src/common/types.ts
|
|
533
|
+
exports.Version = void 0;
|
|
534
|
+
(function (Version) {
|
|
535
|
+
Version["V1"] = "V1";
|
|
536
|
+
Version["V3"] = "V3";
|
|
537
|
+
})(exports.Version || (exports.Version = {}));
|
|
538
|
+
|
|
279
539
|
// Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
|
|
280
540
|
var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
|
|
281
541
|
_inherits(NoXCMSupportImplementedError, _Error);
|
|
@@ -4670,69 +4930,62 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
|
|
|
4670
4930
|
});
|
|
4671
4931
|
|
|
4672
4932
|
var assetsMap = assetsMapJson;
|
|
4673
|
-
function getAssetsObject(node) {
|
|
4933
|
+
var getAssetsObject = function getAssetsObject(node) {
|
|
4674
4934
|
return assetsMap[node];
|
|
4675
|
-
}
|
|
4676
|
-
function getAssetId(node, symbol) {
|
|
4935
|
+
};
|
|
4936
|
+
var getAssetId = function getAssetId(node, symbol) {
|
|
4677
4937
|
var info = getAssetsObject(node).otherAssets.find(function (o) {
|
|
4678
4938
|
return o.symbol === symbol;
|
|
4679
4939
|
});
|
|
4680
|
-
return info ? info.assetId : null;
|
|
4681
|
-
}
|
|
4682
|
-
function getRelayChainSymbol(node) {
|
|
4940
|
+
return info != null ? info.assetId : null;
|
|
4941
|
+
};
|
|
4942
|
+
var getRelayChainSymbol = function getRelayChainSymbol(node) {
|
|
4683
4943
|
return getAssetsObject(node).relayChainAssetSymbol;
|
|
4684
|
-
}
|
|
4685
|
-
function getNativeAssets(node) {
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
function getOtherAssets(node) {
|
|
4944
|
+
};
|
|
4945
|
+
var getNativeAssets = function getNativeAssets(node) {
|
|
4946
|
+
return getAssetsObject(node).nativeAssets;
|
|
4947
|
+
};
|
|
4948
|
+
var getOtherAssets = function getOtherAssets(node) {
|
|
4690
4949
|
return getAssetsObject(node).otherAssets;
|
|
4691
|
-
}
|
|
4692
|
-
function getAllAssetsSymbols(node) {
|
|
4950
|
+
};
|
|
4951
|
+
var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
|
|
4693
4952
|
var _getAssetsObject = getAssetsObject(node),
|
|
4694
4953
|
relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol,
|
|
4695
4954
|
nativeAssets = _getAssetsObject.nativeAssets,
|
|
4696
4955
|
otherAssets = _getAssetsObject.otherAssets;
|
|
4697
|
-
|
|
4956
|
+
var nativeAssetsSymbols = nativeAssets.map(function (_ref) {
|
|
4698
4957
|
var symbol = _ref.symbol;
|
|
4699
4958
|
return symbol;
|
|
4700
|
-
})
|
|
4701
|
-
|
|
4959
|
+
});
|
|
4960
|
+
var otherAssetsSymbols = otherAssets.filter(function (asset) {
|
|
4961
|
+
return asset.symbol !== undefined;
|
|
4702
4962
|
}).map(function (_ref2) {
|
|
4703
4963
|
var symbol = _ref2.symbol;
|
|
4704
4964
|
return symbol;
|
|
4705
|
-
})
|
|
4706
|
-
|
|
4707
|
-
|
|
4965
|
+
});
|
|
4966
|
+
return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
|
|
4967
|
+
};
|
|
4968
|
+
var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
|
|
4708
4969
|
return getAllAssetsSymbols(node).includes(symbol);
|
|
4709
|
-
}
|
|
4710
|
-
function getAssetDecimals(node, symbol) {
|
|
4970
|
+
};
|
|
4971
|
+
var getAssetDecimals = function getAssetDecimals(node, symbol) {
|
|
4711
4972
|
var _getAssetsObject2 = getAssetsObject(node),
|
|
4712
4973
|
otherAssets = _getAssetsObject2.otherAssets,
|
|
4713
4974
|
nativeAssets = _getAssetsObject2.nativeAssets;
|
|
4714
4975
|
var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
|
|
4715
4976
|
return o.symbol === symbol;
|
|
4716
4977
|
});
|
|
4717
|
-
return asset ? asset.decimals : null;
|
|
4718
|
-
}
|
|
4719
|
-
function getParaId(node) {
|
|
4978
|
+
return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
|
|
4979
|
+
};
|
|
4980
|
+
var getParaId = function getParaId(node) {
|
|
4720
4981
|
return getAssetsObject(node).paraId;
|
|
4721
|
-
}
|
|
4722
|
-
function getTNode(nodeID) {
|
|
4723
|
-
var
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
if (getParaId(node) === nodeID) return node;
|
|
4729
|
-
}
|
|
4730
|
-
} catch (err) {
|
|
4731
|
-
_iterator.e(err);
|
|
4732
|
-
} finally {
|
|
4733
|
-
_iterator.f();
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4982
|
+
};
|
|
4983
|
+
var getTNode = function getTNode(nodeID) {
|
|
4984
|
+
var _a;
|
|
4985
|
+
return (_a = NODE_NAMES.find(function (node) {
|
|
4986
|
+
return getParaId(node) === nodeID;
|
|
4987
|
+
})) !== null && _a !== void 0 ? _a : null;
|
|
4988
|
+
};
|
|
4736
4989
|
|
|
4737
4990
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
4738
4991
|
__proto__: null,
|
|
@@ -4748,6 +5001,20 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
4748
5001
|
hasSupportForAsset: hasSupportForAsset
|
|
4749
5002
|
});
|
|
4750
5003
|
|
|
5004
|
+
var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
|
|
5005
|
+
var api = _ref.api,
|
|
5006
|
+
destination = _ref.destination,
|
|
5007
|
+
address = _ref.address,
|
|
5008
|
+
amount = _ref.amount;
|
|
5009
|
+
var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5010
|
+
var paraId = getParaId(destination);
|
|
5011
|
+
var parameters = [createHeaderPolkadotXCM('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpecification(amount, 'RelayToPara', version, destination), 0];
|
|
5012
|
+
if (includeFee) {
|
|
5013
|
+
parameters.push('Unlimited');
|
|
5014
|
+
}
|
|
5015
|
+
return parameters;
|
|
5016
|
+
};
|
|
5017
|
+
|
|
4751
5018
|
var supportsXTokens = function supportsXTokens(obj) {
|
|
4752
5019
|
return 'transferXTokens' in obj;
|
|
4753
5020
|
};
|
|
@@ -4757,6 +5024,7 @@ var supportsPolkadotXCM = function supportsPolkadotXCM(obj) {
|
|
|
4757
5024
|
var ParachainNode = /*#__PURE__*/function () {
|
|
4758
5025
|
function ParachainNode(node, name, type, version) {
|
|
4759
5026
|
_classCallCheck(this, ParachainNode);
|
|
5027
|
+
this._assetCheckEnabled = true;
|
|
4760
5028
|
this._name = name;
|
|
4761
5029
|
this._type = type;
|
|
4762
5030
|
this._node = node;
|
|
@@ -4782,12 +5050,17 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
4782
5050
|
get: function get() {
|
|
4783
5051
|
return this._version;
|
|
4784
5052
|
}
|
|
5053
|
+
}, {
|
|
5054
|
+
key: "assetCheckEnabled",
|
|
5055
|
+
get: function get() {
|
|
5056
|
+
return this._assetCheckEnabled;
|
|
5057
|
+
}
|
|
4785
5058
|
}, {
|
|
4786
5059
|
key: "transfer",
|
|
4787
5060
|
value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
|
|
4788
5061
|
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
4789
|
-
var scenario = destination ? 'ParaToPara' : 'ParaToRelay';
|
|
4790
|
-
var paraId = destination ? getParaId(destination) : undefined;
|
|
5062
|
+
var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
|
|
5063
|
+
var paraId = destination !== undefined ? getParaId(destination) : undefined;
|
|
4791
5064
|
if (supportsXTokens(this)) {
|
|
4792
5065
|
return this.transferXTokens({
|
|
4793
5066
|
api: api,
|
|
@@ -4813,10 +5086,43 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
4813
5086
|
throw new NoXCMSupportImplementedError(this._node);
|
|
4814
5087
|
}
|
|
4815
5088
|
}
|
|
5089
|
+
}, {
|
|
5090
|
+
key: "transferRelayToPara",
|
|
5091
|
+
value: function transferRelayToPara(options) {
|
|
5092
|
+
return {
|
|
5093
|
+
module: 'xcmPallet',
|
|
5094
|
+
section: 'reserveTransferAssets',
|
|
5095
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3)
|
|
5096
|
+
};
|
|
5097
|
+
}
|
|
5098
|
+
}, {
|
|
5099
|
+
key: "getProvider",
|
|
5100
|
+
value: function getProvider() {
|
|
5101
|
+
return getAllNodeProviders(this.node)[0];
|
|
5102
|
+
}
|
|
5103
|
+
}, {
|
|
5104
|
+
key: "createApiInstance",
|
|
5105
|
+
value: function createApiInstance$1() {
|
|
5106
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5107
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5108
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5109
|
+
case 0:
|
|
5110
|
+
_context.next = 2;
|
|
5111
|
+
return createApiInstance(this.getProvider());
|
|
5112
|
+
case 2:
|
|
5113
|
+
return _context.abrupt("return", _context.sent);
|
|
5114
|
+
case 3:
|
|
5115
|
+
case "end":
|
|
5116
|
+
return _context.stop();
|
|
5117
|
+
}
|
|
5118
|
+
}, _callee, this);
|
|
5119
|
+
}));
|
|
5120
|
+
}
|
|
4816
5121
|
}]);
|
|
4817
5122
|
return ParachainNode;
|
|
4818
5123
|
}();
|
|
4819
5124
|
|
|
5125
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
4820
5126
|
var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
4821
5127
|
function XTokensTransferImpl() {
|
|
4822
5128
|
_classCallCheck(this, XTokensTransferImpl);
|
|
@@ -4831,7 +5137,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
4831
5137
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
4832
5138
|
var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
|
|
4833
5139
|
var module = lowercaseFirstLetter(pallet.toString());
|
|
4834
|
-
if (serializedApiCallEnabled) {
|
|
5140
|
+
if (serializedApiCallEnabled === true) {
|
|
4835
5141
|
return {
|
|
4836
5142
|
module: module,
|
|
4837
5143
|
section: 'transfer',
|
|
@@ -4856,13 +5162,19 @@ var Acala$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4856
5162
|
value: function transferXTokens(input) {
|
|
4857
5163
|
var currency = input.currency,
|
|
4858
5164
|
currencyID = input.currencyID;
|
|
4859
|
-
var currencySelection = currencyID ? {
|
|
5165
|
+
var currencySelection = currencyID !== undefined ? {
|
|
4860
5166
|
ForeignAsset: currencyID
|
|
4861
5167
|
} : {
|
|
4862
5168
|
Token: currency
|
|
4863
5169
|
};
|
|
4864
5170
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
4865
5171
|
}
|
|
5172
|
+
}, {
|
|
5173
|
+
key: "getProvider",
|
|
5174
|
+
value: function getProvider() {
|
|
5175
|
+
// Return the second WebSocket URL because the first one is sometimes unreliable.
|
|
5176
|
+
return getAllNodeProviders(this.node)[1];
|
|
5177
|
+
}
|
|
4866
5178
|
}]);
|
|
4867
5179
|
return Acala;
|
|
4868
5180
|
}(ParachainNode);
|
|
@@ -4914,7 +5226,7 @@ var Crust$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4914
5226
|
if (currency === 'CRU') {
|
|
4915
5227
|
return 'SelfReserve';
|
|
4916
5228
|
}
|
|
4917
|
-
if (
|
|
5229
|
+
if (currencyID === undefined) {
|
|
4918
5230
|
throw new InvalidCurrencyError("Asset ".concat(currency, " is not supported by node ").concat(this.node, "."));
|
|
4919
5231
|
}
|
|
4920
5232
|
return {
|
|
@@ -4942,7 +5254,7 @@ var BifrostPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4942
5254
|
value: function transferXTokens(input) {
|
|
4943
5255
|
// Multiple asset options need addressing
|
|
4944
5256
|
var currencySelection = {
|
|
4945
|
-
|
|
5257
|
+
Native: input.currency
|
|
4946
5258
|
};
|
|
4947
5259
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
4948
5260
|
}
|
|
@@ -4996,7 +5308,7 @@ var Clover$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4996
5308
|
if (currency === 'CLV') {
|
|
4997
5309
|
return 'SelfReserve';
|
|
4998
5310
|
}
|
|
4999
|
-
if (
|
|
5311
|
+
if (currencyID === undefined) {
|
|
5000
5312
|
throw new InvalidCurrencyError("Asset ".concat(currency, " is not supported by node ").concat(this.node, "."));
|
|
5001
5313
|
}
|
|
5002
5314
|
return {
|
|
@@ -5019,7 +5331,14 @@ var ComposableFinance$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5019
5331
|
_classCallCheck(this, ComposableFinance);
|
|
5020
5332
|
return _super.call(this, 'ComposableFinance', 'composable', 'polkadot', exports.Version.V3);
|
|
5021
5333
|
}
|
|
5022
|
-
|
|
5334
|
+
_createClass(ComposableFinance, [{
|
|
5335
|
+
key: "transferXTokens",
|
|
5336
|
+
value: function transferXTokens(input) {
|
|
5337
|
+
var currencyID = input.currencyID;
|
|
5338
|
+
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
5339
|
+
}
|
|
5340
|
+
}]);
|
|
5341
|
+
return ComposableFinance;
|
|
5023
5342
|
}(ParachainNode);
|
|
5024
5343
|
|
|
5025
5344
|
var HydraDX$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
@@ -5051,7 +5370,7 @@ var Interlay$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5051
5370
|
value: function transferXTokens(input) {
|
|
5052
5371
|
var currency = input.currency,
|
|
5053
5372
|
currencyID = input.currencyID;
|
|
5054
|
-
var currencySelection = currencyID ? {
|
|
5373
|
+
var currencySelection = currencyID !== undefined ? {
|
|
5055
5374
|
ForeignAsset: currencyID
|
|
5056
5375
|
} : {
|
|
5057
5376
|
Token: currency
|
|
@@ -5113,6 +5432,15 @@ var Moonbeam$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5113
5432
|
};
|
|
5114
5433
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5115
5434
|
}
|
|
5435
|
+
}, {
|
|
5436
|
+
key: "transferRelayToPara",
|
|
5437
|
+
value: function transferRelayToPara(options) {
|
|
5438
|
+
return {
|
|
5439
|
+
module: 'xcmPallet',
|
|
5440
|
+
section: 'limitedReserveTransferAssets',
|
|
5441
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5442
|
+
};
|
|
5443
|
+
}
|
|
5116
5444
|
}]);
|
|
5117
5445
|
return Moonbeam;
|
|
5118
5446
|
}(ParachainNode);
|
|
@@ -5217,9 +5545,10 @@ var BifrostKusama$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5217
5545
|
key: "transferXTokens",
|
|
5218
5546
|
value: function transferXTokens(input) {
|
|
5219
5547
|
// Multiple asset options need addressing
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
}
|
|
5548
|
+
var currencySelection = {
|
|
5549
|
+
Native: input.currency
|
|
5550
|
+
};
|
|
5551
|
+
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5223
5552
|
}
|
|
5224
5553
|
}]);
|
|
5225
5554
|
return BifrostKusama;
|
|
@@ -5230,7 +5559,7 @@ var Pioneer$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5230
5559
|
var _super = _createSuper(Pioneer);
|
|
5231
5560
|
function Pioneer() {
|
|
5232
5561
|
_classCallCheck(this, Pioneer);
|
|
5233
|
-
return _super.call(this, 'Pioneer', '
|
|
5562
|
+
return _super.call(this, 'Pioneer', 'pioneer', 'kusama', exports.Version.V1);
|
|
5234
5563
|
}
|
|
5235
5564
|
_createClass(Pioneer, [{
|
|
5236
5565
|
key: "transferXTokens",
|
|
@@ -5308,6 +5637,15 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5308
5637
|
};
|
|
5309
5638
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5310
5639
|
}
|
|
5640
|
+
}, {
|
|
5641
|
+
key: "transferRelayToPara",
|
|
5642
|
+
value: function transferRelayToPara(options) {
|
|
5643
|
+
return {
|
|
5644
|
+
module: 'xcmPallet',
|
|
5645
|
+
section: 'limitedReserveTransferAssets',
|
|
5646
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5647
|
+
};
|
|
5648
|
+
}
|
|
5311
5649
|
}]);
|
|
5312
5650
|
return Moonriver;
|
|
5313
5651
|
}(ParachainNode);
|
|
@@ -5324,6 +5662,30 @@ var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5324
5662
|
value: function transferXTokens(input) {
|
|
5325
5663
|
return XTokensTransferImpl.transferXTokens(input, input.currencyID);
|
|
5326
5664
|
}
|
|
5665
|
+
}, {
|
|
5666
|
+
key: "createApiInstance",
|
|
5667
|
+
value: function createApiInstance() {
|
|
5668
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5669
|
+
var MangataSDK, instance;
|
|
5670
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5671
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5672
|
+
case 0:
|
|
5673
|
+
_context.next = 2;
|
|
5674
|
+
return import('@mangata-finance/sdk');
|
|
5675
|
+
case 2:
|
|
5676
|
+
MangataSDK = _context.sent;
|
|
5677
|
+
instance = MangataSDK.Mangata.instance([this.getProvider()]);
|
|
5678
|
+
_context.next = 6;
|
|
5679
|
+
return instance.api();
|
|
5680
|
+
case 6:
|
|
5681
|
+
return _context.abrupt("return", _context.sent);
|
|
5682
|
+
case 7:
|
|
5683
|
+
case "end":
|
|
5684
|
+
return _context.stop();
|
|
5685
|
+
}
|
|
5686
|
+
}, _callee, this);
|
|
5687
|
+
}));
|
|
5688
|
+
}
|
|
5327
5689
|
}]);
|
|
5328
5690
|
return Mangata;
|
|
5329
5691
|
}(ParachainNode);
|
|
@@ -5357,7 +5719,7 @@ var Kintsugi$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5357
5719
|
value: function transferXTokens(input) {
|
|
5358
5720
|
var currency = input.currency,
|
|
5359
5721
|
currencyID = input.currencyID;
|
|
5360
|
-
var currencySelection = currencyID ? {
|
|
5722
|
+
var currencySelection = currencyID !== undefined ? {
|
|
5361
5723
|
ForeignAsset: currencyID
|
|
5362
5724
|
} : {
|
|
5363
5725
|
Token: currency
|
|
@@ -5404,7 +5766,7 @@ var CrustShadow$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5404
5766
|
if (currency === 'CSM') {
|
|
5405
5767
|
return 'SelfReserve';
|
|
5406
5768
|
}
|
|
5407
|
-
if (
|
|
5769
|
+
if (currencyID === undefined) {
|
|
5408
5770
|
throw new InvalidCurrencyError("Asset ".concat(currency, " is not supported by node ").concat(this.node, "."));
|
|
5409
5771
|
}
|
|
5410
5772
|
return {
|
|
@@ -5444,7 +5806,7 @@ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
|
5444
5806
|
function NodeNotSupportedError(message) {
|
|
5445
5807
|
var _this;
|
|
5446
5808
|
_classCallCheck(this, NodeNotSupportedError);
|
|
5447
|
-
_this = _super.call(this, message);
|
|
5809
|
+
_this = _super.call(this, message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.');
|
|
5448
5810
|
_this.name = 'NodeNotSupported';
|
|
5449
5811
|
return _this;
|
|
5450
5812
|
}
|
|
@@ -5491,6 +5853,11 @@ var Integritee$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5491
5853
|
if (input.currency === 'KSM') throw new InvalidCurrencyError("Node ".concat(this.node, " does not support currency KSM"));
|
|
5492
5854
|
return XTokensTransferImpl.transferXTokens(input, input.currency);
|
|
5493
5855
|
}
|
|
5856
|
+
}, {
|
|
5857
|
+
key: "transferRelayToPara",
|
|
5858
|
+
value: function transferRelayToPara() {
|
|
5859
|
+
throw new NodeNotSupportedError();
|
|
5860
|
+
}
|
|
5494
5861
|
}]);
|
|
5495
5862
|
return Integritee;
|
|
5496
5863
|
}(ParachainNode);
|
|
@@ -5524,18 +5891,25 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5524
5891
|
value: function transferXTokens(input) {
|
|
5525
5892
|
var currency = input.currency,
|
|
5526
5893
|
currencyID = input.currencyID;
|
|
5527
|
-
var currencySelection = currencyID ? {
|
|
5894
|
+
var currencySelection = currencyID !== undefined ? {
|
|
5528
5895
|
ForeignAsset: currencyID
|
|
5529
5896
|
} : {
|
|
5530
5897
|
Token: currency
|
|
5531
5898
|
};
|
|
5532
5899
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5533
5900
|
}
|
|
5901
|
+
}, {
|
|
5902
|
+
key: "getProvider",
|
|
5903
|
+
value: function getProvider() {
|
|
5904
|
+
// Return the second WebSocket URL because the first one is sometimes unreliable.
|
|
5905
|
+
return getAllNodeProviders(this.node)[1];
|
|
5906
|
+
}
|
|
5534
5907
|
}]);
|
|
5535
5908
|
return Karura;
|
|
5536
5909
|
}(ParachainNode);
|
|
5537
5910
|
|
|
5538
5911
|
// Contains basic structure of polkadotXCM call
|
|
5912
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
5539
5913
|
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
5540
5914
|
function PolkadotXCMTransferImpl() {
|
|
5541
5915
|
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
@@ -5549,14 +5923,14 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
|
5549
5923
|
currencySelection = _ref.currencySelection,
|
|
5550
5924
|
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
5551
5925
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
5552
|
-
if (serializedApiCallEnabled) {
|
|
5926
|
+
if (serializedApiCallEnabled === true) {
|
|
5553
5927
|
return {
|
|
5554
5928
|
module: 'polkadotXcm',
|
|
5555
5929
|
section: method,
|
|
5556
|
-
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees ? [fees] : []))
|
|
5930
|
+
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees !== undefined ? [fees] : []))
|
|
5557
5931
|
};
|
|
5558
5932
|
}
|
|
5559
|
-
return fees ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
5933
|
+
return fees !== undefined ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
5560
5934
|
}
|
|
5561
5935
|
}]);
|
|
5562
5936
|
return PolkadotXCMTransferImpl;
|
|
@@ -5576,6 +5950,15 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5576
5950
|
// TESTED https://polkadot.subscan.io/xcm_message/polkadot-c01158ff1a5c5a596138ed9d0f0f2bccc1d9c51d
|
|
5577
5951
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limitedTeleportAssets', 'Unlimited');
|
|
5578
5952
|
}
|
|
5953
|
+
}, {
|
|
5954
|
+
key: "transferRelayToPara",
|
|
5955
|
+
value: function transferRelayToPara(options) {
|
|
5956
|
+
return {
|
|
5957
|
+
module: 'xcmPallet',
|
|
5958
|
+
section: 'limitedTeleportAssets',
|
|
5959
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5960
|
+
};
|
|
5961
|
+
}
|
|
5579
5962
|
}]);
|
|
5580
5963
|
return AssetHubPolkadot;
|
|
5581
5964
|
}(ParachainNode);
|
|
@@ -5594,6 +5977,15 @@ var AssetHubKusama$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5594
5977
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
5595
5978
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limitedTeleportAssets', 'Unlimited');
|
|
5596
5979
|
}
|
|
5980
|
+
}, {
|
|
5981
|
+
key: "transferRelayToPara",
|
|
5982
|
+
value: function transferRelayToPara(options) {
|
|
5983
|
+
return {
|
|
5984
|
+
module: 'xcmPallet',
|
|
5985
|
+
section: 'limitedTeleportAssets',
|
|
5986
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5987
|
+
};
|
|
5988
|
+
}
|
|
5597
5989
|
}]);
|
|
5598
5990
|
return AssetHubKusama;
|
|
5599
5991
|
}(ParachainNode);
|
|
@@ -5615,6 +6007,15 @@ var Encointer$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5615
6007
|
}
|
|
5616
6008
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5617
6009
|
}
|
|
6010
|
+
}, {
|
|
6011
|
+
key: "transferRelayToPara",
|
|
6012
|
+
value: function transferRelayToPara(options) {
|
|
6013
|
+
return {
|
|
6014
|
+
module: 'xcmPallet',
|
|
6015
|
+
section: 'limitedTeleportAssets',
|
|
6016
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V1, true)
|
|
6017
|
+
};
|
|
6018
|
+
}
|
|
5618
6019
|
}]);
|
|
5619
6020
|
return Encointer;
|
|
5620
6021
|
}(ParachainNode);
|
|
@@ -5628,20 +6029,18 @@ var Robonomics$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5628
6029
|
}
|
|
5629
6030
|
_createClass(Robonomics, [{
|
|
5630
6031
|
key: "transferPolkadotXCM",
|
|
5631
|
-
value: function transferPolkadotXCM(
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
// TESTED https://robonomics.subscan.io/xcm_message/kusama-20b03208c99f2ef29d2d4b4cd4bc5659e54311ea
|
|
5639
|
-
var method = scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
|
|
5640
|
-
return api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
6032
|
+
value: function transferPolkadotXCM(input) {
|
|
6033
|
+
if (input.scenario === 'ParaToPara') {
|
|
6034
|
+
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limitedReserveTransferAssets', {
|
|
6035
|
+
Limited: Robonomics.FEE
|
|
6036
|
+
});
|
|
6037
|
+
}
|
|
6038
|
+
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserveWithdrawAssets');
|
|
5641
6039
|
}
|
|
5642
6040
|
}]);
|
|
5643
6041
|
return Robonomics;
|
|
5644
6042
|
}(ParachainNode);
|
|
6043
|
+
Robonomics$1.FEE = '400000000';
|
|
5645
6044
|
|
|
5646
6045
|
var Astar$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
5647
6046
|
_inherits(Astar, _ParachainNode);
|
|
@@ -5694,6 +6093,11 @@ var Darwinia$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5694
6093
|
}
|
|
5695
6094
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5696
6095
|
}
|
|
6096
|
+
}, {
|
|
6097
|
+
key: "transferRelayToPara",
|
|
6098
|
+
value: function transferRelayToPara() {
|
|
6099
|
+
throw new NodeNotSupportedError();
|
|
6100
|
+
}
|
|
5697
6101
|
}]);
|
|
5698
6102
|
return Darwinia;
|
|
5699
6103
|
}(ParachainNode);
|
|
@@ -5714,6 +6118,11 @@ var Crab$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5714
6118
|
}
|
|
5715
6119
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5716
6120
|
}
|
|
6121
|
+
}, {
|
|
6122
|
+
key: "transferRelayToPara",
|
|
6123
|
+
value: function transferRelayToPara() {
|
|
6124
|
+
throw new NodeNotSupportedError();
|
|
6125
|
+
}
|
|
5717
6126
|
}]);
|
|
5718
6127
|
return Crab;
|
|
5719
6128
|
}(ParachainNode);
|
|
@@ -5722,17 +6131,19 @@ var Quartz$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5722
6131
|
_inherits(Quartz, _ParachainNode);
|
|
5723
6132
|
var _super = _createSuper(Quartz);
|
|
5724
6133
|
function Quartz() {
|
|
6134
|
+
var _this;
|
|
5725
6135
|
_classCallCheck(this, Quartz);
|
|
5726
|
-
|
|
6136
|
+
_this = _super.call(this, 'Quartz', 'quartz', 'kusama', exports.Version.V3);
|
|
6137
|
+
_this._assetCheckEnabled = false;
|
|
6138
|
+
return _this;
|
|
5727
6139
|
}
|
|
5728
6140
|
_createClass(Quartz, [{
|
|
5729
|
-
key: "
|
|
5730
|
-
value: function
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
}
|
|
5735
|
-
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
6141
|
+
key: "transferXTokens",
|
|
6142
|
+
value: function transferXTokens(input) {
|
|
6143
|
+
var currencyID = input.currencyID;
|
|
6144
|
+
return XTokensTransferImpl.transferXTokens(input, {
|
|
6145
|
+
ForeignAssetId: currencyID
|
|
6146
|
+
});
|
|
5736
6147
|
}
|
|
5737
6148
|
}]);
|
|
5738
6149
|
return Quartz;
|
|
@@ -5762,13 +6173,13 @@ var Manta$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5762
6173
|
var _super = _createSuper(Manta);
|
|
5763
6174
|
function Manta() {
|
|
5764
6175
|
_classCallCheck(this, Manta);
|
|
5765
|
-
return _super.call(this, 'Manta', 'manta', 'polkadot', exports.Version.
|
|
6176
|
+
return _super.call(this, 'Manta', 'manta', 'polkadot', exports.Version.V1);
|
|
5766
6177
|
}
|
|
5767
6178
|
_createClass(Manta, [{
|
|
5768
6179
|
key: "transferXTokens",
|
|
5769
6180
|
value: function transferXTokens(input) {
|
|
5770
6181
|
return XTokensTransferImpl.transferXTokens(input, {
|
|
5771
|
-
|
|
6182
|
+
MantaCurrency: input.currencyID
|
|
5772
6183
|
});
|
|
5773
6184
|
}
|
|
5774
6185
|
}]);
|
|
@@ -5812,6 +6223,11 @@ var Nodle$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5812
6223
|
}
|
|
5813
6224
|
return XTokensTransferImpl.transferXTokens(input, 'NodleNative');
|
|
5814
6225
|
}
|
|
6226
|
+
}, {
|
|
6227
|
+
key: "transferRelayToPara",
|
|
6228
|
+
value: function transferRelayToPara() {
|
|
6229
|
+
throw new NodeNotSupportedError();
|
|
6230
|
+
}
|
|
5815
6231
|
}]);
|
|
5816
6232
|
return Nodle;
|
|
5817
6233
|
}(ParachainNode);
|
|
@@ -5852,6 +6268,11 @@ var Pendulum$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5852
6268
|
XCM: input.currencyID
|
|
5853
6269
|
});
|
|
5854
6270
|
}
|
|
6271
|
+
}, {
|
|
6272
|
+
key: "transferRelayToPara",
|
|
6273
|
+
value: function transferRelayToPara() {
|
|
6274
|
+
throw new NodeNotSupportedError();
|
|
6275
|
+
}
|
|
5855
6276
|
}]);
|
|
5856
6277
|
return Pendulum;
|
|
5857
6278
|
}(ParachainNode);
|
|
@@ -5882,9 +6303,10 @@ var Zeitgeist$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5882
6303
|
_createClass(Zeitgeist, [{
|
|
5883
6304
|
key: "transferXTokens",
|
|
5884
6305
|
value: function transferXTokens(input) {
|
|
5885
|
-
|
|
6306
|
+
var currencySelection = input.currency === 'ZTG' ? 'Ztg' : {
|
|
5886
6307
|
ForeignAsset: input.currencyID
|
|
5887
|
-
}
|
|
6308
|
+
};
|
|
6309
|
+
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5888
6310
|
}
|
|
5889
6311
|
}]);
|
|
5890
6312
|
return Zeitgeist;
|
|
@@ -5892,6 +6314,7 @@ var Zeitgeist$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5892
6314
|
|
|
5893
6315
|
// Contains supported Parachains and exports supported XCM Pallets
|
|
5894
6316
|
var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'Clover', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Kylin', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Equilibrium', 'Unique', 'Crust', 'Manta', 'Genshiro', 'Nodle', 'OriginTrail', 'Pendulum', 'Polkadex', 'Zeitgeist'];
|
|
6317
|
+
var NODES_WITH_RELAY_CHAINS = [].concat(NODE_NAMES, ['Polkadot', 'Kusama']);
|
|
5895
6318
|
var nodes = {
|
|
5896
6319
|
AssetHubPolkadot: new AssetHubPolkadot$1(),
|
|
5897
6320
|
Acala: new Acala$1(),
|
|
@@ -6019,6 +6442,7 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
|
|
|
6019
6442
|
}
|
|
6020
6443
|
};
|
|
6021
6444
|
};
|
|
6445
|
+
// TODO: Refactor this function
|
|
6022
6446
|
var createCurrencySpecification = function createCurrencySpecification(amount, scenario, version, node, cur) {
|
|
6023
6447
|
if (scenario === 'ParaToRelay') {
|
|
6024
6448
|
return _defineProperty({}, version, [{
|
|
@@ -6076,6 +6500,19 @@ var createCurrencySpecification = function createCurrencySpecification(amount, s
|
|
|
6076
6500
|
}]
|
|
6077
6501
|
};
|
|
6078
6502
|
}
|
|
6503
|
+
if (scenario === 'ParaToPara' && node === 'Robonomics') {
|
|
6504
|
+
return _defineProperty({}, version, [{
|
|
6505
|
+
id: {
|
|
6506
|
+
Concrete: {
|
|
6507
|
+
parents: 0,
|
|
6508
|
+
interior: 'Here'
|
|
6509
|
+
}
|
|
6510
|
+
},
|
|
6511
|
+
fun: {
|
|
6512
|
+
Fungible: amount
|
|
6513
|
+
}
|
|
6514
|
+
}]);
|
|
6515
|
+
}
|
|
6079
6516
|
// Otherwise
|
|
6080
6517
|
return {
|
|
6081
6518
|
V3: [{
|
|
@@ -6127,51 +6564,90 @@ var getNodeEndpointOption = function getNodeEndpointOption(node) {
|
|
|
6127
6564
|
var _getNode = getNode(node),
|
|
6128
6565
|
type = _getNode.type,
|
|
6129
6566
|
name = _getNode.name;
|
|
6130
|
-
var
|
|
6131
|
-
linked =
|
|
6567
|
+
var _ref9 = type === 'polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama,
|
|
6568
|
+
linked = _ref9.linked;
|
|
6132
6569
|
// TMP Fix because some nodes don't have providers in endpoint options
|
|
6133
|
-
if (node === '
|
|
6134
|
-
return {
|
|
6135
|
-
info: 'imbue',
|
|
6136
|
-
paraId: 2121,
|
|
6137
|
-
providers: {
|
|
6138
|
-
'Imbue Network 0': 'wss://kusama.imbuenetwork.com'
|
|
6139
|
-
}
|
|
6140
|
-
};
|
|
6141
|
-
}
|
|
6142
|
-
if (node === 'Polkadex') {
|
|
6570
|
+
if (node === 'Kylin') {
|
|
6143
6571
|
return {
|
|
6144
|
-
info: '
|
|
6145
|
-
paraId:
|
|
6572
|
+
info: 'kylin',
|
|
6573
|
+
paraId: 2052,
|
|
6146
6574
|
providers: {
|
|
6147
|
-
|
|
6148
|
-
OnFinality: 'wss://polkadex-parachain.api.onfinality.io/public-ws',
|
|
6149
|
-
RadiumBlock: 'wss://polkadex-parachain.public.curie.radiumblock.co/ws'
|
|
6575
|
+
'Kylin Network': 'wss://polkadot.kylin-node.co.uk'
|
|
6150
6576
|
}
|
|
6151
6577
|
};
|
|
6152
6578
|
}
|
|
6153
|
-
return linked ? linked.find(function (o) {
|
|
6579
|
+
return linked !== undefined ? linked.find(function (o) {
|
|
6154
6580
|
return o.info === name;
|
|
6155
6581
|
}) : undefined;
|
|
6156
6582
|
};
|
|
6157
6583
|
var getAllNodeProviders = function getAllNodeProviders(node) {
|
|
6158
6584
|
var _a;
|
|
6159
|
-
var
|
|
6160
|
-
providers =
|
|
6585
|
+
var _ref10 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
|
|
6586
|
+
providers = _ref10.providers;
|
|
6587
|
+
if (providers.length < 1) {
|
|
6588
|
+
throw new Error("Node ".concat(node, " does not have any providers."));
|
|
6589
|
+
}
|
|
6161
6590
|
return Object.values(providers !== null && providers !== void 0 ? providers : []);
|
|
6162
6591
|
};
|
|
6163
6592
|
var getNodeProvider = function getNodeProvider(node) {
|
|
6164
|
-
|
|
6165
|
-
|
|
6593
|
+
return getNode(node).getProvider();
|
|
6594
|
+
};
|
|
6595
|
+
var createApiInstance = function createApiInstance(wsUrl) {
|
|
6596
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
6597
|
+
var wsProvider;
|
|
6598
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6599
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6600
|
+
case 0:
|
|
6601
|
+
wsProvider = new api.WsProvider(wsUrl);
|
|
6602
|
+
_context.next = 3;
|
|
6603
|
+
return api.ApiPromise.create({
|
|
6604
|
+
provider: wsProvider
|
|
6605
|
+
});
|
|
6606
|
+
case 3:
|
|
6607
|
+
return _context.abrupt("return", _context.sent);
|
|
6608
|
+
case 4:
|
|
6609
|
+
case "end":
|
|
6610
|
+
return _context.stop();
|
|
6611
|
+
}
|
|
6612
|
+
}, _callee);
|
|
6613
|
+
}));
|
|
6614
|
+
};
|
|
6615
|
+
var createApiInstanceForNode = function createApiInstanceForNode(node) {
|
|
6616
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
6617
|
+
var endpointOption, wsUrl;
|
|
6618
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6619
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6620
|
+
case 0:
|
|
6621
|
+
if (!(node === 'Polkadot' || node === 'Kusama')) {
|
|
6622
|
+
_context2.next = 6;
|
|
6623
|
+
break;
|
|
6624
|
+
}
|
|
6625
|
+
endpointOption = node === 'Polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama;
|
|
6626
|
+
wsUrl = Object.values(endpointOption.providers)[0];
|
|
6627
|
+
_context2.next = 5;
|
|
6628
|
+
return createApiInstance(wsUrl);
|
|
6629
|
+
case 5:
|
|
6630
|
+
return _context2.abrupt("return", _context2.sent);
|
|
6631
|
+
case 6:
|
|
6632
|
+
_context2.next = 8;
|
|
6633
|
+
return getNode(node).createApiInstance();
|
|
6634
|
+
case 8:
|
|
6635
|
+
return _context2.abrupt("return", _context2.sent);
|
|
6636
|
+
case 9:
|
|
6637
|
+
case "end":
|
|
6638
|
+
return _context2.stop();
|
|
6639
|
+
}
|
|
6640
|
+
}, _callee2);
|
|
6641
|
+
}));
|
|
6166
6642
|
};
|
|
6167
6643
|
var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
|
|
6168
6644
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
6169
6645
|
};
|
|
6170
|
-
var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api,
|
|
6646
|
+
var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref11) {
|
|
6171
6647
|
var _api$tx$module;
|
|
6172
|
-
var module =
|
|
6173
|
-
section =
|
|
6174
|
-
parameters =
|
|
6648
|
+
var module = _ref11.module,
|
|
6649
|
+
section = _ref11.section,
|
|
6650
|
+
parameters = _ref11.parameters;
|
|
6175
6651
|
return (_api$tx$module = api.tx[module])[section].apply(_api$tx$module, _toConsumableArray(parameters));
|
|
6176
6652
|
};
|
|
6177
6653
|
|
|
@@ -6185,7 +6661,7 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
|
|
|
6185
6661
|
assetId = _ref.assetId;
|
|
6186
6662
|
return symbol === symbolOrId || assetId === symbolOrId;
|
|
6187
6663
|
});
|
|
6188
|
-
if (asset) {
|
|
6664
|
+
if (asset !== undefined) {
|
|
6189
6665
|
var symbol = asset.symbol,
|
|
6190
6666
|
assetId = asset.assetId;
|
|
6191
6667
|
return {
|
|
@@ -6206,73 +6682,47 @@ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to
|
|
|
6206
6682
|
throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
|
|
6207
6683
|
}
|
|
6208
6684
|
var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
|
|
6209
|
-
if (destination) {
|
|
6685
|
+
if (destination !== undefined) {
|
|
6210
6686
|
var originRelayChainSymbol = getRelayChainSymbol(origin);
|
|
6211
6687
|
var destinationRelayChainSymbol = getRelayChainSymbol(destination);
|
|
6212
6688
|
if (originRelayChainSymbol !== destinationRelayChainSymbol) {
|
|
6213
6689
|
throw new IncompatibleNodesError();
|
|
6214
6690
|
}
|
|
6215
6691
|
}
|
|
6216
|
-
|
|
6692
|
+
var originNode = getNode(origin);
|
|
6693
|
+
if (asset === null && originNode.assetCheckEnabled) {
|
|
6217
6694
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
6218
6695
|
}
|
|
6219
|
-
if (destination && asset.symbol && !hasSupportForAsset(destination, asset.symbol)) {
|
|
6696
|
+
if (destination !== undefined && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && getNode(destination).assetCheckEnabled && !hasSupportForAsset(destination, asset.symbol)) {
|
|
6220
6697
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
6221
6698
|
}
|
|
6222
|
-
var
|
|
6223
|
-
|
|
6224
|
-
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
6699
|
+
var currencyId = originNode.assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencySymbolOrId.toString();
|
|
6700
|
+
return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
6225
6701
|
};
|
|
6226
6702
|
var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
6227
|
-
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination, true);
|
|
6703
|
+
return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, true);
|
|
6228
6704
|
};
|
|
6229
6705
|
function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
6230
|
-
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination);
|
|
6706
|
+
return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination);
|
|
6231
6707
|
}
|
|
6232
|
-
|
|
6233
|
-
var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, to) {
|
|
6708
|
+
var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address) {
|
|
6234
6709
|
var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
6235
|
-
var
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V3, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V3, destination), 0, 'Unlimited']
|
|
6242
|
-
};
|
|
6243
|
-
if (serializedApiCallEnabled) {
|
|
6244
|
-
return _serializedApiCall;
|
|
6245
|
-
}
|
|
6246
|
-
return callPolkadotJsTxFunction(api, _serializedApiCall);
|
|
6247
|
-
} else if (destination === 'Encointer') {
|
|
6248
|
-
var _serializedApiCall2 = {
|
|
6249
|
-
module: 'xcmPallet',
|
|
6250
|
-
section: 'limitedTeleportAssets',
|
|
6251
|
-
parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V1, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V1, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V1, destination), 0, 'Unlimited']
|
|
6252
|
-
};
|
|
6253
|
-
if (serializedApiCallEnabled) {
|
|
6254
|
-
return _serializedApiCall2;
|
|
6255
|
-
}
|
|
6256
|
-
return callPolkadotJsTxFunction(api, _serializedApiCall2);
|
|
6257
|
-
} else if (destination === 'Darwinia' || destination === 'Crab' || destination === 'Integritee' || destination === 'Nodle' || destination === 'Pendulum') {
|
|
6258
|
-
// Do not do anything because Darwinia and Crab does not have DOT and KSM registered
|
|
6259
|
-
throw new NodeNotSupportedError('These nodes do not support XCM transfers from Relay / to Relay chain.');
|
|
6260
|
-
}
|
|
6261
|
-
var serializedApiCall = {
|
|
6262
|
-
module: 'xcmPallet',
|
|
6263
|
-
section: 'reserveTransferAssets',
|
|
6264
|
-
parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V3, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V3, destination), 0]
|
|
6265
|
-
};
|
|
6710
|
+
var serializedApiCall = getNode(destination).transferRelayToPara({
|
|
6711
|
+
api: api,
|
|
6712
|
+
destination: destination,
|
|
6713
|
+
address: address,
|
|
6714
|
+
amount: amount
|
|
6715
|
+
});
|
|
6266
6716
|
if (serializedApiCallEnabled) {
|
|
6267
6717
|
return serializedApiCall;
|
|
6268
6718
|
}
|
|
6269
6719
|
return callPolkadotJsTxFunction(api, serializedApiCall);
|
|
6270
6720
|
};
|
|
6271
6721
|
function transferRelayToPara(api, destination, amount, to) {
|
|
6272
|
-
return transferRelayToParaCommon(api, destination, amount, to);
|
|
6722
|
+
return transferRelayToParaCommon(api, destination, amount.toString(), to);
|
|
6273
6723
|
}
|
|
6274
6724
|
var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to) {
|
|
6275
|
-
return transferRelayToParaCommon(api, destination, amount, to, true);
|
|
6725
|
+
return transferRelayToParaCommon(api, destination, amount.toString(), to, true);
|
|
6276
6726
|
};
|
|
6277
6727
|
|
|
6278
6728
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
@@ -6284,7 +6734,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
6284
6734
|
transferRelayToParaSerializedApiCall: transferRelayToParaSerializedApiCall
|
|
6285
6735
|
});
|
|
6286
6736
|
|
|
6287
|
-
//Contains XYK Decentralized exchange functions implemented in collaboration with Basilisk team
|
|
6737
|
+
// Contains XYK Decentralized exchange functions implemented in collaboration with Basilisk team
|
|
6288
6738
|
function addLiquidity(api, assetA, assetB, amountA, amountBMaxLimit) {
|
|
6289
6739
|
return api.tx.xyk.addLiquidity(assetA, assetB, amountA, amountBMaxLimit);
|
|
6290
6740
|
}
|
|
@@ -6861,9 +7311,9 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
6861
7311
|
}]);
|
|
6862
7312
|
return GeneralBuilder;
|
|
6863
7313
|
}();
|
|
6864
|
-
function Builder(api) {
|
|
7314
|
+
var Builder = function Builder(api) {
|
|
6865
7315
|
return new GeneralBuilder(api);
|
|
6866
|
-
}
|
|
7316
|
+
};
|
|
6867
7317
|
|
|
6868
7318
|
var AssetHubPolkadot = {
|
|
6869
7319
|
defaultPallet: "PolkadotXcm",
|
|
@@ -7322,6 +7772,7 @@ var getSupportedPallets = function getSupportedPallets(node) {
|
|
|
7322
7772
|
exports.Builder = Builder;
|
|
7323
7773
|
exports.IncompatibleNodesError = IncompatibleNodesError;
|
|
7324
7774
|
exports.InvalidCurrencyError = InvalidCurrencyError;
|
|
7775
|
+
exports.NODES_WITH_RELAY_CHAINS = NODES_WITH_RELAY_CHAINS;
|
|
7325
7776
|
exports.NODE_NAMES = NODE_NAMES;
|
|
7326
7777
|
exports.NoXCMSupportImplementedError = NoXCMSupportImplementedError;
|
|
7327
7778
|
exports.NodeNotSupportedError = NodeNotSupportedError;
|
|
@@ -7329,6 +7780,7 @@ exports.SUPPORTED_PALLETS = SUPPORTED_PALLETS;
|
|
|
7329
7780
|
exports.ScenarioNotSupportedError = ScenarioNotSupportedError;
|
|
7330
7781
|
exports.assets = index$4;
|
|
7331
7782
|
exports.closeChannels = index;
|
|
7783
|
+
exports.createApiInstanceForNode = createApiInstanceForNode;
|
|
7332
7784
|
exports.getAllAssetsSymbols = getAllAssetsSymbols;
|
|
7333
7785
|
exports.getAllNodeProviders = getAllNodeProviders;
|
|
7334
7786
|
exports.getAssetDecimals = getAssetDecimals;
|