@paraspell/sdk-core 11.14.10 → 12.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.d.ts +108 -182
- package/dist/index.mjs +478 -540
- package/package.json +5 -5
- package/dist/index.cjs +0 -14338
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isChainEvm, getAssetsObject, InvalidCurrencyError,
|
|
1
|
+
import { blake2b } from '@noble/hashes/blake2.js';
|
|
2
|
+
import { isChainEvm, getAssetsObject, InvalidCurrencyError, extractAssetLocation, findAssetInfoOrThrow, getOtherAssets, isTAsset, findNativeAssetInfoOrThrow, findAssetInfo, getExistentialDepositOrThrow, isSymbolMatch, getNativeAssetSymbol, getEdFromAssetOrThrow, hasDryRunSupport, findAssetOnDestOrThrow, findAssetInfoOnDest, isAssetEqual, isOverrideLocationSpecifier, getRelayChainSymbol, isSymbolSpecifier, findNativeAssetInfo, isAssetXcEqual, normalizeLocation, normalizeSymbol, Native, hasXcmPaymentApiSupport, findAssetInfoByLoc } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { isAddress, parseUnits as parseUnits$1, formatUnits as formatUnits$1, getContract, createPublicClient, http, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
@@ -426,6 +426,21 @@ var AmountTooLowError = /*#__PURE__*/function (_Error) {
|
|
|
426
426
|
return _createClass(AmountTooLowError);
|
|
427
427
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
428
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Error thrown when a batch operation is invalid or cannot be executed.
|
|
431
|
+
*/
|
|
432
|
+
var BatchValidationError = /*#__PURE__*/function (_Error) {
|
|
433
|
+
function BatchValidationError(message) {
|
|
434
|
+
var _this;
|
|
435
|
+
_classCallCheck(this, BatchValidationError);
|
|
436
|
+
_this = _callSuper(this, BatchValidationError, [message]);
|
|
437
|
+
_this.name = 'BatchValidationError';
|
|
438
|
+
return _this;
|
|
439
|
+
}
|
|
440
|
+
_inherits(BatchValidationError, _Error);
|
|
441
|
+
return _createClass(BatchValidationError);
|
|
442
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
443
|
+
|
|
429
444
|
/**
|
|
430
445
|
* Error thrown when the Ethereum bridge is halted.
|
|
431
446
|
*/
|
|
@@ -446,26 +461,6 @@ var BridgeHaltedError = /*#__PURE__*/function (_Error) {
|
|
|
446
461
|
return _createClass(BridgeHaltedError);
|
|
447
462
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
448
463
|
|
|
449
|
-
/**
|
|
450
|
-
* Used to inform user, that Parachain they wish to use is not supported yet
|
|
451
|
-
*/
|
|
452
|
-
var ChainNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
453
|
-
/**
|
|
454
|
-
* Constructs a new ChainNotSupportedError.
|
|
455
|
-
*
|
|
456
|
-
* @param message - Optional custom error message.
|
|
457
|
-
*/
|
|
458
|
-
function ChainNotSupportedError(message) {
|
|
459
|
-
var _this;
|
|
460
|
-
_classCallCheck(this, ChainNotSupportedError);
|
|
461
|
-
_this = _callSuper(this, ChainNotSupportedError, [message !== null && message !== void 0 ? message : 'These chains do not support XCM transfers from Relay / to Relay chain.']);
|
|
462
|
-
_this.name = 'ChainNotSupported';
|
|
463
|
-
return _this;
|
|
464
|
-
}
|
|
465
|
-
_inherits(ChainNotSupportedError, _Error);
|
|
466
|
-
return _createClass(ChainNotSupportedError);
|
|
467
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
468
|
-
|
|
469
464
|
/**
|
|
470
465
|
* Error thrown when the Dry Run fails.
|
|
471
466
|
*/
|
|
@@ -494,23 +489,18 @@ var DryRunFailedError = /*#__PURE__*/function (_Error) {
|
|
|
494
489
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
495
490
|
|
|
496
491
|
/**
|
|
497
|
-
* Error thrown when
|
|
492
|
+
* Error thrown when a feature or route is temporarily disabled via configuration or governance.
|
|
498
493
|
*/
|
|
499
|
-
var
|
|
500
|
-
|
|
501
|
-
* Constructs a new IncompatibleChainsError.
|
|
502
|
-
*
|
|
503
|
-
* @param message - Optional custom error message.
|
|
504
|
-
*/
|
|
505
|
-
function IncompatibleChainsError(message) {
|
|
494
|
+
var FeatureTemporarilyDisabledError = /*#__PURE__*/function (_Error) {
|
|
495
|
+
function FeatureTemporarilyDisabledError(message) {
|
|
506
496
|
var _this;
|
|
507
|
-
_classCallCheck(this,
|
|
508
|
-
_this = _callSuper(this,
|
|
509
|
-
_this.name = '
|
|
497
|
+
_classCallCheck(this, FeatureTemporarilyDisabledError);
|
|
498
|
+
_this = _callSuper(this, FeatureTemporarilyDisabledError, [message]);
|
|
499
|
+
_this.name = 'FeatureTemporarilyDisabledError';
|
|
510
500
|
return _this;
|
|
511
501
|
}
|
|
512
|
-
_inherits(
|
|
513
|
-
return _createClass(
|
|
502
|
+
_inherits(FeatureTemporarilyDisabledError, _Error);
|
|
503
|
+
return _createClass(FeatureTemporarilyDisabledError);
|
|
514
504
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
515
505
|
|
|
516
506
|
/**
|
|
@@ -533,26 +523,6 @@ var InvalidAddressError = /*#__PURE__*/function (_Error) {
|
|
|
533
523
|
return _createClass(InvalidAddressError);
|
|
534
524
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
535
525
|
|
|
536
|
-
/**
|
|
537
|
-
* Error thrown when the Dry Run fails.
|
|
538
|
-
*/
|
|
539
|
-
var InvalidParameterError = /*#__PURE__*/function (_Error) {
|
|
540
|
-
/**
|
|
541
|
-
* Constructs a new InvalidParameterError.
|
|
542
|
-
*
|
|
543
|
-
* @param message - Required error message.
|
|
544
|
-
*/
|
|
545
|
-
function InvalidParameterError(message) {
|
|
546
|
-
var _this;
|
|
547
|
-
_classCallCheck(this, InvalidParameterError);
|
|
548
|
-
_this = _callSuper(this, InvalidParameterError, [message]);
|
|
549
|
-
_this.name = 'InvalidParameterError';
|
|
550
|
-
return _this;
|
|
551
|
-
}
|
|
552
|
-
_inherits(InvalidParameterError, _Error);
|
|
553
|
-
return _createClass(InvalidParameterError);
|
|
554
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
555
|
-
|
|
556
526
|
/**
|
|
557
527
|
* Error development mode is on and no API override is provided for a specific chain.
|
|
558
528
|
*/
|
|
@@ -573,6 +543,22 @@ var MissingChainApiError = /*#__PURE__*/function (_Error) {
|
|
|
573
543
|
return _createClass(MissingChainApiError);
|
|
574
544
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
575
545
|
|
|
546
|
+
/**
|
|
547
|
+
* Error thrown when a required parameter is missing.
|
|
548
|
+
*/
|
|
549
|
+
var MissingParameterError = /*#__PURE__*/function (_Error) {
|
|
550
|
+
function MissingParameterError(parameter, message) {
|
|
551
|
+
var _this;
|
|
552
|
+
_classCallCheck(this, MissingParameterError);
|
|
553
|
+
var label = Array.isArray(parameter) ? parameter.join(', ') : parameter;
|
|
554
|
+
_this = _callSuper(this, MissingParameterError, [message !== null && message !== void 0 ? message : "Missing required parameter: ".concat(label, ".")]);
|
|
555
|
+
_this.name = 'MissingParameterError';
|
|
556
|
+
return _this;
|
|
557
|
+
}
|
|
558
|
+
_inherits(MissingParameterError, _Error);
|
|
559
|
+
return _createClass(MissingParameterError);
|
|
560
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
561
|
+
|
|
576
562
|
/**
|
|
577
563
|
* Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
|
|
578
564
|
*/
|
|
@@ -594,22 +580,99 @@ var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
|
|
|
594
580
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
595
581
|
|
|
596
582
|
/**
|
|
597
|
-
*
|
|
583
|
+
* Error thrown when numeric input is invalid or cannot be parsed.
|
|
584
|
+
*/
|
|
585
|
+
var NumberFormatError = /*#__PURE__*/function (_Error) {
|
|
586
|
+
function NumberFormatError() {
|
|
587
|
+
var _this;
|
|
588
|
+
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Input must be a valid number';
|
|
589
|
+
_classCallCheck(this, NumberFormatError);
|
|
590
|
+
_this = _callSuper(this, NumberFormatError, [message]);
|
|
591
|
+
_this.name = 'NumberFormatError';
|
|
592
|
+
return _this;
|
|
593
|
+
}
|
|
594
|
+
_inherits(NumberFormatError, _Error);
|
|
595
|
+
return _createClass(NumberFormatError);
|
|
596
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Error thrown when asset or currency overrides are invalid or conflicting.
|
|
600
|
+
*/
|
|
601
|
+
var OverrideConflictError = /*#__PURE__*/function (_Error) {
|
|
602
|
+
function OverrideConflictError(message) {
|
|
603
|
+
var _this;
|
|
604
|
+
_classCallCheck(this, OverrideConflictError);
|
|
605
|
+
_this = _callSuper(this, OverrideConflictError, [message]);
|
|
606
|
+
_this.name = 'OverrideConflictError';
|
|
607
|
+
return _this;
|
|
608
|
+
}
|
|
609
|
+
_inherits(OverrideConflictError, _Error);
|
|
610
|
+
return _createClass(OverrideConflictError);
|
|
611
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* Error thrown when no provider or RPC endpoint is available for the requested chain.
|
|
615
|
+
*/
|
|
616
|
+
var ProviderUnavailableError = /*#__PURE__*/function (_Error) {
|
|
617
|
+
function ProviderUnavailableError(message) {
|
|
618
|
+
var _this;
|
|
619
|
+
_classCallCheck(this, ProviderUnavailableError);
|
|
620
|
+
_this = _callSuper(this, ProviderUnavailableError, [message]);
|
|
621
|
+
_this.name = 'ProviderUnavailableError';
|
|
622
|
+
return _this;
|
|
623
|
+
}
|
|
624
|
+
_inherits(ProviderUnavailableError, _Error);
|
|
625
|
+
return _createClass(ProviderUnavailableError);
|
|
626
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Error thrown when routing or path resolution fails.
|
|
630
|
+
*/
|
|
631
|
+
var RoutingResolutionError = /*#__PURE__*/function (_Error) {
|
|
632
|
+
function RoutingResolutionError(message) {
|
|
633
|
+
var _this;
|
|
634
|
+
_classCallCheck(this, RoutingResolutionError);
|
|
635
|
+
_this = _callSuper(this, RoutingResolutionError, [message]);
|
|
636
|
+
_this.name = 'RoutingResolutionError';
|
|
637
|
+
return _this;
|
|
638
|
+
}
|
|
639
|
+
_inherits(RoutingResolutionError, _Error);
|
|
640
|
+
return _createClass(RoutingResolutionError);
|
|
641
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Error thrown when a required runtime API is not available on the target chain.
|
|
645
|
+
*/
|
|
646
|
+
var RuntimeApiUnavailableError = /*#__PURE__*/function (_Error) {
|
|
647
|
+
function RuntimeApiUnavailableError(chain, apiName) {
|
|
648
|
+
var _this;
|
|
649
|
+
_classCallCheck(this, RuntimeApiUnavailableError);
|
|
650
|
+
_this = _callSuper(this, RuntimeApiUnavailableError, ["Runtime API \"".concat(apiName, "\" is not available on chain ").concat(chain)]);
|
|
651
|
+
_this.name = 'RuntimeApiUnavailableError';
|
|
652
|
+
return _this;
|
|
653
|
+
}
|
|
654
|
+
_inherits(RuntimeApiUnavailableError, _Error);
|
|
655
|
+
return _createClass(RuntimeApiUnavailableError);
|
|
656
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Error thrown when a scenario, route, or chain capability is not supported.
|
|
598
660
|
*/
|
|
599
661
|
var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
600
|
-
|
|
601
|
-
* Constructs a new ScenarioNotSupportedError.
|
|
602
|
-
*
|
|
603
|
-
* @param chain - The chain where the scenario is not supported.
|
|
604
|
-
* @param scenario - The scenario that is not supported.
|
|
605
|
-
* @param message - Optional custom error message.
|
|
606
|
-
*/
|
|
607
|
-
function ScenarioNotSupportedError(chain, scenario, message) {
|
|
662
|
+
function ScenarioNotSupportedError(contextOrMsg) {
|
|
608
663
|
var _this;
|
|
609
664
|
_classCallCheck(this, ScenarioNotSupportedError);
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
665
|
+
if (typeof contextOrMsg === 'string') {
|
|
666
|
+
_this = _callSuper(this, ScenarioNotSupportedError, [contextOrMsg]);
|
|
667
|
+
_this.name = 'ScenarioNotSupportedError';
|
|
668
|
+
return _possibleConstructorReturn(_this);
|
|
669
|
+
}
|
|
670
|
+
var chain = contextOrMsg.chain,
|
|
671
|
+
scenario = contextOrMsg.scenario;
|
|
672
|
+
var parts = ["Scenario ".concat(scenario), "for chain ".concat(chain), 'is not supported'];
|
|
673
|
+
_this = _callSuper(this, ScenarioNotSupportedError, [parts.join(' ')]);
|
|
674
|
+
_this.name = 'ScenarioNotSupportedError';
|
|
675
|
+
return _assertThisInitialized(_this);
|
|
613
676
|
}
|
|
614
677
|
_inherits(ScenarioNotSupportedError, _Error);
|
|
615
678
|
return _createClass(ScenarioNotSupportedError);
|
|
@@ -647,6 +710,21 @@ var UnableToComputeError = /*#__PURE__*/function (_Error) {
|
|
|
647
710
|
return _createClass(UnableToComputeError);
|
|
648
711
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
649
712
|
|
|
713
|
+
/**
|
|
714
|
+
* Error thrown when an operation or parameter combination is not supported.
|
|
715
|
+
*/
|
|
716
|
+
var UnsupportedOperationError = /*#__PURE__*/function (_Error) {
|
|
717
|
+
function UnsupportedOperationError(message) {
|
|
718
|
+
var _this;
|
|
719
|
+
_classCallCheck(this, UnsupportedOperationError);
|
|
720
|
+
_this = _callSuper(this, UnsupportedOperationError, [message]);
|
|
721
|
+
_this.name = 'UnsupportedOperationError';
|
|
722
|
+
return _this;
|
|
723
|
+
}
|
|
724
|
+
_inherits(UnsupportedOperationError, _Error);
|
|
725
|
+
return _createClass(UnsupportedOperationError);
|
|
726
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
727
|
+
|
|
650
728
|
// Inspired by Talisman Society’s SS58 encoder:
|
|
651
729
|
// https://github.com/TalismanSociety/talisman/blob/dev/packages/crypto/src/address/encoding/ss58.ts
|
|
652
730
|
var blake2b256 = function blake2b256(msg) {
|
|
@@ -662,7 +740,7 @@ var blake2b512 = function blake2b512(msg) {
|
|
|
662
740
|
var ALLOWED_PUBKEY_BYTES = new Set([32, 33]);
|
|
663
741
|
var deriveAccountId = function deriveAccountId(raw) {
|
|
664
742
|
if (!ALLOWED_PUBKEY_BYTES.has(raw.length)) {
|
|
665
|
-
throw new
|
|
743
|
+
throw new InvalidAddressError('public key length is invalid');
|
|
666
744
|
}
|
|
667
745
|
return raw.length === 33 ? blake2b256(raw) : raw;
|
|
668
746
|
};
|
|
@@ -680,7 +758,7 @@ var networkToBytes = function networkToBytes(net) {
|
|
|
680
758
|
};
|
|
681
759
|
var encodeSs58 = function encodeSs58(payload, network) {
|
|
682
760
|
if (!VALID_ADDR_PAYLOAD.has(payload.length)) {
|
|
683
|
-
throw new
|
|
761
|
+
throw new InvalidAddressError('unexpected payload length for SS58 address');
|
|
684
762
|
}
|
|
685
763
|
var netBytes = networkToBytes(network);
|
|
686
764
|
var chkInput = new Uint8Array(SS58_HARD_PREFIX.length + netBytes.length + payload.length);
|
|
@@ -700,10 +778,10 @@ var convertSs58 = function convertSs58(api, address, chain) {
|
|
|
700
778
|
return address;
|
|
701
779
|
}
|
|
702
780
|
if (isEvmAddress) {
|
|
703
|
-
throw new
|
|
781
|
+
throw new InvalidAddressError('Cannot convert EVM address to SS58.');
|
|
704
782
|
}
|
|
705
783
|
if (isChainEvm(chain)) {
|
|
706
|
-
throw new
|
|
784
|
+
throw new InvalidAddressError('Cannot convert SS58 address to EVM.');
|
|
707
785
|
}
|
|
708
786
|
var _getAssetsObject = getAssetsObject(chain),
|
|
709
787
|
ss58Prefix = _getAssetsObject.ss58Prefix;
|
|
@@ -722,17 +800,17 @@ var addXcmVersionHeader = function addXcmVersionHeader(obj, version) {
|
|
|
722
800
|
|
|
723
801
|
var assertToIsString = function assertToIsString(to, overrideMsg) {
|
|
724
802
|
if (isTLocation(to)) {
|
|
725
|
-
throw new
|
|
803
|
+
throw new InvalidAddressError(overrideMsg !== null && overrideMsg !== void 0 ? overrideMsg : 'Location destination is not supported for XCM fee calculation.');
|
|
726
804
|
}
|
|
727
805
|
};
|
|
728
806
|
var assertAddressIsString = function assertAddressIsString(address) {
|
|
729
807
|
if (isTLocation(address)) {
|
|
730
|
-
throw new
|
|
808
|
+
throw new InvalidAddressError('Location address is not supported for this transfer type.');
|
|
731
809
|
}
|
|
732
810
|
};
|
|
733
811
|
var assertSenderAddress = function assertSenderAddress(address) {
|
|
734
812
|
if (!address) {
|
|
735
|
-
throw new
|
|
813
|
+
throw new MissingParameterError('senderAddress');
|
|
736
814
|
}
|
|
737
815
|
};
|
|
738
816
|
var assertHasLocation = function assertHasLocation(asset) {
|
|
@@ -741,16 +819,10 @@ var assertHasLocation = function assertHasLocation(asset) {
|
|
|
741
819
|
}
|
|
742
820
|
};
|
|
743
821
|
var assertHasId = function assertHasId(asset) {
|
|
744
|
-
assertIsForeign(asset);
|
|
745
822
|
if (asset.assetId === undefined) {
|
|
746
823
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " has no assetId"));
|
|
747
824
|
}
|
|
748
825
|
};
|
|
749
|
-
var assertIsForeign = function assertIsForeign(asset) {
|
|
750
|
-
if (!isForeignAsset(asset)) {
|
|
751
|
-
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " is not a foreign asset"));
|
|
752
|
-
}
|
|
753
|
-
};
|
|
754
826
|
|
|
755
827
|
var createId = function createId(version, location) {
|
|
756
828
|
if (version === Version.V3) {
|
|
@@ -790,7 +862,7 @@ var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
|
790
862
|
return id;
|
|
791
863
|
}
|
|
792
864
|
if (!(/^\d{38,39}$/.test(id) || /^\d{4}$/.test(id))) {
|
|
793
|
-
throw new
|
|
865
|
+
throw new NumberFormatError("Asset id: ".concat(id, " must be a string and have either 4 digits or 38-39 digits"));
|
|
794
866
|
}
|
|
795
867
|
return "0xffffffff".concat(BigInt(id).toString(16).padStart(32, '0'));
|
|
796
868
|
};
|
|
@@ -807,7 +879,7 @@ var maybeOverrideAsset = function maybeOverrideAsset(version, amount, asset, ove
|
|
|
807
879
|
}
|
|
808
880
|
if (Array.isArray(overriddenCurrency)) {
|
|
809
881
|
if (overriddenCurrency.length !== 1) {
|
|
810
|
-
throw new
|
|
882
|
+
throw new OverrideConflictError('Expected a single asset in overriddenCurrency array.');
|
|
811
883
|
}
|
|
812
884
|
return overriddenCurrency[0];
|
|
813
885
|
}
|
|
@@ -933,7 +1005,7 @@ var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
|
|
|
933
1005
|
if (paraId) {
|
|
934
1006
|
var resolvedChain = getTChain(paraId, getRelayChainOf(chain));
|
|
935
1007
|
if (!resolvedChain) {
|
|
936
|
-
throw new
|
|
1008
|
+
throw new RoutingResolutionError("Chain with paraId ".concat(paraId, " not found"));
|
|
937
1009
|
}
|
|
938
1010
|
return resolvedChain;
|
|
939
1011
|
}
|
|
@@ -974,7 +1046,7 @@ var buildLocation = function buildLocation(_ref) {
|
|
|
974
1046
|
asset = _ref.asset,
|
|
975
1047
|
origin = _ref.origin,
|
|
976
1048
|
destination = _ref.destination;
|
|
977
|
-
if (
|
|
1049
|
+
if (asset.isNative) {
|
|
978
1050
|
return resolveLocationFromDest(destination, asset);
|
|
979
1051
|
}
|
|
980
1052
|
var createDefaultLocation = function createDefaultLocation(assetId) {
|
|
@@ -2684,7 +2756,7 @@ var getChainProviders = function getChainProviders(chain) {
|
|
|
2684
2756
|
var _getChainConfig = getChainConfig(chain),
|
|
2685
2757
|
providers = _getChainConfig.providers;
|
|
2686
2758
|
if (providers.length === 0) {
|
|
2687
|
-
throw new
|
|
2759
|
+
throw new ProviderUnavailableError("No providers found for chain ".concat(chain));
|
|
2688
2760
|
}
|
|
2689
2761
|
// Prefer Dwellir provider
|
|
2690
2762
|
providers.sort(function (a, b) {
|
|
@@ -2773,13 +2845,13 @@ var resolveTChainFromLocation = function resolveTChainFromLocation(relaychain, l
|
|
|
2773
2845
|
var _PARACHAINS$find;
|
|
2774
2846
|
var parachainId = getJunctionValue(location, 'Parachain');
|
|
2775
2847
|
if (parachainId === undefined) {
|
|
2776
|
-
throw new
|
|
2848
|
+
throw new RoutingResolutionError('Parachain ID not found in destination location.');
|
|
2777
2849
|
}
|
|
2778
2850
|
var chain = (_PARACHAINS$find = PARACHAINS.find(function (chain) {
|
|
2779
2851
|
return getParaId(chain) === parachainId && getRelayChainOf(chain) === relaychain;
|
|
2780
2852
|
})) !== null && _PARACHAINS$find !== void 0 ? _PARACHAINS$find : null;
|
|
2781
2853
|
if (chain === null) {
|
|
2782
|
-
throw new
|
|
2854
|
+
throw new RoutingResolutionError('Chain with specified paraId not found in destination location.');
|
|
2783
2855
|
}
|
|
2784
2856
|
return chain;
|
|
2785
2857
|
};
|
|
@@ -2843,7 +2915,7 @@ var claimAssets = /*#__PURE__*/function () {
|
|
|
2843
2915
|
_context.n = 2;
|
|
2844
2916
|
break;
|
|
2845
2917
|
}
|
|
2846
|
-
throw new
|
|
2918
|
+
throw new UnsupportedOperationError('Unsupported pallet for asset claim');
|
|
2847
2919
|
case 2:
|
|
2848
2920
|
version = getChainVersion(chain);
|
|
2849
2921
|
assets = resolveAssets(options, version);
|
|
@@ -2933,7 +3005,7 @@ var getMythosOriginFee = /*#__PURE__*/function () {
|
|
|
2933
3005
|
_context.n = 5;
|
|
2934
3006
|
break;
|
|
2935
3007
|
}
|
|
2936
|
-
throw new
|
|
3008
|
+
throw new UnableToComputeError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
2937
3009
|
case 5:
|
|
2938
3010
|
return _context.a(2, padValueBy(feeConverted, 10));
|
|
2939
3011
|
}
|
|
@@ -3252,7 +3324,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
3252
3324
|
_context2.n = 2;
|
|
3253
3325
|
break;
|
|
3254
3326
|
}
|
|
3255
|
-
throw new
|
|
3327
|
+
throw new BatchValidationError('No transactions to batch.');
|
|
3256
3328
|
case 2:
|
|
3257
3329
|
sameFrom = this.transactionOptions.every(function (tx) {
|
|
3258
3330
|
return tx.from === from;
|
|
@@ -3261,7 +3333,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
3261
3333
|
_context2.n = 3;
|
|
3262
3334
|
break;
|
|
3263
3335
|
}
|
|
3264
|
-
throw new
|
|
3336
|
+
throw new BatchValidationError('All transactions must have the same origin.');
|
|
3265
3337
|
case 3:
|
|
3266
3338
|
_context2.n = 4;
|
|
3267
3339
|
return Promise.all(this.transactionOptions.map(/*#__PURE__*/function () {
|
|
@@ -3311,10 +3383,10 @@ var buildDryRun = function buildDryRun(api, tx, options, bypassOptions) {
|
|
|
3311
3383
|
from = options.from,
|
|
3312
3384
|
currency = options.currency;
|
|
3313
3385
|
if (isTLocation(to)) {
|
|
3314
|
-
throw new
|
|
3386
|
+
throw new InvalidAddressError('Location destination is not supported for XCM fee calculation.');
|
|
3315
3387
|
}
|
|
3316
3388
|
if (isTLocation(address)) {
|
|
3317
|
-
throw new
|
|
3389
|
+
throw new InvalidAddressError('Location address is not supported for XCM fee calculation.');
|
|
3318
3390
|
}
|
|
3319
3391
|
return dryRun({
|
|
3320
3392
|
api: api,
|
|
@@ -3363,7 +3435,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3363
3435
|
key: "to",
|
|
3364
3436
|
value: function to(chain, paraIdTo) {
|
|
3365
3437
|
if (this._options.from && isRelayChain(this._options.from) && chain === 'Ethereum') {
|
|
3366
|
-
throw new
|
|
3438
|
+
throw new ScenarioNotSupportedError('Transfers from relay chain to Ethereum are not yet supported.');
|
|
3367
3439
|
}
|
|
3368
3440
|
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
3369
3441
|
to: chain,
|
|
@@ -3589,7 +3661,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3589
3661
|
_context4.n = 1;
|
|
3590
3662
|
break;
|
|
3591
3663
|
}
|
|
3592
|
-
throw new
|
|
3664
|
+
throw new BatchValidationError('Transaction manager contains batched items. Use buildBatch() to process them.');
|
|
3593
3665
|
case 1:
|
|
3594
3666
|
_context4.n = 2;
|
|
3595
3667
|
return this.prepareNormalizedOptions(this._options);
|
|
@@ -3824,7 +3896,13 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3824
3896
|
return getOriginXcmFee$1;
|
|
3825
3897
|
}()
|
|
3826
3898
|
/**
|
|
3827
|
-
* Estimates the origin and destination XCM fee using paymentInfo function.
|
|
3899
|
+
* Estimates the origin and destination XCM fee using the `paymentInfo` function.
|
|
3900
|
+
*
|
|
3901
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
3902
|
+
* Please use `builder.getXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
3903
|
+
* Will be removed in v13.
|
|
3904
|
+
* For more details, see the documentation:
|
|
3905
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
3828
3906
|
*
|
|
3829
3907
|
* @returns An origin and destination fee estimate.
|
|
3830
3908
|
*/
|
|
@@ -3882,6 +3960,12 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3882
3960
|
/**
|
|
3883
3961
|
* Estimates the origin XCM fee using paymentInfo function.
|
|
3884
3962
|
*
|
|
3963
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
3964
|
+
* Please use `builder.getOriginXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
3965
|
+
* Will be removed in v13.
|
|
3966
|
+
* For more details, see the documentation:
|
|
3967
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
3968
|
+
*
|
|
3885
3969
|
* @returns An origin fee estimate.
|
|
3886
3970
|
*/
|
|
3887
3971
|
)
|
|
@@ -4218,7 +4302,7 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
4218
4302
|
case 1:
|
|
4219
4303
|
edNative = getExistentialDepositOrThrow(origin);
|
|
4220
4304
|
_context.n = 2;
|
|
4221
|
-
return
|
|
4305
|
+
return getBalanceInternal({
|
|
4222
4306
|
api: api,
|
|
4223
4307
|
chain: origin,
|
|
4224
4308
|
address: senderAddress
|
|
@@ -4276,7 +4360,7 @@ var isSufficientDestination = /*#__PURE__*/function () {
|
|
|
4276
4360
|
case 1:
|
|
4277
4361
|
existentialDeposit = getExistentialDepositOrThrow(destination);
|
|
4278
4362
|
_context2.n = 2;
|
|
4279
|
-
return
|
|
4363
|
+
return getBalanceInternal({
|
|
4280
4364
|
api: api,
|
|
4281
4365
|
chain: destination,
|
|
4282
4366
|
address: address
|
|
@@ -4420,8 +4504,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4420
4504
|
fee: _fee,
|
|
4421
4505
|
feeType: 'paymentInfo',
|
|
4422
4506
|
sufficient: sufficient,
|
|
4423
|
-
asset: asset
|
|
4424
|
-
currency: asset.symbol
|
|
4507
|
+
asset: asset
|
|
4425
4508
|
});
|
|
4426
4509
|
case 3:
|
|
4427
4510
|
_context3.n = 4;
|
|
@@ -4461,8 +4544,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4461
4544
|
dryRunError: dryRunResult.failureReason,
|
|
4462
4545
|
dryRunSubError: dryRunResult.failureSubReason,
|
|
4463
4546
|
sufficient: false,
|
|
4464
|
-
asset: asset
|
|
4465
|
-
currency: asset.symbol
|
|
4547
|
+
asset: asset
|
|
4466
4548
|
});
|
|
4467
4549
|
case 7:
|
|
4468
4550
|
fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
|
|
@@ -4472,8 +4554,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4472
4554
|
sufficient: true,
|
|
4473
4555
|
forwardedXcms: newForwardedXcms,
|
|
4474
4556
|
destParaId: destParaId,
|
|
4475
|
-
asset: asset
|
|
4476
|
-
currency: asset.symbol
|
|
4557
|
+
asset: asset
|
|
4477
4558
|
});
|
|
4478
4559
|
}
|
|
4479
4560
|
}, _callee3);
|
|
@@ -4693,11 +4774,11 @@ var validateCurrency = function validateCurrency(currency, feeAsset) {
|
|
|
4693
4774
|
};
|
|
4694
4775
|
var validateDestination = function validateDestination(origin, destination) {
|
|
4695
4776
|
if (isRelayChain(origin) && !isTLocation(destination) && isRelayChain(destination) && origin !== destination) {
|
|
4696
|
-
throw new
|
|
4777
|
+
throw new ScenarioNotSupportedError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
|
|
4697
4778
|
}
|
|
4698
4779
|
var allowedChainsToEthereum = ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Moonbeam', 'Mythos'];
|
|
4699
4780
|
if (destination === 'Ethereum' && !allowedChainsToEthereum.includes(origin)) {
|
|
4700
|
-
throw new
|
|
4781
|
+
throw new ScenarioNotSupportedError("Transfers to Ethereum are only supported from: ".concat(allowedChainsToEthereum.join(', ')));
|
|
4701
4782
|
}
|
|
4702
4783
|
var isLocationDestination = _typeof(destination) === 'object';
|
|
4703
4784
|
var isBridge = !isTLocation(destination) && isSubstrateBridge(origin, destination);
|
|
@@ -4706,7 +4787,7 @@ var validateDestination = function validateDestination(origin, destination) {
|
|
|
4706
4787
|
var originRelayChainSymbol = getRelayChainSymbol(origin);
|
|
4707
4788
|
var destinationRelayChainSymbol = getRelayChainSymbol(destination);
|
|
4708
4789
|
if (!isBridge && originRelayChainSymbol !== destinationRelayChainSymbol) {
|
|
4709
|
-
throw new
|
|
4790
|
+
throw new ScenarioNotSupportedError('Origin and destination must share the same relay chain unless using a bridge.');
|
|
4710
4791
|
}
|
|
4711
4792
|
}
|
|
4712
4793
|
};
|
|
@@ -4726,12 +4807,6 @@ var getFailureInfo$1 = function getFailureInfo(result) {
|
|
|
4726
4807
|
}, {
|
|
4727
4808
|
chain: 'destination',
|
|
4728
4809
|
chainResult: result.destination
|
|
4729
|
-
}, {
|
|
4730
|
-
chain: 'assetHub',
|
|
4731
|
-
chainResult: result.assetHub
|
|
4732
|
-
}, {
|
|
4733
|
-
chain: 'bridgeHub',
|
|
4734
|
-
chainResult: result.bridgeHub
|
|
4735
4810
|
}].concat(_toConsumableArray(result.hops.map(function (hop) {
|
|
4736
4811
|
return {
|
|
4737
4812
|
chain: hop.chain,
|
|
@@ -4957,13 +5032,13 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
4957
5032
|
_context.n = 1;
|
|
4958
5033
|
break;
|
|
4959
5034
|
}
|
|
4960
|
-
throw new
|
|
5035
|
+
throw new UnsupportedOperationError('Multi-assets are not yet supported for EVM transfers');
|
|
4961
5036
|
case 1:
|
|
4962
5037
|
if (!('location' in currency && isOverrideLocationSpecifier(currency.location))) {
|
|
4963
5038
|
_context.n = 2;
|
|
4964
5039
|
break;
|
|
4965
5040
|
}
|
|
4966
|
-
throw new
|
|
5041
|
+
throw new UnsupportedOperationError('Override location is not supported for EVM transfers');
|
|
4967
5042
|
case 2:
|
|
4968
5043
|
contract = getContract({
|
|
4969
5044
|
abi: abi$1,
|
|
@@ -4986,7 +5061,7 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
4986
5061
|
_context.n = 5;
|
|
4987
5062
|
break;
|
|
4988
5063
|
case 3:
|
|
4989
|
-
if (!(
|
|
5064
|
+
if (!(foundAsset.assetId === undefined)) {
|
|
4990
5065
|
_context.n = 4;
|
|
4991
5066
|
break;
|
|
4992
5067
|
}
|
|
@@ -5006,7 +5081,7 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
5006
5081
|
usdtAsset = findAssetInfoOrThrow(from, {
|
|
5007
5082
|
symbol: 'xcUSDT'
|
|
5008
5083
|
}, to);
|
|
5009
|
-
|
|
5084
|
+
assertHasId(usdtAsset);
|
|
5010
5085
|
if (!useMultiAssets) {
|
|
5011
5086
|
_context.n = 7;
|
|
5012
5087
|
break;
|
|
@@ -5262,7 +5337,7 @@ var createMainInstruction = function createMainInstruction(origin, asset, ethAss
|
|
|
5262
5337
|
var assetEcosystem = RELAYCHAINS.find(function (chain) {
|
|
5263
5338
|
return asset.symbol.includes(getNativeAssetSymbol(chain));
|
|
5264
5339
|
});
|
|
5265
|
-
if (!assetEcosystem) throw new
|
|
5340
|
+
if (!assetEcosystem) throw new UnsupportedOperationError('Unsupported native polkadot asset');
|
|
5266
5341
|
return {
|
|
5267
5342
|
DepositReserveAsset: {
|
|
5268
5343
|
assets: {
|
|
@@ -5322,7 +5397,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
5322
5397
|
version = _ref.version;
|
|
5323
5398
|
assertSenderAddress(senderAddress);
|
|
5324
5399
|
if (isChainEvm(origin) && !ahAddress) {
|
|
5325
|
-
throw new
|
|
5400
|
+
throw new MissingParameterError('ahAddress');
|
|
5326
5401
|
}
|
|
5327
5402
|
return _defineProperty({}, version, [{
|
|
5328
5403
|
SetAppendix: origin === 'Mythos' ? [] : [{
|
|
@@ -5473,7 +5548,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5473
5548
|
_context.n = 1;
|
|
5474
5549
|
break;
|
|
5475
5550
|
}
|
|
5476
|
-
throw new
|
|
5551
|
+
throw new MissingParameterError('ahAddress');
|
|
5477
5552
|
case 1:
|
|
5478
5553
|
_context.n = 2;
|
|
5479
5554
|
return getBridgeStatus(api.clone());
|
|
@@ -5489,13 +5564,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5489
5564
|
_context.n = 4;
|
|
5490
5565
|
break;
|
|
5491
5566
|
}
|
|
5492
|
-
throw new
|
|
5567
|
+
throw new UnsupportedOperationError('Multi-assets are not yet supported for EVM transfers');
|
|
5493
5568
|
case 4:
|
|
5494
5569
|
if (!('location' in currency && isOverrideLocationSpecifier(currency.location))) {
|
|
5495
5570
|
_context.n = 5;
|
|
5496
5571
|
break;
|
|
5497
5572
|
}
|
|
5498
|
-
throw new
|
|
5573
|
+
throw new UnsupportedOperationError('Override location is not supported for EVM transfers');
|
|
5499
5574
|
case 5:
|
|
5500
5575
|
foundAsset = findAssetInfoOrThrow(from, currency, to);
|
|
5501
5576
|
amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
|
|
@@ -5555,7 +5630,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5555
5630
|
};
|
|
5556
5631
|
numberToHex32 = function numberToHex32(num) {
|
|
5557
5632
|
return typeof num !== 'number' || isNaN(num) ? function () {
|
|
5558
|
-
throw new
|
|
5633
|
+
throw new NumberFormatError('Input must be a valid number');
|
|
5559
5634
|
}() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
|
|
5560
5635
|
}; // Execute the custom XCM message with the precompile
|
|
5561
5636
|
_context.n = 11;
|
|
@@ -5583,13 +5658,11 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5583
5658
|
|
|
5584
5659
|
var traverseXcmHops = /*#__PURE__*/function () {
|
|
5585
5660
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
|
|
5586
|
-
var api, origin, destination, currency, initialForwardedXcms, initialDestParaId, swapConfig, processHop, shouldContinue, extractNextHopData,
|
|
5661
|
+
var api, origin, destination, currency, initialForwardedXcms, initialDestParaId, swapConfig, processHop, shouldContinue, extractNextHopData, currentOrigin, forwardedXcms, nextParaId, asset, currentAsset, hasPassedExchange, hops, destinationResult, nextChain, hopApi, isDestination, hopResult, _extractNextHopData, newXcms, destParaId;
|
|
5587
5662
|
return _regenerator().w(function (_context) {
|
|
5588
5663
|
while (1) switch (_context.p = _context.n) {
|
|
5589
5664
|
case 0:
|
|
5590
5665
|
api = config.api, origin = config.origin, destination = config.destination, currency = config.currency, initialForwardedXcms = config.initialForwardedXcms, initialDestParaId = config.initialDestParaId, swapConfig = config.swapConfig, processHop = config.processHop, shouldContinue = config.shouldContinue, extractNextHopData = config.extractNextHopData;
|
|
5591
|
-
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5592
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5593
5666
|
currentOrigin = origin;
|
|
5594
5667
|
forwardedXcms = initialForwardedXcms;
|
|
5595
5668
|
nextParaId = initialDestParaId;
|
|
@@ -5597,7 +5670,6 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5597
5670
|
currentAsset = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain) ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, null) : asset;
|
|
5598
5671
|
hasPassedExchange = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain);
|
|
5599
5672
|
hops = [];
|
|
5600
|
-
intermediateResults = {};
|
|
5601
5673
|
case 1:
|
|
5602
5674
|
if (!(Array.isArray(forwardedXcms) && forwardedXcms.length > 0 && forwardedXcms[1].length > 0 && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
|
|
5603
5675
|
_context.n = 10;
|
|
@@ -5608,7 +5680,7 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5608
5680
|
_context.n = 2;
|
|
5609
5681
|
break;
|
|
5610
5682
|
}
|
|
5611
|
-
throw new
|
|
5683
|
+
throw new RoutingResolutionError("Unable to find TChain for paraId ".concat(nextParaId));
|
|
5612
5684
|
case 2:
|
|
5613
5685
|
hopApi = api.clone();
|
|
5614
5686
|
_context.p = 3;
|
|
@@ -5619,8 +5691,6 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5619
5691
|
// - normally when nextChain === destination
|
|
5620
5692
|
// - but if swap is required, only after (or on) the exchange hop
|
|
5621
5693
|
isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
|
|
5622
|
-
isAssetHub = nextChain === assetHubChain;
|
|
5623
|
-
isBridgeHub = nextChain === bridgeHubChain;
|
|
5624
5694
|
_context.n = 5;
|
|
5625
5695
|
return processHop({
|
|
5626
5696
|
api: hopApi,
|
|
@@ -5629,9 +5699,7 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5629
5699
|
currentAsset: currentAsset,
|
|
5630
5700
|
forwardedXcms: forwardedXcms,
|
|
5631
5701
|
hasPassedExchange: hasPassedExchange,
|
|
5632
|
-
isDestination: isDestination
|
|
5633
|
-
isAssetHub: isAssetHub,
|
|
5634
|
-
isBridgeHub: isBridgeHub
|
|
5702
|
+
isDestination: isDestination
|
|
5635
5703
|
});
|
|
5636
5704
|
case 5:
|
|
5637
5705
|
hopResult = _context.v;
|
|
@@ -5643,10 +5711,6 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5643
5711
|
}
|
|
5644
5712
|
if (isDestination) {
|
|
5645
5713
|
destinationResult = hopResult;
|
|
5646
|
-
} else if (isAssetHub) {
|
|
5647
|
-
intermediateResults.assetHub = hopResult;
|
|
5648
|
-
} else if (isBridgeHub) {
|
|
5649
|
-
intermediateResults.bridgeHub = hopResult;
|
|
5650
5714
|
}
|
|
5651
5715
|
if (shouldContinue(hopResult)) {
|
|
5652
5716
|
_context.n = 6;
|
|
@@ -5673,13 +5737,9 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5673
5737
|
_context.n = 1;
|
|
5674
5738
|
break;
|
|
5675
5739
|
case 10:
|
|
5676
|
-
return _context.a(2, _objectSpread2(_objectSpread2(
|
|
5740
|
+
return _context.a(2, _objectSpread2(_objectSpread2({
|
|
5677
5741
|
hops: hops
|
|
5678
|
-
},
|
|
5679
|
-
assetHub: intermediateResults.assetHub
|
|
5680
|
-
}), intermediateResults.bridgeHub && {
|
|
5681
|
-
bridgeHub: intermediateResults.bridgeHub
|
|
5682
|
-
}), destinationResult && {
|
|
5742
|
+
}, destinationResult && {
|
|
5683
5743
|
destination: destinationResult
|
|
5684
5744
|
}), {}, {
|
|
5685
5745
|
lastProcessedChain: currentOrigin
|
|
@@ -5726,8 +5786,7 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
|
|
|
5726
5786
|
|
|
5727
5787
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5728
5788
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5729
|
-
var
|
|
5730
|
-
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, result, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5789
|
+
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, bridgeHubChain, assetHubChain, bridgeHubHop, processedBridgeHub, bridgeHubHopIndex, result, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5731
5790
|
return _regenerator().w(function (_context2) {
|
|
5732
5791
|
while (1) switch (_context2.n) {
|
|
5733
5792
|
case 0:
|
|
@@ -5810,7 +5869,6 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5810
5869
|
}
|
|
5811
5870
|
return _context.a(2, {
|
|
5812
5871
|
success: false,
|
|
5813
|
-
currency: currentAsset.symbol,
|
|
5814
5872
|
asset: currentAsset,
|
|
5815
5873
|
failureReason: "DryRunApi is not available on chain ".concat(currentChain)
|
|
5816
5874
|
});
|
|
@@ -5830,7 +5888,6 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5830
5888
|
case 2:
|
|
5831
5889
|
hopDryRun = _context.v;
|
|
5832
5890
|
return _context.a(2, _objectSpread2(_objectSpread2({}, hopDryRun), {}, {
|
|
5833
|
-
currency: hopAsset.symbol,
|
|
5834
5891
|
asset: hopAsset
|
|
5835
5892
|
}));
|
|
5836
5893
|
}
|
|
@@ -5863,34 +5920,37 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5863
5920
|
case 6:
|
|
5864
5921
|
traversalResult = _context2.v;
|
|
5865
5922
|
// Process Ethereum bridge fees
|
|
5923
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5866
5924
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5867
|
-
|
|
5925
|
+
bridgeHubHop = traversalResult.hops.find(function (hop) {
|
|
5926
|
+
return hop.chain === bridgeHubChain;
|
|
5927
|
+
}); // For Mythos → Ethereum, we skip additional Ethereum bridge fees (aligns with getXcmFeeInternal)
|
|
5868
5928
|
if (!isMythosToEthereum) {
|
|
5869
5929
|
_context2.n = 7;
|
|
5870
5930
|
break;
|
|
5871
5931
|
}
|
|
5872
|
-
_t8 =
|
|
5932
|
+
_t8 = bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result;
|
|
5873
5933
|
_context2.n = 11;
|
|
5874
5934
|
break;
|
|
5875
5935
|
case 7:
|
|
5876
|
-
if (!(
|
|
5936
|
+
if (!(bridgeHubHop !== null && bridgeHubHop !== void 0 && bridgeHubHop.result.success)) {
|
|
5877
5937
|
_context2.n = 9;
|
|
5878
5938
|
break;
|
|
5879
5939
|
}
|
|
5880
5940
|
_context2.n = 8;
|
|
5881
|
-
return addEthereumBridgeFees(api,
|
|
5941
|
+
return addEthereumBridgeFees(api, bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result, destination, assetHubChain);
|
|
5882
5942
|
case 8:
|
|
5883
5943
|
_t9 = _context2.v;
|
|
5884
5944
|
_context2.n = 10;
|
|
5885
5945
|
break;
|
|
5886
5946
|
case 9:
|
|
5887
|
-
_t9 =
|
|
5947
|
+
_t9 = bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result;
|
|
5888
5948
|
case 10:
|
|
5889
5949
|
_t8 = _t9;
|
|
5890
5950
|
case 11:
|
|
5891
5951
|
processedBridgeHub = _t8;
|
|
5892
5952
|
// Update bridge hub in hops if needed
|
|
5893
|
-
if (processedBridgeHub && processedBridgeHub.success &&
|
|
5953
|
+
if (processedBridgeHub && processedBridgeHub.success && bridgeHubHop && bridgeHubHop.result.success && processedBridgeHub.fee !== bridgeHubHop.result.fee) {
|
|
5894
5954
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
5895
5955
|
return hop.chain === bridgeHubChain;
|
|
5896
5956
|
});
|
|
@@ -5900,14 +5960,8 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5900
5960
|
});
|
|
5901
5961
|
}
|
|
5902
5962
|
}
|
|
5903
|
-
bridgeHubWithCurrency = processedBridgeHub !== null && processedBridgeHub !== void 0 && processedBridgeHub.success ? _objectSpread2(_objectSpread2({}, processedBridgeHub), {}, {
|
|
5904
|
-
currency: getNativeAssetSymbol(bridgeHubChain),
|
|
5905
|
-
asset: findNativeAssetInfoOrThrow(bridgeHubChain)
|
|
5906
|
-
}) : processedBridgeHub;
|
|
5907
5963
|
result = {
|
|
5908
5964
|
origin: originDryModified,
|
|
5909
|
-
assetHub: traversalResult.assetHub,
|
|
5910
|
-
bridgeHub: bridgeHubWithCurrency,
|
|
5911
5965
|
destination: traversalResult.destination,
|
|
5912
5966
|
hops: traversalResult.hops
|
|
5913
5967
|
};
|
|
@@ -5954,7 +6008,7 @@ var dryRun = /*#__PURE__*/function () {
|
|
|
5954
6008
|
|
|
5955
6009
|
var dryRunOrigin = /*#__PURE__*/function () {
|
|
5956
6010
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
5957
|
-
var api, chain, address
|
|
6011
|
+
var api, chain, address;
|
|
5958
6012
|
return _regenerator().w(function (_context) {
|
|
5959
6013
|
while (1) switch (_context.p = _context.n) {
|
|
5960
6014
|
case 0:
|
|
@@ -5967,26 +6021,17 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5967
6021
|
_context.n = 2;
|
|
5968
6022
|
return api.getDryRunCall(options);
|
|
5969
6023
|
case 2:
|
|
5970
|
-
|
|
5971
|
-
if (!result.success) {
|
|
5972
|
-
_context.n = 3;
|
|
5973
|
-
break;
|
|
5974
|
-
}
|
|
5975
|
-
return _context.a(2, _objectSpread2(_objectSpread2({}, result), {}, {
|
|
5976
|
-
currency: getNativeAssetSymbol(chain)
|
|
5977
|
-
}));
|
|
6024
|
+
return _context.a(2, _context.v);
|
|
5978
6025
|
case 3:
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
_context.p = 4;
|
|
5982
|
-
_context.n = 5;
|
|
6026
|
+
_context.p = 3;
|
|
6027
|
+
_context.n = 4;
|
|
5983
6028
|
return api.disconnect();
|
|
6029
|
+
case 4:
|
|
6030
|
+
return _context.f(3);
|
|
5984
6031
|
case 5:
|
|
5985
|
-
return _context.f(4);
|
|
5986
|
-
case 6:
|
|
5987
6032
|
return _context.a(2);
|
|
5988
6033
|
}
|
|
5989
|
-
}, _callee, null, [[1,,
|
|
6034
|
+
}, _callee, null, [[1,, 3, 5]]);
|
|
5990
6035
|
}));
|
|
5991
6036
|
return function dryRunOrigin(_x) {
|
|
5992
6037
|
return _ref.apply(this, arguments);
|
|
@@ -5994,7 +6039,7 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5994
6039
|
}();
|
|
5995
6040
|
|
|
5996
6041
|
var pickOtherPallet = function pickOtherPallet(asset, pallets) {
|
|
5997
|
-
if (
|
|
6042
|
+
if (!asset.isNative && (!asset.assetId || asset.assetId.startsWith('0x'))) {
|
|
5998
6043
|
var _pallets$find;
|
|
5999
6044
|
// No assetId means it's probably a ForeignAssets pallet asset
|
|
6000
6045
|
return (_pallets$find = pallets.find(function (pallet) {
|
|
@@ -6007,7 +6052,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
|
|
|
6007
6052
|
var nativePallet = getNativeAssetsPallet(chain);
|
|
6008
6053
|
var otherPallets = getOtherAssetsPallets(chain);
|
|
6009
6054
|
var isMainNativeAsset = isSymbolMatch(asset.symbol, getNativeAssetSymbol(chain));
|
|
6010
|
-
var pallet =
|
|
6055
|
+
var pallet = !asset.isNative && chain !== 'Mythos' || !isMainNativeAsset ? pickOtherPallet(asset, otherPallets) : nativePallet;
|
|
6011
6056
|
var palletInstance = getPalletInstance(pallet);
|
|
6012
6057
|
return palletInstance.mint(address, asset, balance, chain, api);
|
|
6013
6058
|
};
|
|
@@ -6037,7 +6082,7 @@ var calcPreviewMintAmount = function calcPreviewMintAmount(balance, desired) {
|
|
|
6037
6082
|
return missing > 0n ? missing : null;
|
|
6038
6083
|
};
|
|
6039
6084
|
var assetKey = function assetKey(a) {
|
|
6040
|
-
return a.location ? JSON.stringify(a.location) :
|
|
6085
|
+
return a.location ? JSON.stringify(a.location) : !a.isNative && a.assetId != null ? "id:".concat(a.assetId) : "sym:".concat(a.symbol);
|
|
6041
6086
|
};
|
|
6042
6087
|
var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeAssets) {
|
|
6043
6088
|
if (!mintFeeAssets) return 0n;
|
|
@@ -6197,78 +6242,6 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
6197
6242
|
};
|
|
6198
6243
|
}();
|
|
6199
6244
|
|
|
6200
|
-
var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
6201
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6202
|
-
var _getExistentialDeposi;
|
|
6203
|
-
var api, account, accountDestination, ahAddress, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, _yield$Builder$from$t, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
6204
|
-
return _regenerator().w(function (_context) {
|
|
6205
|
-
while (1) switch (_context.n) {
|
|
6206
|
-
case 0:
|
|
6207
|
-
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, ahAddress = _ref.ahAddress, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
|
|
6208
|
-
_context.n = 1;
|
|
6209
|
-
return api.init(origin);
|
|
6210
|
-
case 1:
|
|
6211
|
-
_context.n = 2;
|
|
6212
|
-
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)['buildInternal']();
|
|
6213
|
-
case 2:
|
|
6214
|
-
_yield$Builder$from$t = _context.v;
|
|
6215
|
-
tx = _yield$Builder$from$t.tx;
|
|
6216
|
-
_context.n = 3;
|
|
6217
|
-
return api.calculateTransactionFee(tx, account);
|
|
6218
|
-
case 3:
|
|
6219
|
-
xcmFee = _context.v;
|
|
6220
|
-
xcmFeeWithMargin = xcmFee + xcmFee / BigInt(feeMarginPercentage);
|
|
6221
|
-
_context.n = 4;
|
|
6222
|
-
return getBalanceNative({
|
|
6223
|
-
address: account,
|
|
6224
|
-
chain: origin,
|
|
6225
|
-
api: api
|
|
6226
|
-
});
|
|
6227
|
-
case 4:
|
|
6228
|
-
nativeBalance = _context.v;
|
|
6229
|
-
existentialDeposit = BigInt((_getExistentialDeposi = getExistentialDeposit(origin)) !== null && _getExistentialDeposi !== void 0 ? _getExistentialDeposi : '0');
|
|
6230
|
-
sufficientForXCM = nativeBalance - existentialDeposit - xcmFeeWithMargin > 0;
|
|
6231
|
-
return _context.a(2, {
|
|
6232
|
-
sufficientForXCM: sufficientForXCM,
|
|
6233
|
-
xcmFee: xcmFee
|
|
6234
|
-
});
|
|
6235
|
-
}
|
|
6236
|
-
}, _callee);
|
|
6237
|
-
}));
|
|
6238
|
-
return function getOriginFeeDetailsInternal(_x) {
|
|
6239
|
-
return _ref2.apply(this, arguments);
|
|
6240
|
-
};
|
|
6241
|
-
}();
|
|
6242
|
-
var getOriginFeeDetails = /*#__PURE__*/function () {
|
|
6243
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
6244
|
-
var api;
|
|
6245
|
-
return _regenerator().w(function (_context2) {
|
|
6246
|
-
while (1) switch (_context2.p = _context2.n) {
|
|
6247
|
-
case 0:
|
|
6248
|
-
api = options.api;
|
|
6249
|
-
api.setDisconnectAllowed(false);
|
|
6250
|
-
_context2.p = 1;
|
|
6251
|
-
_context2.n = 2;
|
|
6252
|
-
return getOriginFeeDetailsInternal(options);
|
|
6253
|
-
case 2:
|
|
6254
|
-
return _context2.a(2, _context2.v);
|
|
6255
|
-
case 3:
|
|
6256
|
-
_context2.p = 3;
|
|
6257
|
-
api.setDisconnectAllowed(true);
|
|
6258
|
-
_context2.n = 4;
|
|
6259
|
-
return api.disconnect();
|
|
6260
|
-
case 4:
|
|
6261
|
-
return _context2.f(3);
|
|
6262
|
-
case 5:
|
|
6263
|
-
return _context2.a(2);
|
|
6264
|
-
}
|
|
6265
|
-
}, _callee2, null, [[1,, 3, 5]]);
|
|
6266
|
-
}));
|
|
6267
|
-
return function getOriginFeeDetails(_x2) {
|
|
6268
|
-
return _ref3.apply(this, arguments);
|
|
6269
|
-
};
|
|
6270
|
-
}();
|
|
6271
|
-
|
|
6272
6245
|
var MAX_INCREASE_RETRIES = 5;
|
|
6273
6246
|
var INCREASE_BUMP_STEP = 100;
|
|
6274
6247
|
var FIRST_INCREASE_BUMP_STEP = 1;
|
|
@@ -6484,7 +6457,7 @@ var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
|
6484
6457
|
|
|
6485
6458
|
var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
6486
6459
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6487
|
-
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, _ref$useRootOrigin, useRootOrigin, asset, amount, resolvedFeeAsset,
|
|
6460
|
+
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, _ref$useRootOrigin, useRootOrigin, asset, amount, resolvedFeeAsset, rawFee, paddedFee, sufficient, dryRunResult, _rawFee, _paddedFee, fee, forwardedXcms, destParaId, weight;
|
|
6488
6461
|
return _regenerator().w(function (_context) {
|
|
6489
6462
|
while (1) switch (_context.n) {
|
|
6490
6463
|
case 0:
|
|
@@ -6495,7 +6468,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6495
6468
|
_context.n = 1;
|
|
6496
6469
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
6497
6470
|
case 1:
|
|
6498
|
-
nativeAssetSymbol = getNativeAssetSymbol(origin);
|
|
6499
6471
|
if (hasDryRunSupport(origin)) {
|
|
6500
6472
|
_context.n = 4;
|
|
6501
6473
|
break;
|
|
@@ -6513,7 +6485,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6513
6485
|
sufficient = _context.v;
|
|
6514
6486
|
return _context.a(2, {
|
|
6515
6487
|
fee: paddedFee,
|
|
6516
|
-
currency: nativeAssetSymbol,
|
|
6517
6488
|
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : asset,
|
|
6518
6489
|
feeType: 'paymentInfo',
|
|
6519
6490
|
sufficient: sufficient
|
|
@@ -6545,7 +6516,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6545
6516
|
return _context.a(2, {
|
|
6546
6517
|
dryRunError: dryRunResult.failureReason,
|
|
6547
6518
|
dryRunSubError: dryRunResult.failureSubReason,
|
|
6548
|
-
currency: dryRunResult.currency,
|
|
6549
6519
|
asset: dryRunResult.asset
|
|
6550
6520
|
});
|
|
6551
6521
|
case 6:
|
|
@@ -6556,7 +6526,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6556
6526
|
_paddedFee = padFee(_rawFee, origin, destination, 'origin');
|
|
6557
6527
|
return _context.a(2, {
|
|
6558
6528
|
fee: _paddedFee,
|
|
6559
|
-
currency: dryRunResult.currency,
|
|
6560
6529
|
asset: dryRunResult.asset,
|
|
6561
6530
|
feeType: 'paymentInfo',
|
|
6562
6531
|
dryRunError: dryRunResult.failureReason,
|
|
@@ -6569,7 +6538,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6569
6538
|
fee: fee,
|
|
6570
6539
|
feeType: 'dryRun',
|
|
6571
6540
|
sufficient: true,
|
|
6572
|
-
currency: dryRunResult.currency,
|
|
6573
6541
|
asset: dryRunResult.asset,
|
|
6574
6542
|
forwardedXcms: forwardedXcms,
|
|
6575
6543
|
destParaId: destParaId,
|
|
@@ -6633,6 +6601,13 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
6633
6601
|
};
|
|
6634
6602
|
}();
|
|
6635
6603
|
|
|
6604
|
+
/**
|
|
6605
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
6606
|
+
* Please use `builder.getOriginXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
6607
|
+
* Will be removed in v13.
|
|
6608
|
+
* For more details, see the documentation:
|
|
6609
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
6610
|
+
*/
|
|
6636
6611
|
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
6637
6612
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6638
6613
|
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, amount, rawOriginFee, originFee, resolvedFeeAsset, sufficient, asset;
|
|
@@ -6657,7 +6632,6 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
6657
6632
|
asset = resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset;
|
|
6658
6633
|
return _context.a(2, {
|
|
6659
6634
|
fee: originFee,
|
|
6660
|
-
currency: getNativeAssetSymbol(origin),
|
|
6661
6635
|
asset: asset,
|
|
6662
6636
|
sufficient: sufficient
|
|
6663
6637
|
});
|
|
@@ -6670,23 +6644,13 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
6670
6644
|
}();
|
|
6671
6645
|
|
|
6672
6646
|
var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
6673
|
-
var _chains$origin, _chains$
|
|
6647
|
+
var _chains$origin, _chains$destination;
|
|
6674
6648
|
// Check standard chains first for backwards compatibility
|
|
6675
6649
|
if ((_chains$origin = chains.origin) !== null && _chains$origin !== void 0 && _chains$origin.dryRunError) return {
|
|
6676
6650
|
failureChain: 'origin',
|
|
6677
6651
|
failureReason: chains.origin.dryRunError,
|
|
6678
6652
|
failureSubReason: chains.origin.dryRunSubError
|
|
6679
6653
|
};
|
|
6680
|
-
if ((_chains$assetHub = chains.assetHub) !== null && _chains$assetHub !== void 0 && _chains$assetHub.dryRunError) return {
|
|
6681
|
-
failureChain: 'assetHub',
|
|
6682
|
-
failureReason: chains.assetHub.dryRunError,
|
|
6683
|
-
failureSubReason: chains.assetHub.dryRunSubError
|
|
6684
|
-
};
|
|
6685
|
-
if ((_chains$bridgeHub = chains.bridgeHub) !== null && _chains$bridgeHub !== void 0 && _chains$bridgeHub.dryRunError) return {
|
|
6686
|
-
failureChain: 'bridgeHub',
|
|
6687
|
-
failureReason: chains.bridgeHub.dryRunError,
|
|
6688
|
-
failureSubReason: chains.bridgeHub.dryRunSubError
|
|
6689
|
-
};
|
|
6690
6654
|
if ((_chains$destination = chains.destination) !== null && _chains$destination !== void 0 && _chains$destination.dryRunError) return {
|
|
6691
6655
|
failureChain: 'destination',
|
|
6692
6656
|
failureReason: chains.destination.dryRunError,
|
|
@@ -6715,7 +6679,7 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
6715
6679
|
};
|
|
6716
6680
|
var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
6717
6681
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
6718
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, skipReverseFeeCalculation, asset, amount, _yield$getOriginXcmFe, originFeeRaw, originAsset, originFeeType, originDryRunError, originDryRunSubError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, isMythosToEthereum, originFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee,
|
|
6682
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, skipReverseFeeCalculation, asset, amount, _yield$getOriginXcmFe, originFeeRaw, originAsset, originFeeType, originDryRunError, originDryRunSubError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, isMythosToEthereum, originFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destAsset, destFeeType, destDryRunError, destDryRunSubError, destSufficient, destResult, _destApi, destFallback, bridgeHubChain, assetHubChain, bridgeHubHop, processedBridgeHub, _bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason, _t, _t2, _t3, _t4;
|
|
6719
6683
|
return _regenerator().w(function (_context2) {
|
|
6720
6684
|
while (1) switch (_context2.p = _context2.n) {
|
|
6721
6685
|
case 0:
|
|
@@ -6801,7 +6765,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6801
6765
|
feeType: originFeeType
|
|
6802
6766
|
}), {}, {
|
|
6803
6767
|
sufficient: sufficientOriginFee,
|
|
6804
|
-
currency: originAsset.symbol,
|
|
6805
6768
|
asset: originAsset
|
|
6806
6769
|
}, originDryRunError && {
|
|
6807
6770
|
dryRunError: originDryRunError
|
|
@@ -6817,7 +6780,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6817
6780
|
}), destFeeRes.sufficient !== undefined && {
|
|
6818
6781
|
sufficient: destFeeRes.sufficient
|
|
6819
6782
|
}), {}, {
|
|
6820
|
-
currency: getNativeAssetSymbol(destination),
|
|
6821
6783
|
asset: findNativeAssetInfoOrThrow(destination)
|
|
6822
6784
|
}),
|
|
6823
6785
|
hops: []
|
|
@@ -6923,7 +6885,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6923
6885
|
destDryRunError = destResult.dryRunError;
|
|
6924
6886
|
destDryRunSubError = destResult.dryRunSubError;
|
|
6925
6887
|
destSufficient = destResult.sufficient;
|
|
6926
|
-
destCurrency = destResult.currency;
|
|
6927
6888
|
destAsset = destResult.asset;
|
|
6928
6889
|
_context2.n = 16;
|
|
6929
6890
|
break;
|
|
@@ -6961,7 +6922,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6961
6922
|
destFee = destFallback.fee;
|
|
6962
6923
|
destFeeType = destFallback.feeType;
|
|
6963
6924
|
destSufficient = destFallback.sufficient;
|
|
6964
|
-
destCurrency = getNativeAssetSymbol(destination);
|
|
6965
6925
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
6966
6926
|
_context2.n = 16;
|
|
6967
6927
|
break;
|
|
@@ -6969,30 +6929,33 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6969
6929
|
destFee = 0n;
|
|
6970
6930
|
destFeeType = 'noFeeRequired';
|
|
6971
6931
|
destSufficient = true;
|
|
6972
|
-
destCurrency = getNativeAssetSymbol(destination);
|
|
6973
6932
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
6974
6933
|
case 16:
|
|
6975
6934
|
// Process Ethereum bridge fees
|
|
6935
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
6976
6936
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
6937
|
+
bridgeHubHop = traversalResult.hops.find(function (hop) {
|
|
6938
|
+
return hop.chain === bridgeHubChain;
|
|
6939
|
+
});
|
|
6977
6940
|
if (!isMythosToEthereum) {
|
|
6978
6941
|
_context2.n = 17;
|
|
6979
6942
|
break;
|
|
6980
6943
|
}
|
|
6981
|
-
_t4 =
|
|
6944
|
+
_t4 = bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result;
|
|
6982
6945
|
_context2.n = 19;
|
|
6983
6946
|
break;
|
|
6984
6947
|
case 17:
|
|
6985
6948
|
_context2.n = 18;
|
|
6986
|
-
return addEthereumBridgeFees(api,
|
|
6949
|
+
return addEthereumBridgeFees(api, bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result, destination, assetHubChain);
|
|
6987
6950
|
case 18:
|
|
6988
6951
|
_t4 = _context2.v;
|
|
6989
6952
|
case 19:
|
|
6990
6953
|
processedBridgeHub = _t4;
|
|
6991
6954
|
// Update bridge hub fee in hops if needed
|
|
6992
|
-
if (processedBridgeHub &&
|
|
6993
|
-
|
|
6955
|
+
if (processedBridgeHub && bridgeHubHop && processedBridgeHub.fee !== bridgeHubHop.result.fee) {
|
|
6956
|
+
_bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
6994
6957
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
6995
|
-
return hop.chain ===
|
|
6958
|
+
return hop.chain === _bridgeHubChain;
|
|
6996
6959
|
});
|
|
6997
6960
|
if (bridgeHubHopIndex !== -1) {
|
|
6998
6961
|
traversalResult.hops[bridgeHubHopIndex].result = _objectSpread2(_objectSpread2({}, traversalResult.hops[bridgeHubHopIndex].result), {}, {
|
|
@@ -7001,67 +6964,46 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7001
6964
|
}
|
|
7002
6965
|
}
|
|
7003
6966
|
convertToFeeDetail = function convertToFeeDetail(result) {
|
|
7004
|
-
return _objectSpread2(_objectSpread2(
|
|
7005
|
-
fee: result.fee
|
|
7006
|
-
}), result.feeType && {
|
|
6967
|
+
return _objectSpread2(_objectSpread2({
|
|
6968
|
+
fee: result.fee,
|
|
7007
6969
|
feeType: result.feeType
|
|
7008
|
-
}
|
|
6970
|
+
}, result.sufficient !== undefined && {
|
|
7009
6971
|
sufficient: result.sufficient
|
|
7010
6972
|
}), {}, {
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
}, result.dryRunError && {
|
|
7014
|
-
dryRunError: result.dryRunError
|
|
7015
|
-
}), result.dryRunSubError && {
|
|
6973
|
+
asset: result.asset,
|
|
6974
|
+
dryRunError: result.dryRunError,
|
|
7016
6975
|
dryRunSubError: result.dryRunSubError
|
|
7017
6976
|
});
|
|
7018
6977
|
};
|
|
7019
|
-
result =
|
|
7020
|
-
origin: _objectSpread2(_objectSpread2(
|
|
7021
|
-
weight: originWeight
|
|
7022
|
-
|
|
7023
|
-
fee: originFee
|
|
7024
|
-
}), originFeeType && {
|
|
6978
|
+
result = {
|
|
6979
|
+
origin: _objectSpread2(_objectSpread2({
|
|
6980
|
+
weight: originWeight,
|
|
6981
|
+
fee: originFee,
|
|
7025
6982
|
feeType: originFeeType
|
|
7026
|
-
}
|
|
6983
|
+
}, sufficientOriginFee !== undefined && {
|
|
7027
6984
|
sufficient: sufficientOriginFee
|
|
7028
6985
|
}), {}, {
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
}, originDryRunError && {
|
|
7032
|
-
dryRunError: originDryRunError
|
|
7033
|
-
}), originDryRunSubError && {
|
|
6986
|
+
asset: originAsset,
|
|
6987
|
+
dryRunError: originDryRunError,
|
|
7034
6988
|
dryRunSubError: originDryRunSubError
|
|
7035
|
-
})
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
bridgeHub: convertToFeeDetail(processedBridgeHub)
|
|
7040
|
-
}), {}, {
|
|
7041
|
-
destination: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, destFee !== undefined && {
|
|
7042
|
-
fee: destFee
|
|
7043
|
-
}), destFeeType && {
|
|
7044
|
-
feeType: destFeeType
|
|
7045
|
-
}), {}, {
|
|
6989
|
+
}),
|
|
6990
|
+
destination: {
|
|
6991
|
+
fee: destFee,
|
|
6992
|
+
feeType: destFeeType,
|
|
7046
6993
|
sufficient: destSufficient,
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
}, destDryRunError && {
|
|
7050
|
-
dryRunError: destDryRunError
|
|
7051
|
-
}), destDryRunSubError && {
|
|
6994
|
+
asset: destAsset,
|
|
6995
|
+
dryRunError: destDryRunError,
|
|
7052
6996
|
dryRunSubError: destDryRunSubError
|
|
7053
|
-
}
|
|
6997
|
+
},
|
|
7054
6998
|
hops: traversalResult.hops.map(function (hop) {
|
|
7055
6999
|
return {
|
|
7056
7000
|
chain: hop.chain,
|
|
7057
7001
|
result: convertToFeeDetail(hop.result)
|
|
7058
7002
|
};
|
|
7059
7003
|
})
|
|
7060
|
-
}
|
|
7004
|
+
};
|
|
7061
7005
|
_getFailureInfo2 = getFailureInfo({
|
|
7062
7006
|
origin: result.origin,
|
|
7063
|
-
assetHub: result.assetHub,
|
|
7064
|
-
bridgeHub: result.bridgeHub,
|
|
7065
7007
|
destination: result.destination
|
|
7066
7008
|
}, result.hops), failureChain = _getFailureInfo2.failureChain, failureReason = _getFailureInfo2.failureReason;
|
|
7067
7009
|
return _context2.a(2, _objectSpread2(_objectSpread2({}, result), {}, {
|
|
@@ -7078,7 +7020,7 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7078
7020
|
|
|
7079
7021
|
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
7080
7022
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
7081
|
-
var buildTx,
|
|
7023
|
+
var buildTx, tx, real, forced, _forced, _t;
|
|
7082
7024
|
return _regenerator().w(function (_context) {
|
|
7083
7025
|
while (1) switch (_context.p = _context.n) {
|
|
7084
7026
|
case 0:
|
|
@@ -7099,22 +7041,13 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7099
7041
|
return getBypassResultWithRetries(options, getXcmFeeOnce, tx);
|
|
7100
7042
|
case 4:
|
|
7101
7043
|
forced = _context.v;
|
|
7102
|
-
return _context.a(2, _objectSpread2(_objectSpread2(
|
|
7044
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, forced), {}, {
|
|
7103
7045
|
origin: _objectSpread2(_objectSpread2({}, forced.origin), {}, {
|
|
7104
7046
|
sufficient: real.origin.sufficient
|
|
7105
7047
|
}),
|
|
7106
7048
|
destination: _objectSpread2(_objectSpread2({}, forced.destination), {}, {
|
|
7107
7049
|
sufficient: real.destination.sufficient
|
|
7108
|
-
})
|
|
7109
|
-
}, forced.assetHub ? {
|
|
7110
|
-
assetHub: _objectSpread2(_objectSpread2({}, forced.assetHub), {}, {
|
|
7111
|
-
sufficient: (_real$assetHub = real.assetHub) === null || _real$assetHub === void 0 ? void 0 : _real$assetHub.sufficient
|
|
7112
|
-
})
|
|
7113
|
-
} : {}), forced.bridgeHub ? {
|
|
7114
|
-
bridgeHub: _objectSpread2(_objectSpread2({}, forced.bridgeHub), {}, {
|
|
7115
|
-
sufficient: (_real$bridgeHub = real.bridgeHub) === null || _real$bridgeHub === void 0 ? void 0 : _real$bridgeHub.sufficient
|
|
7116
|
-
})
|
|
7117
|
-
} : {}), {}, {
|
|
7050
|
+
}),
|
|
7118
7051
|
hops: forced.hops.map(function (hop, i) {
|
|
7119
7052
|
var _real$hops$i;
|
|
7120
7053
|
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
@@ -7137,22 +7070,13 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7137
7070
|
return getBypassResultWithRetries(options, getXcmFeeOnce);
|
|
7138
7071
|
case 7:
|
|
7139
7072
|
_forced = _context.v;
|
|
7140
|
-
return _context.a(2, _objectSpread2(_objectSpread2(
|
|
7073
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
7141
7074
|
origin: _objectSpread2(_objectSpread2({}, _forced.origin), {}, {
|
|
7142
7075
|
sufficient: false
|
|
7143
7076
|
}),
|
|
7144
7077
|
destination: _objectSpread2(_objectSpread2({}, _forced.destination), {}, {
|
|
7145
7078
|
sufficient: false
|
|
7146
|
-
})
|
|
7147
|
-
}, _forced.assetHub ? {
|
|
7148
|
-
assetHub: _objectSpread2(_objectSpread2({}, _forced.assetHub), {}, {
|
|
7149
|
-
sufficient: false
|
|
7150
|
-
})
|
|
7151
|
-
} : {}), _forced.bridgeHub ? {
|
|
7152
|
-
bridgeHub: _objectSpread2(_objectSpread2({}, _forced.bridgeHub), {}, {
|
|
7153
|
-
sufficient: false
|
|
7154
|
-
})
|
|
7155
|
-
} : {}), {}, {
|
|
7079
|
+
}),
|
|
7156
7080
|
hops: _forced.hops.map(function (hop) {
|
|
7157
7081
|
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
7158
7082
|
result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
|
|
@@ -7198,6 +7122,13 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
7198
7122
|
|
|
7199
7123
|
var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
|
|
7200
7124
|
var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
|
|
7125
|
+
/**
|
|
7126
|
+
* @deprecated This function is deprecated and will be removed in a future version.
|
|
7127
|
+
* Please use `builder.getXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
7128
|
+
* Will be removed in v13.
|
|
7129
|
+
* For more details, see the documentation:
|
|
7130
|
+
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
7131
|
+
*/
|
|
7201
7132
|
var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
7202
7133
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
7203
7134
|
var api, origin, destination, currency, feeAsset, address, senderAddress, originAsset, destAsset, amount, resolvedFeeAsset, destApi, _ref2, _ref3, fixedOriginFee, fixedDestinationFee, originSufficient, _destinationSufficient, originFeeDetails, currencyInput, destinationFee, destinationSufficient, destFeeDetails, _t;
|
|
@@ -7234,13 +7165,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
7234
7165
|
return _context.a(2, {
|
|
7235
7166
|
origin: {
|
|
7236
7167
|
fee: fixedOriginFee,
|
|
7237
|
-
currency: getNativeAssetSymbol(origin),
|
|
7238
7168
|
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset,
|
|
7239
7169
|
sufficient: originSufficient
|
|
7240
7170
|
},
|
|
7241
7171
|
destination: {
|
|
7242
7172
|
fee: fixedDestinationFee,
|
|
7243
|
-
currency: getNativeAssetSymbol(destination),
|
|
7244
7173
|
asset: destAsset,
|
|
7245
7174
|
sufficient: _destinationSufficient
|
|
7246
7175
|
}
|
|
@@ -7280,7 +7209,6 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
7280
7209
|
destinationSufficient = _context.v;
|
|
7281
7210
|
destFeeDetails = {
|
|
7282
7211
|
fee: destinationFee,
|
|
7283
|
-
currency: getNativeAssetSymbol(destination),
|
|
7284
7212
|
asset: destAsset,
|
|
7285
7213
|
sufficient: destinationSufficient
|
|
7286
7214
|
};
|
|
@@ -7308,7 +7236,7 @@ var transferRelayToPara = /*#__PURE__*/function () {
|
|
|
7308
7236
|
_context.n = 1;
|
|
7309
7237
|
break;
|
|
7310
7238
|
}
|
|
7311
|
-
throw new
|
|
7239
|
+
throw new MissingParameterError('api', 'API is required when using location as destination.');
|
|
7312
7240
|
case 1:
|
|
7313
7241
|
_context.n = 2;
|
|
7314
7242
|
return api.init(origin, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -7356,13 +7284,13 @@ var send = /*#__PURE__*/function () {
|
|
|
7356
7284
|
_context.n = 1;
|
|
7357
7285
|
break;
|
|
7358
7286
|
}
|
|
7359
|
-
throw new
|
|
7287
|
+
throw new ScenarioNotSupportedError('Transfers from relay chain to Ethereum are not supported.');
|
|
7360
7288
|
case 1:
|
|
7361
7289
|
if (asset) {
|
|
7362
7290
|
_context.n = 2;
|
|
7363
7291
|
break;
|
|
7364
7292
|
}
|
|
7365
|
-
throw new
|
|
7293
|
+
throw new MissingParameterError('asset', 'Asset is required for relay chain to relay chain transfers.');
|
|
7366
7294
|
case 2:
|
|
7367
7295
|
isLocalTransfer = origin === destination;
|
|
7368
7296
|
if (!isLocalTransfer) {
|
|
@@ -7529,7 +7457,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
7529
7457
|
break;
|
|
7530
7458
|
}
|
|
7531
7459
|
_context.n = 3;
|
|
7532
|
-
return
|
|
7460
|
+
return getBalanceInternal({
|
|
7533
7461
|
address: address,
|
|
7534
7462
|
chain: destination,
|
|
7535
7463
|
api: destApi
|
|
@@ -7549,15 +7477,12 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
7549
7477
|
receivedAmount: receivedAmount,
|
|
7550
7478
|
balance: destBalance,
|
|
7551
7479
|
balanceAfter: destbalanceAfterResult,
|
|
7552
|
-
|
|
7553
|
-
asset: destAsset,
|
|
7554
|
-
existentialDeposit: edDest
|
|
7480
|
+
asset: destAsset
|
|
7555
7481
|
},
|
|
7556
7482
|
xcmFee: {
|
|
7557
7483
|
fee: destFeeDetail.fee,
|
|
7558
7484
|
balance: destXcmFeeBalance,
|
|
7559
7485
|
balanceAfter: destXcmFeeBalanceAfter,
|
|
7560
|
-
currencySymbol: destFeeDetail.asset.symbol,
|
|
7561
7486
|
asset: destFeeDetail.asset
|
|
7562
7487
|
}
|
|
7563
7488
|
});
|
|
@@ -7571,11 +7496,11 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
7571
7496
|
|
|
7572
7497
|
var buildHopInfo = /*#__PURE__*/function () {
|
|
7573
7498
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
7574
|
-
var api, chain,
|
|
7499
|
+
var api, chain, fee, originChain, asset, currency, hopApi, xcmFeeDetails, isBridgeHub, nativeAsset, hopAsset, hopCurrencyPayload, ed;
|
|
7575
7500
|
return _regenerator().w(function (_context) {
|
|
7576
7501
|
while (1) switch (_context.p = _context.n) {
|
|
7577
7502
|
case 0:
|
|
7578
|
-
api = _ref.api, chain = _ref.chain,
|
|
7503
|
+
api = _ref.api, chain = _ref.chain, fee = _ref.fee, originChain = _ref.originChain, asset = _ref.asset, currency = _ref.currency;
|
|
7579
7504
|
hopApi = api.clone();
|
|
7580
7505
|
_context.n = 1;
|
|
7581
7506
|
return hopApi.init(chain);
|
|
@@ -7583,8 +7508,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7583
7508
|
hopApi.setDisconnectAllowed(false);
|
|
7584
7509
|
_context.p = 2;
|
|
7585
7510
|
xcmFeeDetails = {
|
|
7586
|
-
fee:
|
|
7587
|
-
currencySymbol: asset.symbol,
|
|
7511
|
+
fee: fee,
|
|
7588
7512
|
asset: asset
|
|
7589
7513
|
};
|
|
7590
7514
|
isBridgeHub = chain.includes('BridgeHub');
|
|
@@ -7592,8 +7516,9 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7592
7516
|
_context.n = 3;
|
|
7593
7517
|
break;
|
|
7594
7518
|
}
|
|
7519
|
+
nativeAsset = findNativeAssetInfoOrThrow(chain);
|
|
7595
7520
|
return _context.a(2, {
|
|
7596
|
-
|
|
7521
|
+
asset: nativeAsset,
|
|
7597
7522
|
xcmFee: xcmFeeDetails
|
|
7598
7523
|
});
|
|
7599
7524
|
case 3:
|
|
@@ -7605,7 +7530,6 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7605
7530
|
};
|
|
7606
7531
|
ed = getExistentialDepositOrThrow(chain, hopCurrencyPayload);
|
|
7607
7532
|
return _context.a(2, {
|
|
7608
|
-
currencySymbol: hopAsset.symbol,
|
|
7609
7533
|
asset: hopAsset,
|
|
7610
7534
|
existentialDeposit: ed,
|
|
7611
7535
|
xcmFee: xcmFeeDetails
|
|
@@ -7629,7 +7553,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7629
7553
|
|
|
7630
7554
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
7631
7555
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
7632
|
-
var api, buildTx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFeeInter, _yield$getXcmFeeInter2, originFee,
|
|
7556
|
+
var api, buildTx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFeeInter, _yield$getXcmFeeInter2, originFee, originFeeAsset, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, builtHops, totalHopFee, bridgeHop, destinationInfo, _t;
|
|
7633
7557
|
return _regenerator().w(function (_context2) {
|
|
7634
7558
|
while (1) switch (_context2.p = _context2.n) {
|
|
7635
7559
|
case 0:
|
|
@@ -7638,7 +7562,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7638
7562
|
_context2.n = 1;
|
|
7639
7563
|
break;
|
|
7640
7564
|
}
|
|
7641
|
-
throw new
|
|
7565
|
+
throw new MissingParameterError('ahAddress', "ahAddress is required for EVM origin ".concat(origin, "."));
|
|
7642
7566
|
case 1:
|
|
7643
7567
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
7644
7568
|
_context2.n = 2;
|
|
@@ -7665,7 +7589,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7665
7589
|
break;
|
|
7666
7590
|
case 5:
|
|
7667
7591
|
_context2.n = 6;
|
|
7668
|
-
return
|
|
7592
|
+
return getBalanceInternal({
|
|
7669
7593
|
api: api,
|
|
7670
7594
|
address: senderAddress,
|
|
7671
7595
|
chain: origin
|
|
@@ -7700,10 +7624,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7700
7624
|
_yield$getXcmFeeInter = _context2.v;
|
|
7701
7625
|
_yield$getXcmFeeInter2 = _yield$getXcmFeeInter.origin;
|
|
7702
7626
|
originFee = _yield$getXcmFeeInter2.fee;
|
|
7703
|
-
originFeeCurrency = _yield$getXcmFeeInter2.currency;
|
|
7704
7627
|
originFeeAsset = _yield$getXcmFeeInter2.asset;
|
|
7705
|
-
assetHubFeeResult = _yield$getXcmFeeInter.assetHub;
|
|
7706
|
-
bridgeHubFeeResult = _yield$getXcmFeeInter.bridgeHub;
|
|
7707
7628
|
destFeeDetail = _yield$getXcmFeeInter.destination;
|
|
7708
7629
|
hops = _yield$getXcmFeeInter.hops;
|
|
7709
7630
|
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
|
|
@@ -7711,49 +7632,12 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7711
7632
|
originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - amount : originBalanceFee - originFee;
|
|
7712
7633
|
originBalanceNativeSufficient = originBalanceFee >= originFee;
|
|
7713
7634
|
originBalanceSufficient = originBalanceAfter >= edOrigin;
|
|
7714
|
-
if (!assetHubFeeResult) {
|
|
7715
|
-
_context2.n = 11;
|
|
7716
|
-
break;
|
|
7717
|
-
}
|
|
7718
|
-
_context2.n = 10;
|
|
7719
|
-
return buildHopInfo({
|
|
7720
|
-
api: api,
|
|
7721
|
-
chain: "AssetHub".concat(getRelayChainOf(origin)),
|
|
7722
|
-
feeData: assetHubFeeResult,
|
|
7723
|
-
originChain: origin,
|
|
7724
|
-
currency: currency,
|
|
7725
|
-
asset: assetHubFeeResult.asset,
|
|
7726
|
-
senderAddress: senderAddress,
|
|
7727
|
-
ahAddress: ahAddress
|
|
7728
|
-
});
|
|
7729
|
-
case 10:
|
|
7730
|
-
assetHub = _context2.v;
|
|
7731
|
-
case 11:
|
|
7732
|
-
if (!bridgeHubFeeResult) {
|
|
7733
|
-
_context2.n = 13;
|
|
7734
|
-
break;
|
|
7735
|
-
}
|
|
7736
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
7737
|
-
_context2.n = 12;
|
|
7738
|
-
return buildHopInfo({
|
|
7739
|
-
api: api,
|
|
7740
|
-
chain: bridgeHubChain,
|
|
7741
|
-
feeData: bridgeHubFeeResult,
|
|
7742
|
-
originChain: origin,
|
|
7743
|
-
currency: currency,
|
|
7744
|
-
asset: bridgeHubFeeResult.asset,
|
|
7745
|
-
senderAddress: senderAddress,
|
|
7746
|
-
ahAddress: ahAddress
|
|
7747
|
-
});
|
|
7748
|
-
case 12:
|
|
7749
|
-
bridgeHub = _context2.v;
|
|
7750
|
-
case 13:
|
|
7751
7635
|
builtHops = [];
|
|
7752
7636
|
if (!(hops && hops.length > 0)) {
|
|
7753
|
-
_context2.n =
|
|
7637
|
+
_context2.n = 11;
|
|
7754
7638
|
break;
|
|
7755
7639
|
}
|
|
7756
|
-
_context2.n =
|
|
7640
|
+
_context2.n = 10;
|
|
7757
7641
|
return Promise.all(hops.map(/*#__PURE__*/function () {
|
|
7758
7642
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(hop) {
|
|
7759
7643
|
var result;
|
|
@@ -7764,7 +7648,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7764
7648
|
return buildHopInfo({
|
|
7765
7649
|
api: api,
|
|
7766
7650
|
chain: hop.chain,
|
|
7767
|
-
|
|
7651
|
+
fee: hop.result.fee,
|
|
7768
7652
|
originChain: origin,
|
|
7769
7653
|
currency: currency,
|
|
7770
7654
|
asset: hop.result.asset,
|
|
@@ -7784,13 +7668,16 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7784
7668
|
return _ref3.apply(this, arguments);
|
|
7785
7669
|
};
|
|
7786
7670
|
}()));
|
|
7787
|
-
case
|
|
7671
|
+
case 10:
|
|
7788
7672
|
builtHops = _context2.v;
|
|
7789
|
-
case
|
|
7673
|
+
case 11:
|
|
7790
7674
|
totalHopFee = hops.reduce(function (acc, hop) {
|
|
7791
7675
|
return isAssetXcEqual(hop.result.asset, originAsset) ? acc + hop.result.fee : acc;
|
|
7792
7676
|
}, 0n);
|
|
7793
|
-
|
|
7677
|
+
bridgeHop = hops.find(function (hop) {
|
|
7678
|
+
return hop.chain.startsWith('BridgeHub');
|
|
7679
|
+
});
|
|
7680
|
+
_context2.n = 12;
|
|
7794
7681
|
return buildDestInfo({
|
|
7795
7682
|
api: api,
|
|
7796
7683
|
origin: origin,
|
|
@@ -7803,9 +7690,9 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7803
7690
|
isFeeAssetAh: !!isFeeAssetAh,
|
|
7804
7691
|
destFeeDetail: destFeeDetail,
|
|
7805
7692
|
totalHopFee: totalHopFee,
|
|
7806
|
-
bridgeFee:
|
|
7693
|
+
bridgeFee: bridgeHop === null || bridgeHop === void 0 ? void 0 : bridgeHop.result.fee
|
|
7807
7694
|
});
|
|
7808
|
-
case
|
|
7695
|
+
case 12:
|
|
7809
7696
|
destinationInfo = _context2.v;
|
|
7810
7697
|
return _context2.a(2, {
|
|
7811
7698
|
chain: {
|
|
@@ -7818,35 +7705,30 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7818
7705
|
sufficient: originBalanceSufficient,
|
|
7819
7706
|
balance: originBalance,
|
|
7820
7707
|
balanceAfter: originBalanceAfter,
|
|
7821
|
-
|
|
7822
|
-
asset: originAsset,
|
|
7823
|
-
existentialDeposit: edOrigin
|
|
7708
|
+
asset: originAsset
|
|
7824
7709
|
},
|
|
7825
7710
|
xcmFee: {
|
|
7826
7711
|
sufficient: originBalanceNativeSufficient,
|
|
7827
7712
|
fee: originFee,
|
|
7828
7713
|
balance: originBalanceFee,
|
|
7829
7714
|
balanceAfter: originBalanceFeeAfter,
|
|
7830
|
-
currencySymbol: originFeeCurrency,
|
|
7831
7715
|
asset: originFeeAsset
|
|
7832
7716
|
}
|
|
7833
7717
|
},
|
|
7834
|
-
assetHub: assetHub,
|
|
7835
|
-
bridgeHub: bridgeHub,
|
|
7836
7718
|
hops: builtHops,
|
|
7837
7719
|
destination: destinationInfo
|
|
7838
7720
|
});
|
|
7839
|
-
case
|
|
7840
|
-
_context2.p =
|
|
7721
|
+
case 13:
|
|
7722
|
+
_context2.p = 13;
|
|
7841
7723
|
api.setDisconnectAllowed(true);
|
|
7842
|
-
_context2.n =
|
|
7724
|
+
_context2.n = 14;
|
|
7843
7725
|
return api.disconnect();
|
|
7844
|
-
case
|
|
7845
|
-
return _context2.f(
|
|
7846
|
-
case
|
|
7726
|
+
case 14:
|
|
7727
|
+
return _context2.f(13);
|
|
7728
|
+
case 15:
|
|
7847
7729
|
return _context2.a(2);
|
|
7848
7730
|
}
|
|
7849
|
-
}, _callee2, null, [[3,,
|
|
7731
|
+
}, _callee2, null, [[3,, 13, 15]]);
|
|
7850
7732
|
}));
|
|
7851
7733
|
return function getTransferInfo(_x) {
|
|
7852
7734
|
return _ref2.apply(this, arguments);
|
|
@@ -8120,7 +8002,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8120
8002
|
_context.n = 3;
|
|
8121
8003
|
break;
|
|
8122
8004
|
}
|
|
8123
|
-
throw new
|
|
8005
|
+
throw new UnableToComputeError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency, replaceBigInt), " on chain ").concat(chain, "."));
|
|
8124
8006
|
case 3:
|
|
8125
8007
|
feeToSubtract = fee;
|
|
8126
8008
|
case 4:
|
|
@@ -8598,7 +8480,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
8598
8480
|
_context.n = 2;
|
|
8599
8481
|
break;
|
|
8600
8482
|
}
|
|
8601
|
-
throw new
|
|
8483
|
+
throw new ScenarioNotSupportedError('Unable to verify the existential deposit for substrate bridge scenarios');
|
|
8602
8484
|
case 2:
|
|
8603
8485
|
destApi = api.clone();
|
|
8604
8486
|
_context.n = 3;
|
|
@@ -8793,7 +8675,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8793
8675
|
_context.n = 3;
|
|
8794
8676
|
break;
|
|
8795
8677
|
}
|
|
8796
|
-
throw new
|
|
8678
|
+
throw new UnsupportedOperationError('Relaychain assets require the type-and-then method which is not supported by this chain.');
|
|
8797
8679
|
case 3:
|
|
8798
8680
|
isSubBridge = !isTLocation(destination) && isSubstrateBridge(this.chain, destination);
|
|
8799
8681
|
useTypeAndThen = isRelayAsset && supportsTypeThen && destChain && !isExternalChain(destChain) && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain)) || isSubBridge;
|
|
@@ -8887,7 +8769,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8887
8769
|
_context.n = 8;
|
|
8888
8770
|
break;
|
|
8889
8771
|
}
|
|
8890
|
-
throw new
|
|
8772
|
+
throw new FeatureTemporarilyDisabledError('Astar system asset transfers are temporarily disabled');
|
|
8891
8773
|
case 8:
|
|
8892
8774
|
isAHOrigin = this.chain.includes('AssetHub');
|
|
8893
8775
|
isAHDest = !isTLocation(destination) && destination.includes('AssetHub'); // Handle common cases
|
|
@@ -8935,7 +8817,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8935
8817
|
if (destChain && !isRelayChain(destChain) && !isExternalChain(destChain)) {
|
|
8936
8818
|
var dest = getChain(destChain);
|
|
8937
8819
|
if (!dest.canReceiveFrom(this.chain)) {
|
|
8938
|
-
throw new
|
|
8820
|
+
throw new ScenarioNotSupportedError("Receiving from ".concat(this.chain, " is not yet enabled"));
|
|
8939
8821
|
}
|
|
8940
8822
|
}
|
|
8941
8823
|
}
|
|
@@ -8944,12 +8826,12 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8944
8826
|
value: function throwIfTempDisabled(options, destChain) {
|
|
8945
8827
|
var isSendingDisabled = this.isSendingTempDisabled(options);
|
|
8946
8828
|
if (isSendingDisabled) {
|
|
8947
|
-
throw new
|
|
8829
|
+
throw new FeatureTemporarilyDisabledError("Sending from ".concat(this.chain, " is temporarily disabled"));
|
|
8948
8830
|
}
|
|
8949
8831
|
var scenario = resolveScenario(this.chain, options.to);
|
|
8950
8832
|
var isReceivingDisabled = destChain && !isRelayChain(destChain) && !isExternalChain(destChain) && getChain(destChain).isReceivingTempDisabled(scenario);
|
|
8951
8833
|
if (isReceivingDisabled) {
|
|
8952
|
-
throw new
|
|
8834
|
+
throw new FeatureTemporarilyDisabledError("Receiving on ".concat(destChain, " is temporarily disabled"));
|
|
8953
8835
|
}
|
|
8954
8836
|
}
|
|
8955
8837
|
}, {
|
|
@@ -8976,12 +8858,12 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8976
8858
|
if (isTLocation(to) || isSubstrateBridge(this.chain, to) || to === 'Ethereum') return false;
|
|
8977
8859
|
var isAHPOrigin = this.chain.includes('AssetHub');
|
|
8978
8860
|
var isAHPDest = !isTLocation(to) && to.includes('AssetHub');
|
|
8979
|
-
var isNativeAsset = !isTLocation(to) && (isAHPOrigin &&
|
|
8861
|
+
var isNativeAsset = !isTLocation(to) && (isAHPOrigin && !asset.isNative && isSymbolMatch(asset.symbol, getNativeAssetSymbol(to)) || isAHPDest && asset.isNative && isSymbolMatch(asset.symbol, getNativeAssetSymbol(this.chain)));
|
|
8980
8862
|
var assetHubChain = "AssetHub".concat(getRelayChainOf(this.chain));
|
|
8981
8863
|
var isRegisteredOnAh = asset.location && findAssetInfo(assetHubChain, {
|
|
8982
8864
|
location: asset.location
|
|
8983
8865
|
}, null);
|
|
8984
|
-
return isNativeAsset && Boolean(isRegisteredOnAh) && (isAHPOrigin || isAHPDest);
|
|
8866
|
+
return Boolean(isNativeAsset) && Boolean(isRegisteredOnAh) && (isAHPOrigin || isAHPDest);
|
|
8985
8867
|
}
|
|
8986
8868
|
}, {
|
|
8987
8869
|
key: "getRelayToParaOverrides",
|
|
@@ -9004,7 +8886,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9004
8886
|
_context2.n = 1;
|
|
9005
8887
|
break;
|
|
9006
8888
|
}
|
|
9007
|
-
throw new
|
|
8889
|
+
throw new FeatureTemporarilyDisabledError("Receiving on ".concat(this.chain, " is temporarily disabled"));
|
|
9008
8890
|
case 1:
|
|
9009
8891
|
if (!(transferType === 'typeAndThen')) {
|
|
9010
8892
|
_context2.n = 3;
|
|
@@ -9017,7 +8899,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9017
8899
|
_context2.n = 2;
|
|
9018
8900
|
break;
|
|
9019
8901
|
}
|
|
9020
|
-
throw new
|
|
8902
|
+
throw new UnsupportedOperationError('Cannot override destination when using type and then transfer.');
|
|
9021
8903
|
case 2:
|
|
9022
8904
|
return _context2.a(2, createTypeThenAutoReserve(getRelayChainOf(destChain), _objectSpread2(_objectSpread2({}, options), {}, {
|
|
9023
8905
|
beneficiaryLocation: createBeneficiaryLocation({
|
|
@@ -9078,12 +8960,12 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9078
8960
|
_context3.n = 2;
|
|
9079
8961
|
break;
|
|
9080
8962
|
}
|
|
9081
|
-
throw new
|
|
8963
|
+
throw new UnsupportedOperationError('Fee asset is not supported for local transfers');
|
|
9082
8964
|
case 2:
|
|
9083
8965
|
validatedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
9084
8966
|
address: address
|
|
9085
8967
|
});
|
|
9086
|
-
isNativeAsset = asset.symbol === this.getNativeAssetSymbol() &&
|
|
8968
|
+
isNativeAsset = asset.symbol === this.getNativeAssetSymbol() && asset.isNative;
|
|
9087
8969
|
if (!isAmountAll) {
|
|
9088
8970
|
_context3.n = 4;
|
|
9089
8971
|
break;
|
|
@@ -9325,7 +9207,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9325
9207
|
_context5.n = 1;
|
|
9326
9208
|
break;
|
|
9327
9209
|
}
|
|
9328
|
-
throw new
|
|
9210
|
+
throw new RoutingResolutionError("No foreign asset pallets found for ".concat(this.chain));
|
|
9329
9211
|
case 1:
|
|
9330
9212
|
customCurrencyId = this.getCustomCurrencyId(asset);
|
|
9331
9213
|
_iterator = _createForOfIteratorHelper(pallets);
|
|
@@ -9403,7 +9285,10 @@ var Acala = /*#__PURE__*/function (_Parachain) {
|
|
|
9403
9285
|
}, {
|
|
9404
9286
|
key: "transferRelayToPara",
|
|
9405
9287
|
value: function transferRelayToPara() {
|
|
9406
|
-
throw new
|
|
9288
|
+
throw new ScenarioNotSupportedError({
|
|
9289
|
+
chain: this.chain,
|
|
9290
|
+
scenario: 'RelayToPara'
|
|
9291
|
+
});
|
|
9407
9292
|
}
|
|
9408
9293
|
}, {
|
|
9409
9294
|
key: "transferLocalNativeAsset",
|
|
@@ -9478,10 +9363,10 @@ var Acala = /*#__PURE__*/function (_Parachain) {
|
|
|
9478
9363
|
key: "getCustomCurrencyId",
|
|
9479
9364
|
value: function getCustomCurrencyId(asset) {
|
|
9480
9365
|
var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
|
|
9481
|
-
return
|
|
9482
|
-
ForeignAsset: Number(asset.assetId)
|
|
9483
|
-
} : {
|
|
9366
|
+
return asset.isNative ? {
|
|
9484
9367
|
Token: symbol
|
|
9368
|
+
} : {
|
|
9369
|
+
ForeignAsset: Number(asset.assetId)
|
|
9485
9370
|
};
|
|
9486
9371
|
}
|
|
9487
9372
|
}, {
|
|
@@ -9511,7 +9396,10 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
|
|
|
9511
9396
|
var scenario = input.scenario,
|
|
9512
9397
|
asset = input.asset;
|
|
9513
9398
|
if (scenario !== 'ParaToPara') {
|
|
9514
|
-
throw new ScenarioNotSupportedError(
|
|
9399
|
+
throw new ScenarioNotSupportedError({
|
|
9400
|
+
chain: this.chain,
|
|
9401
|
+
scenario: scenario
|
|
9402
|
+
});
|
|
9515
9403
|
}
|
|
9516
9404
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
9517
9405
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -9521,7 +9409,10 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
|
|
|
9521
9409
|
}, {
|
|
9522
9410
|
key: "transferRelayToPara",
|
|
9523
9411
|
value: function transferRelayToPara() {
|
|
9524
|
-
throw new
|
|
9412
|
+
throw new ScenarioNotSupportedError({
|
|
9413
|
+
chain: this.chain,
|
|
9414
|
+
scenario: 'RelayToPara'
|
|
9415
|
+
});
|
|
9525
9416
|
}
|
|
9526
9417
|
}, {
|
|
9527
9418
|
key: "transferLocalNonNativeAsset",
|
|
@@ -9601,7 +9492,10 @@ var AjunaPaseo = /*#__PURE__*/function (_Parachain) {
|
|
|
9601
9492
|
var scenario = input.scenario,
|
|
9602
9493
|
asset = input.assetInfo;
|
|
9603
9494
|
if (scenario !== 'ParaToPara') {
|
|
9604
|
-
throw new ScenarioNotSupportedError(
|
|
9495
|
+
throw new ScenarioNotSupportedError({
|
|
9496
|
+
chain: this.chain,
|
|
9497
|
+
scenario: scenario
|
|
9498
|
+
});
|
|
9605
9499
|
}
|
|
9606
9500
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
9607
9501
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -9611,7 +9505,10 @@ var AjunaPaseo = /*#__PURE__*/function (_Parachain) {
|
|
|
9611
9505
|
}, {
|
|
9612
9506
|
key: "transferRelayToPara",
|
|
9613
9507
|
value: function transferRelayToPara() {
|
|
9614
|
-
throw new
|
|
9508
|
+
throw new ScenarioNotSupportedError({
|
|
9509
|
+
chain: this.chain,
|
|
9510
|
+
scenario: 'RelayToPara'
|
|
9511
|
+
});
|
|
9615
9512
|
}
|
|
9616
9513
|
}]);
|
|
9617
9514
|
}(Parachain);
|
|
@@ -9717,8 +9614,8 @@ var AssetHubKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
9717
9614
|
scenario = input.scenario;
|
|
9718
9615
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
|
|
9719
9616
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
9720
|
-
if (scenario === 'ParaToPara' && asset.symbol === 'DOT' &&
|
|
9721
|
-
throw new ScenarioNotSupportedError(
|
|
9617
|
+
if (scenario === 'ParaToPara' && asset.symbol === 'DOT' && asset.isNative) {
|
|
9618
|
+
throw new ScenarioNotSupportedError('Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
|
|
9722
9619
|
}
|
|
9723
9620
|
var method = this.getMethod(scenario, destination);
|
|
9724
9621
|
return transferPolkadotXcm(input, method, 'Unlimited');
|
|
@@ -9762,7 +9659,7 @@ var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals,
|
|
|
9762
9659
|
if (!shouldAbstract) {
|
|
9763
9660
|
var strAmount = amount.toString();
|
|
9764
9661
|
if (strAmount.includes('.')) {
|
|
9765
|
-
throw new
|
|
9662
|
+
throw new NumberFormatError("Non-abstracted amount cannot have decimals: ".concat(strAmount));
|
|
9766
9663
|
}
|
|
9767
9664
|
return BigInt(strAmount);
|
|
9768
9665
|
}
|
|
@@ -9860,7 +9757,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
|
|
|
9860
9757
|
reserveChain = _prepareExecuteContex.reserveChain;
|
|
9861
9758
|
var destLocation = createDestination(version, chain, destChain, paraIdTo);
|
|
9862
9759
|
if (chain !== 'AssetHubPolkadot' && reserveChain === undefined) {
|
|
9863
|
-
throw new
|
|
9760
|
+
throw new UnsupportedOperationError('Sending local reserve assets with custom fee asset is not yet supported for this chain.');
|
|
9864
9761
|
}
|
|
9865
9762
|
var transferType = getTransferType(chain, destChain, reserveChain);
|
|
9866
9763
|
var isReserveDest = reserveChain === destChain;
|
|
@@ -10124,7 +10021,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10124
10021
|
_context.n = 1;
|
|
10125
10022
|
break;
|
|
10126
10023
|
}
|
|
10127
|
-
throw new
|
|
10024
|
+
throw new RoutingResolutionError('Could not determine destination chain for execute transfer');
|
|
10128
10025
|
case 1:
|
|
10129
10026
|
internalOptions = {
|
|
10130
10027
|
api: api,
|
|
@@ -10359,7 +10256,7 @@ var findExchangeHopIndex = function findExchangeHopIndex(chain, dryRunResult, ex
|
|
|
10359
10256
|
// If chain is defined but no exchange hop found, it might be because
|
|
10360
10257
|
// the origin chain is the exchange chain (no hops needed)
|
|
10361
10258
|
if (chain && index === -1 && chain !== exchangeChain) {
|
|
10362
|
-
throw new
|
|
10259
|
+
throw new RoutingResolutionError("Exchange hop for ".concat(exchangeChain, " not found in dry run result."));
|
|
10363
10260
|
}
|
|
10364
10261
|
return index;
|
|
10365
10262
|
};
|
|
@@ -10587,7 +10484,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
10587
10484
|
_context.n = 1;
|
|
10588
10485
|
break;
|
|
10589
10486
|
}
|
|
10590
|
-
throw new
|
|
10487
|
+
throw new InvalidAddressError('Location address is not supported for this scenario');
|
|
10591
10488
|
case 1:
|
|
10592
10489
|
assertSenderAddress(senderAddress);
|
|
10593
10490
|
_context.n = 2;
|
|
@@ -10684,7 +10581,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
10684
10581
|
_context.n = 3;
|
|
10685
10582
|
break;
|
|
10686
10583
|
}
|
|
10687
|
-
throw new
|
|
10584
|
+
throw new InvalidAddressError('Location address is not supported for Ethereum transfers');
|
|
10688
10585
|
case 3:
|
|
10689
10586
|
assertHasLocation(asset);
|
|
10690
10587
|
_context.n = 4;
|
|
@@ -10925,7 +10822,6 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
10925
10822
|
asset = options.assetInfo,
|
|
10926
10823
|
address = options.address,
|
|
10927
10824
|
isAmountAll = options.isAmountAll;
|
|
10928
|
-
assertIsForeign(asset);
|
|
10929
10825
|
if (asset.assetId !== undefined) {
|
|
10930
10826
|
var assetId = Number(asset.assetId);
|
|
10931
10827
|
var dest = {
|
|
@@ -11023,9 +10919,10 @@ var Astar = /*#__PURE__*/function (_Parachain) {
|
|
|
11023
10919
|
key: "transferXTokens",
|
|
11024
10920
|
value: function transferXTokens$1(input) {
|
|
11025
10921
|
var asset = input.asset;
|
|
11026
|
-
if (
|
|
10922
|
+
if (asset.isNative) {
|
|
11027
10923
|
return transferXTokens(input, undefined);
|
|
11028
10924
|
}
|
|
10925
|
+
assertHasId(asset);
|
|
11029
10926
|
return transferXTokens(input, BigInt(asset.assetId));
|
|
11030
10927
|
}
|
|
11031
10928
|
}, {
|
|
@@ -11037,7 +10934,10 @@ var Astar = /*#__PURE__*/function (_Parachain) {
|
|
|
11037
10934
|
}, {
|
|
11038
10935
|
key: "transferRelayToPara",
|
|
11039
10936
|
value: function transferRelayToPara() {
|
|
11040
|
-
throw new
|
|
10937
|
+
throw new ScenarioNotSupportedError({
|
|
10938
|
+
chain: this.chain,
|
|
10939
|
+
scenario: 'RelayToPara'
|
|
10940
|
+
});
|
|
11041
10941
|
}
|
|
11042
10942
|
}, {
|
|
11043
10943
|
key: "transferLocalNonNativeAsset",
|
|
@@ -11122,7 +11022,7 @@ var BifrostPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
11122
11022
|
}
|
|
11123
11023
|
var isVToken = asset.symbol && asset.symbol.startsWith('v');
|
|
11124
11024
|
var isVSToken = asset.symbol && asset.symbol.startsWith('vs');
|
|
11125
|
-
if (
|
|
11025
|
+
if (asset.isNative || !asset.isNative && !asset.assetId) {
|
|
11126
11026
|
return isVToken ? {
|
|
11127
11027
|
VToken: asset.symbol.substring(1)
|
|
11128
11028
|
} : {
|
|
@@ -11231,7 +11131,7 @@ var BridgeHubKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
11231
11131
|
value: function transferPolkadotXCM(input) {
|
|
11232
11132
|
var scenario = input.scenario;
|
|
11233
11133
|
if (scenario === 'ParaToPara') {
|
|
11234
|
-
throw new ScenarioNotSupportedError(
|
|
11134
|
+
throw new ScenarioNotSupportedError('Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
|
|
11235
11135
|
}
|
|
11236
11136
|
var method = 'limited_teleport_assets';
|
|
11237
11137
|
return transferPolkadotXcm(input, method, 'Unlimited');
|
|
@@ -11262,7 +11162,7 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
11262
11162
|
var scenario = input.scenario,
|
|
11263
11163
|
destChain = input.destChain;
|
|
11264
11164
|
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
11265
|
-
throw new ScenarioNotSupportedError(
|
|
11165
|
+
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
11266
11166
|
}
|
|
11267
11167
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11268
11168
|
}
|
|
@@ -11367,7 +11267,7 @@ var Collectives = /*#__PURE__*/function (_Parachain) {
|
|
|
11367
11267
|
var scenario = input.scenario,
|
|
11368
11268
|
destChain = input.destChain;
|
|
11369
11269
|
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
11370
|
-
throw new ScenarioNotSupportedError(
|
|
11270
|
+
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
11371
11271
|
}
|
|
11372
11272
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11373
11273
|
}
|
|
@@ -11401,7 +11301,10 @@ var CoretimeKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
11401
11301
|
value: function transferPolkadotXCM(input) {
|
|
11402
11302
|
var scenario = input.scenario;
|
|
11403
11303
|
if (scenario === 'ParaToPara') {
|
|
11404
|
-
throw new ScenarioNotSupportedError(
|
|
11304
|
+
throw new ScenarioNotSupportedError({
|
|
11305
|
+
chain: this.chain,
|
|
11306
|
+
scenario: scenario
|
|
11307
|
+
});
|
|
11405
11308
|
}
|
|
11406
11309
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11407
11310
|
}
|
|
@@ -11430,7 +11333,10 @@ var CoretimePolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
11430
11333
|
value: function transferPolkadotXCM(input) {
|
|
11431
11334
|
var scenario = input.scenario;
|
|
11432
11335
|
if (scenario === 'ParaToPara') {
|
|
11433
|
-
throw new ScenarioNotSupportedError(
|
|
11336
|
+
throw new ScenarioNotSupportedError({
|
|
11337
|
+
chain: this.chain,
|
|
11338
|
+
scenario: scenario
|
|
11339
|
+
});
|
|
11434
11340
|
}
|
|
11435
11341
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11436
11342
|
}
|
|
@@ -11479,12 +11385,18 @@ var Crab = /*#__PURE__*/function (_Parachain) {
|
|
|
11479
11385
|
if (input.scenario === 'ParaToPara') {
|
|
11480
11386
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11481
11387
|
}
|
|
11482
|
-
throw new ScenarioNotSupportedError(
|
|
11388
|
+
throw new ScenarioNotSupportedError({
|
|
11389
|
+
chain: this.chain,
|
|
11390
|
+
scenario: input.scenario
|
|
11391
|
+
});
|
|
11483
11392
|
}
|
|
11484
11393
|
}, {
|
|
11485
11394
|
key: "transferRelayToPara",
|
|
11486
11395
|
value: function transferRelayToPara() {
|
|
11487
|
-
throw new
|
|
11396
|
+
throw new ScenarioNotSupportedError({
|
|
11397
|
+
chain: this.chain,
|
|
11398
|
+
scenario: 'RelayToPara'
|
|
11399
|
+
});
|
|
11488
11400
|
}
|
|
11489
11401
|
}, {
|
|
11490
11402
|
key: "transferLocalNonNativeAsset",
|
|
@@ -11503,12 +11415,10 @@ var Crust = /*#__PURE__*/function (_Parachain) {
|
|
|
11503
11415
|
return _createClass(Crust, [{
|
|
11504
11416
|
key: "getCurrencySelection",
|
|
11505
11417
|
value: function getCurrencySelection(asset) {
|
|
11506
|
-
if (asset.
|
|
11418
|
+
if (asset.isNative) {
|
|
11507
11419
|
return 'SelfReserve';
|
|
11508
11420
|
}
|
|
11509
|
-
|
|
11510
|
-
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " has no assetId"));
|
|
11511
|
-
}
|
|
11421
|
+
assertHasId(asset);
|
|
11512
11422
|
return {
|
|
11513
11423
|
OtherReserve: BigInt(asset.assetId)
|
|
11514
11424
|
};
|
|
@@ -11597,21 +11507,17 @@ var Curio = /*#__PURE__*/function (_Parachain) {
|
|
|
11597
11507
|
return _createClass(Curio, [{
|
|
11598
11508
|
key: "getCustomCurrencyId",
|
|
11599
11509
|
value: function getCustomCurrencyId(asset) {
|
|
11600
|
-
return
|
|
11601
|
-
ForeignAsset: Number(asset.assetId)
|
|
11602
|
-
} : {
|
|
11510
|
+
return asset.isNative ? {
|
|
11603
11511
|
Token: asset.symbol
|
|
11512
|
+
} : {
|
|
11513
|
+
ForeignAsset: Number(asset.assetId)
|
|
11604
11514
|
};
|
|
11605
11515
|
}
|
|
11606
11516
|
}, {
|
|
11607
11517
|
key: "transferXTokens",
|
|
11608
11518
|
value: function transferXTokens$1(input) {
|
|
11609
11519
|
var asset = input.asset;
|
|
11610
|
-
var currencySelection =
|
|
11611
|
-
ForeignAsset: Number(asset.assetId)
|
|
11612
|
-
} : {
|
|
11613
|
-
Token: asset.symbol
|
|
11614
|
-
};
|
|
11520
|
+
var currencySelection = this.getCustomCurrencyId(asset);
|
|
11615
11521
|
return transferXTokens(input, currencySelection);
|
|
11616
11522
|
}
|
|
11617
11523
|
}, {
|
|
@@ -11639,7 +11545,10 @@ var Darwinia = /*#__PURE__*/function (_Parachain) {
|
|
|
11639
11545
|
var scenario = input.scenario,
|
|
11640
11546
|
asset = input.assetInfo;
|
|
11641
11547
|
if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
|
|
11642
|
-
throw new ScenarioNotSupportedError(
|
|
11548
|
+
throw new ScenarioNotSupportedError({
|
|
11549
|
+
chain: this.chain,
|
|
11550
|
+
scenario: scenario
|
|
11551
|
+
});
|
|
11643
11552
|
}
|
|
11644
11553
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11645
11554
|
}
|
|
@@ -11691,7 +11600,10 @@ var Encointer = /*#__PURE__*/function (_Parachain) {
|
|
|
11691
11600
|
if (input.scenario === 'ParaToRelay' || destChain && isTrustedChain(destChain)) {
|
|
11692
11601
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11693
11602
|
}
|
|
11694
|
-
throw new ScenarioNotSupportedError(
|
|
11603
|
+
throw new ScenarioNotSupportedError({
|
|
11604
|
+
chain: this.chain,
|
|
11605
|
+
scenario: input.scenario
|
|
11606
|
+
});
|
|
11695
11607
|
}
|
|
11696
11608
|
}, {
|
|
11697
11609
|
key: "getRelayToParaOverrides",
|
|
@@ -11718,14 +11630,20 @@ var EnergyWebX = /*#__PURE__*/function (_Parachain) {
|
|
|
11718
11630
|
value: function transferPolkadotXCM(input) {
|
|
11719
11631
|
var scenario = input.scenario;
|
|
11720
11632
|
if (scenario !== 'ParaToPara') {
|
|
11721
|
-
throw new ScenarioNotSupportedError(
|
|
11633
|
+
throw new ScenarioNotSupportedError({
|
|
11634
|
+
chain: this.chain,
|
|
11635
|
+
scenario: scenario
|
|
11636
|
+
});
|
|
11722
11637
|
}
|
|
11723
11638
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11724
11639
|
}
|
|
11725
11640
|
}, {
|
|
11726
11641
|
key: "transferRelayToPara",
|
|
11727
11642
|
value: function transferRelayToPara() {
|
|
11728
|
-
throw new
|
|
11643
|
+
throw new ScenarioNotSupportedError({
|
|
11644
|
+
chain: this.chain,
|
|
11645
|
+
scenario: 'RelayToPara'
|
|
11646
|
+
});
|
|
11729
11647
|
}
|
|
11730
11648
|
}]);
|
|
11731
11649
|
}(Parachain);
|
|
@@ -11755,7 +11673,10 @@ var Heima = /*#__PURE__*/function (_Parachain) {
|
|
|
11755
11673
|
var scenario = input.scenario,
|
|
11756
11674
|
asset = input.assetInfo;
|
|
11757
11675
|
if (scenario !== 'ParaToPara') {
|
|
11758
|
-
throw new ScenarioNotSupportedError(
|
|
11676
|
+
throw new ScenarioNotSupportedError({
|
|
11677
|
+
chain: this.chain,
|
|
11678
|
+
scenario: scenario
|
|
11679
|
+
});
|
|
11759
11680
|
}
|
|
11760
11681
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
11761
11682
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -11956,10 +11877,10 @@ var Interlay = /*#__PURE__*/function (_Parachain) {
|
|
|
11956
11877
|
return _createClass(Interlay, [{
|
|
11957
11878
|
key: "getCustomCurrencyId",
|
|
11958
11879
|
value: function getCustomCurrencyId(asset) {
|
|
11959
|
-
return
|
|
11960
|
-
ForeignAsset: Number(asset.assetId)
|
|
11961
|
-
} : {
|
|
11880
|
+
return asset.isNative ? {
|
|
11962
11881
|
Token: asset.symbol
|
|
11882
|
+
} : {
|
|
11883
|
+
ForeignAsset: Number(asset.assetId)
|
|
11963
11884
|
};
|
|
11964
11885
|
}
|
|
11965
11886
|
}, {
|
|
@@ -12020,10 +11941,10 @@ var Jamton = /*#__PURE__*/function (_Parachain) {
|
|
|
12020
11941
|
return _createClass(Jamton, [{
|
|
12021
11942
|
key: "getCustomCurrencyId",
|
|
12022
11943
|
value: function getCustomCurrencyId(asset) {
|
|
12023
|
-
return
|
|
12024
|
-
ForeignAsset: Number(asset.assetId)
|
|
12025
|
-
} : {
|
|
11944
|
+
return asset.isNative ? {
|
|
12026
11945
|
Native: Jamton.NATIVE_ASSET_IDS[asset.symbol]
|
|
11946
|
+
} : {
|
|
11947
|
+
ForeignAsset: Number(asset.assetId)
|
|
12027
11948
|
};
|
|
12028
11949
|
}
|
|
12029
11950
|
}, {
|
|
@@ -12034,12 +11955,12 @@ var Jamton = /*#__PURE__*/function (_Parachain) {
|
|
|
12034
11955
|
destination = input.destination,
|
|
12035
11956
|
version = input.version;
|
|
12036
11957
|
var currencySelection = this.getCustomCurrencyId(asset);
|
|
12037
|
-
if (
|
|
11958
|
+
if (asset.isNative && asset.symbol in Jamton.NATIVE_ASSET_IDS) {
|
|
12038
11959
|
return transferXTokens(input, currencySelection);
|
|
12039
11960
|
}
|
|
12040
11961
|
assertHasId(asset);
|
|
12041
11962
|
if (scenario === 'ParaToPara' && destination !== 'AssetHubPolkadot') {
|
|
12042
|
-
throw new ScenarioNotSupportedError(
|
|
11963
|
+
throw new ScenarioNotSupportedError("Transfer from ".concat(this.chain, " to ").concat(JSON.stringify(destination), " is not yet supported"));
|
|
12043
11964
|
}
|
|
12044
11965
|
if (isSymbolMatch(asset.symbol, 'WUD')) {
|
|
12045
11966
|
var usdt = findAssetInfoOrThrow(this.chain, {
|
|
@@ -12089,14 +12010,17 @@ var KiltSpiritnet = /*#__PURE__*/function (_Parachain) {
|
|
|
12089
12010
|
var scenario = input.scenario,
|
|
12090
12011
|
asset = input.assetInfo;
|
|
12091
12012
|
if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
|
|
12092
|
-
throw new ScenarioNotSupportedError(
|
|
12013
|
+
throw new ScenarioNotSupportedError('KiltSpiritnet only supports native asset ParaToPara transfers');
|
|
12093
12014
|
}
|
|
12094
12015
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
12095
12016
|
}
|
|
12096
12017
|
}, {
|
|
12097
12018
|
key: "transferRelayToPara",
|
|
12098
12019
|
value: function transferRelayToPara() {
|
|
12099
|
-
throw new
|
|
12020
|
+
throw new ScenarioNotSupportedError({
|
|
12021
|
+
chain: this.chain,
|
|
12022
|
+
scenario: 'RelayToPara'
|
|
12023
|
+
});
|
|
12100
12024
|
}
|
|
12101
12025
|
}]);
|
|
12102
12026
|
}(Parachain);
|
|
@@ -12129,10 +12053,10 @@ var Kintsugi = /*#__PURE__*/function (_Parachain) {
|
|
|
12129
12053
|
return _createClass(Kintsugi, [{
|
|
12130
12054
|
key: "getCustomCurrencyId",
|
|
12131
12055
|
value: function getCustomCurrencyId(asset) {
|
|
12132
|
-
return
|
|
12133
|
-
ForeignAsset: Number(asset.assetId)
|
|
12134
|
-
} : {
|
|
12056
|
+
return asset.isNative ? {
|
|
12135
12057
|
Token: asset.symbol
|
|
12058
|
+
} : {
|
|
12059
|
+
ForeignAsset: Number(asset.assetId)
|
|
12136
12060
|
};
|
|
12137
12061
|
}
|
|
12138
12062
|
}, {
|
|
@@ -12201,7 +12125,10 @@ var Laos = /*#__PURE__*/function (_Parachain) {
|
|
|
12201
12125
|
asset = input.assetInfo,
|
|
12202
12126
|
destination = input.destination;
|
|
12203
12127
|
if (scenario !== 'ParaToPara') {
|
|
12204
|
-
throw new ScenarioNotSupportedError(
|
|
12128
|
+
throw new ScenarioNotSupportedError({
|
|
12129
|
+
chain: this.chain,
|
|
12130
|
+
scenario: scenario
|
|
12131
|
+
});
|
|
12205
12132
|
}
|
|
12206
12133
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
12207
12134
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -12214,7 +12141,10 @@ var Laos = /*#__PURE__*/function (_Parachain) {
|
|
|
12214
12141
|
}, {
|
|
12215
12142
|
key: "transferRelayToPara",
|
|
12216
12143
|
value: function transferRelayToPara() {
|
|
12217
|
-
throw new
|
|
12144
|
+
throw new ScenarioNotSupportedError({
|
|
12145
|
+
chain: this.chain,
|
|
12146
|
+
scenario: 'RelayToPara'
|
|
12147
|
+
});
|
|
12218
12148
|
}
|
|
12219
12149
|
}]);
|
|
12220
12150
|
}(Parachain);
|
|
@@ -12314,7 +12244,7 @@ var Moonbeam = /*#__PURE__*/function (_Parachain) {
|
|
|
12314
12244
|
}, {
|
|
12315
12245
|
key: "transferLocalNonNativeAsset",
|
|
12316
12246
|
value: function transferLocalNonNativeAsset(_options) {
|
|
12317
|
-
throw new ScenarioNotSupportedError(
|
|
12247
|
+
throw new ScenarioNotSupportedError("".concat(this.chain, " local transfers are temporarily disabled"));
|
|
12318
12248
|
}
|
|
12319
12249
|
}, {
|
|
12320
12250
|
key: "getBalanceForeign",
|
|
@@ -12404,7 +12334,10 @@ var Mythos = /*#__PURE__*/function (_Parachain) {
|
|
|
12404
12334
|
var scenario = input.scenario,
|
|
12405
12335
|
destination = input.destination;
|
|
12406
12336
|
if (scenario !== 'ParaToPara') {
|
|
12407
|
-
throw new ScenarioNotSupportedError(
|
|
12337
|
+
throw new ScenarioNotSupportedError({
|
|
12338
|
+
chain: this.chain,
|
|
12339
|
+
scenario: scenario
|
|
12340
|
+
});
|
|
12408
12341
|
}
|
|
12409
12342
|
return transferPolkadotXcm(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited');
|
|
12410
12343
|
}
|
|
@@ -12449,7 +12382,10 @@ var Mythos = /*#__PURE__*/function (_Parachain) {
|
|
|
12449
12382
|
}, {
|
|
12450
12383
|
key: "transferRelayToPara",
|
|
12451
12384
|
value: function transferRelayToPara() {
|
|
12452
|
-
throw new
|
|
12385
|
+
throw new ScenarioNotSupportedError({
|
|
12386
|
+
chain: this.chain,
|
|
12387
|
+
scenario: 'RelayToPara'
|
|
12388
|
+
});
|
|
12453
12389
|
}
|
|
12454
12390
|
}]);
|
|
12455
12391
|
}(Parachain);
|
|
@@ -12544,7 +12480,10 @@ var Nodle = /*#__PURE__*/function (_Parachain) {
|
|
|
12544
12480
|
var asset = input.assetInfo,
|
|
12545
12481
|
scenario = input.scenario;
|
|
12546
12482
|
if (scenario !== 'ParaToPara') {
|
|
12547
|
-
throw new ScenarioNotSupportedError(
|
|
12483
|
+
throw new ScenarioNotSupportedError({
|
|
12484
|
+
chain: this.chain,
|
|
12485
|
+
scenario: scenario
|
|
12486
|
+
});
|
|
12548
12487
|
}
|
|
12549
12488
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
12550
12489
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -12554,7 +12493,10 @@ var Nodle = /*#__PURE__*/function (_Parachain) {
|
|
|
12554
12493
|
}, {
|
|
12555
12494
|
key: "transferRelayToPara",
|
|
12556
12495
|
value: function transferRelayToPara() {
|
|
12557
|
-
throw new
|
|
12496
|
+
throw new ScenarioNotSupportedError({
|
|
12497
|
+
chain: this.chain,
|
|
12498
|
+
scenario: 'RelayToPara'
|
|
12499
|
+
});
|
|
12558
12500
|
}
|
|
12559
12501
|
}]);
|
|
12560
12502
|
}(Parachain);
|
|
@@ -12575,7 +12517,7 @@ var PeoplePolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
12575
12517
|
var scenario = input.scenario,
|
|
12576
12518
|
destChain = input.destChain;
|
|
12577
12519
|
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
12578
|
-
throw new ScenarioNotSupportedError(
|
|
12520
|
+
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
12579
12521
|
}
|
|
12580
12522
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
12581
12523
|
}
|
|
@@ -12620,7 +12562,10 @@ var Peaq = /*#__PURE__*/function (_Parachain) {
|
|
|
12620
12562
|
var scenario = input.scenario,
|
|
12621
12563
|
asset = input.asset;
|
|
12622
12564
|
if (scenario !== 'ParaToPara') {
|
|
12623
|
-
throw new ScenarioNotSupportedError(
|
|
12565
|
+
throw new ScenarioNotSupportedError({
|
|
12566
|
+
chain: this.chain,
|
|
12567
|
+
scenario: scenario
|
|
12568
|
+
});
|
|
12624
12569
|
}
|
|
12625
12570
|
assertHasId(asset);
|
|
12626
12571
|
return transferXTokens(input, BigInt(asset.assetId));
|
|
@@ -12628,7 +12573,10 @@ var Peaq = /*#__PURE__*/function (_Parachain) {
|
|
|
12628
12573
|
}, {
|
|
12629
12574
|
key: "transferRelayToPara",
|
|
12630
12575
|
value: function transferRelayToPara() {
|
|
12631
|
-
throw new
|
|
12576
|
+
throw new ScenarioNotSupportedError({
|
|
12577
|
+
chain: this.chain,
|
|
12578
|
+
scenario: 'RelayToPara'
|
|
12579
|
+
});
|
|
12632
12580
|
}
|
|
12633
12581
|
}, {
|
|
12634
12582
|
key: "transferLocalNonNativeAsset",
|
|
@@ -12720,7 +12668,10 @@ var PeopleKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
12720
12668
|
value: function transferPolkadotXCM(input) {
|
|
12721
12669
|
var scenario = input.scenario;
|
|
12722
12670
|
if (scenario === 'ParaToPara') {
|
|
12723
|
-
throw new ScenarioNotSupportedError(
|
|
12671
|
+
throw new ScenarioNotSupportedError({
|
|
12672
|
+
chain: this.chain,
|
|
12673
|
+
scenario: scenario
|
|
12674
|
+
});
|
|
12724
12675
|
}
|
|
12725
12676
|
var method = 'limited_teleport_assets';
|
|
12726
12677
|
return transferPolkadotXcm(input, method, 'Unlimited');
|
|
@@ -12766,7 +12717,7 @@ var determineDestWeight = function determineDestWeight(destChain) {
|
|
|
12766
12717
|
proof_size: 0n
|
|
12767
12718
|
};
|
|
12768
12719
|
}
|
|
12769
|
-
throw new
|
|
12720
|
+
throw new ScenarioNotSupportedError("Pallet XTransfer does not support transfering to ".concat(destChain, "."));
|
|
12770
12721
|
};
|
|
12771
12722
|
|
|
12772
12723
|
var transferXTransfer = function transferXTransfer(input) {
|
|
@@ -12911,7 +12862,10 @@ var RobonomicsPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
12911
12862
|
value: function transferPolkadotXCM(input) {
|
|
12912
12863
|
var scenario = input.scenario;
|
|
12913
12864
|
if (scenario === 'ParaToPara') {
|
|
12914
|
-
throw new ScenarioNotSupportedError(
|
|
12865
|
+
throw new ScenarioNotSupportedError({
|
|
12866
|
+
chain: this.chain,
|
|
12867
|
+
scenario: scenario
|
|
12868
|
+
});
|
|
12915
12869
|
}
|
|
12916
12870
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
12917
12871
|
}
|
|
@@ -12983,7 +12937,10 @@ var Shiden = /*#__PURE__*/function (_Parachain) {
|
|
|
12983
12937
|
}, {
|
|
12984
12938
|
key: "transferRelayToPara",
|
|
12985
12939
|
value: function transferRelayToPara() {
|
|
12986
|
-
throw new
|
|
12940
|
+
throw new ScenarioNotSupportedError({
|
|
12941
|
+
chain: this.chain,
|
|
12942
|
+
scenario: 'RelayToPara'
|
|
12943
|
+
});
|
|
12987
12944
|
}
|
|
12988
12945
|
}, {
|
|
12989
12946
|
key: "transferLocalNonNativeAsset",
|
|
@@ -13012,7 +12969,7 @@ var Unique = /*#__PURE__*/function (_Parachain) {
|
|
|
13012
12969
|
}, {
|
|
13013
12970
|
key: "transferLocalNonNativeAsset",
|
|
13014
12971
|
value: function transferLocalNonNativeAsset(_options) {
|
|
13015
|
-
throw new ScenarioNotSupportedError(
|
|
12972
|
+
throw new ScenarioNotSupportedError("".concat(this.chain, " does not support foreign assets local transfers"));
|
|
13016
12973
|
}
|
|
13017
12974
|
}, {
|
|
13018
12975
|
key: "getBalanceForeign",
|
|
@@ -13069,7 +13026,7 @@ var Xode = /*#__PURE__*/function (_Parachain) {
|
|
|
13069
13026
|
assetInfo = options.assetInfo,
|
|
13070
13027
|
scenario = options.scenario;
|
|
13071
13028
|
if (destChain !== 'AssetHubPolkadot' && scenario === 'ParaToPara') {
|
|
13072
|
-
throw new
|
|
13029
|
+
throw new ScenarioNotSupportedError('Xode chain only supports transfers to / from AssetHubPolkadot');
|
|
13073
13030
|
}
|
|
13074
13031
|
assertHasLocation(assetInfo);
|
|
13075
13032
|
return transferPolkadotXcm(options, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
@@ -13095,7 +13052,7 @@ var Zeitgeist = /*#__PURE__*/function (_Parachain) {
|
|
|
13095
13052
|
return _createClass(Zeitgeist, [{
|
|
13096
13053
|
key: "getCustomCurrencyId",
|
|
13097
13054
|
value: function getCustomCurrencyId(asset) {
|
|
13098
|
-
if (asset.
|
|
13055
|
+
if (asset.isNative) return 'Ztg';
|
|
13099
13056
|
assertHasId(asset);
|
|
13100
13057
|
return {
|
|
13101
13058
|
ForeignAsset: Number(asset.assetId)
|
|
@@ -13451,24 +13408,24 @@ var resolveModuleError = function resolveModuleError(chain, error) {
|
|
|
13451
13408
|
return p.index === Number(error.index);
|
|
13452
13409
|
});
|
|
13453
13410
|
if (!palletDetails) {
|
|
13454
|
-
throw new
|
|
13411
|
+
throw new RoutingResolutionError("Pallet with index ".concat(error.index, " not found"));
|
|
13455
13412
|
}
|
|
13456
13413
|
// Use only the first byte of the error to get the error index
|
|
13457
13414
|
// Including 0x prefix
|
|
13458
13415
|
var errorIndex = Number(error.error.slice(0, 4));
|
|
13459
13416
|
var name = palletDetails.name;
|
|
13460
13417
|
if (name !== 'XTokens' && name !== 'PolkadotXcm' && name !== 'XcmPallet') {
|
|
13461
|
-
throw new
|
|
13418
|
+
throw new UnsupportedOperationError("Pallet ".concat(name, " is not supported"));
|
|
13462
13419
|
}
|
|
13463
13420
|
var failureReason = name === 'XTokens' ? Object.values(XTokensError)[errorIndex] : Object.values(PolkadotXcmError)[errorIndex];
|
|
13464
13421
|
if (!failureReason) {
|
|
13465
|
-
throw new
|
|
13422
|
+
throw new RoutingResolutionError("Error index ".concat(errorIndex, " not found in ").concat(name, " pallet"));
|
|
13466
13423
|
}
|
|
13467
13424
|
if (failureReason === PolkadotXcmError.LocalExecutionIncompleteWithError) {
|
|
13468
13425
|
var subErrorIndex = Number("0x".concat(error.error.slice(6, 8)));
|
|
13469
13426
|
var failureSubReason = Object.values(PolkadotXcmExecutionError)[subErrorIndex];
|
|
13470
13427
|
if (!failureSubReason) {
|
|
13471
|
-
throw new
|
|
13428
|
+
throw new RoutingResolutionError("Sub-error index ".concat(subErrorIndex, " not found in PolkadotXcm pallet"));
|
|
13472
13429
|
}
|
|
13473
13430
|
return {
|
|
13474
13431
|
failureReason: failureReason,
|
|
@@ -13519,7 +13476,7 @@ var AssetManagerPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
13519
13476
|
}, {
|
|
13520
13477
|
key: "getBalance",
|
|
13521
13478
|
value: function getBalance() {
|
|
13522
|
-
throw new
|
|
13479
|
+
throw new UnsupportedOperationError('No balance support.');
|
|
13523
13480
|
}
|
|
13524
13481
|
}]);
|
|
13525
13482
|
}(BaseAssetsPallet);
|
|
@@ -13716,7 +13673,7 @@ var CurrenciesPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
13716
13673
|
}, {
|
|
13717
13674
|
key: "getBalance",
|
|
13718
13675
|
value: function getBalance() {
|
|
13719
|
-
throw new
|
|
13676
|
+
throw new UnsupportedOperationError('No balance support.');
|
|
13720
13677
|
}
|
|
13721
13678
|
}]);
|
|
13722
13679
|
}(BaseAssetsPallet);
|
|
@@ -13922,7 +13879,7 @@ var SystemPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
13922
13879
|
var resolveId = function resolveId(asset, chain) {
|
|
13923
13880
|
if (chain === 'BifrostPolkadot' || chain === 'BifrostKusama' || chain === 'BifrostPaseo') {
|
|
13924
13881
|
var _asset$assetId;
|
|
13925
|
-
var isEthAsset =
|
|
13882
|
+
var isEthAsset = !asset.isNative && ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.startsWith('0x'));
|
|
13926
13883
|
var resolvedAsset = isEthAsset && asset.location ? findAssetInfoOrThrow(chain, {
|
|
13927
13884
|
location: asset.location
|
|
13928
13885
|
}, null) : asset;
|
|
@@ -14098,7 +14055,7 @@ var getBalanceInternal = /*#__PURE__*/function () {
|
|
|
14098
14055
|
while (1) switch (_context2.n) {
|
|
14099
14056
|
case 0:
|
|
14100
14057
|
chain = options.chain, currency = options.currency;
|
|
14101
|
-
asset = findAssetInfoOrThrow(chain, currency, null);
|
|
14058
|
+
asset = currency ? findAssetInfoOrThrow(chain, currency, null) : findNativeAssetInfoOrThrow(chain);
|
|
14102
14059
|
return _context2.a(2, getAssetBalanceInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
14103
14060
|
asset: asset
|
|
14104
14061
|
})));
|
|
@@ -14137,25 +14094,6 @@ var getBalance = /*#__PURE__*/function () {
|
|
|
14137
14094
|
};
|
|
14138
14095
|
}();
|
|
14139
14096
|
|
|
14140
|
-
var getBalanceNative = /*#__PURE__*/function () {
|
|
14141
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
14142
|
-
var chain, currency, asset;
|
|
14143
|
-
return _regenerator().w(function (_context) {
|
|
14144
|
-
while (1) switch (_context.n) {
|
|
14145
|
-
case 0:
|
|
14146
|
-
chain = options.chain, currency = options.currency;
|
|
14147
|
-
asset = currency ? findAssetInfoOrThrow(chain, currency, null) : findNativeAssetInfoOrThrow(chain);
|
|
14148
|
-
return _context.a(2, getAssetBalanceInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
14149
|
-
asset: asset
|
|
14150
|
-
})));
|
|
14151
|
-
}
|
|
14152
|
-
}, _callee);
|
|
14153
|
-
}));
|
|
14154
|
-
return function getBalanceNative(_x) {
|
|
14155
|
-
return _ref.apply(this, arguments);
|
|
14156
|
-
};
|
|
14157
|
-
}();
|
|
14158
|
-
|
|
14159
14097
|
var ERC20_ABI = [{
|
|
14160
14098
|
type: 'function',
|
|
14161
14099
|
name: 'balanceOf',
|
|
@@ -14197,4 +14135,4 @@ var getMoonbeamErc20Balance = /*#__PURE__*/function () {
|
|
|
14197
14135
|
};
|
|
14198
14136
|
}();
|
|
14199
14137
|
|
|
14200
|
-
export { AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BridgeHaltedError, Builder,
|
|
14138
|
+
export { AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RoutingResolutionError, RuntimeApiUnavailableError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, UnsupportedOperationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, constructTypeAndThenCall, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createId, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getFailureInfo$1 as getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
|