@paraspell/sdk 0.0.24 → 0.0.26
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.cjs +1055 -878
- package/dist/index.d.ts +5 -2
- package/dist/index.mjs +1044 -878
- package/package.json +19 -10
package/dist/index.cjs
CHANGED
|
@@ -1,81 +1,210 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('@polkadot/api');
|
|
4
|
-
|
|
4
|
+
var ethers = require('ethers');
|
|
5
5
|
require('@polkadot/apps-config/endpoints');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
7
|
+
function _classCallCheck(instance, Constructor) {
|
|
8
|
+
if (!(instance instanceof Constructor)) {
|
|
9
|
+
throw new TypeError("Cannot call a class as a function");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function _defineProperties(target, props) {
|
|
13
|
+
for (var i = 0; i < props.length; i++) {
|
|
14
|
+
var descriptor = props[i];
|
|
15
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
16
|
+
descriptor.configurable = true;
|
|
17
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
18
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
22
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
23
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
24
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
25
|
+
writable: false
|
|
26
|
+
});
|
|
27
|
+
return Constructor;
|
|
28
|
+
}
|
|
29
|
+
function _inherits(subClass, superClass) {
|
|
30
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
31
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
32
|
+
}
|
|
33
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
34
|
+
constructor: {
|
|
35
|
+
value: subClass,
|
|
36
|
+
writable: true,
|
|
37
|
+
configurable: true
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(subClass, "prototype", {
|
|
41
|
+
writable: false
|
|
42
|
+
});
|
|
43
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
44
|
+
}
|
|
45
|
+
function _getPrototypeOf(o) {
|
|
46
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
47
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
48
|
+
};
|
|
49
|
+
return _getPrototypeOf(o);
|
|
50
|
+
}
|
|
51
|
+
function _setPrototypeOf(o, p) {
|
|
52
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
53
|
+
o.__proto__ = p;
|
|
54
|
+
return o;
|
|
55
|
+
};
|
|
56
|
+
return _setPrototypeOf(o, p);
|
|
57
|
+
}
|
|
58
|
+
function _isNativeReflectConstruct() {
|
|
59
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
60
|
+
if (Reflect.construct.sham) return false;
|
|
61
|
+
if (typeof Proxy === "function") return true;
|
|
62
|
+
try {
|
|
63
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
64
|
+
return true;
|
|
65
|
+
} catch (e) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function _construct(Parent, args, Class) {
|
|
70
|
+
if (_isNativeReflectConstruct()) {
|
|
71
|
+
_construct = Reflect.construct.bind();
|
|
72
|
+
} else {
|
|
73
|
+
_construct = function _construct(Parent, args, Class) {
|
|
74
|
+
var a = [null];
|
|
75
|
+
a.push.apply(a, args);
|
|
76
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
77
|
+
var instance = new Constructor();
|
|
78
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
79
|
+
return instance;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return _construct.apply(null, arguments);
|
|
83
|
+
}
|
|
84
|
+
function _isNativeFunction(fn) {
|
|
85
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
86
|
+
}
|
|
87
|
+
function _wrapNativeSuper(Class) {
|
|
88
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
89
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
90
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
91
|
+
if (typeof Class !== "function") {
|
|
92
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
93
|
+
}
|
|
94
|
+
if (typeof _cache !== "undefined") {
|
|
95
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
96
|
+
_cache.set(Class, Wrapper);
|
|
97
|
+
}
|
|
98
|
+
function Wrapper() {
|
|
99
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
100
|
+
}
|
|
101
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
102
|
+
constructor: {
|
|
103
|
+
value: Wrapper,
|
|
104
|
+
enumerable: false,
|
|
105
|
+
writable: true,
|
|
106
|
+
configurable: true
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
110
|
+
};
|
|
111
|
+
return _wrapNativeSuper(Class);
|
|
112
|
+
}
|
|
113
|
+
function _assertThisInitialized(self) {
|
|
114
|
+
if (self === void 0) {
|
|
115
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
116
|
+
}
|
|
117
|
+
return self;
|
|
118
|
+
}
|
|
119
|
+
function _possibleConstructorReturn(self, call) {
|
|
120
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
121
|
+
return call;
|
|
122
|
+
} else if (call !== void 0) {
|
|
123
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
124
|
+
}
|
|
125
|
+
return _assertThisInitialized(self);
|
|
126
|
+
}
|
|
127
|
+
function _createSuper(Derived) {
|
|
128
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
129
|
+
return function _createSuperInternal() {
|
|
130
|
+
var Super = _getPrototypeOf(Derived),
|
|
131
|
+
result;
|
|
132
|
+
if (hasNativeReflectConstruct) {
|
|
133
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
134
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
135
|
+
} else {
|
|
136
|
+
result = Super.apply(this, arguments);
|
|
137
|
+
}
|
|
138
|
+
return _possibleConstructorReturn(this, result);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function _toConsumableArray(arr) {
|
|
142
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
143
|
+
}
|
|
144
|
+
function _arrayWithoutHoles(arr) {
|
|
145
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
146
|
+
}
|
|
147
|
+
function _iterableToArray(iter) {
|
|
148
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
149
|
+
}
|
|
150
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
151
|
+
if (!o) return;
|
|
152
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
153
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
154
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
155
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
156
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
157
|
+
}
|
|
158
|
+
function _arrayLikeToArray(arr, len) {
|
|
159
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
160
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
161
|
+
return arr2;
|
|
162
|
+
}
|
|
163
|
+
function _nonIterableSpread() {
|
|
164
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
165
|
+
}
|
|
166
|
+
function _toPrimitive(input, hint) {
|
|
167
|
+
if (typeof input !== "object" || input === null) return input;
|
|
168
|
+
var prim = input[Symbol.toPrimitive];
|
|
169
|
+
if (prim !== undefined) {
|
|
170
|
+
var res = prim.call(input, hint || "default");
|
|
171
|
+
if (typeof res !== "object") return res;
|
|
172
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
173
|
+
}
|
|
174
|
+
return (hint === "string" ? String : Number)(input);
|
|
175
|
+
}
|
|
176
|
+
function _toPropertyKey(arg) {
|
|
177
|
+
var key = _toPrimitive(arg, "string");
|
|
178
|
+
return typeof key === "symbol" ? key : String(key);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
var NODE_NAMES = ['Statemint', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'Clover', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Kylin', 'Litentry', 'Moonbeam', 'Parallel', 'Statemine', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Dorafactory', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kico', 'Kintsugi', 'Listen', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Pichiu', 'Quartz', 'Robonomics', 'Shiden', 'Turing'];
|
|
182
|
+
var SUPPORTED_PALLETS = ['XTokens', 'OrmlXTokens', 'PolkadotXcm', 'RelayerXcm'];
|
|
54
183
|
|
|
55
184
|
function createAccID(api, account) {
|
|
56
|
-
console.log(
|
|
57
|
-
return api.createType(
|
|
185
|
+
console.log('Generating AccountId32 address');
|
|
186
|
+
return api.createType('AccountId32', account).toHex();
|
|
58
187
|
}
|
|
59
188
|
function getFees(scenario) {
|
|
60
|
-
if (scenario ===
|
|
61
|
-
console.log(
|
|
62
|
-
return
|
|
63
|
-
} else if (scenario ===
|
|
64
|
-
console.log(
|
|
65
|
-
return
|
|
189
|
+
if (scenario === 'ParaToRelay') {
|
|
190
|
+
console.log('Asigning fees for transfer to Relay chain');
|
|
191
|
+
return 4600000000;
|
|
192
|
+
} else if (scenario === 'ParaToPara') {
|
|
193
|
+
console.log('Asigning fees for transfer to another Parachain chain');
|
|
194
|
+
return 399600000000;
|
|
66
195
|
}
|
|
67
|
-
throw new Error(
|
|
196
|
+
throw new Error("Fees for scenario ".concat(scenario, " are not defined."));
|
|
68
197
|
}
|
|
69
198
|
function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
70
|
-
if (scenario ===
|
|
71
|
-
console.log(
|
|
199
|
+
if (scenario === 'ParaToRelay' && pallet === 'xTokens') {
|
|
200
|
+
console.log('AccountId32 transfer');
|
|
72
201
|
return {
|
|
73
202
|
V1: {
|
|
74
203
|
parents: 1,
|
|
75
204
|
interior: {
|
|
76
205
|
X1: {
|
|
77
206
|
AccountId32: {
|
|
78
|
-
network:
|
|
207
|
+
network: 'any',
|
|
79
208
|
id: createAccID(api, to)
|
|
80
209
|
}
|
|
81
210
|
}
|
|
@@ -83,58 +212,52 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
83
212
|
}
|
|
84
213
|
};
|
|
85
214
|
}
|
|
86
|
-
if (scenario ===
|
|
215
|
+
if (scenario === 'ParaToPara' && pallet === 'xTokens') {
|
|
87
216
|
if (ethers.ethers.utils.isAddress(to)) {
|
|
88
|
-
console.log(
|
|
217
|
+
console.log('AccountKey20 transfer');
|
|
89
218
|
return {
|
|
90
219
|
V1: {
|
|
91
220
|
parents: 1,
|
|
92
221
|
interior: {
|
|
93
|
-
X2: [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
network: "Any",
|
|
100
|
-
key: to
|
|
101
|
-
}
|
|
222
|
+
X2: [{
|
|
223
|
+
Parachain: nodeId
|
|
224
|
+
}, {
|
|
225
|
+
AccountKey20: {
|
|
226
|
+
network: 'Any',
|
|
227
|
+
key: to
|
|
102
228
|
}
|
|
103
|
-
]
|
|
229
|
+
}]
|
|
104
230
|
}
|
|
105
231
|
}
|
|
106
232
|
};
|
|
107
233
|
} else {
|
|
108
|
-
console.log(
|
|
234
|
+
console.log('AccountId32 transfer');
|
|
109
235
|
return {
|
|
110
236
|
V1: {
|
|
111
237
|
parents: 1,
|
|
112
238
|
interior: {
|
|
113
|
-
X2: [
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
network: "Any",
|
|
120
|
-
id: createAccID(api, to)
|
|
121
|
-
}
|
|
239
|
+
X2: [{
|
|
240
|
+
Parachain: nodeId
|
|
241
|
+
}, {
|
|
242
|
+
AccountId32: {
|
|
243
|
+
network: 'Any',
|
|
244
|
+
id: createAccID(api, to)
|
|
122
245
|
}
|
|
123
|
-
]
|
|
246
|
+
}]
|
|
124
247
|
}
|
|
125
248
|
}
|
|
126
249
|
};
|
|
127
250
|
}
|
|
128
251
|
}
|
|
129
|
-
if (scenario ===
|
|
130
|
-
console.log(
|
|
252
|
+
if (scenario === 'ParaToRelay' && pallet === 'polkadotXCM') {
|
|
253
|
+
console.log('AccountId32 transfer');
|
|
131
254
|
return {
|
|
132
255
|
V1: {
|
|
133
256
|
parents: 0,
|
|
134
257
|
interior: {
|
|
135
258
|
X1: {
|
|
136
259
|
AccountId32: {
|
|
137
|
-
network:
|
|
260
|
+
network: 'any',
|
|
138
261
|
id: createAccID(api, to)
|
|
139
262
|
}
|
|
140
263
|
}
|
|
@@ -142,13 +265,13 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
142
265
|
}
|
|
143
266
|
};
|
|
144
267
|
}
|
|
145
|
-
if (scenario ===
|
|
146
|
-
if (node ===
|
|
268
|
+
if (scenario === 'ParaToPara' && pallet === 'polkadotXCM') {
|
|
269
|
+
if (node === 'Quartz') {
|
|
147
270
|
return {
|
|
148
271
|
V0: {
|
|
149
272
|
X1: {
|
|
150
273
|
AccountId32: {
|
|
151
|
-
network:
|
|
274
|
+
network: 'Any',
|
|
152
275
|
id: createAccID(api, to)
|
|
153
276
|
}
|
|
154
277
|
}
|
|
@@ -156,14 +279,14 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
156
279
|
};
|
|
157
280
|
}
|
|
158
281
|
if (ethers.ethers.utils.isAddress(to)) {
|
|
159
|
-
console.log(
|
|
282
|
+
console.log('AccountKey20 transfer');
|
|
160
283
|
return {
|
|
161
284
|
V1: {
|
|
162
285
|
parents: 0,
|
|
163
286
|
interior: {
|
|
164
287
|
X1: {
|
|
165
288
|
AccountKey20: {
|
|
166
|
-
network:
|
|
289
|
+
network: 'Any',
|
|
167
290
|
key: to
|
|
168
291
|
}
|
|
169
292
|
}
|
|
@@ -171,14 +294,14 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
171
294
|
}
|
|
172
295
|
};
|
|
173
296
|
} else {
|
|
174
|
-
console.log(
|
|
297
|
+
console.log('AccountId32 transfer');
|
|
175
298
|
return {
|
|
176
299
|
V1: {
|
|
177
300
|
parents: 0,
|
|
178
301
|
interior: {
|
|
179
302
|
X1: {
|
|
180
303
|
AccountId32: {
|
|
181
|
-
network:
|
|
304
|
+
network: 'Any',
|
|
182
305
|
id: createAccID(api, to)
|
|
183
306
|
}
|
|
184
307
|
}
|
|
@@ -187,16 +310,16 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
187
310
|
};
|
|
188
311
|
}
|
|
189
312
|
}
|
|
190
|
-
if (scenario ===
|
|
313
|
+
if (scenario === 'RelayToPara') {
|
|
191
314
|
if (ethers.ethers.utils.isAddress(to)) {
|
|
192
|
-
console.log(
|
|
315
|
+
console.log('AccountKey20 transfer');
|
|
193
316
|
return {
|
|
194
317
|
V1: {
|
|
195
318
|
parents: 0,
|
|
196
319
|
interior: {
|
|
197
320
|
X1: {
|
|
198
321
|
AccountKey20: {
|
|
199
|
-
network:
|
|
322
|
+
network: 'Any',
|
|
200
323
|
key: to
|
|
201
324
|
}
|
|
202
325
|
}
|
|
@@ -204,14 +327,14 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
204
327
|
}
|
|
205
328
|
};
|
|
206
329
|
} else {
|
|
207
|
-
console.log(
|
|
330
|
+
console.log('AccountId32 transfer');
|
|
208
331
|
return {
|
|
209
332
|
V1: {
|
|
210
333
|
parents: 0,
|
|
211
334
|
interior: {
|
|
212
335
|
X1: {
|
|
213
336
|
AccountId32: {
|
|
214
|
-
network:
|
|
337
|
+
network: 'Any',
|
|
215
338
|
id: createAccID(api, to)
|
|
216
339
|
}
|
|
217
340
|
}
|
|
@@ -222,121 +345,108 @@ function handleAddress(scenario, pallet, api, to, nodeId, node) {
|
|
|
222
345
|
}
|
|
223
346
|
}
|
|
224
347
|
function createCurrencySpecification(amount, scenario, node, cur) {
|
|
225
|
-
if (scenario ===
|
|
226
|
-
console.log(
|
|
348
|
+
if (scenario === 'ParaToRelay') {
|
|
349
|
+
console.log('polkadotXCM transfer in native currency to Relay chain');
|
|
227
350
|
return {
|
|
228
|
-
V1: [
|
|
229
|
-
{
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
interior: "Here"
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
fun: {
|
|
237
|
-
Fungible: amount
|
|
351
|
+
V1: [{
|
|
352
|
+
id: {
|
|
353
|
+
Concrete: {
|
|
354
|
+
parents: 1,
|
|
355
|
+
interior: 'Here'
|
|
238
356
|
}
|
|
357
|
+
},
|
|
358
|
+
fun: {
|
|
359
|
+
Fungible: amount
|
|
239
360
|
}
|
|
240
|
-
]
|
|
361
|
+
}]
|
|
241
362
|
};
|
|
242
363
|
}
|
|
243
|
-
if (scenario ===
|
|
244
|
-
console.log(
|
|
245
|
-
if (node ===
|
|
364
|
+
if (scenario === 'RelayToPara' || scenario === 'ParaToPara') {
|
|
365
|
+
console.log('polkadotXCM Native currency to sender chain transfer');
|
|
366
|
+
if (node === 'Quartz' && scenario === 'ParaToPara') {
|
|
246
367
|
return {
|
|
247
|
-
V0: [
|
|
248
|
-
{
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
amount
|
|
252
|
-
}
|
|
368
|
+
V0: [{
|
|
369
|
+
ConcreteFungible: {
|
|
370
|
+
id: null,
|
|
371
|
+
amount: amount
|
|
253
372
|
}
|
|
254
|
-
]
|
|
373
|
+
}]
|
|
255
374
|
};
|
|
256
375
|
}
|
|
257
|
-
if ((node ===
|
|
376
|
+
if ((node === 'Darwinia' || node === 'Crab') && scenario === 'ParaToPara') {
|
|
377
|
+
// Special case for Darwinia&Crab node
|
|
258
378
|
return {
|
|
259
|
-
V1: [
|
|
260
|
-
{
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
PalletInstance: 5
|
|
267
|
-
}
|
|
379
|
+
V1: [{
|
|
380
|
+
id: {
|
|
381
|
+
Concrete: {
|
|
382
|
+
parents: 0,
|
|
383
|
+
interior: {
|
|
384
|
+
X1: {
|
|
385
|
+
PalletInstance: 5
|
|
268
386
|
}
|
|
269
387
|
}
|
|
270
|
-
},
|
|
271
|
-
fun: {
|
|
272
|
-
Fungible: amount
|
|
273
388
|
}
|
|
389
|
+
},
|
|
390
|
+
fun: {
|
|
391
|
+
Fungible: amount
|
|
274
392
|
}
|
|
275
|
-
]
|
|
393
|
+
}]
|
|
276
394
|
};
|
|
277
|
-
} else if ((node ===
|
|
395
|
+
} else if ((node === 'Statemint' || node === 'Statemine') && scenario === 'ParaToPara') {
|
|
396
|
+
// Another specific case for Statemint & Statemine to send for example USDt
|
|
278
397
|
return {
|
|
279
|
-
V1: [
|
|
280
|
-
{
|
|
281
|
-
id: {
|
|
282
|
-
Concrete: {
|
|
283
|
-
parents: 0,
|
|
284
|
-
interior: {
|
|
285
|
-
X2: [
|
|
286
|
-
{
|
|
287
|
-
PalletInstance: 50
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
GeneralIndex: cur
|
|
291
|
-
}
|
|
292
|
-
]
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
fun: {
|
|
297
|
-
Fungible: amount
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
]
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
return {
|
|
304
|
-
V1: [
|
|
305
|
-
{
|
|
398
|
+
V1: [{
|
|
306
399
|
id: {
|
|
307
400
|
Concrete: {
|
|
308
401
|
parents: 0,
|
|
309
|
-
interior:
|
|
402
|
+
interior: {
|
|
403
|
+
X2: [{
|
|
404
|
+
PalletInstance: 50
|
|
405
|
+
}, {
|
|
406
|
+
GeneralIndex: cur
|
|
407
|
+
}]
|
|
408
|
+
}
|
|
310
409
|
}
|
|
311
410
|
},
|
|
312
411
|
fun: {
|
|
313
412
|
Fungible: amount
|
|
314
413
|
}
|
|
414
|
+
}]
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
// Otherwise
|
|
418
|
+
return {
|
|
419
|
+
V1: [{
|
|
420
|
+
id: {
|
|
421
|
+
Concrete: {
|
|
422
|
+
parents: 0,
|
|
423
|
+
interior: 'Here'
|
|
424
|
+
}
|
|
425
|
+
},
|
|
426
|
+
fun: {
|
|
427
|
+
Fungible: amount
|
|
315
428
|
}
|
|
316
|
-
]
|
|
429
|
+
}]
|
|
317
430
|
};
|
|
318
431
|
}
|
|
319
432
|
}
|
|
320
433
|
function createHeaderPolkadotXCM(scenario, nodeId, node) {
|
|
321
|
-
console.log(
|
|
322
|
-
if (scenario ===
|
|
434
|
+
console.log('Generating header for polkadotXCM transfer');
|
|
435
|
+
if (scenario === 'ParaToRelay') {
|
|
323
436
|
return {
|
|
324
437
|
V1: {
|
|
325
438
|
parents: 1,
|
|
326
|
-
interior:
|
|
439
|
+
interior: 'Here'
|
|
327
440
|
}
|
|
328
441
|
};
|
|
329
442
|
}
|
|
330
|
-
if (scenario ===
|
|
331
|
-
if (node ===
|
|
443
|
+
if (scenario === 'ParaToPara') {
|
|
444
|
+
if (node === 'Quartz') {
|
|
332
445
|
return {
|
|
333
446
|
V0: {
|
|
334
|
-
X2: [
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
Parachain: nodeId
|
|
338
|
-
}
|
|
339
|
-
]
|
|
447
|
+
X2: ['Parent', {
|
|
448
|
+
Parachain: nodeId
|
|
449
|
+
}]
|
|
340
450
|
}
|
|
341
451
|
};
|
|
342
452
|
}
|
|
@@ -351,7 +461,7 @@ function createHeaderPolkadotXCM(scenario, nodeId, node) {
|
|
|
351
461
|
}
|
|
352
462
|
};
|
|
353
463
|
}
|
|
354
|
-
if (scenario ===
|
|
464
|
+
if (scenario === 'RelayToPara') {
|
|
355
465
|
return {
|
|
356
466
|
V1: {
|
|
357
467
|
parents: 0,
|
|
@@ -366,260 +476,224 @@ function createHeaderPolkadotXCM(scenario, nodeId, node) {
|
|
|
366
476
|
}
|
|
367
477
|
function constructXTokens(api, origin, currencyID, currency, amount, addressSelection, fees) {
|
|
368
478
|
switch (origin) {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
479
|
+
// Polkadot xTokens
|
|
480
|
+
case 'Acala':
|
|
481
|
+
console.log('Transferring tokens ' + currency + ' from Acala');
|
|
482
|
+
return api.tx.xTokens.transfer({
|
|
483
|
+
Token: currency
|
|
484
|
+
}, amount, addressSelection, fees);
|
|
485
|
+
// Multiple asset options need addressing
|
|
486
|
+
case 'BifrostPolkadot':
|
|
487
|
+
console.log('Transferring ' + currency + ' tokens from BifrostPolkadot');
|
|
488
|
+
return api.tx.xTokens.transfer({
|
|
489
|
+
Token: currency
|
|
490
|
+
}, amount, addressSelection, fees);
|
|
491
|
+
// Multiple asset options need addressing
|
|
492
|
+
case 'Centrifuge':
|
|
493
|
+
console.log('Transferring tokens from Centrifuge');
|
|
494
|
+
return api.tx.xTokens.transfer('Native', amount, addressSelection, fees);
|
|
495
|
+
// Multiple asset options needs addressing
|
|
496
|
+
case 'Clover':
|
|
497
|
+
console.log('Transferring tokens from Clover');
|
|
498
|
+
return api.tx.xTokens.transfer('SelfReserve', amount, addressSelection, fees);
|
|
499
|
+
// Multiple asset options needs addressing
|
|
500
|
+
case 'HydraDX':
|
|
501
|
+
console.log('Transferring ' + currencyID + 'tokens from HydraDX');
|
|
383
502
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
384
|
-
case
|
|
385
|
-
console.log(
|
|
386
|
-
return api.tx.xTokens.transfer({
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
case
|
|
391
|
-
console.log(
|
|
503
|
+
case 'Interlay':
|
|
504
|
+
console.log('Transferring ' + currency + 'tokens from Interlay');
|
|
505
|
+
return api.tx.xTokens.transfer({
|
|
506
|
+
Token: currency
|
|
507
|
+
}, amount, addressSelection, fees);
|
|
508
|
+
// Multiple asset options needs addressing
|
|
509
|
+
case 'Moonbeam':
|
|
510
|
+
console.log('Transferring tokens from Moonbeam');
|
|
511
|
+
return api.tx.xTokens.transfer('SelfReserve', amount, addressSelection, fees);
|
|
512
|
+
// Multiple asset options needs addressing
|
|
513
|
+
case 'Parallel':
|
|
514
|
+
console.log('Transferring ' + currencyID + ' tokens from Parallel');
|
|
392
515
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
393
|
-
case
|
|
394
|
-
console.log(
|
|
395
|
-
return api.tx.xTokens.transfer(
|
|
396
|
-
case
|
|
397
|
-
console.log(
|
|
516
|
+
case 'Litentry':
|
|
517
|
+
console.log('Transferring ' + currencyID + ' tokens from Litentry');
|
|
518
|
+
return api.tx.xTokens.transfer('SelfReserve', amount, addressSelection, fees);
|
|
519
|
+
case 'Kylin':
|
|
520
|
+
console.log('Transferring ' + currency + ' tokens from Kylin');
|
|
398
521
|
return api.tx.ormlXTokens.transfer(currency, amount, addressSelection, fees);
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
522
|
+
// Kusama xTokens
|
|
523
|
+
case 'Altair':
|
|
524
|
+
console.log('Transferring tokens from Altair');
|
|
525
|
+
return api.tx.xTokens.transfer('Native', amount, addressSelection, fees);
|
|
526
|
+
// Multiple asset options needs addressing
|
|
527
|
+
case 'Amplitude':
|
|
528
|
+
console.log('Transferring ' + currency + ' tokens from Amplitude');
|
|
529
|
+
return api.tx.xTokens.transfer({
|
|
530
|
+
XCM: currency
|
|
531
|
+
}, amount, addressSelection, fees);
|
|
532
|
+
case 'Bajun':
|
|
533
|
+
console.log('Transferring ' + currencyID + ' token from Bajun');
|
|
407
534
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
408
|
-
case
|
|
409
|
-
console.log(
|
|
535
|
+
case 'Basilisk':
|
|
536
|
+
console.log('Transferring ' + currencyID + ' token from Basilisk');
|
|
410
537
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
411
|
-
case
|
|
412
|
-
console.log(
|
|
413
|
-
return api.tx.xTokens.transfer({
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
case
|
|
418
|
-
console.log(
|
|
419
|
-
return api.tx.xTokens.transfer(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
538
|
+
case 'BifrostKusama':
|
|
539
|
+
console.log('Transferring ' + currency + ' tokens from BifrostKusama');
|
|
540
|
+
return api.tx.xTokens.transfer({
|
|
541
|
+
Token: currency
|
|
542
|
+
}, amount, addressSelection, fees);
|
|
543
|
+
// Multiple asset options need addressing
|
|
544
|
+
case 'Pioneer':
|
|
545
|
+
console.log('Transferring tokens from Pioneer');
|
|
546
|
+
return api.tx.xTokens.transfer('NativeToken', amount, addressSelection, fees);
|
|
547
|
+
// Multiple asset options needs addressing
|
|
548
|
+
case 'Calamari':
|
|
549
|
+
console.log('Transferring ' + currencyID + ' token from Calamari');
|
|
550
|
+
return api.tx.xTokens.transfer({
|
|
551
|
+
MantaCurrency: currencyID
|
|
552
|
+
}, amount, addressSelection, fees);
|
|
553
|
+
// Currently only option for XCM transfer
|
|
554
|
+
case 'CrustShadow':
|
|
555
|
+
console.log('Transferring tokens from CrustShadow');
|
|
556
|
+
return api.tx.xTokens.transfer('SelfReserve', amount, addressSelection, fees);
|
|
557
|
+
// Multiple asset options needs addressing
|
|
558
|
+
case 'Dorafactory':
|
|
559
|
+
console.log('Transferring ' + currency + ' tokens from DoraFactory');
|
|
425
560
|
return api.tx.xTokens.transfer(currency, amount, addressSelection, fees);
|
|
426
|
-
case
|
|
427
|
-
console.log(
|
|
561
|
+
case 'Imbue':
|
|
562
|
+
console.log('Transferring ' + currency + ' tokens from imbue');
|
|
428
563
|
return api.tx.xTokens.transfer(currency, amount, addressSelection, fees);
|
|
429
|
-
case
|
|
430
|
-
console.log(
|
|
564
|
+
case 'Integritee':
|
|
565
|
+
console.log('Transferring ' + currency + ' tokens from Integritee');
|
|
431
566
|
return api.tx.xTokens.transfer(currency, amount, addressSelection, fees);
|
|
432
|
-
case
|
|
433
|
-
console.log(
|
|
567
|
+
case 'InvArchTinker':
|
|
568
|
+
console.log('Transferring ' + currencyID + ' token from InvArch Tinker');
|
|
434
569
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
435
|
-
case
|
|
436
|
-
console.log(
|
|
437
|
-
return api.tx.xTokens.transfer({
|
|
438
|
-
|
|
439
|
-
|
|
570
|
+
case 'Karura':
|
|
571
|
+
console.log('Transferring ' + currency + ' tokens from Karura');
|
|
572
|
+
return api.tx.xTokens.transfer({
|
|
573
|
+
Token: currency
|
|
574
|
+
}, amount, addressSelection, fees);
|
|
575
|
+
// Multiple asset options need addressing
|
|
576
|
+
case 'Kico':
|
|
577
|
+
console.log('Transferring ' + currencyID + ' token from KICO');
|
|
440
578
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
441
|
-
case
|
|
442
|
-
console.log(
|
|
443
|
-
return api.tx.xTokens.transfer({
|
|
444
|
-
|
|
445
|
-
|
|
579
|
+
case 'Kintsugi':
|
|
580
|
+
console.log('Transferring ' + currency + ' tokens from kintsugi');
|
|
581
|
+
return api.tx.xTokens.transfer({
|
|
582
|
+
Token: currency
|
|
583
|
+
}, amount, addressSelection, fees);
|
|
584
|
+
// Multiple asset options need addressing
|
|
585
|
+
case 'Listen':
|
|
586
|
+
console.log('Transferring ' + currencyID + ' token from Listen');
|
|
446
587
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
447
|
-
case
|
|
448
|
-
console.log(
|
|
449
|
-
return api.tx.xTokens.transfer(
|
|
450
|
-
|
|
451
|
-
|
|
588
|
+
case 'Litmus':
|
|
589
|
+
console.log('Transferring tokens from Litmus');
|
|
590
|
+
return api.tx.xTokens.transfer('SelfReserve', amount, addressSelection, fees);
|
|
591
|
+
// Multiple asset options needs addressing
|
|
592
|
+
case 'Mangata':
|
|
593
|
+
console.log('Transferring ' + currencyID + ' token from Mangata');
|
|
452
594
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
453
|
-
case
|
|
454
|
-
console.log(
|
|
455
|
-
return api.tx.xTokens.transfer(
|
|
456
|
-
|
|
457
|
-
|
|
595
|
+
case 'Moonriver':
|
|
596
|
+
console.log('Transferring tokens from Moonriver');
|
|
597
|
+
return api.tx.xTokens.transfer('SelfReserve', amount, addressSelection, fees);
|
|
598
|
+
// Multiple asset options needs addressing
|
|
599
|
+
case 'ParallelHeiko':
|
|
600
|
+
console.log('Transferring ' + currencyID + ' token from Parallel Heiko');
|
|
458
601
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
459
|
-
case
|
|
460
|
-
console.log(
|
|
602
|
+
case 'Picasso':
|
|
603
|
+
console.log('Transferring ' + currencyID + ' token from Picasso');
|
|
461
604
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
462
|
-
case
|
|
463
|
-
console.log(
|
|
605
|
+
case 'Pichiu':
|
|
606
|
+
console.log('Transferring ' + currency + ' tokens from Pichiu');
|
|
464
607
|
return api.tx.ormlXTokens.transfer(currency, amount, addressSelection, fees);
|
|
465
|
-
case
|
|
466
|
-
console.log(
|
|
608
|
+
case 'Turing':
|
|
609
|
+
console.log('Transferring ' + currencyID + ' token from Turing');
|
|
467
610
|
return api.tx.xTokens.transfer(currencyID, amount, addressSelection, fees);
|
|
468
611
|
default:
|
|
469
|
-
throw new Error(
|
|
612
|
+
throw new Error("Invalid node: ".concat(origin));
|
|
470
613
|
}
|
|
471
614
|
}
|
|
472
615
|
function constructPolkadotXCM(api, origin, header, addressSelection, currencySelection, scenario) {
|
|
473
616
|
switch (origin) {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
"Unlimited"
|
|
483
|
-
);
|
|
484
|
-
} else if (scenario === "ParaToRelay") {
|
|
485
|
-
console.log("Transferring DOT tokens from Statemint");
|
|
486
|
-
return api.tx.polkadotXcm.limitedTeleportAssets(
|
|
487
|
-
header,
|
|
488
|
-
addressSelection,
|
|
489
|
-
currencySelection,
|
|
490
|
-
0,
|
|
491
|
-
"Unlimited"
|
|
492
|
-
);
|
|
617
|
+
// Polkadot polkadotXCM
|
|
618
|
+
case 'Statemint':
|
|
619
|
+
if (scenario === 'ParaToPara') {
|
|
620
|
+
console.log('Transferring selected tokens from Statemint'); // TESTED https://polkadot.subscan.io/xcm_message/polkadot-e4cdf1c59ffbb3d504adbc893d6b7d72665e484d
|
|
621
|
+
return api.tx.polkadotXcm.limitedReserveTransferAssets(header, addressSelection, currencySelection, 0, 'Unlimited');
|
|
622
|
+
} else if (scenario === 'ParaToRelay') {
|
|
623
|
+
console.log('Transferring DOT tokens from Statemint'); // TESTED https://polkadot.subscan.io/xcm_message/polkadot-c01158ff1a5c5a596138ed9d0f0f2bccc1d9c51d
|
|
624
|
+
return api.tx.polkadotXcm.limitedTeleportAssets(header, addressSelection, currencySelection, 0, 'Unlimited');
|
|
493
625
|
}
|
|
494
626
|
break;
|
|
495
|
-
case
|
|
496
|
-
if (scenario ===
|
|
497
|
-
console.log(
|
|
498
|
-
return api.tx.polkadotXcm.reserveTransferAssets(
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
0
|
|
503
|
-
);
|
|
504
|
-
} else if (scenario === "ParaToRelay") {
|
|
505
|
-
console.log("Transferring DOT tokens from Astar");
|
|
506
|
-
return api.tx.polkadotXcm.reserveWithdrawAssets(
|
|
507
|
-
header,
|
|
508
|
-
addressSelection,
|
|
509
|
-
currencySelection,
|
|
510
|
-
0
|
|
511
|
-
);
|
|
627
|
+
case 'Astar':
|
|
628
|
+
if (scenario === 'ParaToPara') {
|
|
629
|
+
console.log('Transferring native tokens from Astar'); // TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
|
|
630
|
+
return api.tx.polkadotXcm.reserveTransferAssets(header, addressSelection, currencySelection, 0);
|
|
631
|
+
} else if (scenario === 'ParaToRelay') {
|
|
632
|
+
console.log('Transferring DOT tokens from Astar'); // TESTED https://polkadot.subscan.io/xcm_message/polkadot-58e4741f4c9f99bbdf65f16c81a233ad60a7ad1d
|
|
633
|
+
return api.tx.polkadotXcm.reserveWithdrawAssets(header, addressSelection, currencySelection, 0);
|
|
512
634
|
}
|
|
513
635
|
break;
|
|
514
|
-
case
|
|
515
|
-
if (scenario ===
|
|
516
|
-
console.log(
|
|
517
|
-
return api.tx.polkadotXcm.reserveTransferAssets(
|
|
518
|
-
header,
|
|
519
|
-
addressSelection,
|
|
520
|
-
currencySelection,
|
|
521
|
-
0
|
|
522
|
-
);
|
|
636
|
+
case 'Darwinia':
|
|
637
|
+
if (scenario === 'ParaToPara') {
|
|
638
|
+
console.log('Transferring native tokens from Darwinia'); // TESTED https://polkadot.subscan.io/xcm_message/polkadot-55c5c36c8fe8794c8cfbea725c9f8bc5984c6b05
|
|
639
|
+
return api.tx.polkadotXcm.reserveTransferAssets(header, addressSelection, currencySelection, 0);
|
|
523
640
|
}
|
|
524
641
|
break;
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
"Unlimited"
|
|
534
|
-
);
|
|
535
|
-
} else if (scenario === "ParaToRelay") {
|
|
536
|
-
console.log("Transferring KSM tokens from Statemine");
|
|
537
|
-
return api.tx.polkadotXcm.limitedTeleportAssets(
|
|
538
|
-
header,
|
|
539
|
-
addressSelection,
|
|
540
|
-
currencySelection,
|
|
541
|
-
0,
|
|
542
|
-
"Unlimited"
|
|
543
|
-
);
|
|
642
|
+
// Kusama polkadotXCM
|
|
643
|
+
case 'Statemine':
|
|
644
|
+
if (scenario === 'ParaToPara') {
|
|
645
|
+
console.log('Transferring native tokens from Statemine'); // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
|
|
646
|
+
return api.tx.polkadotXcm.limitedReserveTransferAssets(header, addressSelection, currencySelection, 0, 'Unlimited');
|
|
647
|
+
} else if (scenario === 'ParaToRelay') {
|
|
648
|
+
console.log('Transferring KSM tokens from Statemine'); // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
649
|
+
return api.tx.polkadotXcm.limitedTeleportAssets(header, addressSelection, currencySelection, 0, 'Unlimited');
|
|
544
650
|
}
|
|
545
651
|
break;
|
|
546
|
-
case
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
addressSelection,
|
|
552
|
-
currencySelection,
|
|
553
|
-
0,
|
|
554
|
-
"Unlimited"
|
|
555
|
-
);
|
|
652
|
+
case 'Encointer':
|
|
653
|
+
// NO PARA TO PARA SCENARIOS ON SUBSCAN
|
|
654
|
+
if (scenario === 'ParaToRelay') {
|
|
655
|
+
console.log('Transferring KSM tokens from Encointer'); // TESTED https://encointer.subscan.io/xcm_message/kusama-418501e86e947b16c4e4e9040694017e64f9b162
|
|
656
|
+
return api.tx.polkadotXcm.limitedTeleportAssets(header, addressSelection, currencySelection, 0, 'Unlimited');
|
|
556
657
|
}
|
|
557
658
|
break;
|
|
558
|
-
case
|
|
559
|
-
if (scenario ===
|
|
560
|
-
console.log(
|
|
561
|
-
return api.tx.polkadotXcm.reserveTransferAssets(
|
|
562
|
-
header,
|
|
563
|
-
addressSelection,
|
|
564
|
-
currencySelection,
|
|
565
|
-
0
|
|
566
|
-
);
|
|
659
|
+
case 'Crab':
|
|
660
|
+
if (scenario === 'ParaToPara') {
|
|
661
|
+
console.log('Transferring native tokens from Crab'); // TESTED https://kusama.subscan.io/xcm_message/kusama-ce7396ec470ba0c6516a50075046ee65464572dc
|
|
662
|
+
return api.tx.polkadotXcm.reserveTransferAssets(header, addressSelection, currencySelection, 0);
|
|
567
663
|
}
|
|
568
664
|
break;
|
|
569
|
-
case
|
|
570
|
-
if (scenario ===
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
addressSelection,
|
|
575
|
-
currencySelection,
|
|
576
|
-
0
|
|
577
|
-
);
|
|
665
|
+
case 'Quartz':
|
|
666
|
+
if (scenario === 'ParaToPara') {
|
|
667
|
+
// TESTED https://quartz.subscan.io/xcm_message/kusama-f5b6580f8d7f97a8d33209d2b5b34d97454587e9
|
|
668
|
+
console.log('Transferring native tokens from Quartz');
|
|
669
|
+
return api.tx.polkadotXcm.reserveTransferAssets(header, addressSelection, currencySelection, 0);
|
|
578
670
|
}
|
|
579
671
|
break;
|
|
580
|
-
case
|
|
581
|
-
if (scenario ===
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
);
|
|
589
|
-
} else if (scenario === "ParaToRelay") {
|
|
590
|
-
console.log("Transferring KSM tokens from Robonomics");
|
|
591
|
-
return api.tx.polkadotXcm.reserveWithdrawAssets(
|
|
592
|
-
header,
|
|
593
|
-
addressSelection,
|
|
594
|
-
currencySelection,
|
|
595
|
-
0
|
|
596
|
-
);
|
|
672
|
+
case 'Robonomics':
|
|
673
|
+
if (scenario === 'ParaToPara') {
|
|
674
|
+
// TESTED https://robonomics.subscan.io/xcm_message/kusama-e9641113dae59920e5cc0e012f1510ea0e2d0455
|
|
675
|
+
console.log('Transferring native tokens from Robonomics');
|
|
676
|
+
return api.tx.polkadotXcm.reserveTransferAssets(header, addressSelection, currencySelection, 0);
|
|
677
|
+
} else if (scenario === 'ParaToRelay') {
|
|
678
|
+
// TESTED https://robonomics.subscan.io/xcm_message/kusama-20b03208c99f2ef29d2d4b4cd4bc5659e54311ea
|
|
679
|
+
console.log('Transferring KSM tokens from Robonomics');
|
|
680
|
+
return api.tx.polkadotXcm.reserveWithdrawAssets(header, addressSelection, currencySelection, 0);
|
|
597
681
|
}
|
|
598
682
|
break;
|
|
599
|
-
case
|
|
600
|
-
if (scenario ===
|
|
601
|
-
console.log(
|
|
602
|
-
return api.tx.polkadotXcm.reserveTransferAssets(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
0
|
|
607
|
-
);
|
|
608
|
-
} else if (scenario === "ParaToRelay") {
|
|
609
|
-
console.log("Transferring KSM tokens from Shiden");
|
|
610
|
-
return api.tx.polkadotXcm.reserveWithdrawAssets(
|
|
611
|
-
header,
|
|
612
|
-
addressSelection,
|
|
613
|
-
currencySelection,
|
|
614
|
-
0
|
|
615
|
-
);
|
|
683
|
+
case 'Shiden':
|
|
684
|
+
if (scenario === 'ParaToPara') {
|
|
685
|
+
console.log('Transferring native tokens from Shiden'); // Same as Astar, works.
|
|
686
|
+
return api.tx.polkadotXcm.reserveTransferAssets(header, addressSelection, currencySelection, 0);
|
|
687
|
+
} else if (scenario === 'ParaToRelay') {
|
|
688
|
+
console.log('Transferring KSM tokens from Shiden'); // https://shiden.subscan.io/xcm_message/kusama-97eb47c25c781affa557f36dbd117d49f7e1ab4e
|
|
689
|
+
return api.tx.polkadotXcm.reserveWithdrawAssets(header, addressSelection, currencySelection, 0);
|
|
616
690
|
}
|
|
617
691
|
break;
|
|
618
692
|
}
|
|
619
|
-
throw new Error(
|
|
693
|
+
throw new Error("Invalid node/ Node does not support XCM at the moment: ".concat(origin));
|
|
620
694
|
}
|
|
621
695
|
|
|
622
|
-
|
|
696
|
+
var Acala$1 = {
|
|
623
697
|
paraId: 2000,
|
|
624
698
|
relayChainAssetSymbol: "DOT",
|
|
625
699
|
nativeAssets: [
|
|
@@ -731,7 +805,7 @@ const Acala$1 = {
|
|
|
731
805
|
}
|
|
732
806
|
]
|
|
733
807
|
};
|
|
734
|
-
|
|
808
|
+
var Astar$1 = {
|
|
735
809
|
paraId: 2006,
|
|
736
810
|
relayChainAssetSymbol: "DOT",
|
|
737
811
|
nativeAssets: [
|
|
@@ -898,7 +972,7 @@ const Astar$1 = {
|
|
|
898
972
|
}
|
|
899
973
|
]
|
|
900
974
|
};
|
|
901
|
-
|
|
975
|
+
var BifrostPolkadot$1 = {
|
|
902
976
|
paraId: 2030,
|
|
903
977
|
relayChainAssetSymbol: "DOT",
|
|
904
978
|
nativeAssets: [
|
|
@@ -950,7 +1024,7 @@ const BifrostPolkadot$1 = {
|
|
|
950
1024
|
otherAssets: [
|
|
951
1025
|
]
|
|
952
1026
|
};
|
|
953
|
-
|
|
1027
|
+
var Bitgreen$1 = {
|
|
954
1028
|
paraId: 2048,
|
|
955
1029
|
relayChainAssetSymbol: "DOT",
|
|
956
1030
|
nativeAssets: [
|
|
@@ -962,7 +1036,7 @@ const Bitgreen$1 = {
|
|
|
962
1036
|
otherAssets: [
|
|
963
1037
|
]
|
|
964
1038
|
};
|
|
965
|
-
|
|
1039
|
+
var Centrifuge$1 = {
|
|
966
1040
|
paraId: 2031,
|
|
967
1041
|
relayChainAssetSymbol: "DOT",
|
|
968
1042
|
nativeAssets: [
|
|
@@ -994,7 +1068,7 @@ const Centrifuge$1 = {
|
|
|
994
1068
|
}
|
|
995
1069
|
]
|
|
996
1070
|
};
|
|
997
|
-
|
|
1071
|
+
var Clover$1 = {
|
|
998
1072
|
paraId: 2002,
|
|
999
1073
|
relayChainAssetSymbol: "DOT",
|
|
1000
1074
|
nativeAssets: [
|
|
@@ -1016,7 +1090,7 @@ const Clover$1 = {
|
|
|
1016
1090
|
}
|
|
1017
1091
|
]
|
|
1018
1092
|
};
|
|
1019
|
-
|
|
1093
|
+
var ComposableFinance$1 = {
|
|
1020
1094
|
paraId: 2019,
|
|
1021
1095
|
relayChainAssetSymbol: "DOT",
|
|
1022
1096
|
nativeAssets: [
|
|
@@ -1028,7 +1102,7 @@ const ComposableFinance$1 = {
|
|
|
1028
1102
|
otherAssets: [
|
|
1029
1103
|
]
|
|
1030
1104
|
};
|
|
1031
|
-
|
|
1105
|
+
var Darwinia$1 = {
|
|
1032
1106
|
paraId: 2046,
|
|
1033
1107
|
relayChainAssetSymbol: "DOT",
|
|
1034
1108
|
nativeAssets: [
|
|
@@ -1040,7 +1114,7 @@ const Darwinia$1 = {
|
|
|
1040
1114
|
otherAssets: [
|
|
1041
1115
|
]
|
|
1042
1116
|
};
|
|
1043
|
-
|
|
1117
|
+
var HydraDX$1 = {
|
|
1044
1118
|
paraId: 2034,
|
|
1045
1119
|
relayChainAssetSymbol: "DOT",
|
|
1046
1120
|
nativeAssets: [
|
|
@@ -1052,7 +1126,7 @@ const HydraDX$1 = {
|
|
|
1052
1126
|
otherAssets: [
|
|
1053
1127
|
]
|
|
1054
1128
|
};
|
|
1055
|
-
|
|
1129
|
+
var Interlay$1 = {
|
|
1056
1130
|
paraId: 2032,
|
|
1057
1131
|
relayChainAssetSymbol: "DOT",
|
|
1058
1132
|
nativeAssets: [
|
|
@@ -1094,7 +1168,7 @@ const Interlay$1 = {
|
|
|
1094
1168
|
}
|
|
1095
1169
|
]
|
|
1096
1170
|
};
|
|
1097
|
-
|
|
1171
|
+
var Kylin$1 = {
|
|
1098
1172
|
paraId: 2052,
|
|
1099
1173
|
relayChainAssetSymbol: "DOT",
|
|
1100
1174
|
nativeAssets: [
|
|
@@ -1106,7 +1180,7 @@ const Kylin$1 = {
|
|
|
1106
1180
|
otherAssets: [
|
|
1107
1181
|
]
|
|
1108
1182
|
};
|
|
1109
|
-
|
|
1183
|
+
var Litentry$1 = {
|
|
1110
1184
|
paraId: 2013,
|
|
1111
1185
|
relayChainAssetSymbol: "DOT",
|
|
1112
1186
|
nativeAssets: [
|
|
@@ -1118,7 +1192,7 @@ const Litentry$1 = {
|
|
|
1118
1192
|
otherAssets: [
|
|
1119
1193
|
]
|
|
1120
1194
|
};
|
|
1121
|
-
|
|
1195
|
+
var Moonbeam$1 = {
|
|
1122
1196
|
paraId: 2004,
|
|
1123
1197
|
relayChainAssetSymbol: "DOT",
|
|
1124
1198
|
nativeAssets: [
|
|
@@ -1195,7 +1269,7 @@ const Moonbeam$1 = {
|
|
|
1195
1269
|
}
|
|
1196
1270
|
]
|
|
1197
1271
|
};
|
|
1198
|
-
|
|
1272
|
+
var Parallel$1 = {
|
|
1199
1273
|
paraId: 2012,
|
|
1200
1274
|
relayChainAssetSymbol: "DOT",
|
|
1201
1275
|
nativeAssets: [
|
|
@@ -1387,7 +1461,7 @@ const Parallel$1 = {
|
|
|
1387
1461
|
}
|
|
1388
1462
|
]
|
|
1389
1463
|
};
|
|
1390
|
-
|
|
1464
|
+
var Statemint$1 = {
|
|
1391
1465
|
paraId: 1000,
|
|
1392
1466
|
relayChainAssetSymbol: "DOT",
|
|
1393
1467
|
nativeAssets: [
|
|
@@ -1514,7 +1588,7 @@ const Statemint$1 = {
|
|
|
1514
1588
|
}
|
|
1515
1589
|
]
|
|
1516
1590
|
};
|
|
1517
|
-
|
|
1591
|
+
var Altair$1 = {
|
|
1518
1592
|
paraId: 2088,
|
|
1519
1593
|
relayChainAssetSymbol: "KSM",
|
|
1520
1594
|
nativeAssets: [
|
|
@@ -1526,7 +1600,7 @@ const Altair$1 = {
|
|
|
1526
1600
|
otherAssets: [
|
|
1527
1601
|
]
|
|
1528
1602
|
};
|
|
1529
|
-
|
|
1603
|
+
var Amplitude$1 = {
|
|
1530
1604
|
paraId: 2124,
|
|
1531
1605
|
relayChainAssetSymbol: "KSM",
|
|
1532
1606
|
nativeAssets: [
|
|
@@ -1538,7 +1612,7 @@ const Amplitude$1 = {
|
|
|
1538
1612
|
otherAssets: [
|
|
1539
1613
|
]
|
|
1540
1614
|
};
|
|
1541
|
-
|
|
1615
|
+
var Bajun$1 = {
|
|
1542
1616
|
paraId: 2119,
|
|
1543
1617
|
relayChainAssetSymbol: "KSM",
|
|
1544
1618
|
nativeAssets: [
|
|
@@ -1550,7 +1624,7 @@ const Bajun$1 = {
|
|
|
1550
1624
|
otherAssets: [
|
|
1551
1625
|
]
|
|
1552
1626
|
};
|
|
1553
|
-
|
|
1627
|
+
var Basilisk$1 = {
|
|
1554
1628
|
paraId: 2090,
|
|
1555
1629
|
relayChainAssetSymbol: "KSM",
|
|
1556
1630
|
nativeAssets: [
|
|
@@ -1612,7 +1686,7 @@ const Basilisk$1 = {
|
|
|
1612
1686
|
}
|
|
1613
1687
|
]
|
|
1614
1688
|
};
|
|
1615
|
-
|
|
1689
|
+
var BifrostKusama$1 = {
|
|
1616
1690
|
paraId: 2001,
|
|
1617
1691
|
relayChainAssetSymbol: "KSM",
|
|
1618
1692
|
nativeAssets: [
|
|
@@ -1656,7 +1730,7 @@ const BifrostKusama$1 = {
|
|
|
1656
1730
|
otherAssets: [
|
|
1657
1731
|
]
|
|
1658
1732
|
};
|
|
1659
|
-
|
|
1733
|
+
var Calamari$1 = {
|
|
1660
1734
|
paraId: 2084,
|
|
1661
1735
|
relayChainAssetSymbol: "KSM",
|
|
1662
1736
|
nativeAssets: [
|
|
@@ -1698,7 +1772,7 @@ const Calamari$1 = {
|
|
|
1698
1772
|
}
|
|
1699
1773
|
]
|
|
1700
1774
|
};
|
|
1701
|
-
|
|
1775
|
+
var Crab$1 = {
|
|
1702
1776
|
paraId: 2105,
|
|
1703
1777
|
relayChainAssetSymbol: "KSM",
|
|
1704
1778
|
nativeAssets: [
|
|
@@ -1710,7 +1784,7 @@ const Crab$1 = {
|
|
|
1710
1784
|
otherAssets: [
|
|
1711
1785
|
]
|
|
1712
1786
|
};
|
|
1713
|
-
|
|
1787
|
+
var CrustShadow$1 = {
|
|
1714
1788
|
paraId: 2012,
|
|
1715
1789
|
relayChainAssetSymbol: "KSM",
|
|
1716
1790
|
nativeAssets: [
|
|
@@ -1757,7 +1831,7 @@ const CrustShadow$1 = {
|
|
|
1757
1831
|
}
|
|
1758
1832
|
]
|
|
1759
1833
|
};
|
|
1760
|
-
|
|
1834
|
+
var Dorafactory$1 = {
|
|
1761
1835
|
paraId: 2115,
|
|
1762
1836
|
relayChainAssetSymbol: "KSM",
|
|
1763
1837
|
nativeAssets: [
|
|
@@ -1769,7 +1843,7 @@ const Dorafactory$1 = {
|
|
|
1769
1843
|
otherAssets: [
|
|
1770
1844
|
]
|
|
1771
1845
|
};
|
|
1772
|
-
|
|
1846
|
+
var Encointer$1 = {
|
|
1773
1847
|
paraId: 1001,
|
|
1774
1848
|
relayChainAssetSymbol: "KSM",
|
|
1775
1849
|
nativeAssets: [
|
|
@@ -1781,7 +1855,7 @@ const Encointer$1 = {
|
|
|
1781
1855
|
otherAssets: [
|
|
1782
1856
|
]
|
|
1783
1857
|
};
|
|
1784
|
-
|
|
1858
|
+
var Imbue$1 = {
|
|
1785
1859
|
paraId: 2121,
|
|
1786
1860
|
relayChainAssetSymbol: "KSM",
|
|
1787
1861
|
nativeAssets: [
|
|
@@ -1793,7 +1867,7 @@ const Imbue$1 = {
|
|
|
1793
1867
|
otherAssets: [
|
|
1794
1868
|
]
|
|
1795
1869
|
};
|
|
1796
|
-
|
|
1870
|
+
var Integritee$1 = {
|
|
1797
1871
|
paraId: 2015,
|
|
1798
1872
|
relayChainAssetSymbol: "KSM",
|
|
1799
1873
|
nativeAssets: [
|
|
@@ -1805,7 +1879,7 @@ const Integritee$1 = {
|
|
|
1805
1879
|
otherAssets: [
|
|
1806
1880
|
]
|
|
1807
1881
|
};
|
|
1808
|
-
|
|
1882
|
+
var InvArchTinker$1 = {
|
|
1809
1883
|
paraId: 2125,
|
|
1810
1884
|
relayChainAssetSymbol: "KSM",
|
|
1811
1885
|
nativeAssets: [
|
|
@@ -1817,7 +1891,7 @@ const InvArchTinker$1 = {
|
|
|
1817
1891
|
otherAssets: [
|
|
1818
1892
|
]
|
|
1819
1893
|
};
|
|
1820
|
-
|
|
1894
|
+
var Kico$1 = {
|
|
1821
1895
|
paraId: 2107,
|
|
1822
1896
|
relayChainAssetSymbol: "KSM",
|
|
1823
1897
|
nativeAssets: [
|
|
@@ -1889,7 +1963,7 @@ const Kico$1 = {
|
|
|
1889
1963
|
}
|
|
1890
1964
|
]
|
|
1891
1965
|
};
|
|
1892
|
-
|
|
1966
|
+
var Karura$1 = {
|
|
1893
1967
|
paraId: 2000,
|
|
1894
1968
|
relayChainAssetSymbol: "KSM",
|
|
1895
1969
|
nativeAssets: [
|
|
@@ -2067,7 +2141,7 @@ const Karura$1 = {
|
|
|
2067
2141
|
}
|
|
2068
2142
|
]
|
|
2069
2143
|
};
|
|
2070
|
-
|
|
2144
|
+
var Kintsugi$1 = {
|
|
2071
2145
|
paraId: 2092,
|
|
2072
2146
|
relayChainAssetSymbol: "KSM",
|
|
2073
2147
|
nativeAssets: [
|
|
@@ -2124,7 +2198,7 @@ const Kintsugi$1 = {
|
|
|
2124
2198
|
}
|
|
2125
2199
|
]
|
|
2126
2200
|
};
|
|
2127
|
-
|
|
2201
|
+
var Listen$1 = {
|
|
2128
2202
|
paraId: 2118,
|
|
2129
2203
|
relayChainAssetSymbol: "KSM",
|
|
2130
2204
|
nativeAssets: [
|
|
@@ -2181,7 +2255,7 @@ const Listen$1 = {
|
|
|
2181
2255
|
}
|
|
2182
2256
|
]
|
|
2183
2257
|
};
|
|
2184
|
-
|
|
2258
|
+
var Litmus$1 = {
|
|
2185
2259
|
paraId: 2106,
|
|
2186
2260
|
relayChainAssetSymbol: "KSM",
|
|
2187
2261
|
nativeAssets: [
|
|
@@ -2193,7 +2267,7 @@ const Litmus$1 = {
|
|
|
2193
2267
|
otherAssets: [
|
|
2194
2268
|
]
|
|
2195
2269
|
};
|
|
2196
|
-
|
|
2270
|
+
var Mangata$1 = {
|
|
2197
2271
|
paraId: 2110,
|
|
2198
2272
|
relayChainAssetSymbol: "KSM",
|
|
2199
2273
|
nativeAssets: [
|
|
@@ -2300,7 +2374,7 @@ const Mangata$1 = {
|
|
|
2300
2374
|
}
|
|
2301
2375
|
]
|
|
2302
2376
|
};
|
|
2303
|
-
|
|
2377
|
+
var Moonriver$1 = {
|
|
2304
2378
|
paraId: 2023,
|
|
2305
2379
|
relayChainAssetSymbol: "KSM",
|
|
2306
2380
|
nativeAssets: [
|
|
@@ -2397,7 +2471,7 @@ const Moonriver$1 = {
|
|
|
2397
2471
|
}
|
|
2398
2472
|
]
|
|
2399
2473
|
};
|
|
2400
|
-
|
|
2474
|
+
var ParallelHeiko$1 = {
|
|
2401
2475
|
paraId: 2085,
|
|
2402
2476
|
relayChainAssetSymbol: "KSM",
|
|
2403
2477
|
nativeAssets: [
|
|
@@ -2554,7 +2628,7 @@ const ParallelHeiko$1 = {
|
|
|
2554
2628
|
}
|
|
2555
2629
|
]
|
|
2556
2630
|
};
|
|
2557
|
-
|
|
2631
|
+
var Picasso$1 = {
|
|
2558
2632
|
paraId: 2087,
|
|
2559
2633
|
relayChainAssetSymbol: "KSM",
|
|
2560
2634
|
nativeAssets: [
|
|
@@ -2566,7 +2640,7 @@ const Picasso$1 = {
|
|
|
2566
2640
|
otherAssets: [
|
|
2567
2641
|
]
|
|
2568
2642
|
};
|
|
2569
|
-
|
|
2643
|
+
var Pichiu$1 = {
|
|
2570
2644
|
paraId: 2102,
|
|
2571
2645
|
relayChainAssetSymbol: "KSM",
|
|
2572
2646
|
nativeAssets: [
|
|
@@ -2578,7 +2652,7 @@ const Pichiu$1 = {
|
|
|
2578
2652
|
otherAssets: [
|
|
2579
2653
|
]
|
|
2580
2654
|
};
|
|
2581
|
-
|
|
2655
|
+
var Pioneer$1 = {
|
|
2582
2656
|
paraId: 2096,
|
|
2583
2657
|
relayChainAssetSymbol: "KSM",
|
|
2584
2658
|
nativeAssets: [
|
|
@@ -2590,7 +2664,7 @@ const Pioneer$1 = {
|
|
|
2590
2664
|
otherAssets: [
|
|
2591
2665
|
]
|
|
2592
2666
|
};
|
|
2593
|
-
|
|
2667
|
+
var Quartz$1 = {
|
|
2594
2668
|
paraId: 2095,
|
|
2595
2669
|
relayChainAssetSymbol: "KSM",
|
|
2596
2670
|
nativeAssets: [
|
|
@@ -2602,7 +2676,7 @@ const Quartz$1 = {
|
|
|
2602
2676
|
otherAssets: [
|
|
2603
2677
|
]
|
|
2604
2678
|
};
|
|
2605
|
-
|
|
2679
|
+
var Robonomics$1 = {
|
|
2606
2680
|
paraId: 2048,
|
|
2607
2681
|
relayChainAssetSymbol: "KSM",
|
|
2608
2682
|
nativeAssets: [
|
|
@@ -2639,7 +2713,7 @@ const Robonomics$1 = {
|
|
|
2639
2713
|
}
|
|
2640
2714
|
]
|
|
2641
2715
|
};
|
|
2642
|
-
|
|
2716
|
+
var Shiden$1 = {
|
|
2643
2717
|
paraId: 2007,
|
|
2644
2718
|
relayChainAssetSymbol: "KSM",
|
|
2645
2719
|
nativeAssets: [
|
|
@@ -2761,7 +2835,7 @@ const Shiden$1 = {
|
|
|
2761
2835
|
}
|
|
2762
2836
|
]
|
|
2763
2837
|
};
|
|
2764
|
-
|
|
2838
|
+
var Statemine$1 = {
|
|
2765
2839
|
paraId: 1000,
|
|
2766
2840
|
relayChainAssetSymbol: "KSM",
|
|
2767
2841
|
nativeAssets: [
|
|
@@ -3478,7 +3552,7 @@ const Statemine$1 = {
|
|
|
3478
3552
|
}
|
|
3479
3553
|
]
|
|
3480
3554
|
};
|
|
3481
|
-
|
|
3555
|
+
var Turing$1 = {
|
|
3482
3556
|
paraId: 2114,
|
|
3483
3557
|
relayChainAssetSymbol: "KSM",
|
|
3484
3558
|
nativeAssets: [
|
|
@@ -3530,7 +3604,7 @@ const Turing$1 = {
|
|
|
3530
3604
|
}
|
|
3531
3605
|
]
|
|
3532
3606
|
};
|
|
3533
|
-
|
|
3607
|
+
var assets = {
|
|
3534
3608
|
Acala: Acala$1,
|
|
3535
3609
|
Astar: Astar$1,
|
|
3536
3610
|
BifrostPolkadot: BifrostPolkadot$1,
|
|
@@ -3577,7 +3651,7 @@ const assets = {
|
|
|
3577
3651
|
Turing: Turing$1
|
|
3578
3652
|
};
|
|
3579
3653
|
|
|
3580
|
-
|
|
3654
|
+
var assetsMapJson = /*#__PURE__*/Object.freeze({
|
|
3581
3655
|
__proto__: null,
|
|
3582
3656
|
Acala: Acala$1,
|
|
3583
3657
|
Altair: Altair$1,
|
|
@@ -3624,14 +3698,14 @@ const assetsMapJson = {
|
|
|
3624
3698
|
Statemint: Statemint$1,
|
|
3625
3699
|
Turing: Turing$1,
|
|
3626
3700
|
default: assets
|
|
3627
|
-
};
|
|
3701
|
+
});
|
|
3628
3702
|
|
|
3629
|
-
|
|
3703
|
+
var assetsMap = assetsMapJson;
|
|
3630
3704
|
function getAssetsObject(node) {
|
|
3631
3705
|
return assetsMap[node];
|
|
3632
3706
|
}
|
|
3633
3707
|
function getAssetId(node, symbol) {
|
|
3634
|
-
|
|
3708
|
+
var info = getAssetsObject(node).otherAssets.find(function (o) {
|
|
3635
3709
|
return o.symbol === symbol;
|
|
3636
3710
|
});
|
|
3637
3711
|
return info ? info.assetId : null;
|
|
@@ -3640,30 +3714,33 @@ function getRelayChainSymbol(node) {
|
|
|
3640
3714
|
return getAssetsObject(node).relayChainAssetSymbol;
|
|
3641
3715
|
}
|
|
3642
3716
|
function getNativeAssets(node) {
|
|
3643
|
-
|
|
3717
|
+
var info = getAssetsObject(node).nativeAssets;
|
|
3644
3718
|
return info || [];
|
|
3645
3719
|
}
|
|
3646
3720
|
function getOtherAssets(node) {
|
|
3647
3721
|
return getAssetsObject(node).otherAssets;
|
|
3648
3722
|
}
|
|
3649
3723
|
function getAllAssetsSymbols(node) {
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3724
|
+
var _getAssetsObject = getAssetsObject(node),
|
|
3725
|
+
relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol,
|
|
3726
|
+
nativeAssets = _getAssetsObject.nativeAssets,
|
|
3727
|
+
otherAssets = _getAssetsObject.otherAssets;
|
|
3728
|
+
return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssets.map(function (_ref) {
|
|
3729
|
+
var symbol = _ref.symbol;
|
|
3730
|
+
return symbol;
|
|
3731
|
+
})), _toConsumableArray(otherAssets.map(function (_ref2) {
|
|
3732
|
+
var symbol = _ref2.symbol;
|
|
3733
|
+
return symbol;
|
|
3734
|
+
})));
|
|
3660
3735
|
}
|
|
3661
3736
|
function hasSupportForAsset(node, symbol) {
|
|
3662
3737
|
return getAllAssetsSymbols(node).includes(symbol);
|
|
3663
3738
|
}
|
|
3664
3739
|
function getAssetDecimals(node, symbol) {
|
|
3665
|
-
|
|
3666
|
-
|
|
3740
|
+
var _getAssetsObject2 = getAssetsObject(node),
|
|
3741
|
+
otherAssets = _getAssetsObject2.otherAssets,
|
|
3742
|
+
nativeAssets = _getAssetsObject2.nativeAssets;
|
|
3743
|
+
var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
|
|
3667
3744
|
return o.symbol === symbol;
|
|
3668
3745
|
});
|
|
3669
3746
|
return asset ? asset.decimals : null;
|
|
@@ -3672,7 +3749,7 @@ function getParaId(node) {
|
|
|
3672
3749
|
return getAssetsObject(node).paraId;
|
|
3673
3750
|
}
|
|
3674
3751
|
|
|
3675
|
-
|
|
3752
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
3676
3753
|
__proto__: null,
|
|
3677
3754
|
getAllAssetsSymbols: getAllAssetsSymbols,
|
|
3678
3755
|
getAssetDecimals: getAssetDecimals,
|
|
@@ -3683,306 +3760,306 @@ const index$4 = {
|
|
|
3683
3760
|
getParaId: getParaId,
|
|
3684
3761
|
getRelayChainSymbol: getRelayChainSymbol,
|
|
3685
3762
|
hasSupportForAsset: hasSupportForAsset
|
|
3686
|
-
};
|
|
3763
|
+
});
|
|
3687
3764
|
|
|
3688
|
-
|
|
3765
|
+
var Statemint = {
|
|
3689
3766
|
defaultPallet: "PolkadotXcm",
|
|
3690
3767
|
supportedPallets: [
|
|
3691
3768
|
"PolkadotXcm"
|
|
3692
3769
|
]
|
|
3693
3770
|
};
|
|
3694
|
-
|
|
3771
|
+
var Acala = {
|
|
3695
3772
|
defaultPallet: "XTokens",
|
|
3696
3773
|
supportedPallets: [
|
|
3697
3774
|
"PolkadotXcm",
|
|
3698
3775
|
"XTokens"
|
|
3699
3776
|
]
|
|
3700
3777
|
};
|
|
3701
|
-
|
|
3778
|
+
var Astar = {
|
|
3702
3779
|
defaultPallet: "PolkadotXcm",
|
|
3703
3780
|
supportedPallets: [
|
|
3704
3781
|
"PolkadotXcm"
|
|
3705
3782
|
]
|
|
3706
3783
|
};
|
|
3707
|
-
|
|
3784
|
+
var BifrostPolkadot = {
|
|
3708
3785
|
defaultPallet: "XTokens",
|
|
3709
3786
|
supportedPallets: [
|
|
3710
3787
|
"PolkadotXcm",
|
|
3711
3788
|
"XTokens"
|
|
3712
3789
|
]
|
|
3713
3790
|
};
|
|
3714
|
-
|
|
3791
|
+
var Bitgreen = {
|
|
3715
3792
|
defaultPallet: "PolkadotXcm",
|
|
3716
3793
|
supportedPallets: [
|
|
3717
3794
|
"PolkadotXcm"
|
|
3718
3795
|
]
|
|
3719
3796
|
};
|
|
3720
|
-
|
|
3797
|
+
var Centrifuge = {
|
|
3721
3798
|
defaultPallet: "XTokens",
|
|
3722
3799
|
supportedPallets: [
|
|
3723
3800
|
"PolkadotXcm",
|
|
3724
3801
|
"XTokens"
|
|
3725
3802
|
]
|
|
3726
3803
|
};
|
|
3727
|
-
|
|
3804
|
+
var Clover = {
|
|
3728
3805
|
defaultPallet: "XTokens",
|
|
3729
3806
|
supportedPallets: [
|
|
3730
3807
|
"PolkadotXcm",
|
|
3731
3808
|
"XTokens"
|
|
3732
3809
|
]
|
|
3733
3810
|
};
|
|
3734
|
-
|
|
3811
|
+
var ComposableFinance = {
|
|
3735
3812
|
defaultPallet: "RelayerXcm",
|
|
3736
3813
|
supportedPallets: [
|
|
3737
3814
|
"RelayerXcm"
|
|
3738
3815
|
]
|
|
3739
3816
|
};
|
|
3740
|
-
|
|
3817
|
+
var Darwinia = {
|
|
3741
3818
|
defaultPallet: "PolkadotXcm",
|
|
3742
3819
|
supportedPallets: [
|
|
3743
3820
|
"PolkadotXcm"
|
|
3744
3821
|
]
|
|
3745
3822
|
};
|
|
3746
|
-
|
|
3823
|
+
var HydraDX = {
|
|
3747
3824
|
defaultPallet: "XTokens",
|
|
3748
3825
|
supportedPallets: [
|
|
3749
3826
|
"PolkadotXcm",
|
|
3750
3827
|
"XTokens"
|
|
3751
3828
|
]
|
|
3752
3829
|
};
|
|
3753
|
-
|
|
3830
|
+
var Interlay = {
|
|
3754
3831
|
defaultPallet: "XTokens",
|
|
3755
3832
|
supportedPallets: [
|
|
3756
3833
|
"PolkadotXcm",
|
|
3757
3834
|
"XTokens"
|
|
3758
3835
|
]
|
|
3759
3836
|
};
|
|
3760
|
-
|
|
3837
|
+
var Kylin = {
|
|
3761
3838
|
defaultPallet: "OrmlXTokens",
|
|
3762
3839
|
supportedPallets: [
|
|
3763
3840
|
"PolkadotXcm",
|
|
3764
3841
|
"OrmlXTokens"
|
|
3765
3842
|
]
|
|
3766
3843
|
};
|
|
3767
|
-
|
|
3844
|
+
var Litentry = {
|
|
3768
3845
|
defaultPallet: "XTokens",
|
|
3769
3846
|
supportedPallets: [
|
|
3770
3847
|
"PolkadotXcm",
|
|
3771
3848
|
"XTokens"
|
|
3772
3849
|
]
|
|
3773
3850
|
};
|
|
3774
|
-
|
|
3851
|
+
var Moonbeam = {
|
|
3775
3852
|
defaultPallet: "XTokens",
|
|
3776
3853
|
supportedPallets: [
|
|
3777
3854
|
"PolkadotXcm",
|
|
3778
3855
|
"XTokens"
|
|
3779
3856
|
]
|
|
3780
3857
|
};
|
|
3781
|
-
|
|
3858
|
+
var Parallel = {
|
|
3782
3859
|
defaultPallet: "XTokens",
|
|
3783
3860
|
supportedPallets: [
|
|
3784
3861
|
"PolkadotXcm",
|
|
3785
3862
|
"XTokens"
|
|
3786
3863
|
]
|
|
3787
3864
|
};
|
|
3788
|
-
|
|
3865
|
+
var Statemine = {
|
|
3789
3866
|
defaultPallet: "PolkadotXcm",
|
|
3790
3867
|
supportedPallets: [
|
|
3791
3868
|
"PolkadotXcm"
|
|
3792
3869
|
]
|
|
3793
3870
|
};
|
|
3794
|
-
|
|
3871
|
+
var Encointer = {
|
|
3795
3872
|
defaultPallet: "PolkadotXcm",
|
|
3796
3873
|
supportedPallets: [
|
|
3797
3874
|
"PolkadotXcm"
|
|
3798
3875
|
]
|
|
3799
3876
|
};
|
|
3800
|
-
|
|
3877
|
+
var Altair = {
|
|
3801
3878
|
defaultPallet: "XTokens",
|
|
3802
3879
|
supportedPallets: [
|
|
3803
3880
|
"PolkadotXcm",
|
|
3804
3881
|
"XTokens"
|
|
3805
3882
|
]
|
|
3806
3883
|
};
|
|
3807
|
-
|
|
3884
|
+
var Amplitude = {
|
|
3808
3885
|
defaultPallet: "XTokens",
|
|
3809
3886
|
supportedPallets: [
|
|
3810
3887
|
"PolkadotXcm",
|
|
3811
3888
|
"XTokens"
|
|
3812
3889
|
]
|
|
3813
3890
|
};
|
|
3814
|
-
|
|
3891
|
+
var Bajun = {
|
|
3815
3892
|
defaultPallet: "PolkadotXcm",
|
|
3816
3893
|
supportedPallets: [
|
|
3817
3894
|
"PolkadotXcm"
|
|
3818
3895
|
]
|
|
3819
3896
|
};
|
|
3820
|
-
|
|
3897
|
+
var Basilisk = {
|
|
3821
3898
|
defaultPallet: "XTokens",
|
|
3822
3899
|
supportedPallets: [
|
|
3823
3900
|
"PolkadotXcm",
|
|
3824
3901
|
"XTokens"
|
|
3825
3902
|
]
|
|
3826
3903
|
};
|
|
3827
|
-
|
|
3904
|
+
var BifrostKusama = {
|
|
3828
3905
|
defaultPallet: "XTokens",
|
|
3829
3906
|
supportedPallets: [
|
|
3830
3907
|
"PolkadotXcm",
|
|
3831
3908
|
"XTokens"
|
|
3832
3909
|
]
|
|
3833
3910
|
};
|
|
3834
|
-
|
|
3911
|
+
var Pioneer = {
|
|
3835
3912
|
defaultPallet: "XTokens",
|
|
3836
3913
|
supportedPallets: [
|
|
3837
3914
|
"PolkadotXcm",
|
|
3838
3915
|
"XTokens"
|
|
3839
3916
|
]
|
|
3840
3917
|
};
|
|
3841
|
-
|
|
3918
|
+
var Calamari = {
|
|
3842
3919
|
defaultPallet: "XTokens",
|
|
3843
3920
|
supportedPallets: [
|
|
3844
3921
|
"PolkadotXcm",
|
|
3845
3922
|
"XTokens"
|
|
3846
3923
|
]
|
|
3847
3924
|
};
|
|
3848
|
-
|
|
3925
|
+
var CrustShadow = {
|
|
3849
3926
|
defaultPallet: "XTokens",
|
|
3850
3927
|
supportedPallets: [
|
|
3851
3928
|
"PolkadotXcm",
|
|
3852
3929
|
"XTokens"
|
|
3853
3930
|
]
|
|
3854
3931
|
};
|
|
3855
|
-
|
|
3932
|
+
var Crab = {
|
|
3856
3933
|
defaultPallet: "PolkadotXcm",
|
|
3857
3934
|
supportedPallets: [
|
|
3858
3935
|
"PolkadotXcm"
|
|
3859
3936
|
]
|
|
3860
3937
|
};
|
|
3861
|
-
|
|
3938
|
+
var Dorafactory = {
|
|
3862
3939
|
defaultPallet: "XTokens",
|
|
3863
3940
|
supportedPallets: [
|
|
3864
3941
|
"PolkadotXcm",
|
|
3865
3942
|
"XTokens"
|
|
3866
3943
|
]
|
|
3867
3944
|
};
|
|
3868
|
-
|
|
3945
|
+
var Imbue = {
|
|
3869
3946
|
defaultPallet: "XTokens",
|
|
3870
3947
|
supportedPallets: [
|
|
3871
3948
|
"PolkadotXcm",
|
|
3872
3949
|
"XTokens"
|
|
3873
3950
|
]
|
|
3874
3951
|
};
|
|
3875
|
-
|
|
3952
|
+
var Integritee = {
|
|
3876
3953
|
defaultPallet: "XTokens",
|
|
3877
3954
|
supportedPallets: [
|
|
3878
3955
|
"PolkadotXcm",
|
|
3879
3956
|
"XTokens"
|
|
3880
3957
|
]
|
|
3881
3958
|
};
|
|
3882
|
-
|
|
3959
|
+
var InvArchTinker = {
|
|
3883
3960
|
defaultPallet: "XTokens",
|
|
3884
3961
|
supportedPallets: [
|
|
3885
3962
|
"PolkadotXcm",
|
|
3886
3963
|
"XTokens"
|
|
3887
3964
|
]
|
|
3888
3965
|
};
|
|
3889
|
-
|
|
3966
|
+
var Karura = {
|
|
3890
3967
|
defaultPallet: "XTokens",
|
|
3891
3968
|
supportedPallets: [
|
|
3892
3969
|
"PolkadotXcm",
|
|
3893
3970
|
"XTokens"
|
|
3894
3971
|
]
|
|
3895
3972
|
};
|
|
3896
|
-
|
|
3973
|
+
var Kico = {
|
|
3897
3974
|
defaultPallet: "XTokens",
|
|
3898
3975
|
supportedPallets: [
|
|
3899
3976
|
"XTokens",
|
|
3900
3977
|
"PolkadotXcm"
|
|
3901
3978
|
]
|
|
3902
3979
|
};
|
|
3903
|
-
|
|
3980
|
+
var Kintsugi = {
|
|
3904
3981
|
defaultPallet: "XTokens",
|
|
3905
3982
|
supportedPallets: [
|
|
3906
3983
|
"PolkadotXcm",
|
|
3907
3984
|
"XTokens"
|
|
3908
3985
|
]
|
|
3909
3986
|
};
|
|
3910
|
-
|
|
3987
|
+
var Listen = {
|
|
3911
3988
|
defaultPallet: "XTokens",
|
|
3912
3989
|
supportedPallets: [
|
|
3913
3990
|
"PolkadotXcm",
|
|
3914
3991
|
"XTokens"
|
|
3915
3992
|
]
|
|
3916
3993
|
};
|
|
3917
|
-
|
|
3994
|
+
var Litmus = {
|
|
3918
3995
|
defaultPallet: "XTokens",
|
|
3919
3996
|
supportedPallets: [
|
|
3920
3997
|
"PolkadotXcm",
|
|
3921
3998
|
"XTokens"
|
|
3922
3999
|
]
|
|
3923
4000
|
};
|
|
3924
|
-
|
|
4001
|
+
var Mangata = {
|
|
3925
4002
|
defaultPallet: "XTokens",
|
|
3926
4003
|
supportedPallets: [
|
|
3927
4004
|
"PolkadotXcm",
|
|
3928
4005
|
"XTokens"
|
|
3929
4006
|
]
|
|
3930
4007
|
};
|
|
3931
|
-
|
|
4008
|
+
var Moonriver = {
|
|
3932
4009
|
defaultPallet: "XTokens",
|
|
3933
4010
|
supportedPallets: [
|
|
3934
4011
|
"PolkadotXcm",
|
|
3935
4012
|
"XTokens"
|
|
3936
4013
|
]
|
|
3937
4014
|
};
|
|
3938
|
-
|
|
4015
|
+
var ParallelHeiko = {
|
|
3939
4016
|
defaultPallet: "XTokens",
|
|
3940
4017
|
supportedPallets: [
|
|
3941
4018
|
"PolkadotXcm",
|
|
3942
4019
|
"XTokens"
|
|
3943
4020
|
]
|
|
3944
4021
|
};
|
|
3945
|
-
|
|
4022
|
+
var Picasso = {
|
|
3946
4023
|
defaultPallet: "XTokens",
|
|
3947
4024
|
supportedPallets: [
|
|
3948
4025
|
"RelayerXcm",
|
|
3949
4026
|
"XTokens"
|
|
3950
4027
|
]
|
|
3951
4028
|
};
|
|
3952
|
-
|
|
4029
|
+
var Pichiu = {
|
|
3953
4030
|
defaultPallet: "OrmlXTokens",
|
|
3954
4031
|
supportedPallets: [
|
|
3955
4032
|
"PolkadotXcm",
|
|
3956
4033
|
"OrmlXTokens"
|
|
3957
4034
|
]
|
|
3958
4035
|
};
|
|
3959
|
-
|
|
4036
|
+
var Quartz = {
|
|
3960
4037
|
defaultPallet: "XTokens",
|
|
3961
4038
|
supportedPallets: [
|
|
3962
4039
|
"XTokens",
|
|
3963
4040
|
"PolkadotXcm"
|
|
3964
4041
|
]
|
|
3965
4042
|
};
|
|
3966
|
-
|
|
4043
|
+
var Robonomics = {
|
|
3967
4044
|
defaultPallet: "PolkadotXcm",
|
|
3968
4045
|
supportedPallets: [
|
|
3969
4046
|
"PolkadotXcm"
|
|
3970
4047
|
]
|
|
3971
4048
|
};
|
|
3972
|
-
|
|
4049
|
+
var Shiden = {
|
|
3973
4050
|
defaultPallet: "PolkadotXcm",
|
|
3974
4051
|
supportedPallets: [
|
|
3975
4052
|
"PolkadotXcm"
|
|
3976
4053
|
]
|
|
3977
4054
|
};
|
|
3978
|
-
|
|
4055
|
+
var Turing = {
|
|
3979
4056
|
defaultPallet: "XTokens",
|
|
3980
4057
|
supportedPallets: [
|
|
3981
4058
|
"PolkadotXcm",
|
|
3982
4059
|
"XTokens"
|
|
3983
4060
|
]
|
|
3984
4061
|
};
|
|
3985
|
-
|
|
4062
|
+
var pallets = {
|
|
3986
4063
|
Statemint: Statemint,
|
|
3987
4064
|
Acala: Acala,
|
|
3988
4065
|
Astar: Astar,
|
|
@@ -4029,7 +4106,7 @@ const pallets = {
|
|
|
4029
4106
|
Turing: Turing
|
|
4030
4107
|
};
|
|
4031
4108
|
|
|
4032
|
-
|
|
4109
|
+
var palletsMapJson = /*#__PURE__*/Object.freeze({
|
|
4033
4110
|
__proto__: null,
|
|
4034
4111
|
Acala: Acala,
|
|
4035
4112
|
Altair: Altair,
|
|
@@ -4076,112 +4153,81 @@ const palletsMapJson = {
|
|
|
4076
4153
|
Statemint: Statemint,
|
|
4077
4154
|
Turing: Turing,
|
|
4078
4155
|
default: pallets
|
|
4079
|
-
};
|
|
4156
|
+
});
|
|
4080
4157
|
|
|
4081
|
-
|
|
4082
|
-
function getDefaultPallet(node) {
|
|
4158
|
+
var palletsMap = palletsMapJson;
|
|
4159
|
+
var getDefaultPallet = function getDefaultPallet(node) {
|
|
4083
4160
|
return palletsMap[node].defaultPallet;
|
|
4084
|
-
}
|
|
4161
|
+
};
|
|
4162
|
+
var getSupportedPallets = function getSupportedPallets(node) {
|
|
4163
|
+
return palletsMap[node].supportedPallets;
|
|
4164
|
+
};
|
|
4085
4165
|
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4166
|
+
var InvalidCurrencyError = /*#__PURE__*/function (_Error) {
|
|
4167
|
+
_inherits(InvalidCurrencyError, _Error);
|
|
4168
|
+
var _super = _createSuper(InvalidCurrencyError);
|
|
4169
|
+
function InvalidCurrencyError(message) {
|
|
4170
|
+
var _this;
|
|
4171
|
+
_classCallCheck(this, InvalidCurrencyError);
|
|
4172
|
+
_this = _super.call(this, message);
|
|
4173
|
+
_this.name = 'InvalidCurrencyError';
|
|
4174
|
+
return _this;
|
|
4090
4175
|
}
|
|
4091
|
-
|
|
4176
|
+
return _createClass(InvalidCurrencyError);
|
|
4177
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
4092
4178
|
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4179
|
+
var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
4180
|
+
_inherits(NodeNotSupportedError, _Error);
|
|
4181
|
+
var _super = _createSuper(NodeNotSupportedError);
|
|
4182
|
+
function NodeNotSupportedError(message) {
|
|
4183
|
+
var _this;
|
|
4184
|
+
_classCallCheck(this, NodeNotSupportedError);
|
|
4185
|
+
_this = _super.call(this, message);
|
|
4186
|
+
_this.name = 'NodeNotSupported';
|
|
4187
|
+
return _this;
|
|
4097
4188
|
}
|
|
4098
|
-
|
|
4189
|
+
return _createClass(NodeNotSupportedError);
|
|
4190
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
4099
4191
|
|
|
4100
4192
|
function send(api, origin, currency, currencyID, amount, to, destination) {
|
|
4101
4193
|
if (!hasSupportForAsset(origin, currency)) {
|
|
4102
|
-
throw new InvalidCurrencyError(
|
|
4194
|
+
throw new InvalidCurrencyError("Node ".concat(origin, " does not support currency ").concat(currency, "."));
|
|
4103
4195
|
}
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
if (pallet ===
|
|
4108
|
-
return constructXTokens(
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
handleAddress(type,
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
} else if (pallet === "PolkadotXcm" || pallet === "RelayerXcm") {
|
|
4118
|
-
if ((origin === "Statemint" || origin === "Statemine") && type === "ParaToPara") {
|
|
4119
|
-
return constructPolkadotXCM(
|
|
4120
|
-
api,
|
|
4121
|
-
origin,
|
|
4122
|
-
createHeaderPolkadotXCM(type, paraId),
|
|
4123
|
-
handleAddress(type, "polkadotXCM", api, to, paraId),
|
|
4124
|
-
createCurrencySpecification(amount, type, origin, currencyID),
|
|
4125
|
-
type
|
|
4126
|
-
);
|
|
4127
|
-
} else if ((origin === "Darwinia" || origin === "Crab") && type === "ParaToPara") {
|
|
4128
|
-
return constructPolkadotXCM(
|
|
4129
|
-
api,
|
|
4130
|
-
origin,
|
|
4131
|
-
createHeaderPolkadotXCM(type, paraId),
|
|
4132
|
-
handleAddress(type, "polkadotXCM", api, to, paraId),
|
|
4133
|
-
createCurrencySpecification(amount, type, origin),
|
|
4134
|
-
type
|
|
4135
|
-
);
|
|
4136
|
-
} else if (origin === "Quartz" && type === "ParaToPara") {
|
|
4137
|
-
return constructPolkadotXCM(
|
|
4138
|
-
api,
|
|
4139
|
-
origin,
|
|
4140
|
-
createHeaderPolkadotXCM(type, paraId, origin),
|
|
4141
|
-
handleAddress(type, "polkadotXCM", api, to, paraId, origin),
|
|
4142
|
-
createCurrencySpecification(amount, type, origin),
|
|
4143
|
-
type
|
|
4144
|
-
);
|
|
4196
|
+
var type = destination ? 'ParaToPara' : 'ParaToRelay';
|
|
4197
|
+
var paraId = destination ? getParaId(destination) : undefined;
|
|
4198
|
+
var pallet = getDefaultPallet(origin);
|
|
4199
|
+
if (pallet === 'XTokens' || pallet === 'OrmlXTokens') {
|
|
4200
|
+
return constructXTokens(api, origin, currencyID, currency, amount, handleAddress(type, 'xTokens', api, to, paraId), getFees(type));
|
|
4201
|
+
} else if (pallet === 'PolkadotXcm' || pallet === 'RelayerXcm') {
|
|
4202
|
+
// Specific node requirements
|
|
4203
|
+
if ((origin === 'Statemint' || origin === 'Statemine') && type === 'ParaToPara') {
|
|
4204
|
+
return constructPolkadotXCM(api, origin, createHeaderPolkadotXCM(type, paraId), handleAddress(type, 'polkadotXCM', api, to, paraId), createCurrencySpecification(amount, type, origin, currencyID), type);
|
|
4205
|
+
} else if ((origin === 'Darwinia' || origin === 'Crab') && type === 'ParaToPara') {
|
|
4206
|
+
return constructPolkadotXCM(api, origin, createHeaderPolkadotXCM(type, paraId), handleAddress(type, 'polkadotXCM', api, to, paraId), createCurrencySpecification(amount, type, origin), type);
|
|
4207
|
+
} else if (origin === 'Quartz' && type === 'ParaToPara') {
|
|
4208
|
+
return constructPolkadotXCM(api, origin, createHeaderPolkadotXCM(type, paraId, origin), handleAddress(type, 'polkadotXCM', api, to, paraId, origin), createCurrencySpecification(amount, type, origin), type);
|
|
4145
4209
|
}
|
|
4146
|
-
return constructPolkadotXCM(
|
|
4147
|
-
api,
|
|
4148
|
-
origin,
|
|
4149
|
-
createHeaderPolkadotXCM(type, paraId),
|
|
4150
|
-
handleAddress(type, "polkadotXCM", api, to, paraId),
|
|
4151
|
-
createCurrencySpecification(amount, type),
|
|
4152
|
-
type
|
|
4153
|
-
);
|
|
4210
|
+
return constructPolkadotXCM(api, origin, createHeaderPolkadotXCM(type, paraId), handleAddress(type, 'polkadotXCM', api, to, paraId), createCurrencySpecification(amount, type), type);
|
|
4154
4211
|
}
|
|
4155
|
-
throw new Error(
|
|
4212
|
+
throw new Error("Invalid pallet: ".concat(pallet));
|
|
4156
4213
|
}
|
|
4157
4214
|
function transferRelayToPara(api, destination, amount, to) {
|
|
4158
|
-
|
|
4159
|
-
if (destination ===
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
"Unlimited"
|
|
4166
|
-
);
|
|
4167
|
-
} else if (destination === "Darwinia" || destination === "Crab" || destination === "Quartz") {
|
|
4168
|
-
throw new NodeNotSupportedError(
|
|
4169
|
-
"These nodes do not support XCM transfers from Relay / to Relay chain."
|
|
4170
|
-
);
|
|
4215
|
+
var paraId = getParaId(destination);
|
|
4216
|
+
if (destination === 'Statemine' || destination === 'Encointer') {
|
|
4217
|
+
// Same for Statemint, Statemine and Encoiter
|
|
4218
|
+
return api.tx.xcmPallet.limitedTeleportAssets(createHeaderPolkadotXCM('RelayToPara', paraId), handleAddress('RelayToPara', '', api, to, paraId), createCurrencySpecification(amount, 'RelayToPara'), 0, 'Unlimited');
|
|
4219
|
+
} else if (destination === 'Darwinia' || destination === 'Crab' || destination === 'Quartz') {
|
|
4220
|
+
// Do not do anything because Darwinia and Crab does not have DOT and KSM registered Quartz does not work with UMP & DMP too
|
|
4221
|
+
throw new NodeNotSupportedError('These nodes do not support XCM transfers from Relay / to Relay chain.');
|
|
4171
4222
|
}
|
|
4172
|
-
return api.tx.xcmPallet.reserveTransferAssets(
|
|
4173
|
-
createHeaderPolkadotXCM("RelayToPara", paraId),
|
|
4174
|
-
handleAddress("RelayToPara", "", api, to, paraId),
|
|
4175
|
-
createCurrencySpecification(amount, "RelayToPara"),
|
|
4176
|
-
0
|
|
4177
|
-
);
|
|
4223
|
+
return api.tx.xcmPallet.reserveTransferAssets(createHeaderPolkadotXCM('RelayToPara', paraId), handleAddress('RelayToPara', '', api, to, paraId), createCurrencySpecification(amount, 'RelayToPara'), 0);
|
|
4178
4224
|
}
|
|
4179
4225
|
|
|
4180
|
-
|
|
4226
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
4181
4227
|
__proto__: null,
|
|
4182
4228
|
send: send,
|
|
4183
4229
|
transferRelayToPara: transferRelayToPara
|
|
4184
|
-
};
|
|
4230
|
+
});
|
|
4185
4231
|
|
|
4186
4232
|
function addLiquidity(api, assetA, assetB, amountA, amountBMaxLimit) {
|
|
4187
4233
|
return api.tx.xyk.addLiquidity(assetA, assetB, amountA, amountBMaxLimit);
|
|
@@ -4199,363 +4245,483 @@ function sell(api, assetIn, assetOut, amount, maxLimit, discount) {
|
|
|
4199
4245
|
return api.tx.xyk.sell(assetIn, assetOut, amount, maxLimit, discount);
|
|
4200
4246
|
}
|
|
4201
4247
|
|
|
4202
|
-
|
|
4248
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
4203
4249
|
__proto__: null,
|
|
4204
4250
|
addLiquidity: addLiquidity,
|
|
4205
4251
|
buy: buy,
|
|
4206
4252
|
createPool: createPool,
|
|
4207
4253
|
removeLiquidity: removeLiquidity,
|
|
4208
4254
|
sell: sell
|
|
4209
|
-
};
|
|
4255
|
+
});
|
|
4210
4256
|
|
|
4211
4257
|
function openChannel(api, origin, destination, maxSize, maxMessageSize) {
|
|
4212
|
-
return api.tx.sudo.sudo(
|
|
4213
|
-
api.tx.parasSudoWrapper.sudoEstablishHrmpChannel(
|
|
4214
|
-
getParaId(origin),
|
|
4215
|
-
getParaId(destination),
|
|
4216
|
-
maxSize,
|
|
4217
|
-
maxMessageSize
|
|
4218
|
-
)
|
|
4219
|
-
);
|
|
4258
|
+
return api.tx.sudo.sudo(api.tx.parasSudoWrapper.sudoEstablishHrmpChannel(getParaId(origin), getParaId(destination), maxSize, maxMessageSize));
|
|
4220
4259
|
}
|
|
4221
4260
|
|
|
4222
|
-
|
|
4261
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
4223
4262
|
__proto__: null,
|
|
4224
4263
|
openChannel: openChannel
|
|
4225
|
-
};
|
|
4264
|
+
});
|
|
4226
4265
|
|
|
4227
4266
|
function closeChannel(api, origin, inbound, outbound) {
|
|
4228
4267
|
return api.tx.sudo.sudo(api.tx.hrmp.forceCleanHrmp(getParaId(origin), inbound, outbound));
|
|
4229
4268
|
}
|
|
4230
4269
|
|
|
4231
|
-
|
|
4270
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
4232
4271
|
__proto__: null,
|
|
4233
4272
|
closeChannel: closeChannel
|
|
4234
|
-
};
|
|
4273
|
+
});
|
|
4235
4274
|
|
|
4236
|
-
|
|
4237
|
-
|
|
4275
|
+
var AddLiquidityBuilder = /*#__PURE__*/function () {
|
|
4276
|
+
function AddLiquidityBuilder(api) {
|
|
4277
|
+
_classCallCheck(this, AddLiquidityBuilder);
|
|
4238
4278
|
this.api = api;
|
|
4239
4279
|
}
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
}
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
}
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4280
|
+
_createClass(AddLiquidityBuilder, [{
|
|
4281
|
+
key: "assetA",
|
|
4282
|
+
value: function assetA(_assetA) {
|
|
4283
|
+
this._assetA = _assetA;
|
|
4284
|
+
return this;
|
|
4285
|
+
}
|
|
4286
|
+
}, {
|
|
4287
|
+
key: "assetB",
|
|
4288
|
+
value: function assetB(_assetB) {
|
|
4289
|
+
this._assetB = _assetB;
|
|
4290
|
+
return this;
|
|
4291
|
+
}
|
|
4292
|
+
}, {
|
|
4293
|
+
key: "amountA",
|
|
4294
|
+
value: function amountA(_amountA) {
|
|
4295
|
+
this._amountA = _amountA;
|
|
4296
|
+
return this;
|
|
4297
|
+
}
|
|
4298
|
+
}, {
|
|
4299
|
+
key: "amountBMaxLimit",
|
|
4300
|
+
value: function amountBMaxLimit(_amountBMaxLimit) {
|
|
4301
|
+
this._amountBMaxLimit = _amountBMaxLimit;
|
|
4302
|
+
return this;
|
|
4303
|
+
}
|
|
4304
|
+
}, {
|
|
4305
|
+
key: "build",
|
|
4306
|
+
value: function build() {
|
|
4307
|
+
return addLiquidity(this.api, this._assetA, this._assetB, this._amountA, this._amountBMaxLimit);
|
|
4308
|
+
}
|
|
4309
|
+
}], [{
|
|
4310
|
+
key: "create",
|
|
4311
|
+
value: function create(api) {
|
|
4312
|
+
return new AddLiquidityBuilder(api);
|
|
4313
|
+
}
|
|
4314
|
+
}]);
|
|
4315
|
+
return AddLiquidityBuilder;
|
|
4316
|
+
}();
|
|
4264
4317
|
|
|
4265
|
-
|
|
4266
|
-
|
|
4318
|
+
var BuyBuilder = /*#__PURE__*/function () {
|
|
4319
|
+
function BuyBuilder(api) {
|
|
4320
|
+
_classCallCheck(this, BuyBuilder);
|
|
4267
4321
|
this.api = api;
|
|
4268
4322
|
}
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
}
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
}
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
this.
|
|
4297
|
-
this
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4323
|
+
_createClass(BuyBuilder, [{
|
|
4324
|
+
key: "assetOut",
|
|
4325
|
+
value: function assetOut(_assetOut) {
|
|
4326
|
+
this._assetOut = _assetOut;
|
|
4327
|
+
return this;
|
|
4328
|
+
}
|
|
4329
|
+
}, {
|
|
4330
|
+
key: "assetIn",
|
|
4331
|
+
value: function assetIn(_assetIn) {
|
|
4332
|
+
this._assetIn = _assetIn;
|
|
4333
|
+
return this;
|
|
4334
|
+
}
|
|
4335
|
+
}, {
|
|
4336
|
+
key: "amount",
|
|
4337
|
+
value: function amount(_amount) {
|
|
4338
|
+
this._amount = _amount;
|
|
4339
|
+
return this;
|
|
4340
|
+
}
|
|
4341
|
+
}, {
|
|
4342
|
+
key: "maxLimit",
|
|
4343
|
+
value: function maxLimit(_maxLimit) {
|
|
4344
|
+
this._maxLimit = _maxLimit;
|
|
4345
|
+
return this;
|
|
4346
|
+
}
|
|
4347
|
+
}, {
|
|
4348
|
+
key: "discount",
|
|
4349
|
+
value: function discount(_discount) {
|
|
4350
|
+
this._discount = _discount;
|
|
4351
|
+
return this;
|
|
4352
|
+
}
|
|
4353
|
+
}, {
|
|
4354
|
+
key: "build",
|
|
4355
|
+
value: function build() {
|
|
4356
|
+
return buy(this.api, this._assetOut, this._assetIn, this._amount, this._maxLimit, this._discount);
|
|
4357
|
+
}
|
|
4358
|
+
}], [{
|
|
4359
|
+
key: "create",
|
|
4360
|
+
value: function create(api) {
|
|
4361
|
+
return new BuyBuilder(api);
|
|
4362
|
+
}
|
|
4363
|
+
}]);
|
|
4364
|
+
return BuyBuilder;
|
|
4365
|
+
}();
|
|
4304
4366
|
|
|
4305
|
-
|
|
4306
|
-
|
|
4367
|
+
var CloseChannelBuilder = /*#__PURE__*/function () {
|
|
4368
|
+
function CloseChannelBuilder(api, from) {
|
|
4369
|
+
_classCallCheck(this, CloseChannelBuilder);
|
|
4307
4370
|
this.api = api;
|
|
4308
4371
|
this.from = from;
|
|
4309
4372
|
}
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
}
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4373
|
+
_createClass(CloseChannelBuilder, [{
|
|
4374
|
+
key: "inbound",
|
|
4375
|
+
value: function inbound(_inbound) {
|
|
4376
|
+
this._inbound = _inbound;
|
|
4377
|
+
return this;
|
|
4378
|
+
}
|
|
4379
|
+
}, {
|
|
4380
|
+
key: "outbound",
|
|
4381
|
+
value: function outbound(_outbound) {
|
|
4382
|
+
this._outbound = _outbound;
|
|
4383
|
+
return this;
|
|
4384
|
+
}
|
|
4385
|
+
}, {
|
|
4386
|
+
key: "build",
|
|
4387
|
+
value: function build() {
|
|
4388
|
+
return closeChannel(this.api, this.from, this._inbound, this._outbound);
|
|
4389
|
+
}
|
|
4390
|
+
}], [{
|
|
4391
|
+
key: "create",
|
|
4392
|
+
value: function create(api, from) {
|
|
4393
|
+
return new CloseChannelBuilder(api, from);
|
|
4394
|
+
}
|
|
4395
|
+
}]);
|
|
4396
|
+
return CloseChannelBuilder;
|
|
4397
|
+
}();
|
|
4326
4398
|
|
|
4327
|
-
|
|
4328
|
-
|
|
4399
|
+
var CreatePoolBuilder = /*#__PURE__*/function () {
|
|
4400
|
+
function CreatePoolBuilder(api) {
|
|
4401
|
+
_classCallCheck(this, CreatePoolBuilder);
|
|
4329
4402
|
this.api = api;
|
|
4330
4403
|
}
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
}
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
}
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4404
|
+
_createClass(CreatePoolBuilder, [{
|
|
4405
|
+
key: "assetA",
|
|
4406
|
+
value: function assetA(_assetA) {
|
|
4407
|
+
this._assetA = _assetA;
|
|
4408
|
+
return this;
|
|
4409
|
+
}
|
|
4410
|
+
}, {
|
|
4411
|
+
key: "amountA",
|
|
4412
|
+
value: function amountA(_amountA) {
|
|
4413
|
+
this._amountA = _amountA;
|
|
4414
|
+
return this;
|
|
4415
|
+
}
|
|
4416
|
+
}, {
|
|
4417
|
+
key: "assetB",
|
|
4418
|
+
value: function assetB(_assetB) {
|
|
4419
|
+
this._assetB = _assetB;
|
|
4420
|
+
return this;
|
|
4421
|
+
}
|
|
4422
|
+
}, {
|
|
4423
|
+
key: "amountB",
|
|
4424
|
+
value: function amountB(_amountB) {
|
|
4425
|
+
this._amountB = _amountB;
|
|
4426
|
+
return this;
|
|
4427
|
+
}
|
|
4428
|
+
}, {
|
|
4429
|
+
key: "build",
|
|
4430
|
+
value: function build() {
|
|
4431
|
+
return createPool(this.api, this._assetA, this._amountA, this._assetB, this._amountB);
|
|
4432
|
+
}
|
|
4433
|
+
}], [{
|
|
4434
|
+
key: "create",
|
|
4435
|
+
value: function create(api) {
|
|
4436
|
+
return new CreatePoolBuilder(api);
|
|
4437
|
+
}
|
|
4438
|
+
}]);
|
|
4439
|
+
return CreatePoolBuilder;
|
|
4440
|
+
}();
|
|
4355
4441
|
|
|
4356
|
-
|
|
4357
|
-
|
|
4442
|
+
var OpenChannelBuilder = /*#__PURE__*/function () {
|
|
4443
|
+
function OpenChannelBuilder(api, from, to) {
|
|
4444
|
+
_classCallCheck(this, OpenChannelBuilder);
|
|
4358
4445
|
this.api = api;
|
|
4359
4446
|
this.from = from;
|
|
4360
4447
|
this.to = to;
|
|
4361
4448
|
}
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
}
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4449
|
+
_createClass(OpenChannelBuilder, [{
|
|
4450
|
+
key: "maxSize",
|
|
4451
|
+
value: function maxSize(size) {
|
|
4452
|
+
this._maxSize = size;
|
|
4453
|
+
return this;
|
|
4454
|
+
}
|
|
4455
|
+
}, {
|
|
4456
|
+
key: "maxMessageSize",
|
|
4457
|
+
value: function maxMessageSize(size) {
|
|
4458
|
+
this._maxMessageSize = size;
|
|
4459
|
+
return this;
|
|
4460
|
+
}
|
|
4461
|
+
}, {
|
|
4462
|
+
key: "build",
|
|
4463
|
+
value: function build() {
|
|
4464
|
+
return openChannel(this.api, this.from, this.to, this._maxSize, this._maxMessageSize);
|
|
4465
|
+
}
|
|
4466
|
+
}], [{
|
|
4467
|
+
key: "create",
|
|
4468
|
+
value: function create(api, from, to) {
|
|
4469
|
+
return new OpenChannelBuilder(api, from, to);
|
|
4470
|
+
}
|
|
4471
|
+
}]);
|
|
4472
|
+
return OpenChannelBuilder;
|
|
4473
|
+
}();
|
|
4378
4474
|
|
|
4379
|
-
|
|
4380
|
-
|
|
4475
|
+
var RelayToParaBuilder = /*#__PURE__*/function () {
|
|
4476
|
+
function RelayToParaBuilder(api, to) {
|
|
4477
|
+
_classCallCheck(this, RelayToParaBuilder);
|
|
4381
4478
|
this.api = api;
|
|
4382
4479
|
this.to = to;
|
|
4383
4480
|
}
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
}
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4481
|
+
_createClass(RelayToParaBuilder, [{
|
|
4482
|
+
key: "amount",
|
|
4483
|
+
value: function amount(_amount) {
|
|
4484
|
+
this._amount = _amount;
|
|
4485
|
+
return this;
|
|
4486
|
+
}
|
|
4487
|
+
}, {
|
|
4488
|
+
key: "address",
|
|
4489
|
+
value: function address(_address) {
|
|
4490
|
+
this._address = _address;
|
|
4491
|
+
return this;
|
|
4492
|
+
}
|
|
4493
|
+
}, {
|
|
4494
|
+
key: "build",
|
|
4495
|
+
value: function build() {
|
|
4496
|
+
return transferRelayToPara(this.api, this.to, this._amount, this._address);
|
|
4497
|
+
}
|
|
4498
|
+
}], [{
|
|
4499
|
+
key: "create",
|
|
4500
|
+
value: function create(api, to) {
|
|
4501
|
+
return new RelayToParaBuilder(api, to);
|
|
4502
|
+
}
|
|
4503
|
+
}]);
|
|
4504
|
+
return RelayToParaBuilder;
|
|
4505
|
+
}();
|
|
4400
4506
|
|
|
4401
|
-
|
|
4402
|
-
|
|
4507
|
+
var RemoveLiquidityBuilder = /*#__PURE__*/function () {
|
|
4508
|
+
function RemoveLiquidityBuilder(api) {
|
|
4509
|
+
_classCallCheck(this, RemoveLiquidityBuilder);
|
|
4403
4510
|
this.api = api;
|
|
4404
4511
|
}
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
}
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
}
|
|
4424
|
-
|
|
4512
|
+
_createClass(RemoveLiquidityBuilder, [{
|
|
4513
|
+
key: "assetA",
|
|
4514
|
+
value: function assetA(_assetA) {
|
|
4515
|
+
this._assetA = _assetA;
|
|
4516
|
+
return this;
|
|
4517
|
+
}
|
|
4518
|
+
}, {
|
|
4519
|
+
key: "assetB",
|
|
4520
|
+
value: function assetB(_assetB) {
|
|
4521
|
+
this._assetB = _assetB;
|
|
4522
|
+
return this;
|
|
4523
|
+
}
|
|
4524
|
+
}, {
|
|
4525
|
+
key: "liquidityAmount",
|
|
4526
|
+
value: function liquidityAmount(_liquidityAmount) {
|
|
4527
|
+
this._liquidityAmount = _liquidityAmount;
|
|
4528
|
+
return this;
|
|
4529
|
+
}
|
|
4530
|
+
}, {
|
|
4531
|
+
key: "build",
|
|
4532
|
+
value: function build() {
|
|
4533
|
+
return removeLiquidity(this.api, this._assetA, this._assetB, this._liquidityAmount);
|
|
4534
|
+
}
|
|
4535
|
+
}], [{
|
|
4536
|
+
key: "create",
|
|
4537
|
+
value: function create(api) {
|
|
4538
|
+
return new RemoveLiquidityBuilder(api);
|
|
4539
|
+
}
|
|
4540
|
+
}]);
|
|
4541
|
+
return RemoveLiquidityBuilder;
|
|
4542
|
+
}();
|
|
4425
4543
|
|
|
4426
|
-
|
|
4427
|
-
|
|
4544
|
+
var SellBuilder = /*#__PURE__*/function () {
|
|
4545
|
+
function SellBuilder(api) {
|
|
4546
|
+
_classCallCheck(this, SellBuilder);
|
|
4428
4547
|
this.api = api;
|
|
4429
4548
|
}
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
}
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
this.
|
|
4458
|
-
this
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4549
|
+
_createClass(SellBuilder, [{
|
|
4550
|
+
key: "assetIn",
|
|
4551
|
+
value: function assetIn(_assetIn) {
|
|
4552
|
+
this._assetIn = _assetIn;
|
|
4553
|
+
return this;
|
|
4554
|
+
}
|
|
4555
|
+
}, {
|
|
4556
|
+
key: "assetOut",
|
|
4557
|
+
value: function assetOut(_assetOut) {
|
|
4558
|
+
this._assetOut = _assetOut;
|
|
4559
|
+
return this;
|
|
4560
|
+
}
|
|
4561
|
+
}, {
|
|
4562
|
+
key: "amount",
|
|
4563
|
+
value: function amount(_amount) {
|
|
4564
|
+
this._amount = _amount;
|
|
4565
|
+
return this;
|
|
4566
|
+
}
|
|
4567
|
+
}, {
|
|
4568
|
+
key: "maxLimit",
|
|
4569
|
+
value: function maxLimit(_maxLimit) {
|
|
4570
|
+
this._maxLimit = _maxLimit;
|
|
4571
|
+
return this;
|
|
4572
|
+
}
|
|
4573
|
+
}, {
|
|
4574
|
+
key: "discount",
|
|
4575
|
+
value: function discount(_discount) {
|
|
4576
|
+
this._discount = _discount;
|
|
4577
|
+
return this;
|
|
4578
|
+
}
|
|
4579
|
+
}, {
|
|
4580
|
+
key: "build",
|
|
4581
|
+
value: function build() {
|
|
4582
|
+
return sell(this.api, this._assetIn, this._assetOut, this._amount, this._maxLimit, this._discount);
|
|
4583
|
+
}
|
|
4584
|
+
}], [{
|
|
4585
|
+
key: "create",
|
|
4586
|
+
value: function create(api) {
|
|
4587
|
+
return new SellBuilder(api);
|
|
4588
|
+
}
|
|
4589
|
+
}]);
|
|
4590
|
+
return SellBuilder;
|
|
4591
|
+
}();
|
|
4465
4592
|
|
|
4466
|
-
|
|
4467
|
-
|
|
4593
|
+
var SendBuilder = /*#__PURE__*/function () {
|
|
4594
|
+
function SendBuilder(api, from, to, currency) {
|
|
4595
|
+
_classCallCheck(this, SendBuilder);
|
|
4468
4596
|
this.api = api;
|
|
4469
4597
|
this.from = from;
|
|
4470
4598
|
this.to = to;
|
|
4471
4599
|
this.currency = currency;
|
|
4472
4600
|
}
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
this.from,
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
}
|
|
4502
|
-
|
|
4503
|
-
|
|
4601
|
+
_createClass(SendBuilder, [{
|
|
4602
|
+
key: "currencyId",
|
|
4603
|
+
value: function currencyId(_currencyId) {
|
|
4604
|
+
this._currencyId = _currencyId;
|
|
4605
|
+
return this;
|
|
4606
|
+
}
|
|
4607
|
+
}, {
|
|
4608
|
+
key: "amount",
|
|
4609
|
+
value: function amount(_amount) {
|
|
4610
|
+
this._amount = _amount;
|
|
4611
|
+
return this;
|
|
4612
|
+
}
|
|
4613
|
+
}, {
|
|
4614
|
+
key: "address",
|
|
4615
|
+
value: function address(_address) {
|
|
4616
|
+
this._address = _address;
|
|
4617
|
+
return this;
|
|
4618
|
+
}
|
|
4619
|
+
}, {
|
|
4620
|
+
key: "build",
|
|
4621
|
+
value: function build() {
|
|
4622
|
+
return send(this.api, this.from, this.currency, this._currencyId, this._amount, this._address, this.to);
|
|
4623
|
+
}
|
|
4624
|
+
}], [{
|
|
4625
|
+
key: "createParaToRelay",
|
|
4626
|
+
value: function createParaToRelay(api, from, currency) {
|
|
4627
|
+
return new SendBuilder(api, from, undefined, currency);
|
|
4628
|
+
}
|
|
4629
|
+
}, {
|
|
4630
|
+
key: "createParaToPara",
|
|
4631
|
+
value: function createParaToPara(api, from, to, currency) {
|
|
4632
|
+
return new SendBuilder(api, from, to, currency);
|
|
4633
|
+
}
|
|
4634
|
+
}]);
|
|
4635
|
+
return SendBuilder;
|
|
4636
|
+
}();
|
|
4504
4637
|
|
|
4505
|
-
|
|
4506
|
-
|
|
4638
|
+
var ToGeneralBuilder = /*#__PURE__*/function () {
|
|
4639
|
+
function ToGeneralBuilder(api, from, to) {
|
|
4640
|
+
_classCallCheck(this, ToGeneralBuilder);
|
|
4507
4641
|
this.api = api;
|
|
4508
4642
|
this.from = from;
|
|
4509
4643
|
this.to = to;
|
|
4510
4644
|
}
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
}
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4645
|
+
_createClass(ToGeneralBuilder, [{
|
|
4646
|
+
key: "currency",
|
|
4647
|
+
value: function currency(_currency) {
|
|
4648
|
+
return SendBuilder.createParaToPara(this.api, this.from, this.to, _currency);
|
|
4649
|
+
}
|
|
4650
|
+
}, {
|
|
4651
|
+
key: "openChannel",
|
|
4652
|
+
value: function openChannel() {
|
|
4653
|
+
return OpenChannelBuilder.create(this.api, this.from, this.to);
|
|
4654
|
+
}
|
|
4655
|
+
}]);
|
|
4656
|
+
return ToGeneralBuilder;
|
|
4657
|
+
}();
|
|
4658
|
+
var FromGeneralBuilder = /*#__PURE__*/function () {
|
|
4659
|
+
function FromGeneralBuilder(api, from) {
|
|
4660
|
+
_classCallCheck(this, FromGeneralBuilder);
|
|
4520
4661
|
this.api = api;
|
|
4521
4662
|
this.from = from;
|
|
4522
4663
|
}
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
}
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
}
|
|
4533
|
-
|
|
4534
|
-
|
|
4664
|
+
_createClass(FromGeneralBuilder, [{
|
|
4665
|
+
key: "to",
|
|
4666
|
+
value: function to(node) {
|
|
4667
|
+
return new ToGeneralBuilder(this.api, this.from, node);
|
|
4668
|
+
}
|
|
4669
|
+
}, {
|
|
4670
|
+
key: "currency",
|
|
4671
|
+
value: function currency(_currency2) {
|
|
4672
|
+
return SendBuilder.createParaToRelay(this.api, this.from, _currency2);
|
|
4673
|
+
}
|
|
4674
|
+
}, {
|
|
4675
|
+
key: "closeChannel",
|
|
4676
|
+
value: function closeChannel() {
|
|
4677
|
+
return CloseChannelBuilder.create(this.api, this.from);
|
|
4678
|
+
}
|
|
4679
|
+
}]);
|
|
4680
|
+
return FromGeneralBuilder;
|
|
4681
|
+
}();
|
|
4682
|
+
var GeneralBuilder = /*#__PURE__*/function () {
|
|
4683
|
+
function GeneralBuilder(api) {
|
|
4684
|
+
_classCallCheck(this, GeneralBuilder);
|
|
4535
4685
|
this.api = api;
|
|
4536
4686
|
}
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
}
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4687
|
+
_createClass(GeneralBuilder, [{
|
|
4688
|
+
key: "from",
|
|
4689
|
+
value: function from(node) {
|
|
4690
|
+
return new FromGeneralBuilder(this.api, node);
|
|
4691
|
+
}
|
|
4692
|
+
}, {
|
|
4693
|
+
key: "to",
|
|
4694
|
+
value: function to(node) {
|
|
4695
|
+
return RelayToParaBuilder.create(this.api, node);
|
|
4696
|
+
}
|
|
4697
|
+
}, {
|
|
4698
|
+
key: "addLiquidity",
|
|
4699
|
+
value: function addLiquidity() {
|
|
4700
|
+
return AddLiquidityBuilder.create(this.api);
|
|
4701
|
+
}
|
|
4702
|
+
}, {
|
|
4703
|
+
key: "removeLiquidity",
|
|
4704
|
+
value: function removeLiquidity() {
|
|
4705
|
+
return RemoveLiquidityBuilder.create(this.api);
|
|
4706
|
+
}
|
|
4707
|
+
}, {
|
|
4708
|
+
key: "buy",
|
|
4709
|
+
value: function buy() {
|
|
4710
|
+
return BuyBuilder.create(this.api);
|
|
4711
|
+
}
|
|
4712
|
+
}, {
|
|
4713
|
+
key: "sell",
|
|
4714
|
+
value: function sell() {
|
|
4715
|
+
return SellBuilder.create(this.api);
|
|
4716
|
+
}
|
|
4717
|
+
}, {
|
|
4718
|
+
key: "createPool",
|
|
4719
|
+
value: function createPool() {
|
|
4720
|
+
return CreatePoolBuilder.create(this.api);
|
|
4721
|
+
}
|
|
4722
|
+
}]);
|
|
4723
|
+
return GeneralBuilder;
|
|
4724
|
+
}();
|
|
4559
4725
|
function Builder(api) {
|
|
4560
4726
|
return new GeneralBuilder(api);
|
|
4561
4727
|
}
|
|
@@ -4565,6 +4731,17 @@ exports.NODE_NAMES = NODE_NAMES;
|
|
|
4565
4731
|
exports.SUPPORTED_PALLETS = SUPPORTED_PALLETS;
|
|
4566
4732
|
exports.assets = index$4;
|
|
4567
4733
|
exports.closeChannels = index;
|
|
4734
|
+
exports.getAllAssetsSymbols = getAllAssetsSymbols;
|
|
4735
|
+
exports.getAssetDecimals = getAssetDecimals;
|
|
4736
|
+
exports.getAssetId = getAssetId;
|
|
4737
|
+
exports.getAssetsObject = getAssetsObject;
|
|
4738
|
+
exports.getDefaultPallet = getDefaultPallet;
|
|
4739
|
+
exports.getNativeAssets = getNativeAssets;
|
|
4740
|
+
exports.getOtherAssets = getOtherAssets;
|
|
4741
|
+
exports.getParaId = getParaId;
|
|
4742
|
+
exports.getRelayChainSymbol = getRelayChainSymbol;
|
|
4743
|
+
exports.getSupportedPallets = getSupportedPallets;
|
|
4744
|
+
exports.hasSupportForAsset = hasSupportForAsset;
|
|
4568
4745
|
exports.openChannels = index$1;
|
|
4569
4746
|
exports.xcmPallet = index$3;
|
|
4570
4747
|
exports.xyk = index$2;
|