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