@paraspell/sdk-pjs 8.0.0 → 8.0.1
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 +372 -273
- package/dist/index.d.ts +27 -6
- package/dist/index.mjs +373 -274
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -18,6 +18,31 @@ function _arrayWithHoles(r) {
|
|
|
18
18
|
function _arrayWithoutHoles(r) {
|
|
19
19
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
20
20
|
}
|
|
21
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
22
|
+
try {
|
|
23
|
+
var i = n[a](c),
|
|
24
|
+
u = i.value;
|
|
25
|
+
} catch (n) {
|
|
26
|
+
return void e(n);
|
|
27
|
+
}
|
|
28
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
29
|
+
}
|
|
30
|
+
function _asyncToGenerator(n) {
|
|
31
|
+
return function () {
|
|
32
|
+
var t = this,
|
|
33
|
+
e = arguments;
|
|
34
|
+
return new Promise(function (r, o) {
|
|
35
|
+
var a = n.apply(t, e);
|
|
36
|
+
function _next(n) {
|
|
37
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
|
|
38
|
+
}
|
|
39
|
+
function _throw(n) {
|
|
40
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
|
|
41
|
+
}
|
|
42
|
+
_next(void 0);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
21
46
|
function _classCallCheck(a, n) {
|
|
22
47
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
23
48
|
}
|
|
@@ -32,6 +57,14 @@ function _createClass(e, r, t) {
|
|
|
32
57
|
writable: !1
|
|
33
58
|
}), e;
|
|
34
59
|
}
|
|
60
|
+
function _defineProperty(e, r, t) {
|
|
61
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
62
|
+
value: t,
|
|
63
|
+
enumerable: !0,
|
|
64
|
+
configurable: !0,
|
|
65
|
+
writable: !0
|
|
66
|
+
}) : e[r] = t, e;
|
|
67
|
+
}
|
|
35
68
|
function _iterableToArray(r) {
|
|
36
69
|
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
37
70
|
}
|
|
@@ -65,6 +98,27 @@ function _nonIterableRest() {
|
|
|
65
98
|
function _nonIterableSpread() {
|
|
66
99
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
67
100
|
}
|
|
101
|
+
function ownKeys(e, r) {
|
|
102
|
+
var t = Object.keys(e);
|
|
103
|
+
if (Object.getOwnPropertySymbols) {
|
|
104
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
105
|
+
r && (o = o.filter(function (r) {
|
|
106
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
107
|
+
})), t.push.apply(t, o);
|
|
108
|
+
}
|
|
109
|
+
return t;
|
|
110
|
+
}
|
|
111
|
+
function _objectSpread2(e) {
|
|
112
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
113
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
114
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
115
|
+
_defineProperty(e, r, t[r]);
|
|
116
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
117
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return e;
|
|
121
|
+
}
|
|
68
122
|
function _regeneratorRuntime() {
|
|
69
123
|
_regeneratorRuntime = function () {
|
|
70
124
|
return e;
|
|
@@ -376,11 +430,11 @@ function _toPrimitive(t, r) {
|
|
|
376
430
|
if ("object" != typeof t || !t) return t;
|
|
377
431
|
var e = t[Symbol.toPrimitive];
|
|
378
432
|
if (void 0 !== e) {
|
|
379
|
-
var i = e.call(t, r);
|
|
433
|
+
var i = e.call(t, r || "default");
|
|
380
434
|
if ("object" != typeof i) return i;
|
|
381
435
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
382
436
|
}
|
|
383
|
-
return (String )(t);
|
|
437
|
+
return ("string" === r ? String : Number)(t);
|
|
384
438
|
}
|
|
385
439
|
function _toPropertyKey(t) {
|
|
386
440
|
var i = _toPrimitive(t, "string");
|
|
@@ -403,38 +457,6 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
403
457
|
}
|
|
404
458
|
}
|
|
405
459
|
|
|
406
|
-
/******************************************************************************
|
|
407
|
-
Copyright (c) Microsoft Corporation.
|
|
408
|
-
|
|
409
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
410
|
-
purpose with or without fee is hereby granted.
|
|
411
|
-
|
|
412
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
413
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
414
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
415
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
416
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
417
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
418
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
419
|
-
***************************************************************************** */
|
|
420
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
424
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
425
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
426
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
427
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
428
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
429
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
434
|
-
var e = new Error(message);
|
|
435
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
436
|
-
};
|
|
437
|
-
|
|
438
460
|
var findEthAsset = function findEthAsset(currency) {
|
|
439
461
|
var ethAssets = sdkCore.getOtherAssets('Ethereum');
|
|
440
462
|
var ethAsset = 'symbol' in currency ? ethAssets.find(function (asset) {
|
|
@@ -448,8 +470,8 @@ var findEthAsset = function findEthAsset(currency) {
|
|
|
448
470
|
return ethAsset;
|
|
449
471
|
};
|
|
450
472
|
|
|
451
|
-
var createContext = function
|
|
452
|
-
|
|
473
|
+
var createContext = /*#__PURE__*/function () {
|
|
474
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(executionUrl, config) {
|
|
453
475
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
454
476
|
while (1) switch (_context.prev = _context.next) {
|
|
455
477
|
case 0:
|
|
@@ -477,7 +499,10 @@ var createContext = function createContext(executionUrl, config) {
|
|
|
477
499
|
}
|
|
478
500
|
}, _callee);
|
|
479
501
|
}));
|
|
480
|
-
|
|
502
|
+
return function createContext(_x, _x2) {
|
|
503
|
+
return _ref.apply(this, arguments);
|
|
504
|
+
};
|
|
505
|
+
}();
|
|
481
506
|
|
|
482
507
|
var checkPlanFailure = function checkPlanFailure(plan) {
|
|
483
508
|
if (plan.failure) {
|
|
@@ -501,109 +526,106 @@ var isEthersSigner = function isEthersSigner(signer) {
|
|
|
501
526
|
*
|
|
502
527
|
* @throws Will throw an error if the transfer validation fails or if the transfer cannot be completed.
|
|
503
528
|
*/
|
|
504
|
-
var transferEthToPolkadot$1 = function
|
|
505
|
-
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
throw new Error('provider parameter is required for Snowbridge transfers.');
|
|
521
|
-
case 2:
|
|
522
|
-
if (isEthersSigner(signer)) {
|
|
523
|
-
_context.next = 4;
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
throw new Error('Snowbridge does not support Viem provider yet.');
|
|
527
|
-
case 4:
|
|
528
|
-
ethAsset = findEthAsset(currency);
|
|
529
|
-
env = api.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
530
|
-
_context.next = 8;
|
|
531
|
-
return createContext(provider, env.config);
|
|
532
|
-
case 8:
|
|
533
|
-
context = _context.sent;
|
|
534
|
-
destParaId = sdkCore.getParaId(to);
|
|
535
|
-
_context.next = 12;
|
|
536
|
-
return api.toPolkadot.validateSend(context, signer, address, (_b = ethAsset.assetId) !== null && _b !== void 0 ? _b : '', destParaId, BigInt(currency.amount), BigInt(0));
|
|
537
|
-
case 12:
|
|
538
|
-
plan = _context.sent;
|
|
539
|
-
checkPlanFailure(plan);
|
|
540
|
-
_context.next = 16;
|
|
541
|
-
return api.toPolkadot.send(context, signer, plan);
|
|
542
|
-
case 16:
|
|
543
|
-
result = _context.sent;
|
|
544
|
-
return _context.abrupt("return", {
|
|
545
|
-
result: result,
|
|
546
|
-
plan: plan
|
|
547
|
-
});
|
|
548
|
-
case 18:
|
|
549
|
-
case "end":
|
|
550
|
-
return _context.stop();
|
|
551
|
-
}
|
|
552
|
-
}, _callee);
|
|
553
|
-
})();
|
|
554
|
-
});
|
|
555
|
-
};
|
|
556
|
-
|
|
557
|
-
var buildEthTransferOptions = function buildEthTransferOptions(_a) {
|
|
558
|
-
return __awaiter(void 0, [_a], void 0, function (_ref) {
|
|
559
|
-
var currency = _ref.currency,
|
|
560
|
-
to = _ref.to,
|
|
561
|
-
address = _ref.address,
|
|
562
|
-
destAddress = _ref.destAddress;
|
|
563
|
-
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
564
|
-
var _b, ethAsset, env, EXECUTION_URL, context, destParaId, signer, plan;
|
|
565
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
566
|
-
while (1) switch (_context.prev = _context.next) {
|
|
567
|
-
case 0:
|
|
568
|
-
ethAsset = findEthAsset(currency);
|
|
569
|
-
env = api.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
570
|
-
EXECUTION_URL = 'https://eth.llamarpc.com';
|
|
529
|
+
var transferEthToPolkadot$1 = /*#__PURE__*/function () {
|
|
530
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
531
|
+
var _ethAsset$assetId;
|
|
532
|
+
var provider, signer, address, to, currency, ethAsset, env, context, destParaId, plan, result;
|
|
533
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
534
|
+
while (1) switch (_context.prev = _context.next) {
|
|
535
|
+
case 0:
|
|
536
|
+
provider = _ref.provider, signer = _ref.signer, address = _ref.address, to = _ref.to, currency = _ref.currency;
|
|
537
|
+
if (provider) {
|
|
538
|
+
_context.next = 3;
|
|
539
|
+
break;
|
|
540
|
+
}
|
|
541
|
+
throw new Error('provider parameter is required for Snowbridge transfers.');
|
|
542
|
+
case 3:
|
|
543
|
+
if (isEthersSigner(signer)) {
|
|
571
544
|
_context.next = 5;
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
throw new Error('Snowbridge does not support Viem provider yet.');
|
|
548
|
+
case 5:
|
|
549
|
+
ethAsset = findEthAsset(currency);
|
|
550
|
+
env = api.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
551
|
+
_context.next = 9;
|
|
552
|
+
return createContext(provider, env.config);
|
|
553
|
+
case 9:
|
|
554
|
+
context = _context.sent;
|
|
555
|
+
destParaId = sdkCore.getParaId(to);
|
|
556
|
+
_context.next = 13;
|
|
557
|
+
return api.toPolkadot.validateSend(context, signer, address, (_ethAsset$assetId = ethAsset.assetId) !== null && _ethAsset$assetId !== void 0 ? _ethAsset$assetId : '', destParaId, BigInt(currency.amount), 0n);
|
|
558
|
+
case 13:
|
|
559
|
+
plan = _context.sent;
|
|
560
|
+
checkPlanFailure(plan);
|
|
561
|
+
_context.next = 17;
|
|
562
|
+
return api.toPolkadot.send(context, signer, plan);
|
|
563
|
+
case 17:
|
|
564
|
+
result = _context.sent;
|
|
565
|
+
return _context.abrupt("return", {
|
|
566
|
+
result: result,
|
|
567
|
+
plan: plan
|
|
568
|
+
});
|
|
569
|
+
case 19:
|
|
570
|
+
case "end":
|
|
571
|
+
return _context.stop();
|
|
572
|
+
}
|
|
573
|
+
}, _callee);
|
|
574
|
+
}));
|
|
575
|
+
return function transferEthToPolkadot(_x) {
|
|
576
|
+
return _ref2.apply(this, arguments);
|
|
577
|
+
};
|
|
578
|
+
}();
|
|
579
|
+
|
|
580
|
+
var buildEthTransferOptions = /*#__PURE__*/function () {
|
|
581
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
582
|
+
var _ethAsset$assetId;
|
|
583
|
+
var currency, to, address, destAddress, ethAsset, env, EXECUTION_URL, context, destParaId, signer, plan;
|
|
584
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
585
|
+
while (1) switch (_context.prev = _context.next) {
|
|
586
|
+
case 0:
|
|
587
|
+
currency = _ref.currency, to = _ref.to, address = _ref.address, destAddress = _ref.destAddress;
|
|
588
|
+
ethAsset = findEthAsset(currency);
|
|
589
|
+
env = api.environment.SNOWBRIDGE_ENV['polkadot_mainnet'];
|
|
590
|
+
EXECUTION_URL = 'https://eth.llamarpc.com';
|
|
591
|
+
_context.next = 6;
|
|
592
|
+
return createContext(EXECUTION_URL, env.config);
|
|
593
|
+
case 6:
|
|
594
|
+
context = _context.sent;
|
|
595
|
+
destParaId = sdkCore.getParaId(to);
|
|
596
|
+
signer = {
|
|
597
|
+
getAddress: function getAddress() {
|
|
598
|
+
return Promise.resolve(address);
|
|
589
599
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
600
|
+
};
|
|
601
|
+
_context.next = 11;
|
|
602
|
+
return api.toPolkadot.validateSend(context, signer, destAddress, (_ethAsset$assetId = ethAsset.assetId) !== null && _ethAsset$assetId !== void 0 ? _ethAsset$assetId : '', destParaId, BigInt(currency.amount), 0n);
|
|
603
|
+
case 11:
|
|
604
|
+
plan = _context.sent;
|
|
605
|
+
checkPlanFailure(plan);
|
|
606
|
+
if (plan.success) {
|
|
607
|
+
_context.next = 15;
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
throw new Error('Failed to validate send');
|
|
611
|
+
case 15:
|
|
612
|
+
return _context.abrupt("return", {
|
|
613
|
+
token: plan.success.token,
|
|
614
|
+
destinationParaId: plan.success.destinationParaId,
|
|
615
|
+
destinationFee: plan.success.destinationFee,
|
|
616
|
+
amount: plan.success.amount,
|
|
617
|
+
fee: plan.success.fee
|
|
618
|
+
});
|
|
619
|
+
case 16:
|
|
620
|
+
case "end":
|
|
621
|
+
return _context.stop();
|
|
622
|
+
}
|
|
623
|
+
}, _callee);
|
|
624
|
+
}));
|
|
625
|
+
return function buildEthTransferOptions(_x) {
|
|
626
|
+
return _ref2.apply(this, arguments);
|
|
627
|
+
};
|
|
628
|
+
}();
|
|
607
629
|
|
|
608
630
|
var lowercaseFirstLetter = function lowercaseFirstLetter(value) {
|
|
609
631
|
return value.charAt(0).toLowerCase() + value.slice(1);
|
|
@@ -636,9 +658,9 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
636
658
|
}
|
|
637
659
|
}, {
|
|
638
660
|
key: "init",
|
|
639
|
-
value: function
|
|
640
|
-
|
|
641
|
-
var
|
|
661
|
+
value: function () {
|
|
662
|
+
var _init = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(node) {
|
|
663
|
+
var _this$_api;
|
|
642
664
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
643
665
|
while (1) switch (_context.prev = _context.next) {
|
|
644
666
|
case 0:
|
|
@@ -659,11 +681,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
659
681
|
_context.next = 16;
|
|
660
682
|
break;
|
|
661
683
|
case 8:
|
|
662
|
-
if (!((
|
|
684
|
+
if (!((_this$_api = this._api) !== null && _this$_api !== void 0)) {
|
|
663
685
|
_context.next = 12;
|
|
664
686
|
break;
|
|
665
687
|
}
|
|
666
|
-
_context.t0 =
|
|
688
|
+
_context.t0 = _this$_api;
|
|
667
689
|
_context.next = 15;
|
|
668
690
|
break;
|
|
669
691
|
case 12:
|
|
@@ -681,11 +703,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
681
703
|
}
|
|
682
704
|
}, _callee, this);
|
|
683
705
|
}));
|
|
684
|
-
|
|
706
|
+
function init(_x) {
|
|
707
|
+
return _init.apply(this, arguments);
|
|
708
|
+
}
|
|
709
|
+
return init;
|
|
710
|
+
}()
|
|
685
711
|
}, {
|
|
686
712
|
key: "createApiInstance",
|
|
687
|
-
value: function
|
|
688
|
-
|
|
713
|
+
value: function () {
|
|
714
|
+
var _createApiInstance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(wsUrl) {
|
|
689
715
|
var wsProvider;
|
|
690
716
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
691
717
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -700,7 +726,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
700
726
|
}
|
|
701
727
|
}, _callee2);
|
|
702
728
|
}));
|
|
703
|
-
|
|
729
|
+
function createApiInstance(_x2) {
|
|
730
|
+
return _createApiInstance.apply(this, arguments);
|
|
731
|
+
}
|
|
732
|
+
return createApiInstance;
|
|
733
|
+
}()
|
|
704
734
|
}, {
|
|
705
735
|
key: "createAccountId",
|
|
706
736
|
value: function createAccountId(address) {
|
|
@@ -731,8 +761,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
731
761
|
}
|
|
732
762
|
}, {
|
|
733
763
|
key: "calculateTransactionFee",
|
|
734
|
-
value: function
|
|
735
|
-
|
|
764
|
+
value: function () {
|
|
765
|
+
var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(tx, address) {
|
|
736
766
|
var _yield$tx$paymentInfo, partialFee;
|
|
737
767
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
738
768
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -749,11 +779,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
749
779
|
}
|
|
750
780
|
}, _callee3);
|
|
751
781
|
}));
|
|
752
|
-
|
|
782
|
+
function calculateTransactionFee(_x3, _x4) {
|
|
783
|
+
return _calculateTransactionFee.apply(this, arguments);
|
|
784
|
+
}
|
|
785
|
+
return calculateTransactionFee;
|
|
786
|
+
}()
|
|
753
787
|
}, {
|
|
754
788
|
key: "getBalanceNative",
|
|
755
|
-
value: function
|
|
756
|
-
|
|
789
|
+
value: function () {
|
|
790
|
+
var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(address) {
|
|
757
791
|
var response;
|
|
758
792
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
759
793
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -769,11 +803,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
769
803
|
}
|
|
770
804
|
}, _callee4, this);
|
|
771
805
|
}));
|
|
772
|
-
|
|
806
|
+
function getBalanceNative(_x5) {
|
|
807
|
+
return _getBalanceNative.apply(this, arguments);
|
|
808
|
+
}
|
|
809
|
+
return getBalanceNative;
|
|
810
|
+
}()
|
|
773
811
|
}, {
|
|
774
812
|
key: "getBalanceForeignPolkadotXcm",
|
|
775
|
-
value: function
|
|
776
|
-
|
|
813
|
+
value: function () {
|
|
814
|
+
var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(address, id) {
|
|
777
815
|
var parsedId, response, obj;
|
|
778
816
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
779
817
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -784,18 +822,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
784
822
|
case 3:
|
|
785
823
|
response = _context5.sent;
|
|
786
824
|
obj = response.toJSON();
|
|
787
|
-
return _context5.abrupt("return", obj.balance ? BigInt(obj.balance) :
|
|
825
|
+
return _context5.abrupt("return", obj.balance ? BigInt(obj.balance) : 0n);
|
|
788
826
|
case 6:
|
|
789
827
|
case "end":
|
|
790
828
|
return _context5.stop();
|
|
791
829
|
}
|
|
792
830
|
}, _callee5, this);
|
|
793
831
|
}));
|
|
794
|
-
|
|
832
|
+
function getBalanceForeignPolkadotXcm(_x6, _x7) {
|
|
833
|
+
return _getBalanceForeignPolkadotXcm.apply(this, arguments);
|
|
834
|
+
}
|
|
835
|
+
return getBalanceForeignPolkadotXcm;
|
|
836
|
+
}()
|
|
795
837
|
}, {
|
|
796
838
|
key: "getMythosForeignBalance",
|
|
797
|
-
value: function
|
|
798
|
-
|
|
839
|
+
value: function () {
|
|
840
|
+
var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address) {
|
|
799
841
|
var response, obj;
|
|
800
842
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
801
843
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -805,18 +847,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
805
847
|
case 2:
|
|
806
848
|
response = _context6.sent;
|
|
807
849
|
obj = response.toJSON();
|
|
808
|
-
return _context6.abrupt("return", obj.free ? BigInt(obj.free) :
|
|
850
|
+
return _context6.abrupt("return", obj.free ? BigInt(obj.free) : 0n);
|
|
809
851
|
case 5:
|
|
810
852
|
case "end":
|
|
811
853
|
return _context6.stop();
|
|
812
854
|
}
|
|
813
855
|
}, _callee6, this);
|
|
814
856
|
}));
|
|
815
|
-
|
|
857
|
+
function getMythosForeignBalance(_x8) {
|
|
858
|
+
return _getMythosForeignBalance.apply(this, arguments);
|
|
859
|
+
}
|
|
860
|
+
return getMythosForeignBalance;
|
|
861
|
+
}()
|
|
816
862
|
}, {
|
|
817
863
|
key: "getAssetHubForeignBalance",
|
|
818
|
-
value: function
|
|
819
|
-
|
|
864
|
+
value: function () {
|
|
865
|
+
var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address, multiLocation) {
|
|
820
866
|
var response, obj;
|
|
821
867
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
822
868
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -833,11 +879,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
833
879
|
}
|
|
834
880
|
}, _callee7, this);
|
|
835
881
|
}));
|
|
836
|
-
|
|
882
|
+
function getAssetHubForeignBalance(_x9, _x10) {
|
|
883
|
+
return _getAssetHubForeignBalance.apply(this, arguments);
|
|
884
|
+
}
|
|
885
|
+
return getAssetHubForeignBalance;
|
|
886
|
+
}()
|
|
837
887
|
}, {
|
|
838
888
|
key: "getForeignAssetsByIdBalance",
|
|
839
|
-
value: function
|
|
840
|
-
|
|
889
|
+
value: function () {
|
|
890
|
+
var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address, assetId) {
|
|
841
891
|
var response, obj;
|
|
842
892
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
843
893
|
while (1) switch (_context8.prev = _context8.next) {
|
|
@@ -854,11 +904,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
854
904
|
}
|
|
855
905
|
}, _callee8, this);
|
|
856
906
|
}));
|
|
857
|
-
|
|
907
|
+
function getForeignAssetsByIdBalance(_x11, _x12) {
|
|
908
|
+
return _getForeignAssetsByIdBalance.apply(this, arguments);
|
|
909
|
+
}
|
|
910
|
+
return getForeignAssetsByIdBalance;
|
|
911
|
+
}()
|
|
858
912
|
}, {
|
|
859
913
|
key: "getBalanceForeignBifrost",
|
|
860
|
-
value: function
|
|
861
|
-
|
|
914
|
+
value: function () {
|
|
915
|
+
var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, asset) {
|
|
862
916
|
var currencySelection, response, accountData;
|
|
863
917
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
864
918
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -869,18 +923,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
869
923
|
case 3:
|
|
870
924
|
response = _context9.sent;
|
|
871
925
|
accountData = response ? response : null;
|
|
872
|
-
return _context9.abrupt("return", accountData ? BigInt(accountData.free.toString()) :
|
|
926
|
+
return _context9.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
873
927
|
case 6:
|
|
874
928
|
case "end":
|
|
875
929
|
return _context9.stop();
|
|
876
930
|
}
|
|
877
931
|
}, _callee9, this);
|
|
878
932
|
}));
|
|
879
|
-
|
|
933
|
+
function getBalanceForeignBifrost(_x13, _x14) {
|
|
934
|
+
return _getBalanceForeignBifrost.apply(this, arguments);
|
|
935
|
+
}
|
|
936
|
+
return getBalanceForeignBifrost;
|
|
937
|
+
}()
|
|
880
938
|
}, {
|
|
881
939
|
key: "getBalanceNativeAcala",
|
|
882
|
-
value: function
|
|
883
|
-
|
|
940
|
+
value: function () {
|
|
941
|
+
var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, symbol) {
|
|
884
942
|
var response, accountData;
|
|
885
943
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
886
944
|
while (1) switch (_context10.prev = _context10.next) {
|
|
@@ -892,18 +950,22 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
892
950
|
case 2:
|
|
893
951
|
response = _context10.sent;
|
|
894
952
|
accountData = response ? response : null;
|
|
895
|
-
return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) :
|
|
953
|
+
return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
896
954
|
case 5:
|
|
897
955
|
case "end":
|
|
898
956
|
return _context10.stop();
|
|
899
957
|
}
|
|
900
958
|
}, _callee10, this);
|
|
901
959
|
}));
|
|
902
|
-
|
|
960
|
+
function getBalanceNativeAcala(_x15, _x16) {
|
|
961
|
+
return _getBalanceNativeAcala.apply(this, arguments);
|
|
962
|
+
}
|
|
963
|
+
return getBalanceNativeAcala;
|
|
964
|
+
}()
|
|
903
965
|
}, {
|
|
904
966
|
key: "getBalanceForeignXTokens",
|
|
905
|
-
value: function
|
|
906
|
-
|
|
967
|
+
value: function () {
|
|
968
|
+
var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(node, address, asset) {
|
|
907
969
|
var pallet, response, entry, accountData;
|
|
908
970
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
909
971
|
while (1) switch (_context11.prev = _context11.next) {
|
|
@@ -917,28 +979,32 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
917
979
|
case 4:
|
|
918
980
|
response = _context11.sent;
|
|
919
981
|
entry = response.find(function (_ref2) {
|
|
982
|
+
var _asset$symbol, _asset$assetId, _assetItem$toHuman, _asset$symbol2, _assetItem$toHuman2, _asset$assetId2;
|
|
920
983
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
921
984
|
_ref3$0$args = _slicedToArray(_ref3[0].args, 2);
|
|
922
985
|
_ref3$0$args[0];
|
|
923
986
|
var assetItem = _ref3$0$args[1];
|
|
924
987
|
_ref3[1];
|
|
925
|
-
var _a, _b, _c, _d, _e, _f;
|
|
926
988
|
var assetSymbol = assetItem.toString().toLowerCase();
|
|
927
|
-
return assetSymbol === ((
|
|
989
|
+
return assetSymbol === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || sdkCore.isForeignAsset(asset) && assetSymbol === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || Object.values((_assetItem$toHuman = assetItem.toHuman()) !== null && _assetItem$toHuman !== void 0 ? _assetItem$toHuman : {}).toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || sdkCore.isForeignAsset(asset) && Object.values((_assetItem$toHuman2 = assetItem.toHuman()) !== null && _assetItem$toHuman2 !== void 0 ? _assetItem$toHuman2 : {}).toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
|
|
928
990
|
});
|
|
929
991
|
accountData = entry ? entry[1] : null;
|
|
930
|
-
return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) :
|
|
992
|
+
return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
|
|
931
993
|
case 8:
|
|
932
994
|
case "end":
|
|
933
995
|
return _context11.stop();
|
|
934
996
|
}
|
|
935
997
|
}, _callee11, this);
|
|
936
998
|
}));
|
|
937
|
-
|
|
999
|
+
function getBalanceForeignXTokens(_x17, _x18, _x19) {
|
|
1000
|
+
return _getBalanceForeignXTokens.apply(this, arguments);
|
|
1001
|
+
}
|
|
1002
|
+
return getBalanceForeignXTokens;
|
|
1003
|
+
}()
|
|
938
1004
|
}, {
|
|
939
1005
|
key: "getBalanceForeignAssetsAccount",
|
|
940
|
-
value: function
|
|
941
|
-
|
|
1006
|
+
value: function () {
|
|
1007
|
+
var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, assetId) {
|
|
942
1008
|
var response, obj;
|
|
943
1009
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
944
1010
|
while (1) switch (_context12.prev = _context12.next) {
|
|
@@ -955,11 +1021,15 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
955
1021
|
}
|
|
956
1022
|
}, _callee12, this);
|
|
957
1023
|
}));
|
|
958
|
-
|
|
1024
|
+
function getBalanceForeignAssetsAccount(_x20, _x21) {
|
|
1025
|
+
return _getBalanceForeignAssetsAccount.apply(this, arguments);
|
|
1026
|
+
}
|
|
1027
|
+
return getBalanceForeignAssetsAccount;
|
|
1028
|
+
}()
|
|
959
1029
|
}, {
|
|
960
1030
|
key: "getFromStorage",
|
|
961
|
-
value: function
|
|
962
|
-
|
|
1031
|
+
value: function () {
|
|
1032
|
+
var _getFromStorage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(key) {
|
|
963
1033
|
var response;
|
|
964
1034
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
965
1035
|
while (1) switch (_context13.prev = _context13.next) {
|
|
@@ -975,7 +1045,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
975
1045
|
}
|
|
976
1046
|
}, _callee13, this);
|
|
977
1047
|
}));
|
|
978
|
-
|
|
1048
|
+
function getFromStorage(_x22) {
|
|
1049
|
+
return _getFromStorage.apply(this, arguments);
|
|
1050
|
+
}
|
|
1051
|
+
return getFromStorage;
|
|
1052
|
+
}()
|
|
979
1053
|
}, {
|
|
980
1054
|
key: "clone",
|
|
981
1055
|
value: function clone() {
|
|
@@ -983,8 +1057,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
983
1057
|
}
|
|
984
1058
|
}, {
|
|
985
1059
|
key: "createApiForNode",
|
|
986
|
-
value: function
|
|
987
|
-
|
|
1060
|
+
value: function () {
|
|
1061
|
+
var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(node) {
|
|
988
1062
|
var api;
|
|
989
1063
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
990
1064
|
while (1) switch (_context14.prev = _context14.next) {
|
|
@@ -1000,64 +1074,67 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1000
1074
|
}
|
|
1001
1075
|
}, _callee14);
|
|
1002
1076
|
}));
|
|
1003
|
-
|
|
1077
|
+
function createApiForNode(_x23) {
|
|
1078
|
+
return _createApiForNode.apply(this, arguments);
|
|
1079
|
+
}
|
|
1080
|
+
return createApiForNode;
|
|
1081
|
+
}()
|
|
1004
1082
|
}, {
|
|
1005
1083
|
key: "getDryRun",
|
|
1006
|
-
value: function
|
|
1007
|
-
|
|
1008
|
-
var
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
_context15.next = 5;
|
|
1025
|
-
return _this.api.call.dryRunApi.dryRunCall({
|
|
1026
|
-
system: {
|
|
1027
|
-
Signed: address
|
|
1028
|
-
}
|
|
1029
|
-
}, tx);
|
|
1030
|
-
case 5:
|
|
1031
|
-
result = _context15.sent.toHuman();
|
|
1032
|
-
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
1033
|
-
if (isSuccess) {
|
|
1034
|
-
_context15.next = 11;
|
|
1035
|
-
break;
|
|
1084
|
+
value: function () {
|
|
1085
|
+
var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref4) {
|
|
1086
|
+
var tx, address, node, supportsDryRunApi, result, isSuccess, moduleError, failureReason, executionFee, fee;
|
|
1087
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
1088
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
1089
|
+
case 0:
|
|
1090
|
+
tx = _ref4.tx, address = _ref4.address, node = _ref4.node;
|
|
1091
|
+
supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
|
|
1092
|
+
if (supportsDryRunApi) {
|
|
1093
|
+
_context15.next = 4;
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
throw new Error("DryRunApi is not available on node ".concat(node));
|
|
1097
|
+
case 4:
|
|
1098
|
+
_context15.next = 6;
|
|
1099
|
+
return this.api.call.dryRunApi.dryRunCall({
|
|
1100
|
+
system: {
|
|
1101
|
+
Signed: address
|
|
1036
1102
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1103
|
+
}, tx);
|
|
1104
|
+
case 6:
|
|
1105
|
+
result = _context15.sent.toHuman();
|
|
1106
|
+
isSuccess = result.Ok && result.Ok.executionResult.Ok;
|
|
1107
|
+
if (isSuccess) {
|
|
1108
|
+
_context15.next = 12;
|
|
1109
|
+
break;
|
|
1110
|
+
}
|
|
1111
|
+
moduleError = result.Ok.executionResult.Err.error.Module;
|
|
1112
|
+
failureReason = sdkCore.resolveModuleError(node, moduleError);
|
|
1113
|
+
return _context15.abrupt("return", {
|
|
1114
|
+
success: false,
|
|
1115
|
+
failureReason: failureReason
|
|
1116
|
+
});
|
|
1117
|
+
case 12:
|
|
1118
|
+
_context15.next = 14;
|
|
1119
|
+
return this.calculateTransactionFee(tx, address);
|
|
1120
|
+
case 14:
|
|
1121
|
+
executionFee = _context15.sent;
|
|
1122
|
+
fee = sdkCore.computeFeeFromDryRunPjs(result, node, executionFee);
|
|
1123
|
+
return _context15.abrupt("return", {
|
|
1124
|
+
success: true,
|
|
1125
|
+
fee: fee
|
|
1126
|
+
});
|
|
1127
|
+
case 17:
|
|
1128
|
+
case "end":
|
|
1129
|
+
return _context15.stop();
|
|
1130
|
+
}
|
|
1131
|
+
}, _callee15, this);
|
|
1132
|
+
}));
|
|
1133
|
+
function getDryRun(_x24) {
|
|
1134
|
+
return _getDryRun.apply(this, arguments);
|
|
1135
|
+
}
|
|
1136
|
+
return getDryRun;
|
|
1137
|
+
}()
|
|
1061
1138
|
}, {
|
|
1062
1139
|
key: "setDisconnectAllowed",
|
|
1063
1140
|
value: function setDisconnectAllowed(allowed) {
|
|
@@ -1070,8 +1147,8 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1070
1147
|
}
|
|
1071
1148
|
}, {
|
|
1072
1149
|
key: "disconnect",
|
|
1073
|
-
value: function
|
|
1074
|
-
|
|
1150
|
+
value: function () {
|
|
1151
|
+
var _disconnect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
1075
1152
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
1076
1153
|
while (1) switch (_context16.prev = _context16.next) {
|
|
1077
1154
|
case 0:
|
|
@@ -1093,7 +1170,11 @@ var PolkadotJsApi = /*#__PURE__*/function () {
|
|
|
1093
1170
|
}
|
|
1094
1171
|
}, _callee16, this);
|
|
1095
1172
|
}));
|
|
1096
|
-
|
|
1173
|
+
function disconnect() {
|
|
1174
|
+
return _disconnect.apply(this, arguments);
|
|
1175
|
+
}
|
|
1176
|
+
return disconnect;
|
|
1177
|
+
}()
|
|
1097
1178
|
}]);
|
|
1098
1179
|
}();
|
|
1099
1180
|
|
|
@@ -1102,15 +1183,15 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
|
|
|
1102
1183
|
return sdkCore.createApiInstanceForNode(pjsApi, node);
|
|
1103
1184
|
};
|
|
1104
1185
|
var createPolkadotJsApiCall = function createPolkadotJsApiCall(apiCall) {
|
|
1105
|
-
return function (
|
|
1106
|
-
|
|
1186
|
+
return /*#__PURE__*/function () {
|
|
1187
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
1107
1188
|
var pjsApi, optionsWithApi;
|
|
1108
1189
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1109
1190
|
while (1) switch (_context.prev = _context.next) {
|
|
1110
1191
|
case 0:
|
|
1111
1192
|
pjsApi = new PolkadotJsApi();
|
|
1112
1193
|
pjsApi.setApi(options.api);
|
|
1113
|
-
optionsWithApi =
|
|
1194
|
+
optionsWithApi = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1114
1195
|
api: pjsApi
|
|
1115
1196
|
});
|
|
1116
1197
|
return _context.abrupt("return", apiCall(optionsWithApi));
|
|
@@ -1120,7 +1201,10 @@ var createPolkadotJsApiCall = function createPolkadotJsApiCall(apiCall) {
|
|
|
1120
1201
|
}
|
|
1121
1202
|
}, _callee);
|
|
1122
1203
|
}));
|
|
1123
|
-
|
|
1204
|
+
return function (_x) {
|
|
1205
|
+
return _ref.apply(this, arguments);
|
|
1206
|
+
};
|
|
1207
|
+
}();
|
|
1124
1208
|
};
|
|
1125
1209
|
|
|
1126
1210
|
/**
|
|
@@ -1128,19 +1212,10 @@ var createPolkadotJsApiCall = function createPolkadotJsApiCall(apiCall) {
|
|
|
1128
1212
|
* @param options - The transfer options.
|
|
1129
1213
|
* @returns An extrinsic to be signed and sent.
|
|
1130
1214
|
*/
|
|
1131
|
-
var send =
|
|
1132
|
-
var pjsApi = new PolkadotJsApi();
|
|
1133
|
-
pjsApi.setApi(options.api);
|
|
1134
|
-
var destPjsApi = new PolkadotJsApi();
|
|
1135
|
-
destPjsApi.setApi(options.destApiForKeepAlive);
|
|
1136
|
-
return sdkCore.send(Object.assign(Object.assign({}, options), {
|
|
1137
|
-
api: pjsApi,
|
|
1138
|
-
destApiForKeepAlive: destPjsApi
|
|
1139
|
-
}));
|
|
1140
|
-
};
|
|
1215
|
+
var send = createPolkadotJsApiCall(sdkCore.send);
|
|
1141
1216
|
var getDryRun = createPolkadotJsApiCall(sdkCore.getDryRun);
|
|
1142
1217
|
var transferEthToPolkadot = function transferEthToPolkadot(options) {
|
|
1143
|
-
return transferEthToPolkadot$1(
|
|
1218
|
+
return transferEthToPolkadot$1(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
1144
1219
|
api: new PolkadotJsApi()
|
|
1145
1220
|
}));
|
|
1146
1221
|
};
|
|
@@ -1190,15 +1265,34 @@ var getTransferableAmount = createPolkadotJsApiCall(sdkCore.getTransferableAmoun
|
|
|
1190
1265
|
|
|
1191
1266
|
var assets = /*#__PURE__*/Object.freeze({
|
|
1192
1267
|
__proto__: null,
|
|
1268
|
+
Foreign: sdkCore.Foreign,
|
|
1269
|
+
ForeignAbstract: sdkCore.ForeignAbstract,
|
|
1270
|
+
Native: sdkCore.Native,
|
|
1271
|
+
Override: sdkCore.Override,
|
|
1193
1272
|
claimAssets: claimAssets,
|
|
1273
|
+
getAllAssetsSymbols: sdkCore.getAllAssetsSymbols,
|
|
1194
1274
|
getAssetBalance: getAssetBalance,
|
|
1275
|
+
getAssetBySymbolOrId: sdkCore.getAssetBySymbolOrId,
|
|
1276
|
+
getAssetDecimals: sdkCore.getAssetDecimals,
|
|
1277
|
+
getAssetId: sdkCore.getAssetId,
|
|
1278
|
+
getAssets: sdkCore.getAssets,
|
|
1279
|
+
getAssetsObject: sdkCore.getAssetsObject,
|
|
1195
1280
|
getBalanceForeign: getBalanceForeign,
|
|
1196
1281
|
getBalanceNative: getBalanceNative,
|
|
1282
|
+
getExistentialDeposit: sdkCore.getExistentialDeposit,
|
|
1197
1283
|
getMaxForeignTransferableAmount: getMaxForeignTransferableAmount,
|
|
1198
1284
|
getMaxNativeTransferableAmount: getMaxNativeTransferableAmount,
|
|
1285
|
+
getNativeAssetSymbol: sdkCore.getNativeAssetSymbol,
|
|
1286
|
+
getNativeAssets: sdkCore.getNativeAssets,
|
|
1199
1287
|
getOriginFeeDetails: getOriginFeeDetails,
|
|
1288
|
+
getOtherAssets: sdkCore.getOtherAssets,
|
|
1289
|
+
getRelayChainSymbol: sdkCore.getRelayChainSymbol,
|
|
1290
|
+
getSupportedAssets: sdkCore.getSupportedAssets,
|
|
1291
|
+
getTNode: sdkCore.getTNode,
|
|
1200
1292
|
getTransferInfo: getTransferInfo,
|
|
1201
|
-
getTransferableAmount: getTransferableAmount
|
|
1293
|
+
getTransferableAmount: getTransferableAmount,
|
|
1294
|
+
hasSupportForAsset: sdkCore.hasSupportForAsset,
|
|
1295
|
+
isNodeEvm: sdkCore.isNodeEvm
|
|
1202
1296
|
});
|
|
1203
1297
|
|
|
1204
1298
|
/**
|
|
@@ -1272,9 +1366,10 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1272
1366
|
*/
|
|
1273
1367
|
}, {
|
|
1274
1368
|
key: "build",
|
|
1275
|
-
value: function
|
|
1276
|
-
|
|
1277
|
-
var
|
|
1369
|
+
value: (function () {
|
|
1370
|
+
var _build = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1371
|
+
var _yield$transferEthToP, _yield$transferEthToP2;
|
|
1372
|
+
var requiredParams, _i, _requiredParams, param;
|
|
1278
1373
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1279
1374
|
while (1) switch (_context.prev = _context.next) {
|
|
1280
1375
|
case 0:
|
|
@@ -1308,13 +1403,13 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1308
1403
|
_context.next = 15;
|
|
1309
1404
|
return transferEthToPolkadot$1(this._options);
|
|
1310
1405
|
case 15:
|
|
1311
|
-
_context.t2 =
|
|
1406
|
+
_context.t2 = _yield$transferEthToP2 = _context.sent.result.success;
|
|
1312
1407
|
_context.t1 = _context.t2 === null;
|
|
1313
1408
|
if (_context.t1) {
|
|
1314
1409
|
_context.next = 19;
|
|
1315
1410
|
break;
|
|
1316
1411
|
}
|
|
1317
|
-
_context.t1 =
|
|
1412
|
+
_context.t1 = _yield$transferEthToP2 === void 0;
|
|
1318
1413
|
case 19:
|
|
1319
1414
|
if (!_context.t1) {
|
|
1320
1415
|
_context.next = 23;
|
|
@@ -1324,21 +1419,21 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1324
1419
|
_context.next = 24;
|
|
1325
1420
|
break;
|
|
1326
1421
|
case 23:
|
|
1327
|
-
_context.t3 =
|
|
1422
|
+
_context.t3 = _yield$transferEthToP2.ethereum.blockHash;
|
|
1328
1423
|
case 24:
|
|
1329
|
-
_context.t4 =
|
|
1424
|
+
_context.t4 = _yield$transferEthToP = _context.t3;
|
|
1330
1425
|
_context.t0 = _context.t4 !== null;
|
|
1331
1426
|
if (!_context.t0) {
|
|
1332
1427
|
_context.next = 28;
|
|
1333
1428
|
break;
|
|
1334
1429
|
}
|
|
1335
|
-
_context.t0 =
|
|
1430
|
+
_context.t0 = _yield$transferEthToP !== void 0;
|
|
1336
1431
|
case 28:
|
|
1337
1432
|
if (!_context.t0) {
|
|
1338
1433
|
_context.next = 32;
|
|
1339
1434
|
break;
|
|
1340
1435
|
}
|
|
1341
|
-
_context.t5 =
|
|
1436
|
+
_context.t5 = _yield$transferEthToP;
|
|
1342
1437
|
_context.next = 33;
|
|
1343
1438
|
break;
|
|
1344
1439
|
case 32:
|
|
@@ -1351,7 +1446,11 @@ var EvmBuilderClass = /*#__PURE__*/function () {
|
|
|
1351
1446
|
}
|
|
1352
1447
|
}, _callee, this);
|
|
1353
1448
|
}));
|
|
1354
|
-
|
|
1449
|
+
function build() {
|
|
1450
|
+
return _build.apply(this, arguments);
|
|
1451
|
+
}
|
|
1452
|
+
return build;
|
|
1453
|
+
}())
|
|
1355
1454
|
}]);
|
|
1356
1455
|
}();
|
|
1357
1456
|
/**
|