@paraspell/assets 13.5.0 → 13.7.0
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/dist/index.d.ts +50 -7
- package/dist/index.mjs +748 -424
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,344 @@
|
|
|
1
|
-
import { Version, deepEqual, isExternalChain, getJunctionValue, hasJunction, Parents, RELAYCHAINS, replaceBigInt, isSubstrateBridge, isSnowbridge, CHAINS } from '@paraspell/sdk-common';
|
|
1
|
+
import { Version, deepEqual, isChain, isExternalChain, getJunctionValue, hasJunction, Parents, RELAYCHAINS, replaceBigInt, isCustomChain, isSubstrateBridge, isSnowbridge, SUBSTRATE_CHAINS, CHAINS, ETHEREUM_BRIDGE_ORIGINS } from '@paraspell/sdk-common';
|
|
2
|
+
|
|
3
|
+
function _arrayLikeToArray(r, a) {
|
|
4
|
+
(null == a || a > r.length) && (a = r.length);
|
|
5
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6
|
+
return n;
|
|
7
|
+
}
|
|
8
|
+
function _arrayWithHoles(r) {
|
|
9
|
+
if (Array.isArray(r)) return r;
|
|
10
|
+
}
|
|
11
|
+
function _arrayWithoutHoles(r) {
|
|
12
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
13
|
+
}
|
|
14
|
+
function _assertThisInitialized(e) {
|
|
15
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
function _callSuper(t, o, e) {
|
|
19
|
+
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
20
|
+
}
|
|
21
|
+
function _classCallCheck(a, n) {
|
|
22
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
23
|
+
}
|
|
24
|
+
function _construct(t, e, r) {
|
|
25
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
26
|
+
var o = [null];
|
|
27
|
+
o.push.apply(o, e);
|
|
28
|
+
var p = new (t.bind.apply(t, o))();
|
|
29
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
30
|
+
}
|
|
31
|
+
function _createClass(e, r, t) {
|
|
32
|
+
return Object.defineProperty(e, "prototype", {
|
|
33
|
+
writable: false
|
|
34
|
+
}), e;
|
|
35
|
+
}
|
|
36
|
+
function _createForOfIteratorHelper(r, e) {
|
|
37
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
38
|
+
if (!t) {
|
|
39
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
40
|
+
t && (r = t);
|
|
41
|
+
var n = 0,
|
|
42
|
+
F = function () {};
|
|
43
|
+
return {
|
|
44
|
+
s: F,
|
|
45
|
+
n: function () {
|
|
46
|
+
return n >= r.length ? {
|
|
47
|
+
done: true
|
|
48
|
+
} : {
|
|
49
|
+
done: false,
|
|
50
|
+
value: r[n++]
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
e: function (r) {
|
|
54
|
+
throw r;
|
|
55
|
+
},
|
|
56
|
+
f: F
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
60
|
+
}
|
|
61
|
+
var o,
|
|
62
|
+
a = true,
|
|
63
|
+
u = false;
|
|
64
|
+
return {
|
|
65
|
+
s: function () {
|
|
66
|
+
t = t.call(r);
|
|
67
|
+
},
|
|
68
|
+
n: function () {
|
|
69
|
+
var r = t.next();
|
|
70
|
+
return a = r.done, r;
|
|
71
|
+
},
|
|
72
|
+
e: function (r) {
|
|
73
|
+
u = true, o = r;
|
|
74
|
+
},
|
|
75
|
+
f: function () {
|
|
76
|
+
try {
|
|
77
|
+
a || null == t.return || t.return();
|
|
78
|
+
} finally {
|
|
79
|
+
if (u) throw o;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function _defineProperty(e, r, t) {
|
|
85
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
86
|
+
value: t,
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true,
|
|
89
|
+
writable: true
|
|
90
|
+
}) : e[r] = t, e;
|
|
91
|
+
}
|
|
92
|
+
function _getPrototypeOf(t) {
|
|
93
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
94
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
95
|
+
}, _getPrototypeOf(t);
|
|
96
|
+
}
|
|
97
|
+
function _inherits(t, e) {
|
|
98
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
99
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
100
|
+
constructor: {
|
|
101
|
+
value: t,
|
|
102
|
+
writable: true,
|
|
103
|
+
configurable: true
|
|
104
|
+
}
|
|
105
|
+
}), Object.defineProperty(t, "prototype", {
|
|
106
|
+
writable: false
|
|
107
|
+
}), e && _setPrototypeOf(t, e);
|
|
108
|
+
}
|
|
109
|
+
function _isNativeFunction(t) {
|
|
110
|
+
try {
|
|
111
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
112
|
+
} catch (n) {
|
|
113
|
+
return "function" == typeof t;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function _isNativeReflectConstruct() {
|
|
117
|
+
try {
|
|
118
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
119
|
+
} catch (t) {}
|
|
120
|
+
return (_isNativeReflectConstruct = function () {
|
|
121
|
+
return !!t;
|
|
122
|
+
})();
|
|
123
|
+
}
|
|
124
|
+
function _iterableToArray(r) {
|
|
125
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
126
|
+
}
|
|
127
|
+
function _iterableToArrayLimit(r, l) {
|
|
128
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
129
|
+
if (null != t) {
|
|
130
|
+
var e,
|
|
131
|
+
n,
|
|
132
|
+
i,
|
|
133
|
+
u,
|
|
134
|
+
a = [],
|
|
135
|
+
f = true,
|
|
136
|
+
o = false;
|
|
137
|
+
try {
|
|
138
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
139
|
+
} catch (r) {
|
|
140
|
+
o = true, n = r;
|
|
141
|
+
} finally {
|
|
142
|
+
try {
|
|
143
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
144
|
+
} finally {
|
|
145
|
+
if (o) throw n;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return a;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function _nonIterableRest() {
|
|
152
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
153
|
+
}
|
|
154
|
+
function _nonIterableSpread() {
|
|
155
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
156
|
+
}
|
|
157
|
+
function ownKeys(e, r) {
|
|
158
|
+
var t = Object.keys(e);
|
|
159
|
+
if (Object.getOwnPropertySymbols) {
|
|
160
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
161
|
+
r && (o = o.filter(function (r) {
|
|
162
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
163
|
+
})), t.push.apply(t, o);
|
|
164
|
+
}
|
|
165
|
+
return t;
|
|
166
|
+
}
|
|
167
|
+
function _objectSpread2(e) {
|
|
168
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
169
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
170
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
171
|
+
_defineProperty(e, r, t[r]);
|
|
172
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
173
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return e;
|
|
177
|
+
}
|
|
178
|
+
function _objectWithoutProperties(e, t) {
|
|
179
|
+
if (null == e) return {};
|
|
180
|
+
var o,
|
|
181
|
+
r,
|
|
182
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
183
|
+
if (Object.getOwnPropertySymbols) {
|
|
184
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
185
|
+
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
186
|
+
}
|
|
187
|
+
return i;
|
|
188
|
+
}
|
|
189
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
190
|
+
if (null == r) return {};
|
|
191
|
+
var t = {};
|
|
192
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
193
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
194
|
+
t[n] = r[n];
|
|
195
|
+
}
|
|
196
|
+
return t;
|
|
197
|
+
}
|
|
198
|
+
function _possibleConstructorReturn(t, e) {
|
|
199
|
+
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
200
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
201
|
+
return _assertThisInitialized(t);
|
|
202
|
+
}
|
|
203
|
+
function _setPrototypeOf(t, e) {
|
|
204
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
205
|
+
return t.__proto__ = e, t;
|
|
206
|
+
}, _setPrototypeOf(t, e);
|
|
207
|
+
}
|
|
208
|
+
function _slicedToArray(r, e) {
|
|
209
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
210
|
+
}
|
|
211
|
+
function _toConsumableArray(r) {
|
|
212
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
213
|
+
}
|
|
214
|
+
function _toPrimitive(t, r) {
|
|
215
|
+
if ("object" != typeof t || !t) return t;
|
|
216
|
+
var e = t[Symbol.toPrimitive];
|
|
217
|
+
if (void 0 !== e) {
|
|
218
|
+
var i = e.call(t, r);
|
|
219
|
+
if ("object" != typeof i) return i;
|
|
220
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
221
|
+
}
|
|
222
|
+
return ("string" === r ? String : Number)(t);
|
|
223
|
+
}
|
|
224
|
+
function _toPropertyKey(t) {
|
|
225
|
+
var i = _toPrimitive(t, "string");
|
|
226
|
+
return "symbol" == typeof i ? i : i + "";
|
|
227
|
+
}
|
|
228
|
+
function _typeof(o) {
|
|
229
|
+
"@babel/helpers - typeof";
|
|
230
|
+
|
|
231
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
232
|
+
return typeof o;
|
|
233
|
+
} : function (o) {
|
|
234
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
235
|
+
}, _typeof(o);
|
|
236
|
+
}
|
|
237
|
+
function _unsupportedIterableToArray(r, a) {
|
|
238
|
+
if (r) {
|
|
239
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
240
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
241
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function _wrapNativeSuper(t) {
|
|
245
|
+
var r = "function" == typeof Map ? new Map() : void 0;
|
|
246
|
+
return _wrapNativeSuper = function (t) {
|
|
247
|
+
if (null === t || !_isNativeFunction(t)) return t;
|
|
248
|
+
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
249
|
+
if (void 0 !== r) {
|
|
250
|
+
if (r.has(t)) return r.get(t);
|
|
251
|
+
r.set(t, Wrapper);
|
|
252
|
+
}
|
|
253
|
+
function Wrapper() {
|
|
254
|
+
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
255
|
+
}
|
|
256
|
+
return Wrapper.prototype = Object.create(t.prototype, {
|
|
257
|
+
constructor: {
|
|
258
|
+
value: Wrapper,
|
|
259
|
+
enumerable: false,
|
|
260
|
+
writable: true,
|
|
261
|
+
configurable: true
|
|
262
|
+
}
|
|
263
|
+
}), _setPrototypeOf(Wrapper, t);
|
|
264
|
+
}, _wrapNativeSuper(t);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Error thrown when a custom asset's location collides with an existing
|
|
269
|
+
* registry asset and `forceOverride` was not set.
|
|
270
|
+
*/
|
|
271
|
+
var CustomAssetConflictError = /*#__PURE__*/function (_Error) {
|
|
272
|
+
function CustomAssetConflictError(msg) {
|
|
273
|
+
var _this;
|
|
274
|
+
_classCallCheck(this, CustomAssetConflictError);
|
|
275
|
+
_this = _callSuper(this, CustomAssetConflictError, [msg]);
|
|
276
|
+
_this.name = 'CustomAssetConflict';
|
|
277
|
+
return _this;
|
|
278
|
+
}
|
|
279
|
+
_inherits(CustomAssetConflictError, _Error);
|
|
280
|
+
return _createClass(CustomAssetConflictError);
|
|
281
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Error thrown when multiple assets with the same symbol are found.
|
|
285
|
+
*/
|
|
286
|
+
var DuplicateAssetError = /*#__PURE__*/function (_Error) {
|
|
287
|
+
/**
|
|
288
|
+
* Constructs a new DuplicateAssetError.
|
|
289
|
+
*
|
|
290
|
+
* @param symbol - The symbol of the asset causing the duplication error.
|
|
291
|
+
*/
|
|
292
|
+
function DuplicateAssetError(msg) {
|
|
293
|
+
var _this;
|
|
294
|
+
_classCallCheck(this, DuplicateAssetError);
|
|
295
|
+
_this = _callSuper(this, DuplicateAssetError, [msg]);
|
|
296
|
+
_this.name = 'DuplicateAsset';
|
|
297
|
+
return _this;
|
|
298
|
+
}
|
|
299
|
+
_inherits(DuplicateAssetError, _Error);
|
|
300
|
+
return _createClass(DuplicateAssetError);
|
|
301
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Error thrown when multiple assets with the same symbol are found.
|
|
305
|
+
*/
|
|
306
|
+
var DuplicateAssetIdError = /*#__PURE__*/function (_Error) {
|
|
307
|
+
/**
|
|
308
|
+
* Constructs a new DuplicateAssetError.
|
|
309
|
+
*
|
|
310
|
+
* @param symbol - The symbol of the asset causing the duplication error.
|
|
311
|
+
*/
|
|
312
|
+
function DuplicateAssetIdError(id) {
|
|
313
|
+
var _this;
|
|
314
|
+
_classCallCheck(this, DuplicateAssetIdError);
|
|
315
|
+
_this = _callSuper(this, DuplicateAssetIdError, ["Multiple assets found with the same ID: ".concat(id, ". Please specify asset directly by symbol using .currency({symbol: <ASSET_SYMBOL>})")]);
|
|
316
|
+
_this.name = 'DuplicateAssetId';
|
|
317
|
+
return _this;
|
|
318
|
+
}
|
|
319
|
+
_inherits(DuplicateAssetIdError, _Error);
|
|
320
|
+
return _createClass(DuplicateAssetIdError);
|
|
321
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Used to inform user, that currency they wish to use is not registered on either origin or destination Parachain
|
|
325
|
+
*/
|
|
326
|
+
var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
|
|
327
|
+
/**
|
|
328
|
+
* Constructs a new InvalidCurrencyError.
|
|
329
|
+
*
|
|
330
|
+
* @param message - The error message.
|
|
331
|
+
*/
|
|
332
|
+
function InvalidCurrencyError(message) {
|
|
333
|
+
var _this;
|
|
334
|
+
_classCallCheck(this, InvalidCurrencyError);
|
|
335
|
+
_this = _callSuper(this, InvalidCurrencyError, [message]);
|
|
336
|
+
_this.name = 'InvalidCurrencyError';
|
|
337
|
+
return _this;
|
|
338
|
+
}
|
|
339
|
+
_inherits(InvalidCurrencyError, _Error);
|
|
340
|
+
return _createClass(InvalidCurrencyError);
|
|
341
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
2
342
|
|
|
3
343
|
var Polkadot = {
|
|
4
344
|
relaychainSymbol: "DOT",
|
|
@@ -4052,23 +4392,6 @@ var Hydration = {
|
|
|
4052
4392
|
},
|
|
4053
4393
|
isFeeAsset: true
|
|
4054
4394
|
},
|
|
4055
|
-
{
|
|
4056
|
-
assetId: "3370",
|
|
4057
|
-
symbol: "LAOS",
|
|
4058
|
-
decimals: 18,
|
|
4059
|
-
existentialDeposit: "1",
|
|
4060
|
-
location: {
|
|
4061
|
-
parents: 1,
|
|
4062
|
-
interior: {
|
|
4063
|
-
X1: [
|
|
4064
|
-
{
|
|
4065
|
-
Parachain: 3370
|
|
4066
|
-
}
|
|
4067
|
-
]
|
|
4068
|
-
}
|
|
4069
|
-
},
|
|
4070
|
-
isFeeAsset: true
|
|
4071
|
-
},
|
|
4072
4395
|
{
|
|
4073
4396
|
assetId: "1003",
|
|
4074
4397
|
symbol: "aUSDC",
|
|
@@ -7169,6 +7492,29 @@ var AssetHubPolkadot = {
|
|
|
7169
7492
|
existentialDeposit: "1",
|
|
7170
7493
|
alias: "VDOT1"
|
|
7171
7494
|
},
|
|
7495
|
+
{
|
|
7496
|
+
assetId: "50000520",
|
|
7497
|
+
symbol: "DOT",
|
|
7498
|
+
decimals: 18,
|
|
7499
|
+
location: {
|
|
7500
|
+
parents: 1,
|
|
7501
|
+
interior: {
|
|
7502
|
+
X3: [
|
|
7503
|
+
{
|
|
7504
|
+
Parachain: 1000
|
|
7505
|
+
},
|
|
7506
|
+
{
|
|
7507
|
+
PalletInstance: 50
|
|
7508
|
+
},
|
|
7509
|
+
{
|
|
7510
|
+
GeneralIndex: 50000520
|
|
7511
|
+
}
|
|
7512
|
+
]
|
|
7513
|
+
}
|
|
7514
|
+
},
|
|
7515
|
+
existentialDeposit: "1000000000000",
|
|
7516
|
+
alias: "DOT2"
|
|
7517
|
+
},
|
|
7172
7518
|
{
|
|
7173
7519
|
assetId: "40",
|
|
7174
7520
|
symbol: "PEPE",
|
|
@@ -7485,7 +7831,8 @@ var AssetHubPolkadot = {
|
|
|
7485
7831
|
]
|
|
7486
7832
|
}
|
|
7487
7833
|
},
|
|
7488
|
-
existentialDeposit: "10000000000000000"
|
|
7834
|
+
existentialDeposit: "10000000000000000",
|
|
7835
|
+
alias: "DOT1"
|
|
7489
7836
|
},
|
|
7490
7837
|
{
|
|
7491
7838
|
assetId: "1337",
|
|
@@ -7580,6 +7927,29 @@ var AssetHubPolkadot = {
|
|
|
7580
7927
|
existentialDeposit: "1",
|
|
7581
7928
|
alias: "ETH2"
|
|
7582
7929
|
},
|
|
7930
|
+
{
|
|
7931
|
+
assetId: "50000523",
|
|
7932
|
+
symbol: "DED",
|
|
7933
|
+
decimals: 18,
|
|
7934
|
+
location: {
|
|
7935
|
+
parents: 1,
|
|
7936
|
+
interior: {
|
|
7937
|
+
X3: [
|
|
7938
|
+
{
|
|
7939
|
+
Parachain: 1000
|
|
7940
|
+
},
|
|
7941
|
+
{
|
|
7942
|
+
PalletInstance: 50
|
|
7943
|
+
},
|
|
7944
|
+
{
|
|
7945
|
+
GeneralIndex: 50000523
|
|
7946
|
+
}
|
|
7947
|
+
]
|
|
7948
|
+
}
|
|
7949
|
+
},
|
|
7950
|
+
existentialDeposit: "1000000000000",
|
|
7951
|
+
alias: "DED3"
|
|
7952
|
+
},
|
|
7583
7953
|
{
|
|
7584
7954
|
assetId: "22222012",
|
|
7585
7955
|
symbol: "DAMN",
|
|
@@ -9396,32 +9766,6 @@ var CrustShadow = {
|
|
|
9396
9766
|
}
|
|
9397
9767
|
]
|
|
9398
9768
|
};
|
|
9399
|
-
var Laos = {
|
|
9400
|
-
relaychainSymbol: "DOT",
|
|
9401
|
-
nativeAssetSymbol: "LAOS",
|
|
9402
|
-
isEVM: true,
|
|
9403
|
-
ss58Prefix: 42,
|
|
9404
|
-
supportsDryRunApi: true,
|
|
9405
|
-
supportsXcmPaymentApi: true,
|
|
9406
|
-
assets: [
|
|
9407
|
-
{
|
|
9408
|
-
symbol: "LAOS",
|
|
9409
|
-
isNative: true,
|
|
9410
|
-
decimals: 18,
|
|
9411
|
-
existentialDeposit: "0",
|
|
9412
|
-
location: {
|
|
9413
|
-
parents: 1,
|
|
9414
|
-
interior: {
|
|
9415
|
-
X1: [
|
|
9416
|
-
{
|
|
9417
|
-
Parachain: 3370
|
|
9418
|
-
}
|
|
9419
|
-
]
|
|
9420
|
-
}
|
|
9421
|
-
}
|
|
9422
|
-
}
|
|
9423
|
-
]
|
|
9424
|
-
};
|
|
9425
9769
|
var Encointer = {
|
|
9426
9770
|
relaychainSymbol: "KSM",
|
|
9427
9771
|
nativeAssetSymbol: "KSM",
|
|
@@ -13870,6 +14214,58 @@ var Ethereum = {
|
|
|
13870
14214
|
}
|
|
13871
14215
|
}
|
|
13872
14216
|
},
|
|
14217
|
+
{
|
|
14218
|
+
symbol: "NEXO",
|
|
14219
|
+
assetId: "0xb62132e35a6c13ee1ee0f84dc5d40bad8d815206",
|
|
14220
|
+
decimals: 18,
|
|
14221
|
+
existentialDeposit: "1",
|
|
14222
|
+
location: {
|
|
14223
|
+
parents: 2,
|
|
14224
|
+
interior: {
|
|
14225
|
+
X2: [
|
|
14226
|
+
{
|
|
14227
|
+
GlobalConsensus: {
|
|
14228
|
+
Ethereum: {
|
|
14229
|
+
chainId: 1
|
|
14230
|
+
}
|
|
14231
|
+
}
|
|
14232
|
+
},
|
|
14233
|
+
{
|
|
14234
|
+
AccountKey20: {
|
|
14235
|
+
network: null,
|
|
14236
|
+
key: "0xb62132e35a6c13ee1ee0f84dc5d40bad8d815206"
|
|
14237
|
+
}
|
|
14238
|
+
}
|
|
14239
|
+
]
|
|
14240
|
+
}
|
|
14241
|
+
}
|
|
14242
|
+
},
|
|
14243
|
+
{
|
|
14244
|
+
symbol: "sUSDat",
|
|
14245
|
+
assetId: "0xd166337499e176bbc38a1fbd113ab144e5bd2df7",
|
|
14246
|
+
decimals: 18,
|
|
14247
|
+
existentialDeposit: "1",
|
|
14248
|
+
location: {
|
|
14249
|
+
parents: 2,
|
|
14250
|
+
interior: {
|
|
14251
|
+
X2: [
|
|
14252
|
+
{
|
|
14253
|
+
GlobalConsensus: {
|
|
14254
|
+
Ethereum: {
|
|
14255
|
+
chainId: 1
|
|
14256
|
+
}
|
|
14257
|
+
}
|
|
14258
|
+
},
|
|
14259
|
+
{
|
|
14260
|
+
AccountKey20: {
|
|
14261
|
+
network: null,
|
|
14262
|
+
key: "0xd166337499e176bbc38a1fbd113ab144e5bd2df7"
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
]
|
|
14266
|
+
}
|
|
14267
|
+
}
|
|
14268
|
+
},
|
|
13873
14269
|
{
|
|
13874
14270
|
symbol: "SKY",
|
|
13875
14271
|
assetId: "0x56072c95faa701256059aa122697b133aded9279",
|
|
@@ -16602,8 +16998,8 @@ var EnergyWebXPaseo = {
|
|
|
16602
16998
|
nativeAssetSymbol: "EWT",
|
|
16603
16999
|
isEVM: false,
|
|
16604
17000
|
ss58Prefix: 42,
|
|
16605
|
-
supportsDryRunApi:
|
|
16606
|
-
supportsXcmPaymentApi:
|
|
17001
|
+
supportsDryRunApi: true,
|
|
17002
|
+
supportsXcmPaymentApi: true,
|
|
16607
17003
|
assets: [
|
|
16608
17004
|
{
|
|
16609
17005
|
symbol: "EWT",
|
|
@@ -16640,7 +17036,8 @@ var EnergyWebXPaseo = {
|
|
|
16640
17036
|
}
|
|
16641
17037
|
]
|
|
16642
17038
|
}
|
|
16643
|
-
}
|
|
17039
|
+
},
|
|
17040
|
+
isFeeAsset: true
|
|
16644
17041
|
},
|
|
16645
17042
|
{
|
|
16646
17043
|
symbol: "stEWT",
|
|
@@ -18563,32 +18960,6 @@ var HydrationPaseo = {
|
|
|
18563
18960
|
}
|
|
18564
18961
|
]
|
|
18565
18962
|
};
|
|
18566
|
-
var LaosPaseo = {
|
|
18567
|
-
relaychainSymbol: "PAS",
|
|
18568
|
-
nativeAssetSymbol: "SIGMA",
|
|
18569
|
-
isEVM: true,
|
|
18570
|
-
ss58Prefix: 42,
|
|
18571
|
-
supportsDryRunApi: true,
|
|
18572
|
-
supportsXcmPaymentApi: true,
|
|
18573
|
-
assets: [
|
|
18574
|
-
{
|
|
18575
|
-
symbol: "SIGMA",
|
|
18576
|
-
isNative: true,
|
|
18577
|
-
decimals: 18,
|
|
18578
|
-
existentialDeposit: "0",
|
|
18579
|
-
location: {
|
|
18580
|
-
parents: 1,
|
|
18581
|
-
interior: {
|
|
18582
|
-
X1: [
|
|
18583
|
-
{
|
|
18584
|
-
Parachain: 4006
|
|
18585
|
-
}
|
|
18586
|
-
]
|
|
18587
|
-
}
|
|
18588
|
-
}
|
|
18589
|
-
}
|
|
18590
|
-
]
|
|
18591
|
-
};
|
|
18592
18963
|
var NeuroWebPaseo = {
|
|
18593
18964
|
relaychainSymbol: "PAS",
|
|
18594
18965
|
nativeAssetSymbol: "NEURO",
|
|
@@ -18798,7 +19169,6 @@ var assetsMapJson = {
|
|
|
18798
19169
|
BifrostKusama: BifrostKusama,
|
|
18799
19170
|
Crab: Crab,
|
|
18800
19171
|
CrustShadow: CrustShadow,
|
|
18801
|
-
Laos: Laos,
|
|
18802
19172
|
Encointer: Encointer,
|
|
18803
19173
|
Karura: Karura,
|
|
18804
19174
|
Kintsugi: Kintsugi,
|
|
@@ -18837,11 +19207,118 @@ var assetsMapJson = {
|
|
|
18837
19207
|
HeimaPaseo: HeimaPaseo,
|
|
18838
19208
|
EnergyWebXPaseo: EnergyWebXPaseo,
|
|
18839
19209
|
HydrationPaseo: HydrationPaseo,
|
|
18840
|
-
LaosPaseo: LaosPaseo,
|
|
18841
19210
|
NeuroWebPaseo: NeuroWebPaseo,
|
|
18842
19211
|
ZeitgeistPaseo: ZeitgeistPaseo
|
|
18843
19212
|
};
|
|
18844
19213
|
|
|
19214
|
+
/**
|
|
19215
|
+
* Converts a location to a specific XCM version
|
|
19216
|
+
*
|
|
19217
|
+
* In XCM v3, `interior.X1` is a single `Object`. In XCM V4, `interior.X1` is an `Array<Object>`.
|
|
19218
|
+
*
|
|
19219
|
+
* @param location - The location to normalize.
|
|
19220
|
+
* @param version - The target XCM version: `'V3'`, `'V4'` or `'V5'`. Defaults to `'V5'`.
|
|
19221
|
+
* @returns A new transformed `TLocation`
|
|
19222
|
+
*/
|
|
19223
|
+
var normalizeLocation = function normalizeLocation(location) {
|
|
19224
|
+
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Version.V5;
|
|
19225
|
+
if (location.interior === 'Here' || location.interior.X1 === undefined) {
|
|
19226
|
+
return location;
|
|
19227
|
+
}
|
|
19228
|
+
var currentX1 = location.interior.X1;
|
|
19229
|
+
if (version === Version.V4 || version === Version.V5) {
|
|
19230
|
+
if (Array.isArray(currentX1)) {
|
|
19231
|
+
// Already in V4/V5 format
|
|
19232
|
+
return location;
|
|
19233
|
+
}
|
|
19234
|
+
return {
|
|
19235
|
+
parents: location.parents,
|
|
19236
|
+
interior: {
|
|
19237
|
+
X1: [currentX1]
|
|
19238
|
+
}
|
|
19239
|
+
};
|
|
19240
|
+
} else {
|
|
19241
|
+
if (!Array.isArray(currentX1)) {
|
|
19242
|
+
// Already in V3 format
|
|
19243
|
+
return location;
|
|
19244
|
+
}
|
|
19245
|
+
return {
|
|
19246
|
+
parents: location.parents,
|
|
19247
|
+
interior: {
|
|
19248
|
+
X1: currentX1[0]
|
|
19249
|
+
}
|
|
19250
|
+
};
|
|
19251
|
+
}
|
|
19252
|
+
};
|
|
19253
|
+
var canonicalizeLocation = function canonicalizeLocation(location) {
|
|
19254
|
+
var normalized = normalizeLocation(location);
|
|
19255
|
+
return normalized.interior === 'Here' ? {
|
|
19256
|
+
parents: normalized.parents,
|
|
19257
|
+
interior: {
|
|
19258
|
+
Here: null
|
|
19259
|
+
}
|
|
19260
|
+
} : normalized;
|
|
19261
|
+
};
|
|
19262
|
+
|
|
19263
|
+
var baseAssetsMap = assetsMapJson;
|
|
19264
|
+
var normalizeCustomAssets = function normalizeCustomAssets(map) {
|
|
19265
|
+
if (!map) return {};
|
|
19266
|
+
var result = {};
|
|
19267
|
+
for (var _i = 0, _Object$entries = Object.entries(map); _i < _Object$entries.length; _i++) {
|
|
19268
|
+
var _baseAssetsMap$chain$, _baseAssetsMap$chain;
|
|
19269
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
19270
|
+
chain = _Object$entries$_i[0],
|
|
19271
|
+
entries = _Object$entries$_i[1];
|
|
19272
|
+
if (!isChain(chain) || !entries || entries.length === 0) continue;
|
|
19273
|
+
var base = (_baseAssetsMap$chain$ = (_baseAssetsMap$chain = baseAssetsMap[chain]) === null || _baseAssetsMap$chain === void 0 ? void 0 : _baseAssetsMap$chain.assets) !== null && _baseAssetsMap$chain$ !== void 0 ? _baseAssetsMap$chain$ : [];
|
|
19274
|
+
var normalized = entries.map(function (entry) {
|
|
19275
|
+
return _objectSpread2(_objectSpread2({}, entry), {}, {
|
|
19276
|
+
location: canonicalizeLocation(entry.location)
|
|
19277
|
+
});
|
|
19278
|
+
});
|
|
19279
|
+
var _iterator = _createForOfIteratorHelper(normalized),
|
|
19280
|
+
_step;
|
|
19281
|
+
try {
|
|
19282
|
+
var _loop = function _loop() {
|
|
19283
|
+
var entry = _step.value;
|
|
19284
|
+
if (entry.forceOverride) return 1; // continue
|
|
19285
|
+
var clash = base.find(function (a) {
|
|
19286
|
+
return deepEqual(canonicalizeLocation(a.location), entry.location);
|
|
19287
|
+
});
|
|
19288
|
+
if (clash) {
|
|
19289
|
+
throw new CustomAssetConflictError("Custom asset '".concat(entry.symbol, "' on chain '").concat(chain, "' collides on location with registry asset '").concat(clash.symbol, "'. Set 'forceOverride: true' to replace it."));
|
|
19290
|
+
}
|
|
19291
|
+
};
|
|
19292
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
19293
|
+
if (_loop()) continue;
|
|
19294
|
+
}
|
|
19295
|
+
} catch (err) {
|
|
19296
|
+
_iterator.e(err);
|
|
19297
|
+
} finally {
|
|
19298
|
+
_iterator.f();
|
|
19299
|
+
}
|
|
19300
|
+
result[chain] = normalized;
|
|
19301
|
+
}
|
|
19302
|
+
return result;
|
|
19303
|
+
};
|
|
19304
|
+
var mergeCustomAssets = function mergeCustomAssets(base, overlay) {
|
|
19305
|
+
if (!overlay || overlay.length === 0) return _toConsumableArray(base);
|
|
19306
|
+
var kept = base.filter(function (b) {
|
|
19307
|
+
return !overlay.some(function (o) {
|
|
19308
|
+
return deepEqual(o.location, b.location);
|
|
19309
|
+
});
|
|
19310
|
+
});
|
|
19311
|
+
return [].concat(_toConsumableArray(kept), _toConsumableArray(overlay));
|
|
19312
|
+
};
|
|
19313
|
+
var isCustomAsset = function isCustomAsset(chain, asset, ctx) {
|
|
19314
|
+
var _ctx$customAssets;
|
|
19315
|
+
var overlay = ctx === null || ctx === void 0 || (_ctx$customAssets = ctx.customAssets) === null || _ctx$customAssets === void 0 ? void 0 : _ctx$customAssets[chain];
|
|
19316
|
+
if (!overlay || overlay.length === 0) return false;
|
|
19317
|
+
return overlay.some(function (a) {
|
|
19318
|
+
return deepEqual(a.location, asset.location);
|
|
19319
|
+
});
|
|
19320
|
+
};
|
|
19321
|
+
|
|
18845
19322
|
/**
|
|
18846
19323
|
* Normalizes an asset symbol by stripping the 'xc' prefix (if present) and converting it to lowercase.
|
|
18847
19324
|
*
|
|
@@ -18860,168 +19337,6 @@ var isSymbolMatch = function isSymbolMatch(symbolA, symbolB) {
|
|
|
18860
19337
|
return normalizeSymbol(symbolA) === normalizeSymbol(symbolB);
|
|
18861
19338
|
};
|
|
18862
19339
|
|
|
18863
|
-
function _arrayLikeToArray(r, a) {
|
|
18864
|
-
(null == a || a > r.length) && (a = r.length);
|
|
18865
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
18866
|
-
return n;
|
|
18867
|
-
}
|
|
18868
|
-
function _arrayWithoutHoles(r) {
|
|
18869
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
18870
|
-
}
|
|
18871
|
-
function _assertThisInitialized(e) {
|
|
18872
|
-
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
18873
|
-
return e;
|
|
18874
|
-
}
|
|
18875
|
-
function _callSuper(t, o, e) {
|
|
18876
|
-
return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));
|
|
18877
|
-
}
|
|
18878
|
-
function _classCallCheck(a, n) {
|
|
18879
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
18880
|
-
}
|
|
18881
|
-
function _construct(t, e, r) {
|
|
18882
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
18883
|
-
var o = [null];
|
|
18884
|
-
o.push.apply(o, e);
|
|
18885
|
-
var p = new (t.bind.apply(t, o))();
|
|
18886
|
-
return r && _setPrototypeOf(p, r.prototype), p;
|
|
18887
|
-
}
|
|
18888
|
-
function _createClass(e, r, t) {
|
|
18889
|
-
return Object.defineProperty(e, "prototype", {
|
|
18890
|
-
writable: false
|
|
18891
|
-
}), e;
|
|
18892
|
-
}
|
|
18893
|
-
function _defineProperty(e, r, t) {
|
|
18894
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
18895
|
-
value: t,
|
|
18896
|
-
enumerable: true,
|
|
18897
|
-
configurable: true,
|
|
18898
|
-
writable: true
|
|
18899
|
-
}) : e[r] = t, e;
|
|
18900
|
-
}
|
|
18901
|
-
function _getPrototypeOf(t) {
|
|
18902
|
-
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
|
|
18903
|
-
return t.__proto__ || Object.getPrototypeOf(t);
|
|
18904
|
-
}, _getPrototypeOf(t);
|
|
18905
|
-
}
|
|
18906
|
-
function _inherits(t, e) {
|
|
18907
|
-
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
18908
|
-
t.prototype = Object.create(e && e.prototype, {
|
|
18909
|
-
constructor: {
|
|
18910
|
-
value: t,
|
|
18911
|
-
writable: true,
|
|
18912
|
-
configurable: true
|
|
18913
|
-
}
|
|
18914
|
-
}), Object.defineProperty(t, "prototype", {
|
|
18915
|
-
writable: false
|
|
18916
|
-
}), e && _setPrototypeOf(t, e);
|
|
18917
|
-
}
|
|
18918
|
-
function _isNativeFunction(t) {
|
|
18919
|
-
try {
|
|
18920
|
-
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
18921
|
-
} catch (n) {
|
|
18922
|
-
return "function" == typeof t;
|
|
18923
|
-
}
|
|
18924
|
-
}
|
|
18925
|
-
function _isNativeReflectConstruct() {
|
|
18926
|
-
try {
|
|
18927
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
18928
|
-
} catch (t) {}
|
|
18929
|
-
return (_isNativeReflectConstruct = function () {
|
|
18930
|
-
return !!t;
|
|
18931
|
-
})();
|
|
18932
|
-
}
|
|
18933
|
-
function _iterableToArray(r) {
|
|
18934
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
18935
|
-
}
|
|
18936
|
-
function _nonIterableSpread() {
|
|
18937
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
18938
|
-
}
|
|
18939
|
-
function _objectWithoutProperties(e, t) {
|
|
18940
|
-
if (null == e) return {};
|
|
18941
|
-
var o,
|
|
18942
|
-
r,
|
|
18943
|
-
i = _objectWithoutPropertiesLoose(e, t);
|
|
18944
|
-
if (Object.getOwnPropertySymbols) {
|
|
18945
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
18946
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
18947
|
-
}
|
|
18948
|
-
return i;
|
|
18949
|
-
}
|
|
18950
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
18951
|
-
if (null == r) return {};
|
|
18952
|
-
var t = {};
|
|
18953
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
18954
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
18955
|
-
t[n] = r[n];
|
|
18956
|
-
}
|
|
18957
|
-
return t;
|
|
18958
|
-
}
|
|
18959
|
-
function _possibleConstructorReturn(t, e) {
|
|
18960
|
-
if (e && ("object" == typeof e || "function" == typeof e)) return e;
|
|
18961
|
-
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
18962
|
-
return _assertThisInitialized(t);
|
|
18963
|
-
}
|
|
18964
|
-
function _setPrototypeOf(t, e) {
|
|
18965
|
-
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
18966
|
-
return t.__proto__ = e, t;
|
|
18967
|
-
}, _setPrototypeOf(t, e);
|
|
18968
|
-
}
|
|
18969
|
-
function _toConsumableArray(r) {
|
|
18970
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
18971
|
-
}
|
|
18972
|
-
function _toPrimitive(t, r) {
|
|
18973
|
-
if ("object" != typeof t || !t) return t;
|
|
18974
|
-
var e = t[Symbol.toPrimitive];
|
|
18975
|
-
if (void 0 !== e) {
|
|
18976
|
-
var i = e.call(t, r);
|
|
18977
|
-
if ("object" != typeof i) return i;
|
|
18978
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
18979
|
-
}
|
|
18980
|
-
return ("string" === r ? String : Number)(t);
|
|
18981
|
-
}
|
|
18982
|
-
function _toPropertyKey(t) {
|
|
18983
|
-
var i = _toPrimitive(t, "string");
|
|
18984
|
-
return "symbol" == typeof i ? i : i + "";
|
|
18985
|
-
}
|
|
18986
|
-
function _typeof(o) {
|
|
18987
|
-
"@babel/helpers - typeof";
|
|
18988
|
-
|
|
18989
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
18990
|
-
return typeof o;
|
|
18991
|
-
} : function (o) {
|
|
18992
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
18993
|
-
}, _typeof(o);
|
|
18994
|
-
}
|
|
18995
|
-
function _unsupportedIterableToArray(r, a) {
|
|
18996
|
-
if (r) {
|
|
18997
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
18998
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
18999
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
19000
|
-
}
|
|
19001
|
-
}
|
|
19002
|
-
function _wrapNativeSuper(t) {
|
|
19003
|
-
var r = "function" == typeof Map ? new Map() : void 0;
|
|
19004
|
-
return _wrapNativeSuper = function (t) {
|
|
19005
|
-
if (null === t || !_isNativeFunction(t)) return t;
|
|
19006
|
-
if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
|
|
19007
|
-
if (void 0 !== r) {
|
|
19008
|
-
if (r.has(t)) return r.get(t);
|
|
19009
|
-
r.set(t, Wrapper);
|
|
19010
|
-
}
|
|
19011
|
-
function Wrapper() {
|
|
19012
|
-
return _construct(t, arguments, _getPrototypeOf(this).constructor);
|
|
19013
|
-
}
|
|
19014
|
-
return Wrapper.prototype = Object.create(t.prototype, {
|
|
19015
|
-
constructor: {
|
|
19016
|
-
value: Wrapper,
|
|
19017
|
-
enumerable: false,
|
|
19018
|
-
writable: true,
|
|
19019
|
-
configurable: true
|
|
19020
|
-
}
|
|
19021
|
-
}), _setPrototypeOf(Wrapper, t);
|
|
19022
|
-
}, _wrapNativeSuper(t);
|
|
19023
|
-
}
|
|
19024
|
-
|
|
19025
19340
|
var isOverrideLocationSpecifier = function isOverrideLocationSpecifier(locationSpecifier) {
|
|
19026
19341
|
return _typeof(locationSpecifier) === 'object' && 'type' in locationSpecifier && 'value' in locationSpecifier;
|
|
19027
19342
|
};
|
|
@@ -19034,66 +19349,6 @@ var isTAsset = function isTAsset(value) {
|
|
|
19034
19349
|
return _typeof(value) === 'object' && value !== null && 'id' in value && 'fun' in value;
|
|
19035
19350
|
};
|
|
19036
19351
|
|
|
19037
|
-
/**
|
|
19038
|
-
* Error thrown when multiple assets with the same symbol are found.
|
|
19039
|
-
*/
|
|
19040
|
-
var DuplicateAssetError = /*#__PURE__*/function (_Error) {
|
|
19041
|
-
/**
|
|
19042
|
-
* Constructs a new DuplicateAssetError.
|
|
19043
|
-
*
|
|
19044
|
-
* @param symbol - The symbol of the asset causing the duplication error.
|
|
19045
|
-
*/
|
|
19046
|
-
function DuplicateAssetError(msg) {
|
|
19047
|
-
var _this;
|
|
19048
|
-
_classCallCheck(this, DuplicateAssetError);
|
|
19049
|
-
_this = _callSuper(this, DuplicateAssetError, [msg]);
|
|
19050
|
-
_this.name = 'DuplicateAsset';
|
|
19051
|
-
return _this;
|
|
19052
|
-
}
|
|
19053
|
-
_inherits(DuplicateAssetError, _Error);
|
|
19054
|
-
return _createClass(DuplicateAssetError);
|
|
19055
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
19056
|
-
|
|
19057
|
-
/**
|
|
19058
|
-
* Error thrown when multiple assets with the same symbol are found.
|
|
19059
|
-
*/
|
|
19060
|
-
var DuplicateAssetIdError = /*#__PURE__*/function (_Error) {
|
|
19061
|
-
/**
|
|
19062
|
-
* Constructs a new DuplicateAssetError.
|
|
19063
|
-
*
|
|
19064
|
-
* @param symbol - The symbol of the asset causing the duplication error.
|
|
19065
|
-
*/
|
|
19066
|
-
function DuplicateAssetIdError(id) {
|
|
19067
|
-
var _this;
|
|
19068
|
-
_classCallCheck(this, DuplicateAssetIdError);
|
|
19069
|
-
_this = _callSuper(this, DuplicateAssetIdError, ["Multiple assets found with the same ID: ".concat(id, ". Please specify asset directly by symbol using .currency({symbol: <ASSET_SYMBOL>})")]);
|
|
19070
|
-
_this.name = 'DuplicateAssetId';
|
|
19071
|
-
return _this;
|
|
19072
|
-
}
|
|
19073
|
-
_inherits(DuplicateAssetIdError, _Error);
|
|
19074
|
-
return _createClass(DuplicateAssetIdError);
|
|
19075
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
19076
|
-
|
|
19077
|
-
/**
|
|
19078
|
-
* Used to inform user, that currency they wish to use is not registered on either origin or destination Parachain
|
|
19079
|
-
*/
|
|
19080
|
-
var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
|
|
19081
|
-
/**
|
|
19082
|
-
* Constructs a new InvalidCurrencyError.
|
|
19083
|
-
*
|
|
19084
|
-
* @param message - The error message.
|
|
19085
|
-
*/
|
|
19086
|
-
function InvalidCurrencyError(message) {
|
|
19087
|
-
var _this;
|
|
19088
|
-
_classCallCheck(this, InvalidCurrencyError);
|
|
19089
|
-
_this = _callSuper(this, InvalidCurrencyError, [message]);
|
|
19090
|
-
_this.name = 'InvalidCurrencyError';
|
|
19091
|
-
return _this;
|
|
19092
|
-
}
|
|
19093
|
-
_inherits(InvalidCurrencyError, _Error);
|
|
19094
|
-
return _createClass(InvalidCurrencyError);
|
|
19095
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
19096
|
-
|
|
19097
19352
|
var findAssetInfoById = function findAssetInfoById(assets, assetId) {
|
|
19098
19353
|
var id = assetId.toString();
|
|
19099
19354
|
var matches = assets.filter(function (a) {
|
|
@@ -19134,58 +19389,16 @@ var getAssetLocation = function getAssetLocation(chain, currency) {
|
|
|
19134
19389
|
return (_asset$location = asset === null || asset === void 0 ? void 0 : asset.location) !== null && _asset$location !== void 0 ? _asset$location : null;
|
|
19135
19390
|
};
|
|
19136
19391
|
|
|
19137
|
-
/**
|
|
19138
|
-
* Converts a location to a specific XCM version
|
|
19139
|
-
*
|
|
19140
|
-
* In XCM v3, `interior.X1` is a single `Object`. In XCM V4, `interior.X1` is an `Array<Object>`.
|
|
19141
|
-
*
|
|
19142
|
-
* @param location - The location to normalize.
|
|
19143
|
-
* @param version - The target XCM version: `'V3'`, `'V4'` or `'V5'`. Defaults to `'V5'`.
|
|
19144
|
-
* @returns A new transformed `TLocation`
|
|
19145
|
-
*/
|
|
19146
|
-
var normalizeLocation = function normalizeLocation(location) {
|
|
19147
|
-
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Version.V5;
|
|
19148
|
-
if (location.interior === 'Here' || location.interior.X1 === undefined) {
|
|
19149
|
-
return location;
|
|
19150
|
-
}
|
|
19151
|
-
var currentX1 = location.interior.X1;
|
|
19152
|
-
if (version === Version.V4 || version === Version.V5) {
|
|
19153
|
-
if (Array.isArray(currentX1)) {
|
|
19154
|
-
// Already in V4/V5 format
|
|
19155
|
-
return location;
|
|
19156
|
-
}
|
|
19157
|
-
return {
|
|
19158
|
-
parents: location.parents,
|
|
19159
|
-
interior: {
|
|
19160
|
-
X1: [currentX1]
|
|
19161
|
-
}
|
|
19162
|
-
};
|
|
19163
|
-
} else {
|
|
19164
|
-
if (!Array.isArray(currentX1)) {
|
|
19165
|
-
// Already in V3 format
|
|
19166
|
-
return location;
|
|
19167
|
-
}
|
|
19168
|
-
return {
|
|
19169
|
-
parents: location.parents,
|
|
19170
|
-
interior: {
|
|
19171
|
-
X1: currentX1[0]
|
|
19172
|
-
}
|
|
19173
|
-
};
|
|
19174
|
-
}
|
|
19175
|
-
};
|
|
19176
|
-
|
|
19177
19392
|
var findAssetInfoByLoc = function findAssetInfoByLoc(foreignAssets, location) {
|
|
19178
19393
|
if (typeof location === 'string') {
|
|
19179
19394
|
return foreignAssets.find(function (asset) {
|
|
19180
19395
|
return compareLocations(location, asset);
|
|
19181
19396
|
});
|
|
19182
|
-
} else {
|
|
19183
|
-
var normalizedLocation = normalizeLocation(location);
|
|
19184
|
-
return foreignAssets.find(function (asset) {
|
|
19185
|
-
var normalizedAssetML = asset.location && normalizeLocation(asset.location);
|
|
19186
|
-
return deepEqual(normalizedLocation, normalizedAssetML);
|
|
19187
|
-
});
|
|
19188
19397
|
}
|
|
19398
|
+
var normalizedLocation = canonicalizeLocation(location);
|
|
19399
|
+
return foreignAssets.find(function (asset) {
|
|
19400
|
+
return asset.location && deepEqual(normalizedLocation, canonicalizeLocation(asset.location));
|
|
19401
|
+
});
|
|
19189
19402
|
};
|
|
19190
19403
|
|
|
19191
19404
|
var findBestMatches = function findBestMatches(assets, value) {
|
|
@@ -19360,23 +19573,26 @@ var findAssetInfoBySymbol = function findAssetInfoBySymbol(otherAssets, nativeAs
|
|
|
19360
19573
|
return assetsMatches[0];
|
|
19361
19574
|
};
|
|
19362
19575
|
|
|
19363
|
-
var
|
|
19576
|
+
var findAssetInfoImpl = function findAssetInfoImpl(chain, currency, destination, ctx) {
|
|
19364
19577
|
if ('location' in currency && isOverrideLocationSpecifier(currency.location) || Array.isArray(currency)) {
|
|
19365
19578
|
return null;
|
|
19366
19579
|
}
|
|
19367
|
-
var otherAssets =
|
|
19368
|
-
var nativeAssets =
|
|
19580
|
+
var otherAssets = getOtherAssetsImpl(chain, ctx);
|
|
19581
|
+
var nativeAssets = getNativeAssetsImpl(chain, ctx);
|
|
19369
19582
|
var assets = [].concat(_toConsumableArray(nativeAssets), _toConsumableArray(otherAssets));
|
|
19370
19583
|
var asset;
|
|
19371
|
-
if ('
|
|
19372
|
-
asset = findAssetInfoBySymbol(otherAssets, nativeAssets, currency.symbol, destination !== null && destination !== void 0 ? destination : undefined);
|
|
19373
|
-
} else if ('location' in currency && !isOverrideLocationSpecifier(currency.location)) {
|
|
19584
|
+
if ('location' in currency && !isOverrideLocationSpecifier(currency.location)) {
|
|
19374
19585
|
asset = findAssetInfoByLoc(assets, currency.location);
|
|
19586
|
+
} else if ('symbol' in currency) {
|
|
19587
|
+
asset = findAssetInfoBySymbol(otherAssets, nativeAssets, currency.symbol, destination !== null && destination !== void 0 ? destination : undefined);
|
|
19375
19588
|
} else if ('id' in currency) {
|
|
19376
19589
|
asset = findAssetInfoById(assets, currency.id);
|
|
19377
19590
|
}
|
|
19378
19591
|
return asset !== null && asset !== void 0 ? asset : null;
|
|
19379
19592
|
};
|
|
19593
|
+
var findAssetInfo = function findAssetInfo(chain, currency, destination) {
|
|
19594
|
+
return findAssetInfoImpl(chain, currency, destination);
|
|
19595
|
+
};
|
|
19380
19596
|
|
|
19381
19597
|
var Native = function Native(symbol) {
|
|
19382
19598
|
return {
|
|
@@ -19396,6 +19612,9 @@ var ForeignAbstract = function ForeignAbstract(symbol) {
|
|
|
19396
19612
|
value: symbol
|
|
19397
19613
|
};
|
|
19398
19614
|
};
|
|
19615
|
+
/**
|
|
19616
|
+
* @deprecated Use the `customAssets` Builder option to register the asset instead. Will be removed in v14.
|
|
19617
|
+
*/
|
|
19399
19618
|
var Override = function Override(location) {
|
|
19400
19619
|
return {
|
|
19401
19620
|
type: 'Override',
|
|
@@ -19431,13 +19650,16 @@ var isBridgedSystemAsset = function isBridgedSystemAsset(asset, relayChains) {
|
|
|
19431
19650
|
});
|
|
19432
19651
|
};
|
|
19433
19652
|
|
|
19434
|
-
var
|
|
19435
|
-
var asset =
|
|
19653
|
+
var findAssetInfoOrThrowImpl = function findAssetInfoOrThrowImpl(chain, currency, destination, ctx) {
|
|
19654
|
+
var asset = findAssetInfoImpl(chain, currency, destination, ctx);
|
|
19436
19655
|
if (!asset) {
|
|
19437
19656
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency, replaceBigInt), " not found on ").concat(chain));
|
|
19438
19657
|
}
|
|
19439
19658
|
return asset;
|
|
19440
19659
|
};
|
|
19660
|
+
var findAssetInfoOrThrow = function findAssetInfoOrThrow(chain, currency, destination) {
|
|
19661
|
+
return findAssetInfoOrThrowImpl(chain, currency, destination);
|
|
19662
|
+
};
|
|
19441
19663
|
|
|
19442
19664
|
var findStablecoinAssets = function findStablecoinAssets(chain) {
|
|
19443
19665
|
var assets = getOtherAssets(chain);
|
|
@@ -19452,10 +19674,10 @@ var findStablecoinAssets = function findStablecoinAssets(chain) {
|
|
|
19452
19674
|
});
|
|
19453
19675
|
};
|
|
19454
19676
|
|
|
19455
|
-
var findAssetInfoOnSubBridgeDest = function findAssetInfoOnSubBridgeDest(destination, resolvedOriginAsset) {
|
|
19456
|
-
var nativeMatch =
|
|
19677
|
+
var findAssetInfoOnSubBridgeDest = function findAssetInfoOnSubBridgeDest(destination, resolvedOriginAsset, ctx) {
|
|
19678
|
+
var nativeMatch = findAssetInfoImpl(destination, {
|
|
19457
19679
|
symbol: Native(resolvedOriginAsset.symbol)
|
|
19458
|
-
}, null);
|
|
19680
|
+
}, null, ctx);
|
|
19459
19681
|
if (nativeMatch) return nativeMatch;
|
|
19460
19682
|
var isStablecoin = isStableCoinAsset(resolvedOriginAsset);
|
|
19461
19683
|
if (isStablecoin) {
|
|
@@ -19465,92 +19687,117 @@ var findAssetInfoOnSubBridgeDest = function findAssetInfoOnSubBridgeDest(destina
|
|
|
19465
19687
|
});
|
|
19466
19688
|
if (match) return match;
|
|
19467
19689
|
}
|
|
19468
|
-
var foreignMatch =
|
|
19690
|
+
var foreignMatch = findAssetInfoImpl(destination, {
|
|
19469
19691
|
symbol: Foreign(resolvedOriginAsset.symbol)
|
|
19470
|
-
}, null);
|
|
19692
|
+
}, null, ctx);
|
|
19471
19693
|
if (foreignMatch) return foreignMatch;
|
|
19472
19694
|
return null;
|
|
19473
19695
|
};
|
|
19474
|
-
var
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
var resolvedOriginAsset = originAsset !== null && originAsset !== void 0 ? originAsset : findAssetInfoOrThrow(origin, currency, destination);
|
|
19478
|
-
if (isSubBridge) {
|
|
19479
|
-
return findAssetInfoOnSubBridgeDest(destination, resolvedOriginAsset);
|
|
19696
|
+
var resolveAssetOnDest = function resolveAssetOnDest(origin, destination, resolvedOriginAsset, ctx) {
|
|
19697
|
+
if (isSubstrateBridge(origin, destination)) {
|
|
19698
|
+
return findAssetInfoOnSubBridgeDest(destination, resolvedOriginAsset, ctx);
|
|
19480
19699
|
}
|
|
19700
|
+
var isSb = isSnowbridge(origin, destination);
|
|
19481
19701
|
if (isSb && isSystemAsset(resolvedOriginAsset)) {
|
|
19482
|
-
var match =
|
|
19702
|
+
var match = findAssetInfoImpl(destination, {
|
|
19483
19703
|
symbol: resolvedOriginAsset.symbol
|
|
19484
|
-
});
|
|
19704
|
+
}, null, ctx);
|
|
19485
19705
|
if (match) return match;
|
|
19486
19706
|
}
|
|
19487
19707
|
// MYTH has two valid locations (native on Mythos, ERC-20 on Ethereum),
|
|
19488
19708
|
// so resolve by symbol for the Mythos -> Ethereum Snowbridge transfer.
|
|
19489
19709
|
if (isSb && origin === 'Mythos' && resolvedOriginAsset.symbol === 'MYTH') {
|
|
19490
|
-
var _match =
|
|
19710
|
+
var _match = findAssetInfoImpl(destination, {
|
|
19491
19711
|
symbol: 'MYTH'
|
|
19492
|
-
});
|
|
19712
|
+
}, null, ctx);
|
|
19493
19713
|
if (_match) return _match;
|
|
19494
19714
|
}
|
|
19495
|
-
return
|
|
19715
|
+
return findAssetInfoImpl(destination, {
|
|
19496
19716
|
location: resolvedOriginAsset.location
|
|
19497
|
-
});
|
|
19717
|
+
}, null, ctx);
|
|
19498
19718
|
};
|
|
19499
|
-
var
|
|
19500
|
-
var
|
|
19719
|
+
var findAssetInfoOnDestImpl = function findAssetInfoOnDestImpl(origin, destination, currency, originAsset, ctx) {
|
|
19720
|
+
var resolvedOriginAsset = originAsset !== null && originAsset !== void 0 ? originAsset : findAssetInfoOrThrowImpl(origin, currency, destination, ctx);
|
|
19721
|
+
var result = resolveAssetOnDest(origin, destination, resolvedOriginAsset, ctx);
|
|
19722
|
+
if (result) return result;
|
|
19723
|
+
if (!isCustomChain(origin) && isCustomAsset(origin, resolvedOriginAsset, ctx)) {
|
|
19724
|
+
return resolvedOriginAsset;
|
|
19725
|
+
}
|
|
19726
|
+
return null;
|
|
19727
|
+
};
|
|
19728
|
+
var findAssetInfoOnDest = function findAssetInfoOnDest(origin, destination, currency, originAsset) {
|
|
19729
|
+
return findAssetInfoOnDestImpl(origin, destination, currency, originAsset);
|
|
19730
|
+
};
|
|
19731
|
+
var findAssetOnDestOrThrowImpl = function findAssetOnDestOrThrowImpl(origin, destination, currency, ctx) {
|
|
19732
|
+
var asset = findAssetInfoOnDestImpl(origin, destination, currency, null, ctx);
|
|
19501
19733
|
if (!asset) {
|
|
19502
19734
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(currency, replaceBigInt), " not found on ").concat(destination));
|
|
19503
19735
|
}
|
|
19504
19736
|
return asset;
|
|
19505
19737
|
};
|
|
19738
|
+
var findAssetOnDestOrThrow = function findAssetOnDestOrThrow(origin, destination, currency) {
|
|
19739
|
+
return findAssetOnDestOrThrowImpl(origin, destination, currency);
|
|
19740
|
+
};
|
|
19506
19741
|
|
|
19507
|
-
var createSelection = function createSelection(chain) {
|
|
19508
|
-
var nativeSymbol =
|
|
19742
|
+
var createSelection = function createSelection(chain, ctx) {
|
|
19743
|
+
var nativeSymbol = getNativeAssetSymbolImpl(chain, ctx);
|
|
19509
19744
|
return {
|
|
19510
19745
|
symbol: isExternalChain(chain) ? nativeSymbol : Native(nativeSymbol)
|
|
19511
19746
|
};
|
|
19512
19747
|
};
|
|
19748
|
+
var findNativeAssetInfoImpl = function findNativeAssetInfoImpl(chain, ctx) {
|
|
19749
|
+
return findAssetInfoImpl(chain, createSelection(chain, ctx), null, ctx);
|
|
19750
|
+
};
|
|
19513
19751
|
var findNativeAssetInfo = function findNativeAssetInfo(chain) {
|
|
19514
|
-
return
|
|
19752
|
+
return findNativeAssetInfoImpl(chain);
|
|
19753
|
+
};
|
|
19754
|
+
var findNativeAssetInfoOrThrowImpl = function findNativeAssetInfoOrThrowImpl(chain, ctx) {
|
|
19755
|
+
return findAssetInfoOrThrowImpl(chain, createSelection(chain, ctx), null, ctx);
|
|
19515
19756
|
};
|
|
19516
19757
|
var findNativeAssetInfoOrThrow = function findNativeAssetInfoOrThrow(chain) {
|
|
19517
|
-
return
|
|
19758
|
+
return findNativeAssetInfoOrThrowImpl(chain);
|
|
19518
19759
|
};
|
|
19519
19760
|
|
|
19520
19761
|
var extractEdFromAsset = function extractEdFromAsset(asset) {
|
|
19521
19762
|
return asset.existentialDeposit ? BigInt(asset.existentialDeposit) : null;
|
|
19522
19763
|
};
|
|
19523
|
-
|
|
19524
|
-
* Retrieves the existential deposit value for a given chain.
|
|
19525
|
-
*
|
|
19526
|
-
* @param chain - The chain for which to get the existential deposit.
|
|
19527
|
-
* @returns The existential deposit as a bigint if available; otherwise, null.
|
|
19528
|
-
*/
|
|
19529
|
-
var getExistentialDeposit = function getExistentialDeposit(chain, currency) {
|
|
19764
|
+
var getExistentialDepositImpl = function getExistentialDepositImpl(chain, currency, ctx) {
|
|
19530
19765
|
var asset;
|
|
19531
19766
|
if (!currency) {
|
|
19532
|
-
var
|
|
19533
|
-
var nativeAssetSymbol =
|
|
19534
|
-
asset = (
|
|
19767
|
+
var _findAssetInfoImpl;
|
|
19768
|
+
var nativeAssetSymbol = getNativeAssetSymbolImpl(chain, ctx);
|
|
19769
|
+
asset = (_findAssetInfoImpl = findAssetInfoImpl(chain, {
|
|
19535
19770
|
symbol: Native(nativeAssetSymbol)
|
|
19536
|
-
})) !== null &&
|
|
19771
|
+
}, undefined, ctx)) !== null && _findAssetInfoImpl !== void 0 ? _findAssetInfoImpl : findAssetInfoOrThrowImpl(chain, {
|
|
19537
19772
|
symbol: nativeAssetSymbol
|
|
19538
|
-
});
|
|
19773
|
+
}, undefined, ctx);
|
|
19539
19774
|
} else {
|
|
19540
|
-
asset =
|
|
19775
|
+
asset = findAssetInfoOrThrowImpl(chain, currency, undefined, ctx);
|
|
19541
19776
|
}
|
|
19542
19777
|
return extractEdFromAsset(asset);
|
|
19543
19778
|
};
|
|
19779
|
+
/**
|
|
19780
|
+
* Retrieves the existential deposit value for a given chain.
|
|
19781
|
+
*
|
|
19782
|
+
* @param chain - The chain for which to get the existential deposit.
|
|
19783
|
+
* @returns The existential deposit as a bigint if available; otherwise, null.
|
|
19784
|
+
*/
|
|
19785
|
+
var getExistentialDeposit = function getExistentialDeposit(chain, currency) {
|
|
19786
|
+
return getExistentialDepositImpl(chain, currency);
|
|
19787
|
+
};
|
|
19544
19788
|
var assertEdDefined = function assertEdDefined(ed, chain, currency) {
|
|
19545
19789
|
if (ed === undefined || ed === null) {
|
|
19546
19790
|
throw new InvalidCurrencyError("Existential deposit not found for currency ".concat(JSON.stringify(currency, replaceBigInt)).concat(chain ? " on chain ".concat(chain, ".") : '.'));
|
|
19547
19791
|
}
|
|
19548
19792
|
};
|
|
19549
|
-
var
|
|
19550
|
-
var ed =
|
|
19793
|
+
var getExistentialDepositOrThrowImpl = function getExistentialDepositOrThrowImpl(chain, currency, ctx) {
|
|
19794
|
+
var ed = getExistentialDepositImpl(chain, currency, ctx);
|
|
19551
19795
|
assertEdDefined(ed, chain, currency);
|
|
19552
19796
|
return ed;
|
|
19553
19797
|
};
|
|
19798
|
+
var getExistentialDepositOrThrow = function getExistentialDepositOrThrow(chain, currency) {
|
|
19799
|
+
return getExistentialDepositOrThrowImpl(chain, currency);
|
|
19800
|
+
};
|
|
19554
19801
|
var getEdFromAssetOrThrow = function getEdFromAssetOrThrow(asset) {
|
|
19555
19802
|
var ed = extractEdFromAsset(asset);
|
|
19556
19803
|
assertEdDefined(ed, undefined, asset);
|
|
@@ -19582,8 +19829,24 @@ var getFeeAssets = function getFeeAssets(chain) {
|
|
|
19582
19829
|
return feeAssets;
|
|
19583
19830
|
};
|
|
19584
19831
|
|
|
19585
|
-
// Contains different useful asset query operations from compatible Parachains asset map
|
|
19586
19832
|
var assetsMap = assetsMapJson;
|
|
19833
|
+
var getAssetsObjectImpl = function getAssetsObjectImpl(chain, ctx) {
|
|
19834
|
+
var _ctx$customAssets;
|
|
19835
|
+
if (isCustomChain(chain)) {
|
|
19836
|
+
var _ctx$customChainAsset;
|
|
19837
|
+
var entry = ctx === null || ctx === void 0 || (_ctx$customChainAsset = ctx.customChainAssets) === null || _ctx$customChainAsset === void 0 ? void 0 : _ctx$customChainAsset[chain];
|
|
19838
|
+
if (!entry) {
|
|
19839
|
+
throw new InvalidCurrencyError("Custom chain '".concat(chain, "' is not registered."));
|
|
19840
|
+
}
|
|
19841
|
+
return entry;
|
|
19842
|
+
}
|
|
19843
|
+
var base = assetsMap[chain];
|
|
19844
|
+
var overlay = ctx === null || ctx === void 0 || (_ctx$customAssets = ctx.customAssets) === null || _ctx$customAssets === void 0 ? void 0 : _ctx$customAssets[chain];
|
|
19845
|
+
if (!overlay || overlay.length === 0) return base;
|
|
19846
|
+
return _objectSpread2(_objectSpread2({}, base), {}, {
|
|
19847
|
+
assets: mergeCustomAssets(base.assets, overlay)
|
|
19848
|
+
});
|
|
19849
|
+
};
|
|
19587
19850
|
/**
|
|
19588
19851
|
* Retrieves the assets object for a given chain containing the native and foreign assets.
|
|
19589
19852
|
*
|
|
@@ -19591,10 +19854,13 @@ var assetsMap = assetsMapJson;
|
|
|
19591
19854
|
* @returns The assets object associated with the given chain.
|
|
19592
19855
|
*/
|
|
19593
19856
|
var getAssetsObject = function getAssetsObject(chain) {
|
|
19594
|
-
return
|
|
19857
|
+
return getAssetsObjectImpl(chain);
|
|
19858
|
+
};
|
|
19859
|
+
var isChainEvmImpl = function isChainEvmImpl(chain, ctx) {
|
|
19860
|
+
return getAssetsObjectImpl(chain, ctx).isEVM;
|
|
19595
19861
|
};
|
|
19596
19862
|
var isChainEvm = function isChainEvm(chain) {
|
|
19597
|
-
return
|
|
19863
|
+
return isChainEvmImpl(chain);
|
|
19598
19864
|
};
|
|
19599
19865
|
/**
|
|
19600
19866
|
* Retrieves the asset ID for a given symbol on a specified chain.
|
|
@@ -19611,6 +19877,9 @@ var getAssetId = function getAssetId(chain, symbol) {
|
|
|
19611
19877
|
});
|
|
19612
19878
|
return asset != null && asset.assetId ? asset.assetId : null;
|
|
19613
19879
|
};
|
|
19880
|
+
var getRelayChainSymbolImpl = function getRelayChainSymbolImpl(chain, ctx) {
|
|
19881
|
+
return getAssetsObjectImpl(chain, ctx).relaychainSymbol;
|
|
19882
|
+
};
|
|
19614
19883
|
/**
|
|
19615
19884
|
* Retrieves the relay chain asset symbol for a specified chain.
|
|
19616
19885
|
*
|
|
@@ -19618,7 +19887,12 @@ var getAssetId = function getAssetId(chain, symbol) {
|
|
|
19618
19887
|
* @returns The relay chain asset symbol.
|
|
19619
19888
|
*/
|
|
19620
19889
|
var getRelayChainSymbol = function getRelayChainSymbol(chain) {
|
|
19621
|
-
return
|
|
19890
|
+
return getRelayChainSymbolImpl(chain);
|
|
19891
|
+
};
|
|
19892
|
+
var getNativeAssetsImpl = function getNativeAssetsImpl(chain, ctx) {
|
|
19893
|
+
return getAssetsObjectImpl(chain, ctx).assets.filter(function (asset) {
|
|
19894
|
+
return asset.isNative;
|
|
19895
|
+
});
|
|
19622
19896
|
};
|
|
19623
19897
|
/**
|
|
19624
19898
|
* Retrieves the list of native assets for a specified chain.
|
|
@@ -19627,8 +19901,11 @@ var getRelayChainSymbol = function getRelayChainSymbol(chain) {
|
|
|
19627
19901
|
* @returns An array of native asset details.
|
|
19628
19902
|
*/
|
|
19629
19903
|
var getNativeAssets = function getNativeAssets(chain) {
|
|
19630
|
-
return
|
|
19631
|
-
|
|
19904
|
+
return getNativeAssetsImpl(chain);
|
|
19905
|
+
};
|
|
19906
|
+
var getOtherAssetsImpl = function getOtherAssetsImpl(chain, ctx) {
|
|
19907
|
+
return getAssetsObjectImpl(chain, ctx).assets.filter(function (asset) {
|
|
19908
|
+
return !asset.isNative;
|
|
19632
19909
|
});
|
|
19633
19910
|
};
|
|
19634
19911
|
/**
|
|
@@ -19638,9 +19915,10 @@ var getNativeAssets = function getNativeAssets(chain) {
|
|
|
19638
19915
|
* @returns An array of other asset details.
|
|
19639
19916
|
*/
|
|
19640
19917
|
var getOtherAssets = function getOtherAssets(chain) {
|
|
19641
|
-
return
|
|
19642
|
-
|
|
19643
|
-
|
|
19918
|
+
return getOtherAssetsImpl(chain);
|
|
19919
|
+
};
|
|
19920
|
+
var getAssetsImpl = function getAssetsImpl(chain, ctx) {
|
|
19921
|
+
return getAssetsObjectImpl(chain, ctx).assets;
|
|
19644
19922
|
};
|
|
19645
19923
|
/**
|
|
19646
19924
|
* Retrieves the complete list of assets for a specified chain, including relay chain asset, native, and other assets.
|
|
@@ -19649,9 +19927,7 @@ var getOtherAssets = function getOtherAssets(chain) {
|
|
|
19649
19927
|
* @returns An array of objects of all assets associated with the chain.
|
|
19650
19928
|
*/
|
|
19651
19929
|
var getAssets = function getAssets(chain) {
|
|
19652
|
-
|
|
19653
|
-
assets = _getAssetsObject.assets;
|
|
19654
|
-
return assets;
|
|
19930
|
+
return getAssetsImpl(chain);
|
|
19655
19931
|
};
|
|
19656
19932
|
/**
|
|
19657
19933
|
* Retrieves the symbols of all assets (relay chain, native, and other assets) for a specified chain.
|
|
@@ -19660,13 +19936,16 @@ var getAssets = function getAssets(chain) {
|
|
|
19660
19936
|
* @returns An array of asset symbols.
|
|
19661
19937
|
*/
|
|
19662
19938
|
var getAllAssetsSymbols = function getAllAssetsSymbols(chain) {
|
|
19663
|
-
var
|
|
19664
|
-
assets =
|
|
19939
|
+
var _getAssetsObject = getAssetsObject(chain),
|
|
19940
|
+
assets = _getAssetsObject.assets;
|
|
19665
19941
|
return assets.map(function (_ref) {
|
|
19666
19942
|
var symbol = _ref.symbol;
|
|
19667
19943
|
return symbol;
|
|
19668
19944
|
});
|
|
19669
19945
|
};
|
|
19946
|
+
var getNativeAssetSymbolImpl = function getNativeAssetSymbolImpl(chain, ctx) {
|
|
19947
|
+
return getAssetsObjectImpl(chain, ctx).nativeAssetSymbol;
|
|
19948
|
+
};
|
|
19670
19949
|
/**
|
|
19671
19950
|
* Retrieves the symbol of the native asset for a specified chain.
|
|
19672
19951
|
*
|
|
@@ -19674,7 +19953,7 @@ var getAllAssetsSymbols = function getAllAssetsSymbols(chain) {
|
|
|
19674
19953
|
* @returns The symbol of the native asset.
|
|
19675
19954
|
*/
|
|
19676
19955
|
var getNativeAssetSymbol = function getNativeAssetSymbol(chain) {
|
|
19677
|
-
return
|
|
19956
|
+
return getNativeAssetSymbolImpl(chain);
|
|
19678
19957
|
};
|
|
19679
19958
|
/**
|
|
19680
19959
|
* Determines whether a specified chain supports an asset with the given symbol.
|
|
@@ -19716,24 +19995,34 @@ var hasSupportForAsset = function hasSupportForAsset(chain, symbol) {
|
|
|
19716
19995
|
* @returns The number of decimals if the asset is found; otherwise, null.
|
|
19717
19996
|
*/
|
|
19718
19997
|
var getAssetDecimals = function getAssetDecimals(chain, symbol) {
|
|
19719
|
-
var
|
|
19720
|
-
assets =
|
|
19998
|
+
var _getAssetsObject2 = getAssetsObject(chain),
|
|
19999
|
+
assets = _getAssetsObject2.assets;
|
|
19721
20000
|
var isMainNativeAsset = isSymbolMatch(symbol, getNativeAssetSymbol(chain));
|
|
19722
|
-
if (isMainNativeAsset) return
|
|
20001
|
+
if (isMainNativeAsset) return findNativeAssetInfoOrThrowImpl(chain).decimals;
|
|
19723
20002
|
var asset = assets.find(function (o) {
|
|
19724
20003
|
return o.symbol === symbol;
|
|
19725
20004
|
});
|
|
19726
20005
|
return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
|
|
19727
20006
|
};
|
|
19728
|
-
var
|
|
20007
|
+
var hasDryRunSupportImpl = function hasDryRunSupportImpl(chain, ctx) {
|
|
19729
20008
|
// These chains have DryRun but it's not working
|
|
19730
20009
|
var DISABLED_CHAINS = ['Basilisk', 'Jamton'];
|
|
19731
|
-
return
|
|
20010
|
+
return getAssetsObjectImpl(chain, ctx).supportsDryRunApi && !DISABLED_CHAINS.some(function (disabled) {
|
|
20011
|
+
return disabled === chain;
|
|
20012
|
+
});
|
|
19732
20013
|
};
|
|
19733
|
-
var
|
|
20014
|
+
var hasDryRunSupport = function hasDryRunSupport(chain) {
|
|
20015
|
+
return hasDryRunSupportImpl(chain);
|
|
20016
|
+
};
|
|
20017
|
+
var hasXcmPaymentApiSupportImpl = function hasXcmPaymentApiSupportImpl(chain, ctx) {
|
|
19734
20018
|
// These chains have XcmPaymentApi but it's not working
|
|
19735
20019
|
var DISABLED_CHAINS = ['Basilisk', 'Jamton'];
|
|
19736
|
-
return
|
|
20020
|
+
return getAssetsObjectImpl(chain, ctx).supportsXcmPaymentApi && !DISABLED_CHAINS.some(function (disabled) {
|
|
20021
|
+
return disabled === chain;
|
|
20022
|
+
});
|
|
20023
|
+
};
|
|
20024
|
+
var hasXcmPaymentApiSupport = function hasXcmPaymentApiSupport(chain) {
|
|
20025
|
+
return hasXcmPaymentApiSupportImpl(chain);
|
|
19737
20026
|
};
|
|
19738
20027
|
|
|
19739
20028
|
var isAssetEqual = function isAssetEqual(asset1, asset2) {
|
|
@@ -19746,16 +20035,9 @@ var isAssetXcEqual = function isAssetXcEqual(asset1, asset2) {
|
|
|
19746
20035
|
return isAssetEqual(asset1, asset2);
|
|
19747
20036
|
};
|
|
19748
20037
|
|
|
19749
|
-
|
|
19750
|
-
|
|
19751
|
-
|
|
19752
|
-
* @param origin - The origin chain.
|
|
19753
|
-
* @param destination - The destination chain.
|
|
19754
|
-
* @returns An array of assets supported between the origin and destination chains.
|
|
19755
|
-
*/
|
|
19756
|
-
var getSupportedAssets = function getSupportedAssets(origin, destination) {
|
|
19757
|
-
var originAssets = getAssets(origin);
|
|
19758
|
-
var destinationAssets = getAssets(destination);
|
|
20038
|
+
var getSupportedAssetsImpl = function getSupportedAssetsImpl(origin, destination, ctx) {
|
|
20039
|
+
var originAssets = getAssetsImpl(origin, ctx);
|
|
20040
|
+
var destinationAssets = getAssetsImpl(destination, ctx);
|
|
19759
20041
|
var supportedAssets = originAssets.filter(function (asset) {
|
|
19760
20042
|
return destinationAssets.some(function (a) {
|
|
19761
20043
|
return isAssetXcEqual(a, asset);
|
|
@@ -19768,7 +20050,9 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
|
|
|
19768
20050
|
return isSystemAsset(asset);
|
|
19769
20051
|
});
|
|
19770
20052
|
if (isSubBridge) {
|
|
19771
|
-
var nativeSymbols = [origin, destination].map(
|
|
20053
|
+
var nativeSymbols = [origin, destination].map(function (chain) {
|
|
20054
|
+
return getNativeAssetSymbolImpl(chain, ctx);
|
|
20055
|
+
});
|
|
19772
20056
|
var filteredSystemAssets = systemAssets.filter(function (_ref) {
|
|
19773
20057
|
var symbol = _ref.symbol;
|
|
19774
20058
|
return nativeSymbols.includes(symbol);
|
|
@@ -19786,11 +20070,47 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
|
|
|
19786
20070
|
}
|
|
19787
20071
|
return supportedAssets;
|
|
19788
20072
|
};
|
|
20073
|
+
/**
|
|
20074
|
+
* Retrieves the list of assets that are supported for transfers between two specified chains.
|
|
20075
|
+
*
|
|
20076
|
+
* @param origin - The origin chain.
|
|
20077
|
+
* @param destination - The destination chain.
|
|
20078
|
+
* @returns An array of assets supported between the origin and destination chains.
|
|
20079
|
+
*/
|
|
20080
|
+
var getSupportedAssets = function getSupportedAssets(origin, destination) {
|
|
20081
|
+
return getSupportedAssetsImpl(origin, destination);
|
|
20082
|
+
};
|
|
19789
20083
|
|
|
20084
|
+
var isDestinationReachable = function isDestinationReachable(origin, destination) {
|
|
20085
|
+
if (isExternalChain(origin) || isExternalChain(destination)) {
|
|
20086
|
+
var substrateSide = isExternalChain(origin) ? destination : origin;
|
|
20087
|
+
if (isExternalChain(substrateSide)) return false;
|
|
20088
|
+
return ETHEREUM_BRIDGE_ORIGINS.includes(substrateSide);
|
|
20089
|
+
}
|
|
20090
|
+
if (isSubstrateBridge(origin, destination)) return true;
|
|
20091
|
+
return getRelayChainSymbol(origin) === getRelayChainSymbol(destination);
|
|
20092
|
+
};
|
|
20093
|
+
var isUnsupportedAssetHubNative = function isUnsupportedAssetHubNative(origin, destination, originAsset, nativeAssets) {
|
|
20094
|
+
if (isExternalChain(origin) || isExternalChain(destination)) return false;
|
|
20095
|
+
var originIsAssetHub = origin.startsWith('AssetHub');
|
|
20096
|
+
var destinationIsAssetHub = destination.startsWith('AssetHub');
|
|
20097
|
+
if (originIsAssetHub === destinationIsAssetHub) return false;
|
|
20098
|
+
if (isSystemAsset(originAsset)) return false;
|
|
20099
|
+
return nativeAssets.some(function (_native) {
|
|
20100
|
+
return isAssetEqual(originAsset, _native);
|
|
20101
|
+
});
|
|
20102
|
+
};
|
|
19790
20103
|
var getSupportedDestinations = function getSupportedDestinations(origin, currency) {
|
|
19791
20104
|
findAssetInfoOrThrow(origin, currency);
|
|
20105
|
+
var ecosystem = getRelayChainSymbol(origin);
|
|
20106
|
+
var nativeAssets = SUBSTRATE_CHAINS.filter(function (chain) {
|
|
20107
|
+
return getRelayChainSymbol(chain) === ecosystem;
|
|
20108
|
+
}).map(function (chain) {
|
|
20109
|
+
return findNativeAssetInfoOrThrow(chain);
|
|
20110
|
+
});
|
|
19792
20111
|
return CHAINS.filter(function (destination) {
|
|
19793
20112
|
if (destination === origin) return false;
|
|
20113
|
+
if (!isDestinationReachable(origin, destination)) return false;
|
|
19794
20114
|
// Check if we still can find asset if we specify destination
|
|
19795
20115
|
var originAsset;
|
|
19796
20116
|
try {
|
|
@@ -19801,6 +20121,10 @@ var getSupportedDestinations = function getSupportedDestinations(origin, currenc
|
|
|
19801
20121
|
}
|
|
19802
20122
|
throw error;
|
|
19803
20123
|
}
|
|
20124
|
+
if (isUnsupportedAssetHubNative(origin, destination, originAsset, nativeAssets)) return false;
|
|
20125
|
+
if (isSubstrateBridge(origin, destination)) {
|
|
20126
|
+
return isSystemAsset(originAsset) || isStableCoinAsset(originAsset);
|
|
20127
|
+
}
|
|
19804
20128
|
try {
|
|
19805
20129
|
return !!findAssetInfoOnDest(origin, destination, currency, originAsset);
|
|
19806
20130
|
} catch (error) {
|
|
@@ -19812,4 +20136,4 @@ var getSupportedDestinations = function getSupportedDestinations(origin, currenc
|
|
|
19812
20136
|
});
|
|
19813
20137
|
};
|
|
19814
20138
|
|
|
19815
|
-
export { DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, Override, assertEdDefined, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoOnDest, findAssetInfoOrThrow, findAssetOnDestOrThrow, findBestMatches, findNativeAssetInfo, findNativeAssetInfoOrThrow, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetLocation, getAssets, getAssetsObject, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, getFeeAssets, getNativeAssetSymbol, getNativeAssets, getOtherAssets, getRelayChainSymbol, getSupportedAssets, getSupportedDestinations, hasDryRunSupport, hasSupportForAsset, hasXcmPaymentApiSupport, isAssetEqual, isAssetXcEqual, isBridgedSystemAsset, isChainEvm, isOverrideLocationSpecifier, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeLocation, normalizeSymbol };
|
|
20139
|
+
export { CustomAssetConflictError, DuplicateAssetError, DuplicateAssetIdError, Foreign, ForeignAbstract, InvalidCurrencyError, Native, Override, assertEdDefined, canonicalizeLocation, compareLocations, extractAssetLocation, findAssetInfo, findAssetInfoById, findAssetInfoByLoc, findAssetInfoBySymbol, findAssetInfoImpl, findAssetInfoOnDest, findAssetInfoOnDestImpl, findAssetInfoOrThrow, findAssetInfoOrThrowImpl, findAssetOnDestOrThrow, findAssetOnDestOrThrowImpl, findBestMatches, findNativeAssetInfo, findNativeAssetInfoImpl, findNativeAssetInfoOrThrow, findNativeAssetInfoOrThrowImpl, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetLocation, getAssets, getAssetsImpl, getAssetsObject, getAssetsObjectImpl, getEdFromAssetOrThrow, getExistentialDeposit, getExistentialDepositImpl, getExistentialDepositOrThrow, getExistentialDepositOrThrowImpl, getFeeAssets, getNativeAssetSymbol, getNativeAssetSymbolImpl, getNativeAssets, getNativeAssetsImpl, getOtherAssets, getOtherAssetsImpl, getRelayChainSymbol, getRelayChainSymbolImpl, getSupportedAssets, getSupportedAssetsImpl, getSupportedDestinations, hasDryRunSupport, hasDryRunSupportImpl, hasSupportForAsset, hasXcmPaymentApiSupport, hasXcmPaymentApiSupportImpl, isAssetEqual, isAssetXcEqual, isBridgedSystemAsset, isChainEvm, isChainEvmImpl, isCustomAsset, isOverrideLocationSpecifier, isStableCoinAsset, isSymbolMatch, isSymbolSpecifier, isSystemAsset, isTAsset, normalizeCustomAssets, normalizeLocation, normalizeSymbol };
|