@paraspell/sdk-core 11.14.8 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +119 -184
- package/dist/index.mjs +511 -563
- package/package.json +5 -5
- package/dist/index.cjs +0 -14326
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,17 +819,19 @@ 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
|
-
|
|
750
|
-
|
|
751
|
-
|
|
826
|
+
|
|
827
|
+
var createId = function createId(version, location) {
|
|
828
|
+
if (version === Version.V3) {
|
|
829
|
+
return {
|
|
830
|
+
Concrete: location
|
|
831
|
+
};
|
|
752
832
|
}
|
|
833
|
+
return location;
|
|
753
834
|
};
|
|
754
|
-
|
|
755
835
|
var createAsset = function createAsset(version, amount, location) {
|
|
756
836
|
if (version === Version.V3) {
|
|
757
837
|
return {
|
|
@@ -782,7 +862,7 @@ var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
|
782
862
|
return id;
|
|
783
863
|
}
|
|
784
864
|
if (!(/^\d{38,39}$/.test(id) || /^\d{4}$/.test(id))) {
|
|
785
|
-
throw new
|
|
865
|
+
throw new NumberFormatError("Asset id: ".concat(id, " must be a string and have either 4 digits or 38-39 digits"));
|
|
786
866
|
}
|
|
787
867
|
return "0xffffffff".concat(BigInt(id).toString(16).padStart(32, '0'));
|
|
788
868
|
};
|
|
@@ -799,7 +879,7 @@ var maybeOverrideAsset = function maybeOverrideAsset(version, amount, asset, ove
|
|
|
799
879
|
}
|
|
800
880
|
if (Array.isArray(overriddenCurrency)) {
|
|
801
881
|
if (overriddenCurrency.length !== 1) {
|
|
802
|
-
throw new
|
|
882
|
+
throw new OverrideConflictError('Expected a single asset in overriddenCurrency array.');
|
|
803
883
|
}
|
|
804
884
|
return overriddenCurrency[0];
|
|
805
885
|
}
|
|
@@ -925,7 +1005,7 @@ var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
|
|
|
925
1005
|
if (paraId) {
|
|
926
1006
|
var resolvedChain = getTChain(paraId, getRelayChainOf(chain));
|
|
927
1007
|
if (!resolvedChain) {
|
|
928
|
-
throw new
|
|
1008
|
+
throw new RoutingResolutionError("Chain with paraId ".concat(paraId, " not found"));
|
|
929
1009
|
}
|
|
930
1010
|
return resolvedChain;
|
|
931
1011
|
}
|
|
@@ -966,7 +1046,7 @@ var buildLocation = function buildLocation(_ref) {
|
|
|
966
1046
|
asset = _ref.asset,
|
|
967
1047
|
origin = _ref.origin,
|
|
968
1048
|
destination = _ref.destination;
|
|
969
|
-
if (
|
|
1049
|
+
if (asset.isNative) {
|
|
970
1050
|
return resolveLocationFromDest(destination, asset);
|
|
971
1051
|
}
|
|
972
1052
|
var createDefaultLocation = function createDefaultLocation(assetId) {
|
|
@@ -2676,7 +2756,7 @@ var getChainProviders = function getChainProviders(chain) {
|
|
|
2676
2756
|
var _getChainConfig = getChainConfig(chain),
|
|
2677
2757
|
providers = _getChainConfig.providers;
|
|
2678
2758
|
if (providers.length === 0) {
|
|
2679
|
-
throw new
|
|
2759
|
+
throw new ProviderUnavailableError("No providers found for chain ".concat(chain));
|
|
2680
2760
|
}
|
|
2681
2761
|
// Prefer Dwellir provider
|
|
2682
2762
|
providers.sort(function (a, b) {
|
|
@@ -2765,26 +2845,16 @@ var resolveTChainFromLocation = function resolveTChainFromLocation(relaychain, l
|
|
|
2765
2845
|
var _PARACHAINS$find;
|
|
2766
2846
|
var parachainId = getJunctionValue(location, 'Parachain');
|
|
2767
2847
|
if (parachainId === undefined) {
|
|
2768
|
-
throw new
|
|
2848
|
+
throw new RoutingResolutionError('Parachain ID not found in destination location.');
|
|
2769
2849
|
}
|
|
2770
2850
|
var chain = (_PARACHAINS$find = PARACHAINS.find(function (chain) {
|
|
2771
2851
|
return getParaId(chain) === parachainId && getRelayChainOf(chain) === relaychain;
|
|
2772
2852
|
})) !== null && _PARACHAINS$find !== void 0 ? _PARACHAINS$find : null;
|
|
2773
2853
|
if (chain === null) {
|
|
2774
|
-
throw new
|
|
2854
|
+
throw new RoutingResolutionError('Chain with specified paraId not found in destination location.');
|
|
2775
2855
|
}
|
|
2776
2856
|
return chain;
|
|
2777
2857
|
};
|
|
2778
|
-
var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
|
|
2779
|
-
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
2780
|
-
isDestination: false
|
|
2781
|
-
},
|
|
2782
|
-
isDestination = _ref.isDestination;
|
|
2783
|
-
if ('location' in currency) {
|
|
2784
|
-
throw new InvalidCurrencyError("\n Selected chain doesn't support location you provided. Maybe you meant custom location. If so, you need to use override option. Your selection should look like this: {location: Override(".concat(JSON.stringify(currency.location), ")}."));
|
|
2785
|
-
}
|
|
2786
|
-
throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
|
|
2787
|
-
};
|
|
2788
2858
|
|
|
2789
2859
|
var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
|
|
2790
2860
|
var assets = options.assets,
|
|
@@ -2845,7 +2915,7 @@ var claimAssets = /*#__PURE__*/function () {
|
|
|
2845
2915
|
_context.n = 2;
|
|
2846
2916
|
break;
|
|
2847
2917
|
}
|
|
2848
|
-
throw new
|
|
2918
|
+
throw new UnsupportedOperationError('Unsupported pallet for asset claim');
|
|
2849
2919
|
case 2:
|
|
2850
2920
|
version = getChainVersion(chain);
|
|
2851
2921
|
assets = resolveAssets(options, version);
|
|
@@ -2935,7 +3005,7 @@ var getMythosOriginFee = /*#__PURE__*/function () {
|
|
|
2935
3005
|
_context.n = 5;
|
|
2936
3006
|
break;
|
|
2937
3007
|
}
|
|
2938
|
-
throw new
|
|
3008
|
+
throw new UnableToComputeError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
2939
3009
|
case 5:
|
|
2940
3010
|
return _context.a(2, padValueBy(feeConverted, 10));
|
|
2941
3011
|
}
|
|
@@ -3254,7 +3324,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
3254
3324
|
_context2.n = 2;
|
|
3255
3325
|
break;
|
|
3256
3326
|
}
|
|
3257
|
-
throw new
|
|
3327
|
+
throw new BatchValidationError('No transactions to batch.');
|
|
3258
3328
|
case 2:
|
|
3259
3329
|
sameFrom = this.transactionOptions.every(function (tx) {
|
|
3260
3330
|
return tx.from === from;
|
|
@@ -3263,7 +3333,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
3263
3333
|
_context2.n = 3;
|
|
3264
3334
|
break;
|
|
3265
3335
|
}
|
|
3266
|
-
throw new
|
|
3336
|
+
throw new BatchValidationError('All transactions must have the same origin.');
|
|
3267
3337
|
case 3:
|
|
3268
3338
|
_context2.n = 4;
|
|
3269
3339
|
return Promise.all(this.transactionOptions.map(/*#__PURE__*/function () {
|
|
@@ -3313,10 +3383,10 @@ var buildDryRun = function buildDryRun(api, tx, options, bypassOptions) {
|
|
|
3313
3383
|
from = options.from,
|
|
3314
3384
|
currency = options.currency;
|
|
3315
3385
|
if (isTLocation(to)) {
|
|
3316
|
-
throw new
|
|
3386
|
+
throw new InvalidAddressError('Location destination is not supported for XCM fee calculation.');
|
|
3317
3387
|
}
|
|
3318
3388
|
if (isTLocation(address)) {
|
|
3319
|
-
throw new
|
|
3389
|
+
throw new InvalidAddressError('Location address is not supported for XCM fee calculation.');
|
|
3320
3390
|
}
|
|
3321
3391
|
return dryRun({
|
|
3322
3392
|
api: api,
|
|
@@ -3365,7 +3435,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3365
3435
|
key: "to",
|
|
3366
3436
|
value: function to(chain, paraIdTo) {
|
|
3367
3437
|
if (this._options.from && isRelayChain(this._options.from) && chain === 'Ethereum') {
|
|
3368
|
-
throw new
|
|
3438
|
+
throw new ScenarioNotSupportedError('Transfers from relay chain to Ethereum are not yet supported.');
|
|
3369
3439
|
}
|
|
3370
3440
|
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
3371
3441
|
to: chain,
|
|
@@ -3591,7 +3661,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3591
3661
|
_context4.n = 1;
|
|
3592
3662
|
break;
|
|
3593
3663
|
}
|
|
3594
|
-
throw new
|
|
3664
|
+
throw new BatchValidationError('Transaction manager contains batched items. Use buildBatch() to process them.');
|
|
3595
3665
|
case 1:
|
|
3596
3666
|
_context4.n = 2;
|
|
3597
3667
|
return this.prepareNormalizedOptions(this._options);
|
|
@@ -3826,7 +3896,13 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3826
3896
|
return getOriginXcmFee$1;
|
|
3827
3897
|
}()
|
|
3828
3898
|
/**
|
|
3829
|
-
* 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}
|
|
3830
3906
|
*
|
|
3831
3907
|
* @returns An origin and destination fee estimate.
|
|
3832
3908
|
*/
|
|
@@ -3884,6 +3960,12 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3884
3960
|
/**
|
|
3885
3961
|
* Estimates the origin XCM fee using paymentInfo function.
|
|
3886
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
|
+
*
|
|
3887
3969
|
* @returns An origin fee estimate.
|
|
3888
3970
|
*/
|
|
3889
3971
|
)
|
|
@@ -4220,7 +4302,7 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
4220
4302
|
case 1:
|
|
4221
4303
|
edNative = getExistentialDepositOrThrow(origin);
|
|
4222
4304
|
_context.n = 2;
|
|
4223
|
-
return
|
|
4305
|
+
return getBalanceInternal({
|
|
4224
4306
|
api: api,
|
|
4225
4307
|
chain: origin,
|
|
4226
4308
|
address: senderAddress
|
|
@@ -4278,7 +4360,7 @@ var isSufficientDestination = /*#__PURE__*/function () {
|
|
|
4278
4360
|
case 1:
|
|
4279
4361
|
existentialDeposit = getExistentialDepositOrThrow(destination);
|
|
4280
4362
|
_context2.n = 2;
|
|
4281
|
-
return
|
|
4363
|
+
return getBalanceInternal({
|
|
4282
4364
|
api: api,
|
|
4283
4365
|
chain: destination,
|
|
4284
4366
|
address: address
|
|
@@ -4422,8 +4504,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4422
4504
|
fee: _fee,
|
|
4423
4505
|
feeType: 'paymentInfo',
|
|
4424
4506
|
sufficient: sufficient,
|
|
4425
|
-
asset: asset
|
|
4426
|
-
currency: asset.symbol
|
|
4507
|
+
asset: asset
|
|
4427
4508
|
});
|
|
4428
4509
|
case 3:
|
|
4429
4510
|
_context3.n = 4;
|
|
@@ -4463,8 +4544,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4463
4544
|
dryRunError: dryRunResult.failureReason,
|
|
4464
4545
|
dryRunSubError: dryRunResult.failureSubReason,
|
|
4465
4546
|
sufficient: false,
|
|
4466
|
-
asset: asset
|
|
4467
|
-
currency: asset.symbol
|
|
4547
|
+
asset: asset
|
|
4468
4548
|
});
|
|
4469
4549
|
case 7:
|
|
4470
4550
|
fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
|
|
@@ -4474,8 +4554,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4474
4554
|
sufficient: true,
|
|
4475
4555
|
forwardedXcms: newForwardedXcms,
|
|
4476
4556
|
destParaId: destParaId,
|
|
4477
|
-
asset: asset
|
|
4478
|
-
currency: asset.symbol
|
|
4557
|
+
asset: asset
|
|
4479
4558
|
});
|
|
4480
4559
|
}
|
|
4481
4560
|
}, _callee3);
|
|
@@ -4552,14 +4631,13 @@ var validateAssetSupport = function validateAssetSupport(_ref, assetCheckEnabled
|
|
|
4552
4631
|
var origin = _ref.from,
|
|
4553
4632
|
destination = _ref.to,
|
|
4554
4633
|
currency = _ref.currency;
|
|
4555
|
-
var isRelayDestination = !isTLocation(destination) && isRelayChain(destination);
|
|
4556
4634
|
var isLocationDestination = _typeof(destination) === 'object';
|
|
4557
|
-
if (!isBridge && !isRelayDestination && !isLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol)) {
|
|
4558
|
-
throw new InvalidCurrencyError("Destination chain ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
|
|
4559
|
-
}
|
|
4560
4635
|
if (asset === null && assetCheckEnabled) {
|
|
4561
4636
|
throwUnsupportedCurrency(currency, origin);
|
|
4562
4637
|
}
|
|
4638
|
+
if (!isLocationDestination && assetCheckEnabled && !findAssetInfoOnDest(origin, destination, currency, asset)) {
|
|
4639
|
+
throw new InvalidCurrencyError("Destination chain ".concat(destination, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
|
|
4640
|
+
}
|
|
4563
4641
|
validateBridgeAsset(origin, destination, asset, currency, isBridge);
|
|
4564
4642
|
validateEthereumAsset(origin, destination, asset);
|
|
4565
4643
|
};
|
|
@@ -4696,11 +4774,11 @@ var validateCurrency = function validateCurrency(currency, feeAsset) {
|
|
|
4696
4774
|
};
|
|
4697
4775
|
var validateDestination = function validateDestination(origin, destination) {
|
|
4698
4776
|
if (isRelayChain(origin) && !isTLocation(destination) && isRelayChain(destination) && origin !== destination) {
|
|
4699
|
-
throw new
|
|
4777
|
+
throw new ScenarioNotSupportedError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
|
|
4700
4778
|
}
|
|
4701
4779
|
var allowedChainsToEthereum = ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Moonbeam', 'Mythos'];
|
|
4702
4780
|
if (destination === 'Ethereum' && !allowedChainsToEthereum.includes(origin)) {
|
|
4703
|
-
throw new
|
|
4781
|
+
throw new ScenarioNotSupportedError("Transfers to Ethereum are only supported from: ".concat(allowedChainsToEthereum.join(', ')));
|
|
4704
4782
|
}
|
|
4705
4783
|
var isLocationDestination = _typeof(destination) === 'object';
|
|
4706
4784
|
var isBridge = !isTLocation(destination) && isSubstrateBridge(origin, destination);
|
|
@@ -4709,7 +4787,7 @@ var validateDestination = function validateDestination(origin, destination) {
|
|
|
4709
4787
|
var originRelayChainSymbol = getRelayChainSymbol(origin);
|
|
4710
4788
|
var destinationRelayChainSymbol = getRelayChainSymbol(destination);
|
|
4711
4789
|
if (!isBridge && originRelayChainSymbol !== destinationRelayChainSymbol) {
|
|
4712
|
-
throw new
|
|
4790
|
+
throw new ScenarioNotSupportedError('Origin and destination must share the same relay chain unless using a bridge.');
|
|
4713
4791
|
}
|
|
4714
4792
|
}
|
|
4715
4793
|
};
|
|
@@ -4729,12 +4807,6 @@ var getFailureInfo$1 = function getFailureInfo(result) {
|
|
|
4729
4807
|
}, {
|
|
4730
4808
|
chain: 'destination',
|
|
4731
4809
|
chainResult: result.destination
|
|
4732
|
-
}, {
|
|
4733
|
-
chain: 'assetHub',
|
|
4734
|
-
chainResult: result.assetHub
|
|
4735
|
-
}, {
|
|
4736
|
-
chain: 'bridgeHub',
|
|
4737
|
-
chainResult: result.bridgeHub
|
|
4738
4810
|
}].concat(_toConsumableArray(result.hops.map(function (hop) {
|
|
4739
4811
|
return {
|
|
4740
4812
|
chain: hop.chain,
|
|
@@ -4960,13 +5032,13 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
4960
5032
|
_context.n = 1;
|
|
4961
5033
|
break;
|
|
4962
5034
|
}
|
|
4963
|
-
throw new
|
|
5035
|
+
throw new UnsupportedOperationError('Multi-assets are not yet supported for EVM transfers');
|
|
4964
5036
|
case 1:
|
|
4965
5037
|
if (!('location' in currency && isOverrideLocationSpecifier(currency.location))) {
|
|
4966
5038
|
_context.n = 2;
|
|
4967
5039
|
break;
|
|
4968
5040
|
}
|
|
4969
|
-
throw new
|
|
5041
|
+
throw new UnsupportedOperationError('Override location is not supported for EVM transfers');
|
|
4970
5042
|
case 2:
|
|
4971
5043
|
contract = getContract({
|
|
4972
5044
|
abi: abi$1,
|
|
@@ -4989,7 +5061,7 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
4989
5061
|
_context.n = 5;
|
|
4990
5062
|
break;
|
|
4991
5063
|
case 3:
|
|
4992
|
-
if (!(
|
|
5064
|
+
if (!(foundAsset.assetId === undefined)) {
|
|
4993
5065
|
_context.n = 4;
|
|
4994
5066
|
break;
|
|
4995
5067
|
}
|
|
@@ -5009,7 +5081,7 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
5009
5081
|
usdtAsset = findAssetInfoOrThrow(from, {
|
|
5010
5082
|
symbol: 'xcUSDT'
|
|
5011
5083
|
}, to);
|
|
5012
|
-
|
|
5084
|
+
assertHasId(usdtAsset);
|
|
5013
5085
|
if (!useMultiAssets) {
|
|
5014
5086
|
_context.n = 7;
|
|
5015
5087
|
break;
|
|
@@ -5265,7 +5337,7 @@ var createMainInstruction = function createMainInstruction(origin, asset, ethAss
|
|
|
5265
5337
|
var assetEcosystem = RELAYCHAINS.find(function (chain) {
|
|
5266
5338
|
return asset.symbol.includes(getNativeAssetSymbol(chain));
|
|
5267
5339
|
});
|
|
5268
|
-
if (!assetEcosystem) throw new
|
|
5340
|
+
if (!assetEcosystem) throw new UnsupportedOperationError('Unsupported native polkadot asset');
|
|
5269
5341
|
return {
|
|
5270
5342
|
DepositReserveAsset: {
|
|
5271
5343
|
assets: {
|
|
@@ -5325,7 +5397,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
5325
5397
|
version = _ref.version;
|
|
5326
5398
|
assertSenderAddress(senderAddress);
|
|
5327
5399
|
if (isChainEvm(origin) && !ahAddress) {
|
|
5328
|
-
throw new
|
|
5400
|
+
throw new MissingParameterError('ahAddress');
|
|
5329
5401
|
}
|
|
5330
5402
|
return _defineProperty({}, version, [{
|
|
5331
5403
|
SetAppendix: origin === 'Mythos' ? [] : [{
|
|
@@ -5476,7 +5548,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5476
5548
|
_context.n = 1;
|
|
5477
5549
|
break;
|
|
5478
5550
|
}
|
|
5479
|
-
throw new
|
|
5551
|
+
throw new MissingParameterError('ahAddress');
|
|
5480
5552
|
case 1:
|
|
5481
5553
|
_context.n = 2;
|
|
5482
5554
|
return getBridgeStatus(api.clone());
|
|
@@ -5492,13 +5564,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5492
5564
|
_context.n = 4;
|
|
5493
5565
|
break;
|
|
5494
5566
|
}
|
|
5495
|
-
throw new
|
|
5567
|
+
throw new UnsupportedOperationError('Multi-assets are not yet supported for EVM transfers');
|
|
5496
5568
|
case 4:
|
|
5497
5569
|
if (!('location' in currency && isOverrideLocationSpecifier(currency.location))) {
|
|
5498
5570
|
_context.n = 5;
|
|
5499
5571
|
break;
|
|
5500
5572
|
}
|
|
5501
|
-
throw new
|
|
5573
|
+
throw new UnsupportedOperationError('Override location is not supported for EVM transfers');
|
|
5502
5574
|
case 5:
|
|
5503
5575
|
foundAsset = findAssetInfoOrThrow(from, currency, to);
|
|
5504
5576
|
amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
|
|
@@ -5558,7 +5630,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5558
5630
|
};
|
|
5559
5631
|
numberToHex32 = function numberToHex32(num) {
|
|
5560
5632
|
return typeof num !== 'number' || isNaN(num) ? function () {
|
|
5561
|
-
throw new
|
|
5633
|
+
throw new NumberFormatError('Input must be a valid number');
|
|
5562
5634
|
}() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
|
|
5563
5635
|
}; // Execute the custom XCM message with the precompile
|
|
5564
5636
|
_context.n = 11;
|
|
@@ -5586,13 +5658,11 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5586
5658
|
|
|
5587
5659
|
var traverseXcmHops = /*#__PURE__*/function () {
|
|
5588
5660
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(config) {
|
|
5589
|
-
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;
|
|
5590
5662
|
return _regenerator().w(function (_context) {
|
|
5591
5663
|
while (1) switch (_context.p = _context.n) {
|
|
5592
5664
|
case 0:
|
|
5593
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;
|
|
5594
|
-
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5595
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5596
5666
|
currentOrigin = origin;
|
|
5597
5667
|
forwardedXcms = initialForwardedXcms;
|
|
5598
5668
|
nextParaId = initialDestParaId;
|
|
@@ -5600,7 +5670,6 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5600
5670
|
currentAsset = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain) ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, null) : asset;
|
|
5601
5671
|
hasPassedExchange = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain);
|
|
5602
5672
|
hops = [];
|
|
5603
|
-
intermediateResults = {};
|
|
5604
5673
|
case 1:
|
|
5605
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)) {
|
|
5606
5675
|
_context.n = 10;
|
|
@@ -5611,7 +5680,7 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5611
5680
|
_context.n = 2;
|
|
5612
5681
|
break;
|
|
5613
5682
|
}
|
|
5614
|
-
throw new
|
|
5683
|
+
throw new RoutingResolutionError("Unable to find TChain for paraId ".concat(nextParaId));
|
|
5615
5684
|
case 2:
|
|
5616
5685
|
hopApi = api.clone();
|
|
5617
5686
|
_context.p = 3;
|
|
@@ -5622,8 +5691,6 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5622
5691
|
// - normally when nextChain === destination
|
|
5623
5692
|
// - but if swap is required, only after (or on) the exchange hop
|
|
5624
5693
|
isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
|
|
5625
|
-
isAssetHub = nextChain === assetHubChain;
|
|
5626
|
-
isBridgeHub = nextChain === bridgeHubChain;
|
|
5627
5694
|
_context.n = 5;
|
|
5628
5695
|
return processHop({
|
|
5629
5696
|
api: hopApi,
|
|
@@ -5632,9 +5699,7 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5632
5699
|
currentAsset: currentAsset,
|
|
5633
5700
|
forwardedXcms: forwardedXcms,
|
|
5634
5701
|
hasPassedExchange: hasPassedExchange,
|
|
5635
|
-
isDestination: isDestination
|
|
5636
|
-
isAssetHub: isAssetHub,
|
|
5637
|
-
isBridgeHub: isBridgeHub
|
|
5702
|
+
isDestination: isDestination
|
|
5638
5703
|
});
|
|
5639
5704
|
case 5:
|
|
5640
5705
|
hopResult = _context.v;
|
|
@@ -5646,10 +5711,6 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5646
5711
|
}
|
|
5647
5712
|
if (isDestination) {
|
|
5648
5713
|
destinationResult = hopResult;
|
|
5649
|
-
} else if (isAssetHub) {
|
|
5650
|
-
intermediateResults.assetHub = hopResult;
|
|
5651
|
-
} else if (isBridgeHub) {
|
|
5652
|
-
intermediateResults.bridgeHub = hopResult;
|
|
5653
5714
|
}
|
|
5654
5715
|
if (shouldContinue(hopResult)) {
|
|
5655
5716
|
_context.n = 6;
|
|
@@ -5676,13 +5737,9 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
5676
5737
|
_context.n = 1;
|
|
5677
5738
|
break;
|
|
5678
5739
|
case 10:
|
|
5679
|
-
return _context.a(2, _objectSpread2(_objectSpread2(
|
|
5740
|
+
return _context.a(2, _objectSpread2(_objectSpread2({
|
|
5680
5741
|
hops: hops
|
|
5681
|
-
},
|
|
5682
|
-
assetHub: intermediateResults.assetHub
|
|
5683
|
-
}), intermediateResults.bridgeHub && {
|
|
5684
|
-
bridgeHub: intermediateResults.bridgeHub
|
|
5685
|
-
}), destinationResult && {
|
|
5742
|
+
}, destinationResult && {
|
|
5686
5743
|
destination: destinationResult
|
|
5687
5744
|
}), {}, {
|
|
5688
5745
|
lastProcessedChain: currentOrigin
|
|
@@ -5729,8 +5786,7 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
|
|
|
5729
5786
|
|
|
5730
5787
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5731
5788
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5732
|
-
var
|
|
5733
|
-
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;
|
|
5734
5790
|
return _regenerator().w(function (_context2) {
|
|
5735
5791
|
while (1) switch (_context2.n) {
|
|
5736
5792
|
case 0:
|
|
@@ -5813,7 +5869,6 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5813
5869
|
}
|
|
5814
5870
|
return _context.a(2, {
|
|
5815
5871
|
success: false,
|
|
5816
|
-
currency: currentAsset.symbol,
|
|
5817
5872
|
asset: currentAsset,
|
|
5818
5873
|
failureReason: "DryRunApi is not available on chain ".concat(currentChain)
|
|
5819
5874
|
});
|
|
@@ -5833,7 +5888,6 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5833
5888
|
case 2:
|
|
5834
5889
|
hopDryRun = _context.v;
|
|
5835
5890
|
return _context.a(2, _objectSpread2(_objectSpread2({}, hopDryRun), {}, {
|
|
5836
|
-
currency: hopAsset.symbol,
|
|
5837
5891
|
asset: hopAsset
|
|
5838
5892
|
}));
|
|
5839
5893
|
}
|
|
@@ -5866,34 +5920,37 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5866
5920
|
case 6:
|
|
5867
5921
|
traversalResult = _context2.v;
|
|
5868
5922
|
// Process Ethereum bridge fees
|
|
5923
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5869
5924
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5870
|
-
|
|
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)
|
|
5871
5928
|
if (!isMythosToEthereum) {
|
|
5872
5929
|
_context2.n = 7;
|
|
5873
5930
|
break;
|
|
5874
5931
|
}
|
|
5875
|
-
_t8 =
|
|
5932
|
+
_t8 = bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result;
|
|
5876
5933
|
_context2.n = 11;
|
|
5877
5934
|
break;
|
|
5878
5935
|
case 7:
|
|
5879
|
-
if (!(
|
|
5936
|
+
if (!(bridgeHubHop !== null && bridgeHubHop !== void 0 && bridgeHubHop.result.success)) {
|
|
5880
5937
|
_context2.n = 9;
|
|
5881
5938
|
break;
|
|
5882
5939
|
}
|
|
5883
5940
|
_context2.n = 8;
|
|
5884
|
-
return addEthereumBridgeFees(api,
|
|
5941
|
+
return addEthereumBridgeFees(api, bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result, destination, assetHubChain);
|
|
5885
5942
|
case 8:
|
|
5886
5943
|
_t9 = _context2.v;
|
|
5887
5944
|
_context2.n = 10;
|
|
5888
5945
|
break;
|
|
5889
5946
|
case 9:
|
|
5890
|
-
_t9 =
|
|
5947
|
+
_t9 = bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result;
|
|
5891
5948
|
case 10:
|
|
5892
5949
|
_t8 = _t9;
|
|
5893
5950
|
case 11:
|
|
5894
5951
|
processedBridgeHub = _t8;
|
|
5895
5952
|
// Update bridge hub in hops if needed
|
|
5896
|
-
if (processedBridgeHub && processedBridgeHub.success &&
|
|
5953
|
+
if (processedBridgeHub && processedBridgeHub.success && bridgeHubHop && bridgeHubHop.result.success && processedBridgeHub.fee !== bridgeHubHop.result.fee) {
|
|
5897
5954
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
5898
5955
|
return hop.chain === bridgeHubChain;
|
|
5899
5956
|
});
|
|
@@ -5903,14 +5960,8 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5903
5960
|
});
|
|
5904
5961
|
}
|
|
5905
5962
|
}
|
|
5906
|
-
bridgeHubWithCurrency = processedBridgeHub !== null && processedBridgeHub !== void 0 && processedBridgeHub.success ? _objectSpread2(_objectSpread2({}, processedBridgeHub), {}, {
|
|
5907
|
-
currency: getNativeAssetSymbol(bridgeHubChain),
|
|
5908
|
-
asset: findNativeAssetInfoOrThrow(bridgeHubChain)
|
|
5909
|
-
}) : processedBridgeHub;
|
|
5910
5963
|
result = {
|
|
5911
5964
|
origin: originDryModified,
|
|
5912
|
-
assetHub: traversalResult.assetHub,
|
|
5913
|
-
bridgeHub: bridgeHubWithCurrency,
|
|
5914
5965
|
destination: traversalResult.destination,
|
|
5915
5966
|
hops: traversalResult.hops
|
|
5916
5967
|
};
|
|
@@ -5957,7 +6008,7 @@ var dryRun = /*#__PURE__*/function () {
|
|
|
5957
6008
|
|
|
5958
6009
|
var dryRunOrigin = /*#__PURE__*/function () {
|
|
5959
6010
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
5960
|
-
var api, chain, address
|
|
6011
|
+
var api, chain, address;
|
|
5961
6012
|
return _regenerator().w(function (_context) {
|
|
5962
6013
|
while (1) switch (_context.p = _context.n) {
|
|
5963
6014
|
case 0:
|
|
@@ -5970,26 +6021,17 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5970
6021
|
_context.n = 2;
|
|
5971
6022
|
return api.getDryRunCall(options);
|
|
5972
6023
|
case 2:
|
|
5973
|
-
|
|
5974
|
-
if (!result.success) {
|
|
5975
|
-
_context.n = 3;
|
|
5976
|
-
break;
|
|
5977
|
-
}
|
|
5978
|
-
return _context.a(2, _objectSpread2(_objectSpread2({}, result), {}, {
|
|
5979
|
-
currency: getNativeAssetSymbol(chain)
|
|
5980
|
-
}));
|
|
6024
|
+
return _context.a(2, _context.v);
|
|
5981
6025
|
case 3:
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
_context.p = 4;
|
|
5985
|
-
_context.n = 5;
|
|
6026
|
+
_context.p = 3;
|
|
6027
|
+
_context.n = 4;
|
|
5986
6028
|
return api.disconnect();
|
|
6029
|
+
case 4:
|
|
6030
|
+
return _context.f(3);
|
|
5987
6031
|
case 5:
|
|
5988
|
-
return _context.f(4);
|
|
5989
|
-
case 6:
|
|
5990
6032
|
return _context.a(2);
|
|
5991
6033
|
}
|
|
5992
|
-
}, _callee, null, [[1,,
|
|
6034
|
+
}, _callee, null, [[1,, 3, 5]]);
|
|
5993
6035
|
}));
|
|
5994
6036
|
return function dryRunOrigin(_x) {
|
|
5995
6037
|
return _ref.apply(this, arguments);
|
|
@@ -5997,7 +6039,7 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5997
6039
|
}();
|
|
5998
6040
|
|
|
5999
6041
|
var pickOtherPallet = function pickOtherPallet(asset, pallets) {
|
|
6000
|
-
if (
|
|
6042
|
+
if (!asset.isNative && (!asset.assetId || asset.assetId.startsWith('0x'))) {
|
|
6001
6043
|
var _pallets$find;
|
|
6002
6044
|
// No assetId means it's probably a ForeignAssets pallet asset
|
|
6003
6045
|
return (_pallets$find = pallets.find(function (pallet) {
|
|
@@ -6010,7 +6052,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
|
|
|
6010
6052
|
var nativePallet = getNativeAssetsPallet(chain);
|
|
6011
6053
|
var otherPallets = getOtherAssetsPallets(chain);
|
|
6012
6054
|
var isMainNativeAsset = isSymbolMatch(asset.symbol, getNativeAssetSymbol(chain));
|
|
6013
|
-
var pallet =
|
|
6055
|
+
var pallet = !asset.isNative && chain !== 'Mythos' || !isMainNativeAsset ? pickOtherPallet(asset, otherPallets) : nativePallet;
|
|
6014
6056
|
var palletInstance = getPalletInstance(pallet);
|
|
6015
6057
|
return palletInstance.mint(address, asset, balance, chain, api);
|
|
6016
6058
|
};
|
|
@@ -6040,7 +6082,7 @@ var calcPreviewMintAmount = function calcPreviewMintAmount(balance, desired) {
|
|
|
6040
6082
|
return missing > 0n ? missing : null;
|
|
6041
6083
|
};
|
|
6042
6084
|
var assetKey = function assetKey(a) {
|
|
6043
|
-
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);
|
|
6044
6086
|
};
|
|
6045
6087
|
var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeAssets) {
|
|
6046
6088
|
if (!mintFeeAssets) return 0n;
|
|
@@ -6200,78 +6242,6 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
6200
6242
|
};
|
|
6201
6243
|
}();
|
|
6202
6244
|
|
|
6203
|
-
var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
6204
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6205
|
-
var _getExistentialDeposi;
|
|
6206
|
-
var api, account, accountDestination, ahAddress, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, _yield$Builder$from$t, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
6207
|
-
return _regenerator().w(function (_context) {
|
|
6208
|
-
while (1) switch (_context.n) {
|
|
6209
|
-
case 0:
|
|
6210
|
-
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;
|
|
6211
|
-
_context.n = 1;
|
|
6212
|
-
return api.init(origin);
|
|
6213
|
-
case 1:
|
|
6214
|
-
_context.n = 2;
|
|
6215
|
-
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)['buildInternal']();
|
|
6216
|
-
case 2:
|
|
6217
|
-
_yield$Builder$from$t = _context.v;
|
|
6218
|
-
tx = _yield$Builder$from$t.tx;
|
|
6219
|
-
_context.n = 3;
|
|
6220
|
-
return api.calculateTransactionFee(tx, account);
|
|
6221
|
-
case 3:
|
|
6222
|
-
xcmFee = _context.v;
|
|
6223
|
-
xcmFeeWithMargin = xcmFee + xcmFee / BigInt(feeMarginPercentage);
|
|
6224
|
-
_context.n = 4;
|
|
6225
|
-
return getBalanceNative({
|
|
6226
|
-
address: account,
|
|
6227
|
-
chain: origin,
|
|
6228
|
-
api: api
|
|
6229
|
-
});
|
|
6230
|
-
case 4:
|
|
6231
|
-
nativeBalance = _context.v;
|
|
6232
|
-
existentialDeposit = BigInt((_getExistentialDeposi = getExistentialDeposit(origin)) !== null && _getExistentialDeposi !== void 0 ? _getExistentialDeposi : '0');
|
|
6233
|
-
sufficientForXCM = nativeBalance - existentialDeposit - xcmFeeWithMargin > 0;
|
|
6234
|
-
return _context.a(2, {
|
|
6235
|
-
sufficientForXCM: sufficientForXCM,
|
|
6236
|
-
xcmFee: xcmFee
|
|
6237
|
-
});
|
|
6238
|
-
}
|
|
6239
|
-
}, _callee);
|
|
6240
|
-
}));
|
|
6241
|
-
return function getOriginFeeDetailsInternal(_x) {
|
|
6242
|
-
return _ref2.apply(this, arguments);
|
|
6243
|
-
};
|
|
6244
|
-
}();
|
|
6245
|
-
var getOriginFeeDetails = /*#__PURE__*/function () {
|
|
6246
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
6247
|
-
var api;
|
|
6248
|
-
return _regenerator().w(function (_context2) {
|
|
6249
|
-
while (1) switch (_context2.p = _context2.n) {
|
|
6250
|
-
case 0:
|
|
6251
|
-
api = options.api;
|
|
6252
|
-
api.setDisconnectAllowed(false);
|
|
6253
|
-
_context2.p = 1;
|
|
6254
|
-
_context2.n = 2;
|
|
6255
|
-
return getOriginFeeDetailsInternal(options);
|
|
6256
|
-
case 2:
|
|
6257
|
-
return _context2.a(2, _context2.v);
|
|
6258
|
-
case 3:
|
|
6259
|
-
_context2.p = 3;
|
|
6260
|
-
api.setDisconnectAllowed(true);
|
|
6261
|
-
_context2.n = 4;
|
|
6262
|
-
return api.disconnect();
|
|
6263
|
-
case 4:
|
|
6264
|
-
return _context2.f(3);
|
|
6265
|
-
case 5:
|
|
6266
|
-
return _context2.a(2);
|
|
6267
|
-
}
|
|
6268
|
-
}, _callee2, null, [[1,, 3, 5]]);
|
|
6269
|
-
}));
|
|
6270
|
-
return function getOriginFeeDetails(_x2) {
|
|
6271
|
-
return _ref3.apply(this, arguments);
|
|
6272
|
-
};
|
|
6273
|
-
}();
|
|
6274
|
-
|
|
6275
6245
|
var MAX_INCREASE_RETRIES = 5;
|
|
6276
6246
|
var INCREASE_BUMP_STEP = 100;
|
|
6277
6247
|
var FIRST_INCREASE_BUMP_STEP = 1;
|
|
@@ -6487,7 +6457,7 @@ var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
|
6487
6457
|
|
|
6488
6458
|
var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
6489
6459
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6490
|
-
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;
|
|
6491
6461
|
return _regenerator().w(function (_context) {
|
|
6492
6462
|
while (1) switch (_context.n) {
|
|
6493
6463
|
case 0:
|
|
@@ -6498,7 +6468,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6498
6468
|
_context.n = 1;
|
|
6499
6469
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
6500
6470
|
case 1:
|
|
6501
|
-
nativeAssetSymbol = getNativeAssetSymbol(origin);
|
|
6502
6471
|
if (hasDryRunSupport(origin)) {
|
|
6503
6472
|
_context.n = 4;
|
|
6504
6473
|
break;
|
|
@@ -6516,7 +6485,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6516
6485
|
sufficient = _context.v;
|
|
6517
6486
|
return _context.a(2, {
|
|
6518
6487
|
fee: paddedFee,
|
|
6519
|
-
currency: nativeAssetSymbol,
|
|
6520
6488
|
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : asset,
|
|
6521
6489
|
feeType: 'paymentInfo',
|
|
6522
6490
|
sufficient: sufficient
|
|
@@ -6548,7 +6516,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6548
6516
|
return _context.a(2, {
|
|
6549
6517
|
dryRunError: dryRunResult.failureReason,
|
|
6550
6518
|
dryRunSubError: dryRunResult.failureSubReason,
|
|
6551
|
-
currency: dryRunResult.currency,
|
|
6552
6519
|
asset: dryRunResult.asset
|
|
6553
6520
|
});
|
|
6554
6521
|
case 6:
|
|
@@ -6559,7 +6526,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6559
6526
|
_paddedFee = padFee(_rawFee, origin, destination, 'origin');
|
|
6560
6527
|
return _context.a(2, {
|
|
6561
6528
|
fee: _paddedFee,
|
|
6562
|
-
currency: dryRunResult.currency,
|
|
6563
6529
|
asset: dryRunResult.asset,
|
|
6564
6530
|
feeType: 'paymentInfo',
|
|
6565
6531
|
dryRunError: dryRunResult.failureReason,
|
|
@@ -6572,7 +6538,6 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
6572
6538
|
fee: fee,
|
|
6573
6539
|
feeType: 'dryRun',
|
|
6574
6540
|
sufficient: true,
|
|
6575
|
-
currency: dryRunResult.currency,
|
|
6576
6541
|
asset: dryRunResult.asset,
|
|
6577
6542
|
forwardedXcms: forwardedXcms,
|
|
6578
6543
|
destParaId: destParaId,
|
|
@@ -6636,6 +6601,13 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
6636
6601
|
};
|
|
6637
6602
|
}();
|
|
6638
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
|
+
*/
|
|
6639
6611
|
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
6640
6612
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
6641
6613
|
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, amount, rawOriginFee, originFee, resolvedFeeAsset, sufficient, asset;
|
|
@@ -6660,7 +6632,6 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
6660
6632
|
asset = resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset;
|
|
6661
6633
|
return _context.a(2, {
|
|
6662
6634
|
fee: originFee,
|
|
6663
|
-
currency: getNativeAssetSymbol(origin),
|
|
6664
6635
|
asset: asset,
|
|
6665
6636
|
sufficient: sufficient
|
|
6666
6637
|
});
|
|
@@ -6673,23 +6644,13 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
6673
6644
|
}();
|
|
6674
6645
|
|
|
6675
6646
|
var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
6676
|
-
var _chains$origin, _chains$
|
|
6647
|
+
var _chains$origin, _chains$destination;
|
|
6677
6648
|
// Check standard chains first for backwards compatibility
|
|
6678
6649
|
if ((_chains$origin = chains.origin) !== null && _chains$origin !== void 0 && _chains$origin.dryRunError) return {
|
|
6679
6650
|
failureChain: 'origin',
|
|
6680
6651
|
failureReason: chains.origin.dryRunError,
|
|
6681
6652
|
failureSubReason: chains.origin.dryRunSubError
|
|
6682
6653
|
};
|
|
6683
|
-
if ((_chains$assetHub = chains.assetHub) !== null && _chains$assetHub !== void 0 && _chains$assetHub.dryRunError) return {
|
|
6684
|
-
failureChain: 'assetHub',
|
|
6685
|
-
failureReason: chains.assetHub.dryRunError,
|
|
6686
|
-
failureSubReason: chains.assetHub.dryRunSubError
|
|
6687
|
-
};
|
|
6688
|
-
if ((_chains$bridgeHub = chains.bridgeHub) !== null && _chains$bridgeHub !== void 0 && _chains$bridgeHub.dryRunError) return {
|
|
6689
|
-
failureChain: 'bridgeHub',
|
|
6690
|
-
failureReason: chains.bridgeHub.dryRunError,
|
|
6691
|
-
failureSubReason: chains.bridgeHub.dryRunSubError
|
|
6692
|
-
};
|
|
6693
6654
|
if ((_chains$destination = chains.destination) !== null && _chains$destination !== void 0 && _chains$destination.dryRunError) return {
|
|
6694
6655
|
failureChain: 'destination',
|
|
6695
6656
|
failureReason: chains.destination.dryRunError,
|
|
@@ -6718,7 +6679,7 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
6718
6679
|
};
|
|
6719
6680
|
var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
6720
6681
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
6721
|
-
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;
|
|
6722
6683
|
return _regenerator().w(function (_context2) {
|
|
6723
6684
|
while (1) switch (_context2.p = _context2.n) {
|
|
6724
6685
|
case 0:
|
|
@@ -6804,7 +6765,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6804
6765
|
feeType: originFeeType
|
|
6805
6766
|
}), {}, {
|
|
6806
6767
|
sufficient: sufficientOriginFee,
|
|
6807
|
-
currency: originAsset.symbol,
|
|
6808
6768
|
asset: originAsset
|
|
6809
6769
|
}, originDryRunError && {
|
|
6810
6770
|
dryRunError: originDryRunError
|
|
@@ -6820,7 +6780,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6820
6780
|
}), destFeeRes.sufficient !== undefined && {
|
|
6821
6781
|
sufficient: destFeeRes.sufficient
|
|
6822
6782
|
}), {}, {
|
|
6823
|
-
currency: getNativeAssetSymbol(destination),
|
|
6824
6783
|
asset: findNativeAssetInfoOrThrow(destination)
|
|
6825
6784
|
}),
|
|
6826
6785
|
hops: []
|
|
@@ -6926,7 +6885,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6926
6885
|
destDryRunError = destResult.dryRunError;
|
|
6927
6886
|
destDryRunSubError = destResult.dryRunSubError;
|
|
6928
6887
|
destSufficient = destResult.sufficient;
|
|
6929
|
-
destCurrency = destResult.currency;
|
|
6930
6888
|
destAsset = destResult.asset;
|
|
6931
6889
|
_context2.n = 16;
|
|
6932
6890
|
break;
|
|
@@ -6964,7 +6922,6 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6964
6922
|
destFee = destFallback.fee;
|
|
6965
6923
|
destFeeType = destFallback.feeType;
|
|
6966
6924
|
destSufficient = destFallback.sufficient;
|
|
6967
|
-
destCurrency = getNativeAssetSymbol(destination);
|
|
6968
6925
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
6969
6926
|
_context2.n = 16;
|
|
6970
6927
|
break;
|
|
@@ -6972,30 +6929,33 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
6972
6929
|
destFee = 0n;
|
|
6973
6930
|
destFeeType = 'noFeeRequired';
|
|
6974
6931
|
destSufficient = true;
|
|
6975
|
-
destCurrency = getNativeAssetSymbol(destination);
|
|
6976
6932
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
6977
6933
|
case 16:
|
|
6978
6934
|
// Process Ethereum bridge fees
|
|
6935
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
6979
6936
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
6937
|
+
bridgeHubHop = traversalResult.hops.find(function (hop) {
|
|
6938
|
+
return hop.chain === bridgeHubChain;
|
|
6939
|
+
});
|
|
6980
6940
|
if (!isMythosToEthereum) {
|
|
6981
6941
|
_context2.n = 17;
|
|
6982
6942
|
break;
|
|
6983
6943
|
}
|
|
6984
|
-
_t4 =
|
|
6944
|
+
_t4 = bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result;
|
|
6985
6945
|
_context2.n = 19;
|
|
6986
6946
|
break;
|
|
6987
6947
|
case 17:
|
|
6988
6948
|
_context2.n = 18;
|
|
6989
|
-
return addEthereumBridgeFees(api,
|
|
6949
|
+
return addEthereumBridgeFees(api, bridgeHubHop === null || bridgeHubHop === void 0 ? void 0 : bridgeHubHop.result, destination, assetHubChain);
|
|
6990
6950
|
case 18:
|
|
6991
6951
|
_t4 = _context2.v;
|
|
6992
6952
|
case 19:
|
|
6993
6953
|
processedBridgeHub = _t4;
|
|
6994
6954
|
// Update bridge hub fee in hops if needed
|
|
6995
|
-
if (processedBridgeHub &&
|
|
6996
|
-
|
|
6955
|
+
if (processedBridgeHub && bridgeHubHop && processedBridgeHub.fee !== bridgeHubHop.result.fee) {
|
|
6956
|
+
_bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
6997
6957
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
6998
|
-
return hop.chain ===
|
|
6958
|
+
return hop.chain === _bridgeHubChain;
|
|
6999
6959
|
});
|
|
7000
6960
|
if (bridgeHubHopIndex !== -1) {
|
|
7001
6961
|
traversalResult.hops[bridgeHubHopIndex].result = _objectSpread2(_objectSpread2({}, traversalResult.hops[bridgeHubHopIndex].result), {}, {
|
|
@@ -7004,67 +6964,46 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7004
6964
|
}
|
|
7005
6965
|
}
|
|
7006
6966
|
convertToFeeDetail = function convertToFeeDetail(result) {
|
|
7007
|
-
return _objectSpread2(_objectSpread2(
|
|
7008
|
-
fee: result.fee
|
|
7009
|
-
}), result.feeType && {
|
|
6967
|
+
return _objectSpread2(_objectSpread2({
|
|
6968
|
+
fee: result.fee,
|
|
7010
6969
|
feeType: result.feeType
|
|
7011
|
-
}
|
|
6970
|
+
}, result.sufficient !== undefined && {
|
|
7012
6971
|
sufficient: result.sufficient
|
|
7013
6972
|
}), {}, {
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
}, result.dryRunError && {
|
|
7017
|
-
dryRunError: result.dryRunError
|
|
7018
|
-
}), result.dryRunSubError && {
|
|
6973
|
+
asset: result.asset,
|
|
6974
|
+
dryRunError: result.dryRunError,
|
|
7019
6975
|
dryRunSubError: result.dryRunSubError
|
|
7020
6976
|
});
|
|
7021
6977
|
};
|
|
7022
|
-
result =
|
|
7023
|
-
origin: _objectSpread2(_objectSpread2(
|
|
7024
|
-
weight: originWeight
|
|
7025
|
-
|
|
7026
|
-
fee: originFee
|
|
7027
|
-
}), originFeeType && {
|
|
6978
|
+
result = {
|
|
6979
|
+
origin: _objectSpread2(_objectSpread2({
|
|
6980
|
+
weight: originWeight,
|
|
6981
|
+
fee: originFee,
|
|
7028
6982
|
feeType: originFeeType
|
|
7029
|
-
}
|
|
6983
|
+
}, sufficientOriginFee !== undefined && {
|
|
7030
6984
|
sufficient: sufficientOriginFee
|
|
7031
6985
|
}), {}, {
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
}, originDryRunError && {
|
|
7035
|
-
dryRunError: originDryRunError
|
|
7036
|
-
}), originDryRunSubError && {
|
|
6986
|
+
asset: originAsset,
|
|
6987
|
+
dryRunError: originDryRunError,
|
|
7037
6988
|
dryRunSubError: originDryRunSubError
|
|
7038
|
-
})
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
bridgeHub: convertToFeeDetail(processedBridgeHub)
|
|
7043
|
-
}), {}, {
|
|
7044
|
-
destination: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, destFee !== undefined && {
|
|
7045
|
-
fee: destFee
|
|
7046
|
-
}), destFeeType && {
|
|
7047
|
-
feeType: destFeeType
|
|
7048
|
-
}), {}, {
|
|
6989
|
+
}),
|
|
6990
|
+
destination: {
|
|
6991
|
+
fee: destFee,
|
|
6992
|
+
feeType: destFeeType,
|
|
7049
6993
|
sufficient: destSufficient,
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
}, destDryRunError && {
|
|
7053
|
-
dryRunError: destDryRunError
|
|
7054
|
-
}), destDryRunSubError && {
|
|
6994
|
+
asset: destAsset,
|
|
6995
|
+
dryRunError: destDryRunError,
|
|
7055
6996
|
dryRunSubError: destDryRunSubError
|
|
7056
|
-
}
|
|
6997
|
+
},
|
|
7057
6998
|
hops: traversalResult.hops.map(function (hop) {
|
|
7058
6999
|
return {
|
|
7059
7000
|
chain: hop.chain,
|
|
7060
7001
|
result: convertToFeeDetail(hop.result)
|
|
7061
7002
|
};
|
|
7062
7003
|
})
|
|
7063
|
-
}
|
|
7004
|
+
};
|
|
7064
7005
|
_getFailureInfo2 = getFailureInfo({
|
|
7065
7006
|
origin: result.origin,
|
|
7066
|
-
assetHub: result.assetHub,
|
|
7067
|
-
bridgeHub: result.bridgeHub,
|
|
7068
7007
|
destination: result.destination
|
|
7069
7008
|
}, result.hops), failureChain = _getFailureInfo2.failureChain, failureReason = _getFailureInfo2.failureReason;
|
|
7070
7009
|
return _context2.a(2, _objectSpread2(_objectSpread2({}, result), {}, {
|
|
@@ -7081,7 +7020,7 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7081
7020
|
|
|
7082
7021
|
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
7083
7022
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
7084
|
-
var buildTx,
|
|
7023
|
+
var buildTx, tx, real, forced, _forced, _t;
|
|
7085
7024
|
return _regenerator().w(function (_context) {
|
|
7086
7025
|
while (1) switch (_context.p = _context.n) {
|
|
7087
7026
|
case 0:
|
|
@@ -7102,22 +7041,13 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7102
7041
|
return getBypassResultWithRetries(options, getXcmFeeOnce, tx);
|
|
7103
7042
|
case 4:
|
|
7104
7043
|
forced = _context.v;
|
|
7105
|
-
return _context.a(2, _objectSpread2(_objectSpread2(
|
|
7044
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, forced), {}, {
|
|
7106
7045
|
origin: _objectSpread2(_objectSpread2({}, forced.origin), {}, {
|
|
7107
7046
|
sufficient: real.origin.sufficient
|
|
7108
7047
|
}),
|
|
7109
7048
|
destination: _objectSpread2(_objectSpread2({}, forced.destination), {}, {
|
|
7110
7049
|
sufficient: real.destination.sufficient
|
|
7111
|
-
})
|
|
7112
|
-
}, forced.assetHub ? {
|
|
7113
|
-
assetHub: _objectSpread2(_objectSpread2({}, forced.assetHub), {}, {
|
|
7114
|
-
sufficient: (_real$assetHub = real.assetHub) === null || _real$assetHub === void 0 ? void 0 : _real$assetHub.sufficient
|
|
7115
|
-
})
|
|
7116
|
-
} : {}), forced.bridgeHub ? {
|
|
7117
|
-
bridgeHub: _objectSpread2(_objectSpread2({}, forced.bridgeHub), {}, {
|
|
7118
|
-
sufficient: (_real$bridgeHub = real.bridgeHub) === null || _real$bridgeHub === void 0 ? void 0 : _real$bridgeHub.sufficient
|
|
7119
|
-
})
|
|
7120
|
-
} : {}), {}, {
|
|
7050
|
+
}),
|
|
7121
7051
|
hops: forced.hops.map(function (hop, i) {
|
|
7122
7052
|
var _real$hops$i;
|
|
7123
7053
|
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
@@ -7140,22 +7070,13 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7140
7070
|
return getBypassResultWithRetries(options, getXcmFeeOnce);
|
|
7141
7071
|
case 7:
|
|
7142
7072
|
_forced = _context.v;
|
|
7143
|
-
return _context.a(2, _objectSpread2(_objectSpread2(
|
|
7073
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
7144
7074
|
origin: _objectSpread2(_objectSpread2({}, _forced.origin), {}, {
|
|
7145
7075
|
sufficient: false
|
|
7146
7076
|
}),
|
|
7147
7077
|
destination: _objectSpread2(_objectSpread2({}, _forced.destination), {}, {
|
|
7148
7078
|
sufficient: false
|
|
7149
|
-
})
|
|
7150
|
-
}, _forced.assetHub ? {
|
|
7151
|
-
assetHub: _objectSpread2(_objectSpread2({}, _forced.assetHub), {}, {
|
|
7152
|
-
sufficient: false
|
|
7153
|
-
})
|
|
7154
|
-
} : {}), _forced.bridgeHub ? {
|
|
7155
|
-
bridgeHub: _objectSpread2(_objectSpread2({}, _forced.bridgeHub), {}, {
|
|
7156
|
-
sufficient: false
|
|
7157
|
-
})
|
|
7158
|
-
} : {}), {}, {
|
|
7079
|
+
}),
|
|
7159
7080
|
hops: _forced.hops.map(function (hop) {
|
|
7160
7081
|
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
7161
7082
|
result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
|
|
@@ -7201,6 +7122,13 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
7201
7122
|
|
|
7202
7123
|
var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
|
|
7203
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
|
+
*/
|
|
7204
7132
|
var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
7205
7133
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
7206
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;
|
|
@@ -7237,13 +7165,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
7237
7165
|
return _context.a(2, {
|
|
7238
7166
|
origin: {
|
|
7239
7167
|
fee: fixedOriginFee,
|
|
7240
|
-
currency: getNativeAssetSymbol(origin),
|
|
7241
7168
|
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset,
|
|
7242
7169
|
sufficient: originSufficient
|
|
7243
7170
|
},
|
|
7244
7171
|
destination: {
|
|
7245
7172
|
fee: fixedDestinationFee,
|
|
7246
|
-
currency: getNativeAssetSymbol(destination),
|
|
7247
7173
|
asset: destAsset,
|
|
7248
7174
|
sufficient: _destinationSufficient
|
|
7249
7175
|
}
|
|
@@ -7283,7 +7209,6 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
7283
7209
|
destinationSufficient = _context.v;
|
|
7284
7210
|
destFeeDetails = {
|
|
7285
7211
|
fee: destinationFee,
|
|
7286
|
-
currency: getNativeAssetSymbol(destination),
|
|
7287
7212
|
asset: destAsset,
|
|
7288
7213
|
sufficient: destinationSufficient
|
|
7289
7214
|
};
|
|
@@ -7311,7 +7236,7 @@ var transferRelayToPara = /*#__PURE__*/function () {
|
|
|
7311
7236
|
_context.n = 1;
|
|
7312
7237
|
break;
|
|
7313
7238
|
}
|
|
7314
|
-
throw new
|
|
7239
|
+
throw new MissingParameterError('api', 'API is required when using location as destination.');
|
|
7315
7240
|
case 1:
|
|
7316
7241
|
_context.n = 2;
|
|
7317
7242
|
return api.init(origin, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -7359,13 +7284,13 @@ var send = /*#__PURE__*/function () {
|
|
|
7359
7284
|
_context.n = 1;
|
|
7360
7285
|
break;
|
|
7361
7286
|
}
|
|
7362
|
-
throw new
|
|
7287
|
+
throw new ScenarioNotSupportedError('Transfers from relay chain to Ethereum are not supported.');
|
|
7363
7288
|
case 1:
|
|
7364
7289
|
if (asset) {
|
|
7365
7290
|
_context.n = 2;
|
|
7366
7291
|
break;
|
|
7367
7292
|
}
|
|
7368
|
-
throw new
|
|
7293
|
+
throw new MissingParameterError('asset', 'Asset is required for relay chain to relay chain transfers.');
|
|
7369
7294
|
case 2:
|
|
7370
7295
|
isLocalTransfer = origin === destination;
|
|
7371
7296
|
if (!isLocalTransfer) {
|
|
@@ -7532,7 +7457,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
7532
7457
|
break;
|
|
7533
7458
|
}
|
|
7534
7459
|
_context.n = 3;
|
|
7535
|
-
return
|
|
7460
|
+
return getBalanceInternal({
|
|
7536
7461
|
address: address,
|
|
7537
7462
|
chain: destination,
|
|
7538
7463
|
api: destApi
|
|
@@ -7552,15 +7477,12 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
7552
7477
|
receivedAmount: receivedAmount,
|
|
7553
7478
|
balance: destBalance,
|
|
7554
7479
|
balanceAfter: destbalanceAfterResult,
|
|
7555
|
-
|
|
7556
|
-
asset: destAsset,
|
|
7557
|
-
existentialDeposit: edDest
|
|
7480
|
+
asset: destAsset
|
|
7558
7481
|
},
|
|
7559
7482
|
xcmFee: {
|
|
7560
7483
|
fee: destFeeDetail.fee,
|
|
7561
7484
|
balance: destXcmFeeBalance,
|
|
7562
7485
|
balanceAfter: destXcmFeeBalanceAfter,
|
|
7563
|
-
currencySymbol: destFeeDetail.asset.symbol,
|
|
7564
7486
|
asset: destFeeDetail.asset
|
|
7565
7487
|
}
|
|
7566
7488
|
});
|
|
@@ -7574,11 +7496,11 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
7574
7496
|
|
|
7575
7497
|
var buildHopInfo = /*#__PURE__*/function () {
|
|
7576
7498
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
7577
|
-
var api, chain,
|
|
7499
|
+
var api, chain, fee, originChain, asset, currency, hopApi, xcmFeeDetails, isBridgeHub, nativeAsset, hopAsset, hopCurrencyPayload, ed;
|
|
7578
7500
|
return _regenerator().w(function (_context) {
|
|
7579
7501
|
while (1) switch (_context.p = _context.n) {
|
|
7580
7502
|
case 0:
|
|
7581
|
-
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;
|
|
7582
7504
|
hopApi = api.clone();
|
|
7583
7505
|
_context.n = 1;
|
|
7584
7506
|
return hopApi.init(chain);
|
|
@@ -7586,8 +7508,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7586
7508
|
hopApi.setDisconnectAllowed(false);
|
|
7587
7509
|
_context.p = 2;
|
|
7588
7510
|
xcmFeeDetails = {
|
|
7589
|
-
fee:
|
|
7590
|
-
currencySymbol: asset.symbol,
|
|
7511
|
+
fee: fee,
|
|
7591
7512
|
asset: asset
|
|
7592
7513
|
};
|
|
7593
7514
|
isBridgeHub = chain.includes('BridgeHub');
|
|
@@ -7595,8 +7516,9 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7595
7516
|
_context.n = 3;
|
|
7596
7517
|
break;
|
|
7597
7518
|
}
|
|
7519
|
+
nativeAsset = findNativeAssetInfoOrThrow(chain);
|
|
7598
7520
|
return _context.a(2, {
|
|
7599
|
-
|
|
7521
|
+
asset: nativeAsset,
|
|
7600
7522
|
xcmFee: xcmFeeDetails
|
|
7601
7523
|
});
|
|
7602
7524
|
case 3:
|
|
@@ -7608,7 +7530,6 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7608
7530
|
};
|
|
7609
7531
|
ed = getExistentialDepositOrThrow(chain, hopCurrencyPayload);
|
|
7610
7532
|
return _context.a(2, {
|
|
7611
|
-
currencySymbol: hopAsset.symbol,
|
|
7612
7533
|
asset: hopAsset,
|
|
7613
7534
|
existentialDeposit: ed,
|
|
7614
7535
|
xcmFee: xcmFeeDetails
|
|
@@ -7632,7 +7553,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
7632
7553
|
|
|
7633
7554
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
7634
7555
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
7635
|
-
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;
|
|
7636
7557
|
return _regenerator().w(function (_context2) {
|
|
7637
7558
|
while (1) switch (_context2.p = _context2.n) {
|
|
7638
7559
|
case 0:
|
|
@@ -7641,7 +7562,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7641
7562
|
_context2.n = 1;
|
|
7642
7563
|
break;
|
|
7643
7564
|
}
|
|
7644
|
-
throw new
|
|
7565
|
+
throw new MissingParameterError('ahAddress', "ahAddress is required for EVM origin ".concat(origin, "."));
|
|
7645
7566
|
case 1:
|
|
7646
7567
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
7647
7568
|
_context2.n = 2;
|
|
@@ -7668,7 +7589,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7668
7589
|
break;
|
|
7669
7590
|
case 5:
|
|
7670
7591
|
_context2.n = 6;
|
|
7671
|
-
return
|
|
7592
|
+
return getBalanceInternal({
|
|
7672
7593
|
api: api,
|
|
7673
7594
|
address: senderAddress,
|
|
7674
7595
|
chain: origin
|
|
@@ -7703,10 +7624,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7703
7624
|
_yield$getXcmFeeInter = _context2.v;
|
|
7704
7625
|
_yield$getXcmFeeInter2 = _yield$getXcmFeeInter.origin;
|
|
7705
7626
|
originFee = _yield$getXcmFeeInter2.fee;
|
|
7706
|
-
originFeeCurrency = _yield$getXcmFeeInter2.currency;
|
|
7707
7627
|
originFeeAsset = _yield$getXcmFeeInter2.asset;
|
|
7708
|
-
assetHubFeeResult = _yield$getXcmFeeInter.assetHub;
|
|
7709
|
-
bridgeHubFeeResult = _yield$getXcmFeeInter.bridgeHub;
|
|
7710
7628
|
destFeeDetail = _yield$getXcmFeeInter.destination;
|
|
7711
7629
|
hops = _yield$getXcmFeeInter.hops;
|
|
7712
7630
|
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
|
|
@@ -7714,49 +7632,12 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7714
7632
|
originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - amount : originBalanceFee - originFee;
|
|
7715
7633
|
originBalanceNativeSufficient = originBalanceFee >= originFee;
|
|
7716
7634
|
originBalanceSufficient = originBalanceAfter >= edOrigin;
|
|
7717
|
-
if (!assetHubFeeResult) {
|
|
7718
|
-
_context2.n = 11;
|
|
7719
|
-
break;
|
|
7720
|
-
}
|
|
7721
|
-
_context2.n = 10;
|
|
7722
|
-
return buildHopInfo({
|
|
7723
|
-
api: api,
|
|
7724
|
-
chain: "AssetHub".concat(getRelayChainOf(origin)),
|
|
7725
|
-
feeData: assetHubFeeResult,
|
|
7726
|
-
originChain: origin,
|
|
7727
|
-
currency: currency,
|
|
7728
|
-
asset: assetHubFeeResult.asset,
|
|
7729
|
-
senderAddress: senderAddress,
|
|
7730
|
-
ahAddress: ahAddress
|
|
7731
|
-
});
|
|
7732
|
-
case 10:
|
|
7733
|
-
assetHub = _context2.v;
|
|
7734
|
-
case 11:
|
|
7735
|
-
if (!bridgeHubFeeResult) {
|
|
7736
|
-
_context2.n = 13;
|
|
7737
|
-
break;
|
|
7738
|
-
}
|
|
7739
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
7740
|
-
_context2.n = 12;
|
|
7741
|
-
return buildHopInfo({
|
|
7742
|
-
api: api,
|
|
7743
|
-
chain: bridgeHubChain,
|
|
7744
|
-
feeData: bridgeHubFeeResult,
|
|
7745
|
-
originChain: origin,
|
|
7746
|
-
currency: currency,
|
|
7747
|
-
asset: bridgeHubFeeResult.asset,
|
|
7748
|
-
senderAddress: senderAddress,
|
|
7749
|
-
ahAddress: ahAddress
|
|
7750
|
-
});
|
|
7751
|
-
case 12:
|
|
7752
|
-
bridgeHub = _context2.v;
|
|
7753
|
-
case 13:
|
|
7754
7635
|
builtHops = [];
|
|
7755
7636
|
if (!(hops && hops.length > 0)) {
|
|
7756
|
-
_context2.n =
|
|
7637
|
+
_context2.n = 11;
|
|
7757
7638
|
break;
|
|
7758
7639
|
}
|
|
7759
|
-
_context2.n =
|
|
7640
|
+
_context2.n = 10;
|
|
7760
7641
|
return Promise.all(hops.map(/*#__PURE__*/function () {
|
|
7761
7642
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(hop) {
|
|
7762
7643
|
var result;
|
|
@@ -7767,7 +7648,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7767
7648
|
return buildHopInfo({
|
|
7768
7649
|
api: api,
|
|
7769
7650
|
chain: hop.chain,
|
|
7770
|
-
|
|
7651
|
+
fee: hop.result.fee,
|
|
7771
7652
|
originChain: origin,
|
|
7772
7653
|
currency: currency,
|
|
7773
7654
|
asset: hop.result.asset,
|
|
@@ -7787,13 +7668,16 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7787
7668
|
return _ref3.apply(this, arguments);
|
|
7788
7669
|
};
|
|
7789
7670
|
}()));
|
|
7790
|
-
case
|
|
7671
|
+
case 10:
|
|
7791
7672
|
builtHops = _context2.v;
|
|
7792
|
-
case
|
|
7673
|
+
case 11:
|
|
7793
7674
|
totalHopFee = hops.reduce(function (acc, hop) {
|
|
7794
7675
|
return isAssetXcEqual(hop.result.asset, originAsset) ? acc + hop.result.fee : acc;
|
|
7795
7676
|
}, 0n);
|
|
7796
|
-
|
|
7677
|
+
bridgeHop = hops.find(function (hop) {
|
|
7678
|
+
return hop.chain.startsWith('BridgeHub');
|
|
7679
|
+
});
|
|
7680
|
+
_context2.n = 12;
|
|
7797
7681
|
return buildDestInfo({
|
|
7798
7682
|
api: api,
|
|
7799
7683
|
origin: origin,
|
|
@@ -7806,9 +7690,9 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7806
7690
|
isFeeAssetAh: !!isFeeAssetAh,
|
|
7807
7691
|
destFeeDetail: destFeeDetail,
|
|
7808
7692
|
totalHopFee: totalHopFee,
|
|
7809
|
-
bridgeFee:
|
|
7693
|
+
bridgeFee: bridgeHop === null || bridgeHop === void 0 ? void 0 : bridgeHop.result.fee
|
|
7810
7694
|
});
|
|
7811
|
-
case
|
|
7695
|
+
case 12:
|
|
7812
7696
|
destinationInfo = _context2.v;
|
|
7813
7697
|
return _context2.a(2, {
|
|
7814
7698
|
chain: {
|
|
@@ -7821,35 +7705,30 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
7821
7705
|
sufficient: originBalanceSufficient,
|
|
7822
7706
|
balance: originBalance,
|
|
7823
7707
|
balanceAfter: originBalanceAfter,
|
|
7824
|
-
|
|
7825
|
-
asset: originAsset,
|
|
7826
|
-
existentialDeposit: edOrigin
|
|
7708
|
+
asset: originAsset
|
|
7827
7709
|
},
|
|
7828
7710
|
xcmFee: {
|
|
7829
7711
|
sufficient: originBalanceNativeSufficient,
|
|
7830
7712
|
fee: originFee,
|
|
7831
7713
|
balance: originBalanceFee,
|
|
7832
7714
|
balanceAfter: originBalanceFeeAfter,
|
|
7833
|
-
currencySymbol: originFeeCurrency,
|
|
7834
7715
|
asset: originFeeAsset
|
|
7835
7716
|
}
|
|
7836
7717
|
},
|
|
7837
|
-
assetHub: assetHub,
|
|
7838
|
-
bridgeHub: bridgeHub,
|
|
7839
7718
|
hops: builtHops,
|
|
7840
7719
|
destination: destinationInfo
|
|
7841
7720
|
});
|
|
7842
|
-
case
|
|
7843
|
-
_context2.p =
|
|
7721
|
+
case 13:
|
|
7722
|
+
_context2.p = 13;
|
|
7844
7723
|
api.setDisconnectAllowed(true);
|
|
7845
|
-
_context2.n =
|
|
7724
|
+
_context2.n = 14;
|
|
7846
7725
|
return api.disconnect();
|
|
7847
|
-
case
|
|
7848
|
-
return _context2.f(
|
|
7849
|
-
case
|
|
7726
|
+
case 14:
|
|
7727
|
+
return _context2.f(13);
|
|
7728
|
+
case 15:
|
|
7850
7729
|
return _context2.a(2);
|
|
7851
7730
|
}
|
|
7852
|
-
}, _callee2, null, [[3,,
|
|
7731
|
+
}, _callee2, null, [[3,, 13, 15]]);
|
|
7853
7732
|
}));
|
|
7854
7733
|
return function getTransferInfo(_x) {
|
|
7855
7734
|
return _ref2.apply(this, arguments);
|
|
@@ -8123,7 +8002,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8123
8002
|
_context.n = 3;
|
|
8124
8003
|
break;
|
|
8125
8004
|
}
|
|
8126
|
-
throw new
|
|
8005
|
+
throw new UnableToComputeError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency, replaceBigInt), " on chain ").concat(chain, "."));
|
|
8127
8006
|
case 3:
|
|
8128
8007
|
feeToSubtract = fee;
|
|
8129
8008
|
case 4:
|
|
@@ -8601,7 +8480,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
8601
8480
|
_context.n = 2;
|
|
8602
8481
|
break;
|
|
8603
8482
|
}
|
|
8604
|
-
throw new
|
|
8483
|
+
throw new ScenarioNotSupportedError('Unable to verify the existential deposit for substrate bridge scenarios');
|
|
8605
8484
|
case 2:
|
|
8606
8485
|
destApi = api.clone();
|
|
8607
8486
|
_context.n = 3;
|
|
@@ -8796,7 +8675,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8796
8675
|
_context.n = 3;
|
|
8797
8676
|
break;
|
|
8798
8677
|
}
|
|
8799
|
-
throw new
|
|
8678
|
+
throw new UnsupportedOperationError('Relaychain assets require the type-and-then method which is not supported by this chain.');
|
|
8800
8679
|
case 3:
|
|
8801
8680
|
isSubBridge = !isTLocation(destination) && isSubstrateBridge(this.chain, destination);
|
|
8802
8681
|
useTypeAndThen = isRelayAsset && supportsTypeThen && destChain && !isExternalChain(destChain) && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain)) || isSubBridge;
|
|
@@ -8890,7 +8769,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8890
8769
|
_context.n = 8;
|
|
8891
8770
|
break;
|
|
8892
8771
|
}
|
|
8893
|
-
throw new
|
|
8772
|
+
throw new FeatureTemporarilyDisabledError('Astar system asset transfers are temporarily disabled');
|
|
8894
8773
|
case 8:
|
|
8895
8774
|
isAHOrigin = this.chain.includes('AssetHub');
|
|
8896
8775
|
isAHDest = !isTLocation(destination) && destination.includes('AssetHub'); // Handle common cases
|
|
@@ -8938,7 +8817,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8938
8817
|
if (destChain && !isRelayChain(destChain) && !isExternalChain(destChain)) {
|
|
8939
8818
|
var dest = getChain(destChain);
|
|
8940
8819
|
if (!dest.canReceiveFrom(this.chain)) {
|
|
8941
|
-
throw new
|
|
8820
|
+
throw new ScenarioNotSupportedError("Receiving from ".concat(this.chain, " is not yet enabled"));
|
|
8942
8821
|
}
|
|
8943
8822
|
}
|
|
8944
8823
|
}
|
|
@@ -8947,12 +8826,12 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8947
8826
|
value: function throwIfTempDisabled(options, destChain) {
|
|
8948
8827
|
var isSendingDisabled = this.isSendingTempDisabled(options);
|
|
8949
8828
|
if (isSendingDisabled) {
|
|
8950
|
-
throw new
|
|
8829
|
+
throw new FeatureTemporarilyDisabledError("Sending from ".concat(this.chain, " is temporarily disabled"));
|
|
8951
8830
|
}
|
|
8952
8831
|
var scenario = resolveScenario(this.chain, options.to);
|
|
8953
8832
|
var isReceivingDisabled = destChain && !isRelayChain(destChain) && !isExternalChain(destChain) && getChain(destChain).isReceivingTempDisabled(scenario);
|
|
8954
8833
|
if (isReceivingDisabled) {
|
|
8955
|
-
throw new
|
|
8834
|
+
throw new FeatureTemporarilyDisabledError("Receiving on ".concat(destChain, " is temporarily disabled"));
|
|
8956
8835
|
}
|
|
8957
8836
|
}
|
|
8958
8837
|
}, {
|
|
@@ -8979,12 +8858,12 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
8979
8858
|
if (isTLocation(to) || isSubstrateBridge(this.chain, to) || to === 'Ethereum') return false;
|
|
8980
8859
|
var isAHPOrigin = this.chain.includes('AssetHub');
|
|
8981
8860
|
var isAHPDest = !isTLocation(to) && to.includes('AssetHub');
|
|
8982
|
-
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)));
|
|
8983
8862
|
var assetHubChain = "AssetHub".concat(getRelayChainOf(this.chain));
|
|
8984
8863
|
var isRegisteredOnAh = asset.location && findAssetInfo(assetHubChain, {
|
|
8985
8864
|
location: asset.location
|
|
8986
8865
|
}, null);
|
|
8987
|
-
return isNativeAsset && Boolean(isRegisteredOnAh) && (isAHPOrigin || isAHPDest);
|
|
8866
|
+
return Boolean(isNativeAsset) && Boolean(isRegisteredOnAh) && (isAHPOrigin || isAHPDest);
|
|
8988
8867
|
}
|
|
8989
8868
|
}, {
|
|
8990
8869
|
key: "getRelayToParaOverrides",
|
|
@@ -9007,7 +8886,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9007
8886
|
_context2.n = 1;
|
|
9008
8887
|
break;
|
|
9009
8888
|
}
|
|
9010
|
-
throw new
|
|
8889
|
+
throw new FeatureTemporarilyDisabledError("Receiving on ".concat(this.chain, " is temporarily disabled"));
|
|
9011
8890
|
case 1:
|
|
9012
8891
|
if (!(transferType === 'typeAndThen')) {
|
|
9013
8892
|
_context2.n = 3;
|
|
@@ -9020,7 +8899,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9020
8899
|
_context2.n = 2;
|
|
9021
8900
|
break;
|
|
9022
8901
|
}
|
|
9023
|
-
throw new
|
|
8902
|
+
throw new UnsupportedOperationError('Cannot override destination when using type and then transfer.');
|
|
9024
8903
|
case 2:
|
|
9025
8904
|
return _context2.a(2, createTypeThenAutoReserve(getRelayChainOf(destChain), _objectSpread2(_objectSpread2({}, options), {}, {
|
|
9026
8905
|
beneficiaryLocation: createBeneficiaryLocation({
|
|
@@ -9081,12 +8960,12 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9081
8960
|
_context3.n = 2;
|
|
9082
8961
|
break;
|
|
9083
8962
|
}
|
|
9084
|
-
throw new
|
|
8963
|
+
throw new UnsupportedOperationError('Fee asset is not supported for local transfers');
|
|
9085
8964
|
case 2:
|
|
9086
8965
|
validatedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
9087
8966
|
address: address
|
|
9088
8967
|
});
|
|
9089
|
-
isNativeAsset = asset.symbol === this.getNativeAssetSymbol() &&
|
|
8968
|
+
isNativeAsset = asset.symbol === this.getNativeAssetSymbol() && asset.isNative;
|
|
9090
8969
|
if (!isAmountAll) {
|
|
9091
8970
|
_context3.n = 4;
|
|
9092
8971
|
break;
|
|
@@ -9328,7 +9207,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
9328
9207
|
_context5.n = 1;
|
|
9329
9208
|
break;
|
|
9330
9209
|
}
|
|
9331
|
-
throw new
|
|
9210
|
+
throw new RoutingResolutionError("No foreign asset pallets found for ".concat(this.chain));
|
|
9332
9211
|
case 1:
|
|
9333
9212
|
customCurrencyId = this.getCustomCurrencyId(asset);
|
|
9334
9213
|
_iterator = _createForOfIteratorHelper(pallets);
|
|
@@ -9406,7 +9285,10 @@ var Acala = /*#__PURE__*/function (_Parachain) {
|
|
|
9406
9285
|
}, {
|
|
9407
9286
|
key: "transferRelayToPara",
|
|
9408
9287
|
value: function transferRelayToPara() {
|
|
9409
|
-
throw new
|
|
9288
|
+
throw new ScenarioNotSupportedError({
|
|
9289
|
+
chain: this.chain,
|
|
9290
|
+
scenario: 'RelayToPara'
|
|
9291
|
+
});
|
|
9410
9292
|
}
|
|
9411
9293
|
}, {
|
|
9412
9294
|
key: "transferLocalNativeAsset",
|
|
@@ -9481,10 +9363,10 @@ var Acala = /*#__PURE__*/function (_Parachain) {
|
|
|
9481
9363
|
key: "getCustomCurrencyId",
|
|
9482
9364
|
value: function getCustomCurrencyId(asset) {
|
|
9483
9365
|
var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
|
|
9484
|
-
return
|
|
9485
|
-
ForeignAsset: Number(asset.assetId)
|
|
9486
|
-
} : {
|
|
9366
|
+
return asset.isNative ? {
|
|
9487
9367
|
Token: symbol
|
|
9368
|
+
} : {
|
|
9369
|
+
ForeignAsset: Number(asset.assetId)
|
|
9488
9370
|
};
|
|
9489
9371
|
}
|
|
9490
9372
|
}, {
|
|
@@ -9514,7 +9396,10 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
|
|
|
9514
9396
|
var scenario = input.scenario,
|
|
9515
9397
|
asset = input.asset;
|
|
9516
9398
|
if (scenario !== 'ParaToPara') {
|
|
9517
|
-
throw new ScenarioNotSupportedError(
|
|
9399
|
+
throw new ScenarioNotSupportedError({
|
|
9400
|
+
chain: this.chain,
|
|
9401
|
+
scenario: scenario
|
|
9402
|
+
});
|
|
9518
9403
|
}
|
|
9519
9404
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
9520
9405
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -9524,7 +9409,10 @@ var Ajuna = /*#__PURE__*/function (_Parachain) {
|
|
|
9524
9409
|
}, {
|
|
9525
9410
|
key: "transferRelayToPara",
|
|
9526
9411
|
value: function transferRelayToPara() {
|
|
9527
|
-
throw new
|
|
9412
|
+
throw new ScenarioNotSupportedError({
|
|
9413
|
+
chain: this.chain,
|
|
9414
|
+
scenario: 'RelayToPara'
|
|
9415
|
+
});
|
|
9528
9416
|
}
|
|
9529
9417
|
}, {
|
|
9530
9418
|
key: "transferLocalNonNativeAsset",
|
|
@@ -9604,7 +9492,10 @@ var AjunaPaseo = /*#__PURE__*/function (_Parachain) {
|
|
|
9604
9492
|
var scenario = input.scenario,
|
|
9605
9493
|
asset = input.assetInfo;
|
|
9606
9494
|
if (scenario !== 'ParaToPara') {
|
|
9607
|
-
throw new ScenarioNotSupportedError(
|
|
9495
|
+
throw new ScenarioNotSupportedError({
|
|
9496
|
+
chain: this.chain,
|
|
9497
|
+
scenario: scenario
|
|
9498
|
+
});
|
|
9608
9499
|
}
|
|
9609
9500
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
9610
9501
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -9614,7 +9505,10 @@ var AjunaPaseo = /*#__PURE__*/function (_Parachain) {
|
|
|
9614
9505
|
}, {
|
|
9615
9506
|
key: "transferRelayToPara",
|
|
9616
9507
|
value: function transferRelayToPara() {
|
|
9617
|
-
throw new
|
|
9508
|
+
throw new ScenarioNotSupportedError({
|
|
9509
|
+
chain: this.chain,
|
|
9510
|
+
scenario: 'RelayToPara'
|
|
9511
|
+
});
|
|
9618
9512
|
}
|
|
9619
9513
|
}]);
|
|
9620
9514
|
}(Parachain);
|
|
@@ -9720,8 +9614,8 @@ var AssetHubKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
9720
9614
|
scenario = input.scenario;
|
|
9721
9615
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
|
|
9722
9616
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
9723
|
-
if (scenario === 'ParaToPara' && asset.symbol === 'DOT' &&
|
|
9724
|
-
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>}.');
|
|
9725
9619
|
}
|
|
9726
9620
|
var method = this.getMethod(scenario, destination);
|
|
9727
9621
|
return transferPolkadotXcm(input, method, 'Unlimited');
|
|
@@ -9765,7 +9659,7 @@ var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals,
|
|
|
9765
9659
|
if (!shouldAbstract) {
|
|
9766
9660
|
var strAmount = amount.toString();
|
|
9767
9661
|
if (strAmount.includes('.')) {
|
|
9768
|
-
throw new
|
|
9662
|
+
throw new NumberFormatError("Non-abstracted amount cannot have decimals: ".concat(strAmount));
|
|
9769
9663
|
}
|
|
9770
9664
|
return BigInt(strAmount);
|
|
9771
9665
|
}
|
|
@@ -9780,11 +9674,13 @@ var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals,
|
|
|
9780
9674
|
return parseUnits(amount.toString(), decimals);
|
|
9781
9675
|
};
|
|
9782
9676
|
|
|
9783
|
-
var createAssetsFilter = function createAssetsFilter(asset) {
|
|
9677
|
+
var createAssetsFilter = function createAssetsFilter(asset, version) {
|
|
9678
|
+
var location = extractAssetLocation(asset);
|
|
9679
|
+
var id = createId(version, location);
|
|
9784
9680
|
return {
|
|
9785
9681
|
Wild: {
|
|
9786
9682
|
AllOf: {
|
|
9787
|
-
id:
|
|
9683
|
+
id: id,
|
|
9788
9684
|
fun: 'Fungible'
|
|
9789
9685
|
}
|
|
9790
9686
|
}
|
|
@@ -9861,13 +9757,13 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
|
|
|
9861
9757
|
reserveChain = _prepareExecuteContex.reserveChain;
|
|
9862
9758
|
var destLocation = createDestination(version, chain, destChain, paraIdTo);
|
|
9863
9759
|
if (chain !== 'AssetHubPolkadot' && reserveChain === undefined) {
|
|
9864
|
-
throw new
|
|
9760
|
+
throw new UnsupportedOperationError('Sending local reserve assets with custom fee asset is not yet supported for this chain.');
|
|
9865
9761
|
}
|
|
9866
9762
|
var transferType = getTransferType(chain, destChain, reserveChain);
|
|
9867
9763
|
var isReserveDest = reserveChain === destChain;
|
|
9868
9764
|
var resolvedDepositInstruction = isReserveDest ? suffixXcm : [{
|
|
9869
9765
|
DepositReserveAsset: {
|
|
9870
|
-
assets: createAssetsFilter(assetLocalizedToReserve),
|
|
9766
|
+
assets: createAssetsFilter(assetLocalizedToReserve, version),
|
|
9871
9767
|
dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
|
|
9872
9768
|
xcm: [{
|
|
9873
9769
|
BuyExecution: {
|
|
@@ -9883,7 +9779,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
|
|
|
9883
9779
|
// Use teleport for trusted chains
|
|
9884
9780
|
mainInstructions = [{
|
|
9885
9781
|
InitiateTeleport: {
|
|
9886
|
-
assets: createAssetsFilter(assetLocalized),
|
|
9782
|
+
assets: createAssetsFilter(assetLocalized, version),
|
|
9887
9783
|
dest: destLocation,
|
|
9888
9784
|
xcm: [{
|
|
9889
9785
|
BuyExecution: {
|
|
@@ -9898,7 +9794,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
|
|
|
9898
9794
|
// Teleport to reserve chain first
|
|
9899
9795
|
mainInstructions = [{
|
|
9900
9796
|
InitiateTeleport: {
|
|
9901
|
-
assets: createAssetsFilter(assetLocalized),
|
|
9797
|
+
assets: createAssetsFilter(assetLocalized, version),
|
|
9902
9798
|
dest: getChainLocation(chain, reserveChain),
|
|
9903
9799
|
xcm: [{
|
|
9904
9800
|
BuyExecution: {
|
|
@@ -9913,7 +9809,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
|
|
|
9913
9809
|
// Use InitiateReserve for non-trusted chains
|
|
9914
9810
|
mainInstructions = [{
|
|
9915
9811
|
InitiateReserveWithdraw: {
|
|
9916
|
-
assets: createAssetsFilter(assetLocalized),
|
|
9812
|
+
assets: createAssetsFilter(assetLocalized, version),
|
|
9917
9813
|
reserve: getChainLocation(chain, reserveChain),
|
|
9918
9814
|
xcm: [{
|
|
9919
9815
|
BuyExecution: {
|
|
@@ -10079,7 +9975,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10079
9975
|
});
|
|
10080
9976
|
var depositInstruction = {
|
|
10081
9977
|
DepositAsset: {
|
|
10082
|
-
assets: createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest),
|
|
9978
|
+
assets: createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest, version),
|
|
10083
9979
|
beneficiary: beneficiary
|
|
10084
9980
|
}
|
|
10085
9981
|
};
|
|
@@ -10125,7 +10021,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10125
10021
|
_context.n = 1;
|
|
10126
10022
|
break;
|
|
10127
10023
|
}
|
|
10128
|
-
throw new
|
|
10024
|
+
throw new RoutingResolutionError('Could not determine destination chain for execute transfer');
|
|
10129
10025
|
case 1:
|
|
10130
10026
|
internalOptions = {
|
|
10131
10027
|
api: api,
|
|
@@ -10218,7 +10114,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
10218
10114
|
}
|
|
10219
10115
|
return _context.a(2, [{
|
|
10220
10116
|
ExchangeAsset: {
|
|
10221
|
-
give: createAssetsFilter(assetFrom),
|
|
10117
|
+
give: createAssetsFilter(assetFrom, version),
|
|
10222
10118
|
want: [assetTo],
|
|
10223
10119
|
maximal: false
|
|
10224
10120
|
}
|
|
@@ -10231,13 +10127,13 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
10231
10127
|
assetNative = createAsset(version, exchangeFee === 0n ? (nativeAmountOut + 1n) / 2n : nativeAmountOut, localizeLocation(exchangeChain, nativeAsset.location));
|
|
10232
10128
|
return _context.a(2, [{
|
|
10233
10129
|
ExchangeAsset: {
|
|
10234
|
-
give: createAssetsFilter(assetFrom),
|
|
10130
|
+
give: createAssetsFilter(assetFrom, version),
|
|
10235
10131
|
want: [assetNative],
|
|
10236
10132
|
maximal: false
|
|
10237
10133
|
}
|
|
10238
10134
|
}, {
|
|
10239
10135
|
ExchangeAsset: {
|
|
10240
|
-
give: createAssetsFilter(assetNative),
|
|
10136
|
+
give: createAssetsFilter(assetNative, version),
|
|
10241
10137
|
want: [assetTo],
|
|
10242
10138
|
maximal: true
|
|
10243
10139
|
}
|
|
@@ -10360,7 +10256,7 @@ var findExchangeHopIndex = function findExchangeHopIndex(chain, dryRunResult, ex
|
|
|
10360
10256
|
// If chain is defined but no exchange hop found, it might be because
|
|
10361
10257
|
// the origin chain is the exchange chain (no hops needed)
|
|
10362
10258
|
if (chain && index === -1 && chain !== exchangeChain) {
|
|
10363
|
-
throw new
|
|
10259
|
+
throw new RoutingResolutionError("Exchange hop for ".concat(exchangeChain, " not found in dry run result."));
|
|
10364
10260
|
}
|
|
10365
10261
|
return index;
|
|
10366
10262
|
};
|
|
@@ -10588,7 +10484,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
10588
10484
|
_context.n = 1;
|
|
10589
10485
|
break;
|
|
10590
10486
|
}
|
|
10591
|
-
throw new
|
|
10487
|
+
throw new InvalidAddressError('Location address is not supported for this scenario');
|
|
10592
10488
|
case 1:
|
|
10593
10489
|
assertSenderAddress(senderAddress);
|
|
10594
10490
|
_context.n = 2;
|
|
@@ -10640,6 +10536,17 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
10640
10536
|
};
|
|
10641
10537
|
}();
|
|
10642
10538
|
|
|
10539
|
+
var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
|
|
10540
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
10541
|
+
isDestination: false
|
|
10542
|
+
},
|
|
10543
|
+
isDestination = _ref.isDestination;
|
|
10544
|
+
if ('location' in currency) {
|
|
10545
|
+
throw new InvalidCurrencyError("\n Selected chain doesn't support location you provided. Maybe you meant custom location. If so, you need to use override option. Your selection should look like this: {location: Override(".concat(JSON.stringify(currency.location), ")}."));
|
|
10546
|
+
}
|
|
10547
|
+
throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
|
|
10548
|
+
};
|
|
10549
|
+
|
|
10643
10550
|
var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
10644
10551
|
function AssetHubPolkadot() {
|
|
10645
10552
|
var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'AssetHubPolkadot';
|
|
@@ -10674,7 +10581,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
10674
10581
|
_context.n = 3;
|
|
10675
10582
|
break;
|
|
10676
10583
|
}
|
|
10677
|
-
throw new
|
|
10584
|
+
throw new InvalidAddressError('Location address is not supported for Ethereum transfers');
|
|
10678
10585
|
case 3:
|
|
10679
10586
|
assertHasLocation(asset);
|
|
10680
10587
|
_context.n = 4;
|
|
@@ -10915,7 +10822,6 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
10915
10822
|
asset = options.assetInfo,
|
|
10916
10823
|
address = options.address,
|
|
10917
10824
|
isAmountAll = options.isAmountAll;
|
|
10918
|
-
assertIsForeign(asset);
|
|
10919
10825
|
if (asset.assetId !== undefined) {
|
|
10920
10826
|
var assetId = Number(asset.assetId);
|
|
10921
10827
|
var dest = {
|
|
@@ -11013,9 +10919,10 @@ var Astar = /*#__PURE__*/function (_Parachain) {
|
|
|
11013
10919
|
key: "transferXTokens",
|
|
11014
10920
|
value: function transferXTokens$1(input) {
|
|
11015
10921
|
var asset = input.asset;
|
|
11016
|
-
if (
|
|
10922
|
+
if (asset.isNative) {
|
|
11017
10923
|
return transferXTokens(input, undefined);
|
|
11018
10924
|
}
|
|
10925
|
+
assertHasId(asset);
|
|
11019
10926
|
return transferXTokens(input, BigInt(asset.assetId));
|
|
11020
10927
|
}
|
|
11021
10928
|
}, {
|
|
@@ -11027,7 +10934,10 @@ var Astar = /*#__PURE__*/function (_Parachain) {
|
|
|
11027
10934
|
}, {
|
|
11028
10935
|
key: "transferRelayToPara",
|
|
11029
10936
|
value: function transferRelayToPara() {
|
|
11030
|
-
throw new
|
|
10937
|
+
throw new ScenarioNotSupportedError({
|
|
10938
|
+
chain: this.chain,
|
|
10939
|
+
scenario: 'RelayToPara'
|
|
10940
|
+
});
|
|
11031
10941
|
}
|
|
11032
10942
|
}, {
|
|
11033
10943
|
key: "transferLocalNonNativeAsset",
|
|
@@ -11112,7 +11022,7 @@ var BifrostPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
11112
11022
|
}
|
|
11113
11023
|
var isVToken = asset.symbol && asset.symbol.startsWith('v');
|
|
11114
11024
|
var isVSToken = asset.symbol && asset.symbol.startsWith('vs');
|
|
11115
|
-
if (
|
|
11025
|
+
if (asset.isNative || !asset.isNative && !asset.assetId) {
|
|
11116
11026
|
return isVToken ? {
|
|
11117
11027
|
VToken: asset.symbol.substring(1)
|
|
11118
11028
|
} : {
|
|
@@ -11221,7 +11131,7 @@ var BridgeHubKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
11221
11131
|
value: function transferPolkadotXCM(input) {
|
|
11222
11132
|
var scenario = input.scenario;
|
|
11223
11133
|
if (scenario === 'ParaToPara') {
|
|
11224
|
-
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.');
|
|
11225
11135
|
}
|
|
11226
11136
|
var method = 'limited_teleport_assets';
|
|
11227
11137
|
return transferPolkadotXcm(input, method, 'Unlimited');
|
|
@@ -11252,7 +11162,7 @@ var BridgeHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
11252
11162
|
var scenario = input.scenario,
|
|
11253
11163
|
destChain = input.destChain;
|
|
11254
11164
|
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
11255
|
-
throw new ScenarioNotSupportedError(
|
|
11165
|
+
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
11256
11166
|
}
|
|
11257
11167
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11258
11168
|
}
|
|
@@ -11357,7 +11267,7 @@ var Collectives = /*#__PURE__*/function (_Parachain) {
|
|
|
11357
11267
|
var scenario = input.scenario,
|
|
11358
11268
|
destChain = input.destChain;
|
|
11359
11269
|
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
11360
|
-
throw new ScenarioNotSupportedError(
|
|
11270
|
+
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
11361
11271
|
}
|
|
11362
11272
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11363
11273
|
}
|
|
@@ -11391,7 +11301,10 @@ var CoretimeKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
11391
11301
|
value: function transferPolkadotXCM(input) {
|
|
11392
11302
|
var scenario = input.scenario;
|
|
11393
11303
|
if (scenario === 'ParaToPara') {
|
|
11394
|
-
throw new ScenarioNotSupportedError(
|
|
11304
|
+
throw new ScenarioNotSupportedError({
|
|
11305
|
+
chain: this.chain,
|
|
11306
|
+
scenario: scenario
|
|
11307
|
+
});
|
|
11395
11308
|
}
|
|
11396
11309
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11397
11310
|
}
|
|
@@ -11420,7 +11333,10 @@ var CoretimePolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
11420
11333
|
value: function transferPolkadotXCM(input) {
|
|
11421
11334
|
var scenario = input.scenario;
|
|
11422
11335
|
if (scenario === 'ParaToPara') {
|
|
11423
|
-
throw new ScenarioNotSupportedError(
|
|
11336
|
+
throw new ScenarioNotSupportedError({
|
|
11337
|
+
chain: this.chain,
|
|
11338
|
+
scenario: scenario
|
|
11339
|
+
});
|
|
11424
11340
|
}
|
|
11425
11341
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11426
11342
|
}
|
|
@@ -11469,12 +11385,18 @@ var Crab = /*#__PURE__*/function (_Parachain) {
|
|
|
11469
11385
|
if (input.scenario === 'ParaToPara') {
|
|
11470
11386
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11471
11387
|
}
|
|
11472
|
-
throw new ScenarioNotSupportedError(
|
|
11388
|
+
throw new ScenarioNotSupportedError({
|
|
11389
|
+
chain: this.chain,
|
|
11390
|
+
scenario: input.scenario
|
|
11391
|
+
});
|
|
11473
11392
|
}
|
|
11474
11393
|
}, {
|
|
11475
11394
|
key: "transferRelayToPara",
|
|
11476
11395
|
value: function transferRelayToPara() {
|
|
11477
|
-
throw new
|
|
11396
|
+
throw new ScenarioNotSupportedError({
|
|
11397
|
+
chain: this.chain,
|
|
11398
|
+
scenario: 'RelayToPara'
|
|
11399
|
+
});
|
|
11478
11400
|
}
|
|
11479
11401
|
}, {
|
|
11480
11402
|
key: "transferLocalNonNativeAsset",
|
|
@@ -11493,12 +11415,10 @@ var Crust = /*#__PURE__*/function (_Parachain) {
|
|
|
11493
11415
|
return _createClass(Crust, [{
|
|
11494
11416
|
key: "getCurrencySelection",
|
|
11495
11417
|
value: function getCurrencySelection(asset) {
|
|
11496
|
-
if (asset.
|
|
11418
|
+
if (asset.isNative) {
|
|
11497
11419
|
return 'SelfReserve';
|
|
11498
11420
|
}
|
|
11499
|
-
|
|
11500
|
-
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " has no assetId"));
|
|
11501
|
-
}
|
|
11421
|
+
assertHasId(asset);
|
|
11502
11422
|
return {
|
|
11503
11423
|
OtherReserve: BigInt(asset.assetId)
|
|
11504
11424
|
};
|
|
@@ -11587,21 +11507,17 @@ var Curio = /*#__PURE__*/function (_Parachain) {
|
|
|
11587
11507
|
return _createClass(Curio, [{
|
|
11588
11508
|
key: "getCustomCurrencyId",
|
|
11589
11509
|
value: function getCustomCurrencyId(asset) {
|
|
11590
|
-
return
|
|
11591
|
-
ForeignAsset: Number(asset.assetId)
|
|
11592
|
-
} : {
|
|
11510
|
+
return asset.isNative ? {
|
|
11593
11511
|
Token: asset.symbol
|
|
11512
|
+
} : {
|
|
11513
|
+
ForeignAsset: Number(asset.assetId)
|
|
11594
11514
|
};
|
|
11595
11515
|
}
|
|
11596
11516
|
}, {
|
|
11597
11517
|
key: "transferXTokens",
|
|
11598
11518
|
value: function transferXTokens$1(input) {
|
|
11599
11519
|
var asset = input.asset;
|
|
11600
|
-
var currencySelection =
|
|
11601
|
-
ForeignAsset: Number(asset.assetId)
|
|
11602
|
-
} : {
|
|
11603
|
-
Token: asset.symbol
|
|
11604
|
-
};
|
|
11520
|
+
var currencySelection = this.getCustomCurrencyId(asset);
|
|
11605
11521
|
return transferXTokens(input, currencySelection);
|
|
11606
11522
|
}
|
|
11607
11523
|
}, {
|
|
@@ -11629,7 +11545,10 @@ var Darwinia = /*#__PURE__*/function (_Parachain) {
|
|
|
11629
11545
|
var scenario = input.scenario,
|
|
11630
11546
|
asset = input.assetInfo;
|
|
11631
11547
|
if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
|
|
11632
|
-
throw new ScenarioNotSupportedError(
|
|
11548
|
+
throw new ScenarioNotSupportedError({
|
|
11549
|
+
chain: this.chain,
|
|
11550
|
+
scenario: scenario
|
|
11551
|
+
});
|
|
11633
11552
|
}
|
|
11634
11553
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11635
11554
|
}
|
|
@@ -11681,7 +11600,10 @@ var Encointer = /*#__PURE__*/function (_Parachain) {
|
|
|
11681
11600
|
if (input.scenario === 'ParaToRelay' || destChain && isTrustedChain(destChain)) {
|
|
11682
11601
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
11683
11602
|
}
|
|
11684
|
-
throw new ScenarioNotSupportedError(
|
|
11603
|
+
throw new ScenarioNotSupportedError({
|
|
11604
|
+
chain: this.chain,
|
|
11605
|
+
scenario: input.scenario
|
|
11606
|
+
});
|
|
11685
11607
|
}
|
|
11686
11608
|
}, {
|
|
11687
11609
|
key: "getRelayToParaOverrides",
|
|
@@ -11708,14 +11630,20 @@ var EnergyWebX = /*#__PURE__*/function (_Parachain) {
|
|
|
11708
11630
|
value: function transferPolkadotXCM(input) {
|
|
11709
11631
|
var scenario = input.scenario;
|
|
11710
11632
|
if (scenario !== 'ParaToPara') {
|
|
11711
|
-
throw new ScenarioNotSupportedError(
|
|
11633
|
+
throw new ScenarioNotSupportedError({
|
|
11634
|
+
chain: this.chain,
|
|
11635
|
+
scenario: scenario
|
|
11636
|
+
});
|
|
11712
11637
|
}
|
|
11713
11638
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
11714
11639
|
}
|
|
11715
11640
|
}, {
|
|
11716
11641
|
key: "transferRelayToPara",
|
|
11717
11642
|
value: function transferRelayToPara() {
|
|
11718
|
-
throw new
|
|
11643
|
+
throw new ScenarioNotSupportedError({
|
|
11644
|
+
chain: this.chain,
|
|
11645
|
+
scenario: 'RelayToPara'
|
|
11646
|
+
});
|
|
11719
11647
|
}
|
|
11720
11648
|
}]);
|
|
11721
11649
|
}(Parachain);
|
|
@@ -11745,7 +11673,10 @@ var Heima = /*#__PURE__*/function (_Parachain) {
|
|
|
11745
11673
|
var scenario = input.scenario,
|
|
11746
11674
|
asset = input.assetInfo;
|
|
11747
11675
|
if (scenario !== 'ParaToPara') {
|
|
11748
|
-
throw new ScenarioNotSupportedError(
|
|
11676
|
+
throw new ScenarioNotSupportedError({
|
|
11677
|
+
chain: this.chain,
|
|
11678
|
+
scenario: scenario
|
|
11679
|
+
});
|
|
11749
11680
|
}
|
|
11750
11681
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
11751
11682
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -11946,10 +11877,10 @@ var Interlay = /*#__PURE__*/function (_Parachain) {
|
|
|
11946
11877
|
return _createClass(Interlay, [{
|
|
11947
11878
|
key: "getCustomCurrencyId",
|
|
11948
11879
|
value: function getCustomCurrencyId(asset) {
|
|
11949
|
-
return
|
|
11950
|
-
ForeignAsset: Number(asset.assetId)
|
|
11951
|
-
} : {
|
|
11880
|
+
return asset.isNative ? {
|
|
11952
11881
|
Token: asset.symbol
|
|
11882
|
+
} : {
|
|
11883
|
+
ForeignAsset: Number(asset.assetId)
|
|
11953
11884
|
};
|
|
11954
11885
|
}
|
|
11955
11886
|
}, {
|
|
@@ -12010,10 +11941,10 @@ var Jamton = /*#__PURE__*/function (_Parachain) {
|
|
|
12010
11941
|
return _createClass(Jamton, [{
|
|
12011
11942
|
key: "getCustomCurrencyId",
|
|
12012
11943
|
value: function getCustomCurrencyId(asset) {
|
|
12013
|
-
return
|
|
12014
|
-
ForeignAsset: Number(asset.assetId)
|
|
12015
|
-
} : {
|
|
11944
|
+
return asset.isNative ? {
|
|
12016
11945
|
Native: Jamton.NATIVE_ASSET_IDS[asset.symbol]
|
|
11946
|
+
} : {
|
|
11947
|
+
ForeignAsset: Number(asset.assetId)
|
|
12017
11948
|
};
|
|
12018
11949
|
}
|
|
12019
11950
|
}, {
|
|
@@ -12024,12 +11955,12 @@ var Jamton = /*#__PURE__*/function (_Parachain) {
|
|
|
12024
11955
|
destination = input.destination,
|
|
12025
11956
|
version = input.version;
|
|
12026
11957
|
var currencySelection = this.getCustomCurrencyId(asset);
|
|
12027
|
-
if (
|
|
11958
|
+
if (asset.isNative && asset.symbol in Jamton.NATIVE_ASSET_IDS) {
|
|
12028
11959
|
return transferXTokens(input, currencySelection);
|
|
12029
11960
|
}
|
|
12030
11961
|
assertHasId(asset);
|
|
12031
11962
|
if (scenario === 'ParaToPara' && destination !== 'AssetHubPolkadot') {
|
|
12032
|
-
throw new ScenarioNotSupportedError(
|
|
11963
|
+
throw new ScenarioNotSupportedError("Transfer from ".concat(this.chain, " to ").concat(JSON.stringify(destination), " is not yet supported"));
|
|
12033
11964
|
}
|
|
12034
11965
|
if (isSymbolMatch(asset.symbol, 'WUD')) {
|
|
12035
11966
|
var usdt = findAssetInfoOrThrow(this.chain, {
|
|
@@ -12079,14 +12010,17 @@ var KiltSpiritnet = /*#__PURE__*/function (_Parachain) {
|
|
|
12079
12010
|
var scenario = input.scenario,
|
|
12080
12011
|
asset = input.assetInfo;
|
|
12081
12012
|
if (scenario === 'ParaToPara' && asset.symbol !== this.getNativeAssetSymbol()) {
|
|
12082
|
-
throw new ScenarioNotSupportedError(
|
|
12013
|
+
throw new ScenarioNotSupportedError('KiltSpiritnet only supports native asset ParaToPara transfers');
|
|
12083
12014
|
}
|
|
12084
12015
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
12085
12016
|
}
|
|
12086
12017
|
}, {
|
|
12087
12018
|
key: "transferRelayToPara",
|
|
12088
12019
|
value: function transferRelayToPara() {
|
|
12089
|
-
throw new
|
|
12020
|
+
throw new ScenarioNotSupportedError({
|
|
12021
|
+
chain: this.chain,
|
|
12022
|
+
scenario: 'RelayToPara'
|
|
12023
|
+
});
|
|
12090
12024
|
}
|
|
12091
12025
|
}]);
|
|
12092
12026
|
}(Parachain);
|
|
@@ -12119,10 +12053,10 @@ var Kintsugi = /*#__PURE__*/function (_Parachain) {
|
|
|
12119
12053
|
return _createClass(Kintsugi, [{
|
|
12120
12054
|
key: "getCustomCurrencyId",
|
|
12121
12055
|
value: function getCustomCurrencyId(asset) {
|
|
12122
|
-
return
|
|
12123
|
-
ForeignAsset: Number(asset.assetId)
|
|
12124
|
-
} : {
|
|
12056
|
+
return asset.isNative ? {
|
|
12125
12057
|
Token: asset.symbol
|
|
12058
|
+
} : {
|
|
12059
|
+
ForeignAsset: Number(asset.assetId)
|
|
12126
12060
|
};
|
|
12127
12061
|
}
|
|
12128
12062
|
}, {
|
|
@@ -12191,7 +12125,10 @@ var Laos = /*#__PURE__*/function (_Parachain) {
|
|
|
12191
12125
|
asset = input.assetInfo,
|
|
12192
12126
|
destination = input.destination;
|
|
12193
12127
|
if (scenario !== 'ParaToPara') {
|
|
12194
|
-
throw new ScenarioNotSupportedError(
|
|
12128
|
+
throw new ScenarioNotSupportedError({
|
|
12129
|
+
chain: this.chain,
|
|
12130
|
+
scenario: scenario
|
|
12131
|
+
});
|
|
12195
12132
|
}
|
|
12196
12133
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
12197
12134
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -12204,7 +12141,10 @@ var Laos = /*#__PURE__*/function (_Parachain) {
|
|
|
12204
12141
|
}, {
|
|
12205
12142
|
key: "transferRelayToPara",
|
|
12206
12143
|
value: function transferRelayToPara() {
|
|
12207
|
-
throw new
|
|
12144
|
+
throw new ScenarioNotSupportedError({
|
|
12145
|
+
chain: this.chain,
|
|
12146
|
+
scenario: 'RelayToPara'
|
|
12147
|
+
});
|
|
12208
12148
|
}
|
|
12209
12149
|
}]);
|
|
12210
12150
|
}(Parachain);
|
|
@@ -12304,7 +12244,7 @@ var Moonbeam = /*#__PURE__*/function (_Parachain) {
|
|
|
12304
12244
|
}, {
|
|
12305
12245
|
key: "transferLocalNonNativeAsset",
|
|
12306
12246
|
value: function transferLocalNonNativeAsset(_options) {
|
|
12307
|
-
throw new ScenarioNotSupportedError(
|
|
12247
|
+
throw new ScenarioNotSupportedError("".concat(this.chain, " local transfers are temporarily disabled"));
|
|
12308
12248
|
}
|
|
12309
12249
|
}, {
|
|
12310
12250
|
key: "getBalanceForeign",
|
|
@@ -12394,7 +12334,10 @@ var Mythos = /*#__PURE__*/function (_Parachain) {
|
|
|
12394
12334
|
var scenario = input.scenario,
|
|
12395
12335
|
destination = input.destination;
|
|
12396
12336
|
if (scenario !== 'ParaToPara') {
|
|
12397
|
-
throw new ScenarioNotSupportedError(
|
|
12337
|
+
throw new ScenarioNotSupportedError({
|
|
12338
|
+
chain: this.chain,
|
|
12339
|
+
scenario: scenario
|
|
12340
|
+
});
|
|
12398
12341
|
}
|
|
12399
12342
|
return transferPolkadotXcm(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited');
|
|
12400
12343
|
}
|
|
@@ -12439,7 +12382,10 @@ var Mythos = /*#__PURE__*/function (_Parachain) {
|
|
|
12439
12382
|
}, {
|
|
12440
12383
|
key: "transferRelayToPara",
|
|
12441
12384
|
value: function transferRelayToPara() {
|
|
12442
|
-
throw new
|
|
12385
|
+
throw new ScenarioNotSupportedError({
|
|
12386
|
+
chain: this.chain,
|
|
12387
|
+
scenario: 'RelayToPara'
|
|
12388
|
+
});
|
|
12443
12389
|
}
|
|
12444
12390
|
}]);
|
|
12445
12391
|
}(Parachain);
|
|
@@ -12534,7 +12480,10 @@ var Nodle = /*#__PURE__*/function (_Parachain) {
|
|
|
12534
12480
|
var asset = input.assetInfo,
|
|
12535
12481
|
scenario = input.scenario;
|
|
12536
12482
|
if (scenario !== 'ParaToPara') {
|
|
12537
|
-
throw new ScenarioNotSupportedError(
|
|
12483
|
+
throw new ScenarioNotSupportedError({
|
|
12484
|
+
chain: this.chain,
|
|
12485
|
+
scenario: scenario
|
|
12486
|
+
});
|
|
12538
12487
|
}
|
|
12539
12488
|
if (asset.symbol !== this.getNativeAssetSymbol()) {
|
|
12540
12489
|
throw new InvalidCurrencyError("Asset ".concat(asset.symbol, " is not supported by chain ").concat(this.chain, "."));
|
|
@@ -12544,7 +12493,10 @@ var Nodle = /*#__PURE__*/function (_Parachain) {
|
|
|
12544
12493
|
}, {
|
|
12545
12494
|
key: "transferRelayToPara",
|
|
12546
12495
|
value: function transferRelayToPara() {
|
|
12547
|
-
throw new
|
|
12496
|
+
throw new ScenarioNotSupportedError({
|
|
12497
|
+
chain: this.chain,
|
|
12498
|
+
scenario: 'RelayToPara'
|
|
12499
|
+
});
|
|
12548
12500
|
}
|
|
12549
12501
|
}]);
|
|
12550
12502
|
}(Parachain);
|
|
@@ -12565,7 +12517,7 @@ var PeoplePolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
12565
12517
|
var scenario = input.scenario,
|
|
12566
12518
|
destChain = input.destChain;
|
|
12567
12519
|
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
12568
|
-
throw new ScenarioNotSupportedError(
|
|
12520
|
+
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
12569
12521
|
}
|
|
12570
12522
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
12571
12523
|
}
|
|
@@ -12610,7 +12562,10 @@ var Peaq = /*#__PURE__*/function (_Parachain) {
|
|
|
12610
12562
|
var scenario = input.scenario,
|
|
12611
12563
|
asset = input.asset;
|
|
12612
12564
|
if (scenario !== 'ParaToPara') {
|
|
12613
|
-
throw new ScenarioNotSupportedError(
|
|
12565
|
+
throw new ScenarioNotSupportedError({
|
|
12566
|
+
chain: this.chain,
|
|
12567
|
+
scenario: scenario
|
|
12568
|
+
});
|
|
12614
12569
|
}
|
|
12615
12570
|
assertHasId(asset);
|
|
12616
12571
|
return transferXTokens(input, BigInt(asset.assetId));
|
|
@@ -12618,7 +12573,10 @@ var Peaq = /*#__PURE__*/function (_Parachain) {
|
|
|
12618
12573
|
}, {
|
|
12619
12574
|
key: "transferRelayToPara",
|
|
12620
12575
|
value: function transferRelayToPara() {
|
|
12621
|
-
throw new
|
|
12576
|
+
throw new ScenarioNotSupportedError({
|
|
12577
|
+
chain: this.chain,
|
|
12578
|
+
scenario: 'RelayToPara'
|
|
12579
|
+
});
|
|
12622
12580
|
}
|
|
12623
12581
|
}, {
|
|
12624
12582
|
key: "transferLocalNonNativeAsset",
|
|
@@ -12710,7 +12668,10 @@ var PeopleKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
12710
12668
|
value: function transferPolkadotXCM(input) {
|
|
12711
12669
|
var scenario = input.scenario;
|
|
12712
12670
|
if (scenario === 'ParaToPara') {
|
|
12713
|
-
throw new ScenarioNotSupportedError(
|
|
12671
|
+
throw new ScenarioNotSupportedError({
|
|
12672
|
+
chain: this.chain,
|
|
12673
|
+
scenario: scenario
|
|
12674
|
+
});
|
|
12714
12675
|
}
|
|
12715
12676
|
var method = 'limited_teleport_assets';
|
|
12716
12677
|
return transferPolkadotXcm(input, method, 'Unlimited');
|
|
@@ -12756,7 +12717,7 @@ var determineDestWeight = function determineDestWeight(destChain) {
|
|
|
12756
12717
|
proof_size: 0n
|
|
12757
12718
|
};
|
|
12758
12719
|
}
|
|
12759
|
-
throw new
|
|
12720
|
+
throw new ScenarioNotSupportedError("Pallet XTransfer does not support transfering to ".concat(destChain, "."));
|
|
12760
12721
|
};
|
|
12761
12722
|
|
|
12762
12723
|
var transferXTransfer = function transferXTransfer(input) {
|
|
@@ -12901,7 +12862,10 @@ var RobonomicsPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
12901
12862
|
value: function transferPolkadotXCM(input) {
|
|
12902
12863
|
var scenario = input.scenario;
|
|
12903
12864
|
if (scenario === 'ParaToPara') {
|
|
12904
|
-
throw new ScenarioNotSupportedError(
|
|
12865
|
+
throw new ScenarioNotSupportedError({
|
|
12866
|
+
chain: this.chain,
|
|
12867
|
+
scenario: scenario
|
|
12868
|
+
});
|
|
12905
12869
|
}
|
|
12906
12870
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
12907
12871
|
}
|
|
@@ -12973,7 +12937,10 @@ var Shiden = /*#__PURE__*/function (_Parachain) {
|
|
|
12973
12937
|
}, {
|
|
12974
12938
|
key: "transferRelayToPara",
|
|
12975
12939
|
value: function transferRelayToPara() {
|
|
12976
|
-
throw new
|
|
12940
|
+
throw new ScenarioNotSupportedError({
|
|
12941
|
+
chain: this.chain,
|
|
12942
|
+
scenario: 'RelayToPara'
|
|
12943
|
+
});
|
|
12977
12944
|
}
|
|
12978
12945
|
}, {
|
|
12979
12946
|
key: "transferLocalNonNativeAsset",
|
|
@@ -13002,7 +12969,7 @@ var Unique = /*#__PURE__*/function (_Parachain) {
|
|
|
13002
12969
|
}, {
|
|
13003
12970
|
key: "transferLocalNonNativeAsset",
|
|
13004
12971
|
value: function transferLocalNonNativeAsset(_options) {
|
|
13005
|
-
throw new ScenarioNotSupportedError(
|
|
12972
|
+
throw new ScenarioNotSupportedError("".concat(this.chain, " does not support foreign assets local transfers"));
|
|
13006
12973
|
}
|
|
13007
12974
|
}, {
|
|
13008
12975
|
key: "getBalanceForeign",
|
|
@@ -13059,7 +13026,7 @@ var Xode = /*#__PURE__*/function (_Parachain) {
|
|
|
13059
13026
|
assetInfo = options.assetInfo,
|
|
13060
13027
|
scenario = options.scenario;
|
|
13061
13028
|
if (destChain !== 'AssetHubPolkadot' && scenario === 'ParaToPara') {
|
|
13062
|
-
throw new
|
|
13029
|
+
throw new ScenarioNotSupportedError('Xode chain only supports transfers to / from AssetHubPolkadot');
|
|
13063
13030
|
}
|
|
13064
13031
|
assertHasLocation(assetInfo);
|
|
13065
13032
|
return transferPolkadotXcm(options, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
@@ -13085,7 +13052,7 @@ var Zeitgeist = /*#__PURE__*/function (_Parachain) {
|
|
|
13085
13052
|
return _createClass(Zeitgeist, [{
|
|
13086
13053
|
key: "getCustomCurrencyId",
|
|
13087
13054
|
value: function getCustomCurrencyId(asset) {
|
|
13088
|
-
if (asset.
|
|
13055
|
+
if (asset.isNative) return 'Ztg';
|
|
13089
13056
|
assertHasId(asset);
|
|
13090
13057
|
return {
|
|
13091
13058
|
ForeignAsset: Number(asset.assetId)
|
|
@@ -13441,24 +13408,24 @@ var resolveModuleError = function resolveModuleError(chain, error) {
|
|
|
13441
13408
|
return p.index === Number(error.index);
|
|
13442
13409
|
});
|
|
13443
13410
|
if (!palletDetails) {
|
|
13444
|
-
throw new
|
|
13411
|
+
throw new RoutingResolutionError("Pallet with index ".concat(error.index, " not found"));
|
|
13445
13412
|
}
|
|
13446
13413
|
// Use only the first byte of the error to get the error index
|
|
13447
13414
|
// Including 0x prefix
|
|
13448
13415
|
var errorIndex = Number(error.error.slice(0, 4));
|
|
13449
13416
|
var name = palletDetails.name;
|
|
13450
13417
|
if (name !== 'XTokens' && name !== 'PolkadotXcm' && name !== 'XcmPallet') {
|
|
13451
|
-
throw new
|
|
13418
|
+
throw new UnsupportedOperationError("Pallet ".concat(name, " is not supported"));
|
|
13452
13419
|
}
|
|
13453
13420
|
var failureReason = name === 'XTokens' ? Object.values(XTokensError)[errorIndex] : Object.values(PolkadotXcmError)[errorIndex];
|
|
13454
13421
|
if (!failureReason) {
|
|
13455
|
-
throw new
|
|
13422
|
+
throw new RoutingResolutionError("Error index ".concat(errorIndex, " not found in ").concat(name, " pallet"));
|
|
13456
13423
|
}
|
|
13457
13424
|
if (failureReason === PolkadotXcmError.LocalExecutionIncompleteWithError) {
|
|
13458
13425
|
var subErrorIndex = Number("0x".concat(error.error.slice(6, 8)));
|
|
13459
13426
|
var failureSubReason = Object.values(PolkadotXcmExecutionError)[subErrorIndex];
|
|
13460
13427
|
if (!failureSubReason) {
|
|
13461
|
-
throw new
|
|
13428
|
+
throw new RoutingResolutionError("Sub-error index ".concat(subErrorIndex, " not found in PolkadotXcm pallet"));
|
|
13462
13429
|
}
|
|
13463
13430
|
return {
|
|
13464
13431
|
failureReason: failureReason,
|
|
@@ -13509,7 +13476,7 @@ var AssetManagerPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
13509
13476
|
}, {
|
|
13510
13477
|
key: "getBalance",
|
|
13511
13478
|
value: function getBalance() {
|
|
13512
|
-
throw new
|
|
13479
|
+
throw new UnsupportedOperationError('No balance support.');
|
|
13513
13480
|
}
|
|
13514
13481
|
}]);
|
|
13515
13482
|
}(BaseAssetsPallet);
|
|
@@ -13706,7 +13673,7 @@ var CurrenciesPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
13706
13673
|
}, {
|
|
13707
13674
|
key: "getBalance",
|
|
13708
13675
|
value: function getBalance() {
|
|
13709
|
-
throw new
|
|
13676
|
+
throw new UnsupportedOperationError('No balance support.');
|
|
13710
13677
|
}
|
|
13711
13678
|
}]);
|
|
13712
13679
|
}(BaseAssetsPallet);
|
|
@@ -13912,7 +13879,7 @@ var SystemPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
13912
13879
|
var resolveId = function resolveId(asset, chain) {
|
|
13913
13880
|
if (chain === 'BifrostPolkadot' || chain === 'BifrostKusama' || chain === 'BifrostPaseo') {
|
|
13914
13881
|
var _asset$assetId;
|
|
13915
|
-
var isEthAsset =
|
|
13882
|
+
var isEthAsset = !asset.isNative && ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.startsWith('0x'));
|
|
13916
13883
|
var resolvedAsset = isEthAsset && asset.location ? findAssetInfoOrThrow(chain, {
|
|
13917
13884
|
location: asset.location
|
|
13918
13885
|
}, null) : asset;
|
|
@@ -14088,7 +14055,7 @@ var getBalanceInternal = /*#__PURE__*/function () {
|
|
|
14088
14055
|
while (1) switch (_context2.n) {
|
|
14089
14056
|
case 0:
|
|
14090
14057
|
chain = options.chain, currency = options.currency;
|
|
14091
|
-
asset = findAssetInfoOrThrow(chain, currency, null);
|
|
14058
|
+
asset = currency ? findAssetInfoOrThrow(chain, currency, null) : findNativeAssetInfoOrThrow(chain);
|
|
14092
14059
|
return _context2.a(2, getAssetBalanceInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
14093
14060
|
asset: asset
|
|
14094
14061
|
})));
|
|
@@ -14127,25 +14094,6 @@ var getBalance = /*#__PURE__*/function () {
|
|
|
14127
14094
|
};
|
|
14128
14095
|
}();
|
|
14129
14096
|
|
|
14130
|
-
var getBalanceNative = /*#__PURE__*/function () {
|
|
14131
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
14132
|
-
var chain, currency, asset;
|
|
14133
|
-
return _regenerator().w(function (_context) {
|
|
14134
|
-
while (1) switch (_context.n) {
|
|
14135
|
-
case 0:
|
|
14136
|
-
chain = options.chain, currency = options.currency;
|
|
14137
|
-
asset = currency ? findAssetInfoOrThrow(chain, currency, null) : findNativeAssetInfoOrThrow(chain);
|
|
14138
|
-
return _context.a(2, getAssetBalanceInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
14139
|
-
asset: asset
|
|
14140
|
-
})));
|
|
14141
|
-
}
|
|
14142
|
-
}, _callee);
|
|
14143
|
-
}));
|
|
14144
|
-
return function getBalanceNative(_x) {
|
|
14145
|
-
return _ref.apply(this, arguments);
|
|
14146
|
-
};
|
|
14147
|
-
}();
|
|
14148
|
-
|
|
14149
14097
|
var ERC20_ABI = [{
|
|
14150
14098
|
type: 'function',
|
|
14151
14099
|
name: 'balanceOf',
|
|
@@ -14187,4 +14135,4 @@ var getMoonbeamErc20Balance = /*#__PURE__*/function () {
|
|
|
14187
14135
|
};
|
|
14188
14136
|
}();
|
|
14189
14137
|
|
|
14190
|
-
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 };
|