@paraspell/sdk-core 12.9.6 → 12.10.0-rc.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 +125 -163
- package/dist/index.mjs +484 -713
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -718,6 +718,26 @@ var ScenarioNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
|
718
718
|
return _createClass(ScenarioNotSupportedError);
|
|
719
719
|
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
720
720
|
|
|
721
|
+
/**
|
|
722
|
+
* Error thrown when a submitted transaction encounters a dispatch error on-chain.
|
|
723
|
+
*/
|
|
724
|
+
var SubmitTransactionError = /*#__PURE__*/function (_Error) {
|
|
725
|
+
/**
|
|
726
|
+
* Constructs a new SubmitTransactionError.
|
|
727
|
+
*
|
|
728
|
+
* @param message - The dispatch error details.
|
|
729
|
+
*/
|
|
730
|
+
function SubmitTransactionError(message) {
|
|
731
|
+
var _this;
|
|
732
|
+
_classCallCheck(this, SubmitTransactionError);
|
|
733
|
+
_this = _callSuper(this, SubmitTransactionError, [message]);
|
|
734
|
+
_this.name = 'SubmitTransactionError';
|
|
735
|
+
return _this;
|
|
736
|
+
}
|
|
737
|
+
_inherits(SubmitTransactionError, _Error);
|
|
738
|
+
return _createClass(SubmitTransactionError);
|
|
739
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error));
|
|
740
|
+
|
|
721
741
|
var TransferToAhNotSupported = /*#__PURE__*/function (_Error) {
|
|
722
742
|
function TransferToAhNotSupported(message) {
|
|
723
743
|
var _this;
|
|
@@ -2495,9 +2515,9 @@ var assertAddressIsString = function assertAddressIsString(address) {
|
|
|
2495
2515
|
throw new InvalidAddressError('Location address is not supported for this transfer type.');
|
|
2496
2516
|
}
|
|
2497
2517
|
};
|
|
2498
|
-
var
|
|
2518
|
+
var assertSender = function assertSender(address) {
|
|
2499
2519
|
if (!address) {
|
|
2500
|
-
throw new MissingParameterError('
|
|
2520
|
+
throw new MissingParameterError('sender');
|
|
2501
2521
|
}
|
|
2502
2522
|
};
|
|
2503
2523
|
var assertHasId = function assertHasId(asset) {
|
|
@@ -2505,7 +2525,7 @@ var assertHasId = function assertHasId(asset) {
|
|
|
2505
2525
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, replaceBigInt), " has no assetId"));
|
|
2506
2526
|
}
|
|
2507
2527
|
};
|
|
2508
|
-
var
|
|
2528
|
+
var assertSenderSource = function assertSenderSource(sender) {
|
|
2509
2529
|
if (sender === undefined) {
|
|
2510
2530
|
throw new InvalidAddressError('Sender address needs to be a derivation path or signer to sign and submit transaction using this method.');
|
|
2511
2531
|
}
|
|
@@ -2708,7 +2728,7 @@ var resolveAssets = function resolveAssets(_ref, version) {
|
|
|
2708
2728
|
chain = _ref.chain,
|
|
2709
2729
|
currency = _ref.currency;
|
|
2710
2730
|
var normalizeAsset = function normalizeAsset(amount, currency) {
|
|
2711
|
-
var asset = findAssetInfoOrThrow(chain, currency
|
|
2731
|
+
var asset = findAssetInfoOrThrow(chain, currency);
|
|
2712
2732
|
var abstracted = abstractDecimals(amount, asset.decimals, api);
|
|
2713
2733
|
return createAsset(version, abstracted, localizeLocation(chain, asset.location));
|
|
2714
2734
|
};
|
|
@@ -2732,6 +2752,9 @@ var resolveAssets = function resolveAssets(_ref, version) {
|
|
|
2732
2752
|
return [normalizeAsset(currency.amount, currency)];
|
|
2733
2753
|
};
|
|
2734
2754
|
|
|
2755
|
+
/**
|
|
2756
|
+
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
2757
|
+
*/
|
|
2735
2758
|
var claimAssets = /*#__PURE__*/function () {
|
|
2736
2759
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
2737
2760
|
var api, chain, address, pallets, supportedPallet, version, assets, params, call;
|
|
@@ -3017,8 +3040,8 @@ var validateTransact = function validateTransact(_ref) {
|
|
|
3017
3040
|
var api = _ref.api,
|
|
3018
3041
|
from = _ref.from,
|
|
3019
3042
|
to = _ref.to,
|
|
3020
|
-
|
|
3021
|
-
address = _ref.
|
|
3043
|
+
sender = _ref.sender,
|
|
3044
|
+
address = _ref.recipient,
|
|
3022
3045
|
transactOptions = _ref.transactOptions;
|
|
3023
3046
|
var call = transactOptions === null || transactOptions === void 0 ? void 0 : transactOptions.call;
|
|
3024
3047
|
if (!call) return;
|
|
@@ -3031,7 +3054,7 @@ var validateTransact = function validateTransact(_ref) {
|
|
|
3031
3054
|
if (isChainEvm(from) || typeof to === 'string' && isChainEvm(to)) {
|
|
3032
3055
|
throw new UnsupportedOperationError('Transact option is only supported for Substrate to Substrate scenarios.');
|
|
3033
3056
|
}
|
|
3034
|
-
if (typeof address === 'string' &&
|
|
3057
|
+
if (typeof address === 'string' && sender && !compareAddresses(api, address, sender)) {
|
|
3035
3058
|
return new ValidationError('Sender address must match the destination address for transact to work.');
|
|
3036
3059
|
}
|
|
3037
3060
|
};
|
|
@@ -3041,15 +3064,15 @@ var resolveTransferParams = function resolveTransferParams(options) {
|
|
|
3041
3064
|
origin = options.from,
|
|
3042
3065
|
currency = options.currency,
|
|
3043
3066
|
feeAsset = options.feeAsset,
|
|
3044
|
-
address = options.
|
|
3067
|
+
address = options.recipient,
|
|
3045
3068
|
destination = options.to,
|
|
3046
3069
|
version = options.version,
|
|
3047
|
-
|
|
3070
|
+
sender = options.sender;
|
|
3048
3071
|
validateCurrency(currency, feeAsset);
|
|
3049
3072
|
validateDestination(origin, destination);
|
|
3050
3073
|
validateTransact(options);
|
|
3051
3074
|
validateDestinationAddress(address, destination, api);
|
|
3052
|
-
if (
|
|
3075
|
+
if (sender) validateAddress(api, sender, origin, false);
|
|
3053
3076
|
var isBridge = !isTLocation(destination) && isSubstrateBridge(origin, destination);
|
|
3054
3077
|
var assetCheckEnabled = shouldPerformAssetCheck(origin, currency);
|
|
3055
3078
|
validateAssetSpecifiers(assetCheckEnabled, currency);
|
|
@@ -3092,11 +3115,11 @@ var resolveTransferParams = function resolveTransferParams(options) {
|
|
|
3092
3115
|
};
|
|
3093
3116
|
var createTransfer = /*#__PURE__*/function () {
|
|
3094
3117
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
3095
|
-
var api, origin, currency, feeAsset,
|
|
3118
|
+
var api, origin, currency, feeAsset, recipient, destination, paraIdTo, sender, ahAddress, pallet, method, transactOptions, isAmountAll, keepAlive, _resolveTransferParam, resolvedFeeAsset, resolvedVersion, overriddenAsset, normalizedAsset;
|
|
3096
3119
|
return _regenerator().w(function (_context) {
|
|
3097
3120
|
while (1) switch (_context.n) {
|
|
3098
3121
|
case 0:
|
|
3099
|
-
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset,
|
|
3122
|
+
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, recipient = options.recipient, destination = options.to, paraIdTo = options.paraIdTo, sender = options.sender, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method, transactOptions = options.transactOptions, isAmountAll = options.isAmountAll, keepAlive = options.keepAlive;
|
|
3100
3123
|
_resolveTransferParam = resolveTransferParams(options), resolvedFeeAsset = _resolveTransferParam.resolvedFeeAsset, resolvedVersion = _resolveTransferParam.resolvedVersion, overriddenAsset = _resolveTransferParam.overriddenAsset, normalizedAsset = _resolveTransferParam.normalizedAsset;
|
|
3101
3124
|
_context.n = 1;
|
|
3102
3125
|
return api.init(origin, TX_CLIENT_TIMEOUT_MS);
|
|
@@ -3107,12 +3130,12 @@ var createTransfer = /*#__PURE__*/function () {
|
|
|
3107
3130
|
currency: currency,
|
|
3108
3131
|
feeAsset: resolvedFeeAsset,
|
|
3109
3132
|
feeCurrency: feeAsset,
|
|
3110
|
-
|
|
3133
|
+
recipient: recipient,
|
|
3111
3134
|
to: destination,
|
|
3112
3135
|
paraIdTo: paraIdTo,
|
|
3113
3136
|
overriddenAsset: overriddenAsset,
|
|
3114
3137
|
version: resolvedVersion,
|
|
3115
|
-
|
|
3138
|
+
sender: sender,
|
|
3116
3139
|
ahAddress: ahAddress,
|
|
3117
3140
|
pallet: pallet,
|
|
3118
3141
|
method: method,
|
|
@@ -3208,6 +3231,8 @@ var getMythosOriginFee = /*#__PURE__*/function () {
|
|
|
3208
3231
|
|
|
3209
3232
|
/**
|
|
3210
3233
|
* Builder class for constructing asset claim transactions.
|
|
3234
|
+
*
|
|
3235
|
+
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
3211
3236
|
*/
|
|
3212
3237
|
var AssetClaimBuilder = /*#__PURE__*/function () {
|
|
3213
3238
|
function AssetClaimBuilder(api, options) {
|
|
@@ -3235,14 +3260,14 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
|
|
|
3235
3260
|
* @returns
|
|
3236
3261
|
*/
|
|
3237
3262
|
}, {
|
|
3238
|
-
key: "
|
|
3239
|
-
value: function
|
|
3240
|
-
var isPath = typeof
|
|
3241
|
-
var isPathOrSigner = isPath || isSenderSigner(
|
|
3242
|
-
var address = isPathOrSigner ? this.api.deriveAddress(
|
|
3263
|
+
key: "sender",
|
|
3264
|
+
value: function sender(_sender) {
|
|
3265
|
+
var isPath = typeof _sender === 'string' && _sender.startsWith('//');
|
|
3266
|
+
var isPathOrSigner = isPath || isSenderSigner(_sender);
|
|
3267
|
+
var address = isPathOrSigner ? this.api.deriveAddress(_sender) : _sender;
|
|
3243
3268
|
return new AssetClaimBuilder(this.api, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
3244
|
-
|
|
3245
|
-
|
|
3269
|
+
sender: address,
|
|
3270
|
+
senderSource: isPathOrSigner ? _sender : undefined
|
|
3246
3271
|
}));
|
|
3247
3272
|
}
|
|
3248
3273
|
/**
|
|
@@ -3293,8 +3318,8 @@ var AssetClaimBuilder = /*#__PURE__*/function () {
|
|
|
3293
3318
|
return _regenerator().w(function (_context) {
|
|
3294
3319
|
while (1) switch (_context.n) {
|
|
3295
3320
|
case 0:
|
|
3296
|
-
sender = this._options.
|
|
3297
|
-
|
|
3321
|
+
sender = this._options.senderSource;
|
|
3322
|
+
assertSenderSource(sender);
|
|
3298
3323
|
_context.n = 1;
|
|
3299
3324
|
return claimAssets(_objectSpread2({
|
|
3300
3325
|
api: this.api
|
|
@@ -3481,7 +3506,7 @@ var normalizeAmountAll = /*#__PURE__*/function () {
|
|
|
3481
3506
|
}));
|
|
3482
3507
|
buildTx = builderWithMinAmount['createTxFactory']();
|
|
3483
3508
|
assertToIsString(options.to);
|
|
3484
|
-
|
|
3509
|
+
assertSender(options.sender);
|
|
3485
3510
|
if (!swapOptions) {
|
|
3486
3511
|
_context.n = 3;
|
|
3487
3512
|
break;
|
|
@@ -3504,7 +3529,7 @@ var normalizeAmountAll = /*#__PURE__*/function () {
|
|
|
3504
3529
|
buildTx: buildTx,
|
|
3505
3530
|
origin: options.from,
|
|
3506
3531
|
destination: options.to,
|
|
3507
|
-
|
|
3532
|
+
sender: options.sender,
|
|
3508
3533
|
feeAsset: options.feeAsset,
|
|
3509
3534
|
version: options.version,
|
|
3510
3535
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
@@ -3628,8 +3653,7 @@ var BatchTransactionManager = /*#__PURE__*/function () {
|
|
|
3628
3653
|
*/
|
|
3629
3654
|
var buildDryRun = function buildDryRun(api, tx, options, bypassOptions) {
|
|
3630
3655
|
var to = options.to,
|
|
3631
|
-
|
|
3632
|
-
senderAddress = options.senderAddress,
|
|
3656
|
+
sender = options.sender,
|
|
3633
3657
|
feeAsset = options.feeAsset,
|
|
3634
3658
|
from = options.from,
|
|
3635
3659
|
currency = options.currency,
|
|
@@ -3637,17 +3661,13 @@ var buildDryRun = function buildDryRun(api, tx, options, bypassOptions) {
|
|
|
3637
3661
|
if (isTLocation(to)) {
|
|
3638
3662
|
throw new InvalidAddressError('Location destination is not supported for XCM fee calculation.');
|
|
3639
3663
|
}
|
|
3640
|
-
if (isTLocation(address)) {
|
|
3641
|
-
throw new InvalidAddressError('Location address is not supported for XCM fee calculation.');
|
|
3642
|
-
}
|
|
3643
3664
|
return dryRun({
|
|
3644
3665
|
api: api,
|
|
3645
3666
|
tx: tx,
|
|
3646
|
-
|
|
3667
|
+
sender: sender,
|
|
3647
3668
|
origin: from,
|
|
3648
3669
|
destination: to,
|
|
3649
3670
|
currency: currency,
|
|
3650
|
-
senderAddress: senderAddress,
|
|
3651
3671
|
feeAsset: feeAsset,
|
|
3652
3672
|
version: version,
|
|
3653
3673
|
bypassOptions: bypassOptions
|
|
@@ -3695,6 +3715,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3695
3715
|
/**
|
|
3696
3716
|
* Initiates the process to claim assets from a specified chain.
|
|
3697
3717
|
*
|
|
3718
|
+
* @deprecated Asset claim functionality is deprecated and will be removed in v14.
|
|
3698
3719
|
* @param chain - The chain from which to claim assets.
|
|
3699
3720
|
* @returns An instance of Builder
|
|
3700
3721
|
*/
|
|
@@ -3721,33 +3742,33 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
3721
3742
|
/**
|
|
3722
3743
|
* Sets the recipient address.
|
|
3723
3744
|
*
|
|
3724
|
-
* @param address - The destination
|
|
3745
|
+
* @param address - The recipient address on the destination chain.
|
|
3725
3746
|
* @returns An instance of Builder
|
|
3726
3747
|
*/
|
|
3727
3748
|
}, {
|
|
3728
|
-
key: "
|
|
3729
|
-
value: function address
|
|
3730
|
-
var isPath = typeof
|
|
3731
|
-
var resolvedAddress = isPath ? this.api.deriveAddress(
|
|
3749
|
+
key: "recipient",
|
|
3750
|
+
value: function recipient(address) {
|
|
3751
|
+
var isPath = typeof address === 'string' && address.startsWith('//');
|
|
3752
|
+
var resolvedAddress = isPath ? this.api.deriveAddress(address) : address;
|
|
3732
3753
|
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
3733
|
-
|
|
3754
|
+
recipient: resolvedAddress
|
|
3734
3755
|
}));
|
|
3735
3756
|
}
|
|
3736
3757
|
/**
|
|
3737
3758
|
* Sets the sender address.
|
|
3738
3759
|
*
|
|
3739
|
-
* @param
|
|
3740
|
-
* @returns
|
|
3760
|
+
* @param sender - The sender address or signer.
|
|
3761
|
+
* @returns An instance of Builder
|
|
3741
3762
|
*/
|
|
3742
3763
|
}, {
|
|
3743
|
-
key: "
|
|
3744
|
-
value: function
|
|
3745
|
-
var isPath = typeof
|
|
3746
|
-
var isPathOrSigner = isPath || isSenderSigner(
|
|
3747
|
-
var address = isPathOrSigner ? this.api.deriveAddress(
|
|
3764
|
+
key: "sender",
|
|
3765
|
+
value: function sender(_sender) {
|
|
3766
|
+
var isPath = typeof _sender === 'string' && _sender.startsWith('//');
|
|
3767
|
+
var isPathOrSigner = isPath || isSenderSigner(_sender);
|
|
3768
|
+
var address = isPathOrSigner ? this.api.deriveAddress(_sender) : _sender;
|
|
3748
3769
|
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
3749
|
-
|
|
3750
|
-
|
|
3770
|
+
sender: address,
|
|
3771
|
+
senderSource: isPathOrSigner ? _sender : undefined
|
|
3751
3772
|
}));
|
|
3752
3773
|
}
|
|
3753
3774
|
/**
|
|
@@ -4059,20 +4080,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4059
4080
|
key: "maybePerformXcmFormatCheck",
|
|
4060
4081
|
value: function () {
|
|
4061
4082
|
var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(tx, options, isCalledInternally) {
|
|
4062
|
-
var
|
|
4083
|
+
var sender, config, dryRunResult;
|
|
4063
4084
|
return _regenerator().w(function (_context7) {
|
|
4064
4085
|
while (1) switch (_context7.n) {
|
|
4065
4086
|
case 0:
|
|
4066
|
-
|
|
4087
|
+
sender = options.sender;
|
|
4067
4088
|
config = this.api.getConfig();
|
|
4068
4089
|
if (!(isConfig(config) && config.xcmFormatCheck && !isCalledInternally)) {
|
|
4069
4090
|
_context7.n = 2;
|
|
4070
4091
|
break;
|
|
4071
4092
|
}
|
|
4072
|
-
|
|
4093
|
+
assertSender(sender);
|
|
4073
4094
|
_context7.n = 1;
|
|
4074
4095
|
return buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
4075
|
-
|
|
4096
|
+
sender: sender
|
|
4076
4097
|
}), {
|
|
4077
4098
|
sentAssetMintMode: 'bypass'
|
|
4078
4099
|
});
|
|
@@ -4109,9 +4130,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4109
4130
|
return _context8.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4110
4131
|
api: this.api,
|
|
4111
4132
|
swapOptions: swapOptions
|
|
4112
|
-
}),
|
|
4113
|
-
// Temporarily use type cast till the swap pkg dep is released and updated
|
|
4114
|
-
function (builder) {
|
|
4133
|
+
}), function (builder) {
|
|
4115
4134
|
return builder.dryRun();
|
|
4116
4135
|
}));
|
|
4117
4136
|
case 1:
|
|
@@ -4178,7 +4197,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4178
4197
|
value: (function () {
|
|
4179
4198
|
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
4180
4199
|
var _options$disableFallb;
|
|
4181
|
-
var disableFallback, _yield$this$prepareNo3, normalizedOptions, buildTx, api, from, to,
|
|
4200
|
+
var disableFallback, _yield$this$prepareNo3, normalizedOptions, buildTx, api, from, to, sender, recipient, currency, feeAsset, version, swapOptions;
|
|
4182
4201
|
return _regenerator().w(function (_context0) {
|
|
4183
4202
|
while (1) switch (_context0.n) {
|
|
4184
4203
|
case 0:
|
|
@@ -4189,9 +4208,9 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4189
4208
|
_yield$this$prepareNo3 = _context0.v;
|
|
4190
4209
|
normalizedOptions = _yield$this$prepareNo3.normalizedOptions;
|
|
4191
4210
|
buildTx = _yield$this$prepareNo3.buildTx;
|
|
4192
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4211
|
+
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4193
4212
|
assertToIsString(to);
|
|
4194
|
-
assertAddressIsString(
|
|
4213
|
+
assertAddressIsString(recipient);
|
|
4195
4214
|
if (!swapOptions) {
|
|
4196
4215
|
_context0.n = 2;
|
|
4197
4216
|
break;
|
|
@@ -4207,8 +4226,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4207
4226
|
buildTx: buildTx,
|
|
4208
4227
|
origin: from,
|
|
4209
4228
|
destination: to,
|
|
4210
|
-
|
|
4211
|
-
|
|
4229
|
+
sender: sender,
|
|
4230
|
+
recipient: recipient,
|
|
4212
4231
|
version: version,
|
|
4213
4232
|
currency: currency,
|
|
4214
4233
|
feeAsset: feeAsset,
|
|
@@ -4240,7 +4259,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4240
4259
|
api,
|
|
4241
4260
|
from,
|
|
4242
4261
|
to,
|
|
4243
|
-
|
|
4262
|
+
sender,
|
|
4244
4263
|
currency,
|
|
4245
4264
|
feeAsset,
|
|
4246
4265
|
version,
|
|
@@ -4258,7 +4277,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4258
4277
|
_yield$this$prepareNo4 = _context1.v;
|
|
4259
4278
|
normalizedOptions = _yield$this$prepareNo4.normalizedOptions;
|
|
4260
4279
|
buildTx = _yield$this$prepareNo4.buildTx;
|
|
4261
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4280
|
+
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4262
4281
|
assertToIsString(to);
|
|
4263
4282
|
assertSwapSupport(swapOptions);
|
|
4264
4283
|
_context1.p = 2;
|
|
@@ -4268,7 +4287,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4268
4287
|
buildTx: buildTx,
|
|
4269
4288
|
origin: from,
|
|
4270
4289
|
destination: to,
|
|
4271
|
-
|
|
4290
|
+
sender: sender,
|
|
4272
4291
|
version: version,
|
|
4273
4292
|
currency: currency,
|
|
4274
4293
|
feeAsset: feeAsset,
|
|
@@ -4293,24 +4312,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4293
4312
|
return getOriginXcmFee$1;
|
|
4294
4313
|
}()
|
|
4295
4314
|
/**
|
|
4296
|
-
*
|
|
4297
|
-
*
|
|
4298
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
4299
|
-
* Please use `builder.getXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
4300
|
-
* Will be removed in v13.
|
|
4301
|
-
* For more details, see the documentation:
|
|
4302
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
4315
|
+
* Returns the max transferable amount for the transfer
|
|
4303
4316
|
*
|
|
4304
|
-
* @returns
|
|
4317
|
+
* @returns The max transferable amount.
|
|
4305
4318
|
*/
|
|
4306
4319
|
)
|
|
4307
4320
|
}, {
|
|
4308
|
-
key: "
|
|
4321
|
+
key: "getTransferableAmount",
|
|
4309
4322
|
value: (function () {
|
|
4310
|
-
var
|
|
4311
|
-
var _yield$this$prepareNo5, normalizedOptions, buildTx, api, from, to,
|
|
4323
|
+
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
4324
|
+
var _yield$this$prepareNo5, normalizedOptions, buildTx, api, from, to, sender, currency, feeAsset, version, swapOptions;
|
|
4312
4325
|
return _regenerator().w(function (_context10) {
|
|
4313
|
-
while (1) switch (_context10.
|
|
4326
|
+
while (1) switch (_context10.n) {
|
|
4314
4327
|
case 0:
|
|
4315
4328
|
_context10.n = 1;
|
|
4316
4329
|
return this.prepareNormalizedOptions(this._options);
|
|
@@ -4318,148 +4331,30 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4318
4331
|
_yield$this$prepareNo5 = _context10.v;
|
|
4319
4332
|
normalizedOptions = _yield$this$prepareNo5.normalizedOptions;
|
|
4320
4333
|
buildTx = _yield$this$prepareNo5.buildTx;
|
|
4321
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4322
|
-
assertToIsString(to);
|
|
4323
|
-
assertAddressIsString(address);
|
|
4324
|
-
assertSwapSupport(swapOptions);
|
|
4325
|
-
_context10.n = 2;
|
|
4326
|
-
return buildTx();
|
|
4327
|
-
case 2:
|
|
4328
|
-
tx = _context10.v;
|
|
4329
|
-
_context10.p = 3;
|
|
4330
|
-
_context10.n = 4;
|
|
4331
|
-
return getXcmFeeEstimate({
|
|
4332
|
-
api: api,
|
|
4333
|
-
tx: tx,
|
|
4334
|
-
origin: from,
|
|
4335
|
-
destination: to,
|
|
4336
|
-
address: address,
|
|
4337
|
-
senderAddress: senderAddress,
|
|
4338
|
-
currency: currency
|
|
4339
|
-
});
|
|
4340
|
-
case 4:
|
|
4341
|
-
return _context10.a(2, _context10.v);
|
|
4342
|
-
case 5:
|
|
4343
|
-
_context10.p = 5;
|
|
4344
|
-
_context10.n = 6;
|
|
4345
|
-
return this.api.disconnect();
|
|
4346
|
-
case 6:
|
|
4347
|
-
return _context10.f(5);
|
|
4348
|
-
case 7:
|
|
4349
|
-
return _context10.a(2);
|
|
4350
|
-
}
|
|
4351
|
-
}, _callee10, this, [[3,, 5, 7]]);
|
|
4352
|
-
}));
|
|
4353
|
-
function getXcmFeeEstimate$1() {
|
|
4354
|
-
return _getXcmFeeEstimate2.apply(this, arguments);
|
|
4355
|
-
}
|
|
4356
|
-
return getXcmFeeEstimate$1;
|
|
4357
|
-
}()
|
|
4358
|
-
/**
|
|
4359
|
-
* Estimates the origin XCM fee using paymentInfo function.
|
|
4360
|
-
*
|
|
4361
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
4362
|
-
* Please use `builder.getOriginXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
4363
|
-
* Will be removed in v13.
|
|
4364
|
-
* For more details, see the documentation:
|
|
4365
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
4366
|
-
*
|
|
4367
|
-
* @returns An origin fee estimate.
|
|
4368
|
-
*/
|
|
4369
|
-
)
|
|
4370
|
-
}, {
|
|
4371
|
-
key: "getOriginXcmFeeEstimate",
|
|
4372
|
-
value: (function () {
|
|
4373
|
-
var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
4374
|
-
var _yield$this$prepareNo6, normalizedOptions, buildTx, api, from, to, senderAddress, currency, swapOptions, tx;
|
|
4375
|
-
return _regenerator().w(function (_context11) {
|
|
4376
|
-
while (1) switch (_context11.p = _context11.n) {
|
|
4377
|
-
case 0:
|
|
4378
|
-
_context11.n = 1;
|
|
4379
|
-
return this.prepareNormalizedOptions(this._options);
|
|
4380
|
-
case 1:
|
|
4381
|
-
_yield$this$prepareNo6 = _context11.v;
|
|
4382
|
-
normalizedOptions = _yield$this$prepareNo6.normalizedOptions;
|
|
4383
|
-
buildTx = _yield$this$prepareNo6.buildTx;
|
|
4384
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency, swapOptions = normalizedOptions.swapOptions;
|
|
4385
|
-
assertToIsString(to);
|
|
4386
|
-
assertSwapSupport(swapOptions);
|
|
4387
|
-
_context11.n = 2;
|
|
4388
|
-
return buildTx();
|
|
4389
|
-
case 2:
|
|
4390
|
-
tx = _context11.v;
|
|
4391
|
-
_context11.p = 3;
|
|
4392
|
-
_context11.n = 4;
|
|
4393
|
-
return getOriginXcmFeeEstimate({
|
|
4394
|
-
api: api,
|
|
4395
|
-
tx: tx,
|
|
4396
|
-
origin: from,
|
|
4397
|
-
destination: to,
|
|
4398
|
-
currency: currency,
|
|
4399
|
-
senderAddress: senderAddress
|
|
4400
|
-
});
|
|
4401
|
-
case 4:
|
|
4402
|
-
return _context11.a(2, _context11.v);
|
|
4403
|
-
case 5:
|
|
4404
|
-
_context11.p = 5;
|
|
4405
|
-
_context11.n = 6;
|
|
4406
|
-
return this.api.disconnect();
|
|
4407
|
-
case 6:
|
|
4408
|
-
return _context11.f(5);
|
|
4409
|
-
case 7:
|
|
4410
|
-
return _context11.a(2);
|
|
4411
|
-
}
|
|
4412
|
-
}, _callee11, this, [[3,, 5, 7]]);
|
|
4413
|
-
}));
|
|
4414
|
-
function getOriginXcmFeeEstimate$1() {
|
|
4415
|
-
return _getOriginXcmFeeEstimate2.apply(this, arguments);
|
|
4416
|
-
}
|
|
4417
|
-
return getOriginXcmFeeEstimate$1;
|
|
4418
|
-
}()
|
|
4419
|
-
/**
|
|
4420
|
-
* Returns the max transferable amount for the transfer
|
|
4421
|
-
*
|
|
4422
|
-
* @returns The max transferable amount.
|
|
4423
|
-
*/
|
|
4424
|
-
)
|
|
4425
|
-
}, {
|
|
4426
|
-
key: "getTransferableAmount",
|
|
4427
|
-
value: (function () {
|
|
4428
|
-
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
4429
|
-
var _yield$this$prepareNo7, normalizedOptions, buildTx, api, from, to, senderAddress, currency, feeAsset, version, swapOptions;
|
|
4430
|
-
return _regenerator().w(function (_context12) {
|
|
4431
|
-
while (1) switch (_context12.n) {
|
|
4432
|
-
case 0:
|
|
4433
|
-
_context12.n = 1;
|
|
4434
|
-
return this.prepareNormalizedOptions(this._options);
|
|
4435
|
-
case 1:
|
|
4436
|
-
_yield$this$prepareNo7 = _context12.v;
|
|
4437
|
-
normalizedOptions = _yield$this$prepareNo7.normalizedOptions;
|
|
4438
|
-
buildTx = _yield$this$prepareNo7.buildTx;
|
|
4439
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4334
|
+
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4440
4335
|
assertToIsString(to);
|
|
4441
4336
|
if (!swapOptions) {
|
|
4442
|
-
|
|
4337
|
+
_context10.n = 2;
|
|
4443
4338
|
break;
|
|
4444
4339
|
}
|
|
4445
|
-
return
|
|
4340
|
+
return _context10.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
|
|
4446
4341
|
swapOptions: swapOptions
|
|
4447
4342
|
}), function (builder) {
|
|
4448
4343
|
return builder.getTransferableAmount();
|
|
4449
4344
|
}));
|
|
4450
4345
|
case 2:
|
|
4451
|
-
return
|
|
4346
|
+
return _context10.a(2, getTransferableAmount({
|
|
4452
4347
|
api: api,
|
|
4453
4348
|
buildTx: buildTx,
|
|
4454
4349
|
origin: from,
|
|
4455
4350
|
destination: to,
|
|
4456
|
-
|
|
4351
|
+
sender: sender,
|
|
4457
4352
|
feeAsset: feeAsset,
|
|
4458
4353
|
version: version,
|
|
4459
4354
|
currency: currency
|
|
4460
4355
|
}));
|
|
4461
4356
|
}
|
|
4462
|
-
},
|
|
4357
|
+
}, _callee10, this);
|
|
4463
4358
|
}));
|
|
4464
4359
|
function getTransferableAmount$1() {
|
|
4465
4360
|
return _getTransferableAmount2.apply(this, arguments);
|
|
@@ -4475,44 +4370,44 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4475
4370
|
}, {
|
|
4476
4371
|
key: "getMinTransferableAmount",
|
|
4477
4372
|
value: (function () {
|
|
4478
|
-
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4479
|
-
var _yield$this$
|
|
4480
|
-
return _regenerator().w(function (
|
|
4481
|
-
while (1) switch (
|
|
4373
|
+
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
4374
|
+
var _yield$this$prepareNo6, normalizedOptions, buildTx, api, from, to, sender, recipient, currency, feeAsset, version, swapOptions;
|
|
4375
|
+
return _regenerator().w(function (_context11) {
|
|
4376
|
+
while (1) switch (_context11.n) {
|
|
4482
4377
|
case 0:
|
|
4483
|
-
|
|
4378
|
+
_context11.n = 1;
|
|
4484
4379
|
return this.prepareNormalizedOptions(this._options);
|
|
4485
4380
|
case 1:
|
|
4486
|
-
_yield$this$
|
|
4487
|
-
normalizedOptions = _yield$this$
|
|
4488
|
-
buildTx = _yield$this$
|
|
4489
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4381
|
+
_yield$this$prepareNo6 = _context11.v;
|
|
4382
|
+
normalizedOptions = _yield$this$prepareNo6.normalizedOptions;
|
|
4383
|
+
buildTx = _yield$this$prepareNo6.buildTx;
|
|
4384
|
+
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4490
4385
|
assertToIsString(to);
|
|
4491
|
-
assertAddressIsString(
|
|
4386
|
+
assertAddressIsString(recipient);
|
|
4492
4387
|
if (!swapOptions) {
|
|
4493
|
-
|
|
4388
|
+
_context11.n = 2;
|
|
4494
4389
|
break;
|
|
4495
4390
|
}
|
|
4496
|
-
return
|
|
4391
|
+
return _context11.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
|
|
4497
4392
|
swapOptions: swapOptions
|
|
4498
4393
|
}), function (builder) {
|
|
4499
4394
|
return builder.getMinTransferableAmount();
|
|
4500
4395
|
}));
|
|
4501
4396
|
case 2:
|
|
4502
|
-
return
|
|
4397
|
+
return _context11.a(2, getMinTransferableAmount({
|
|
4503
4398
|
api: api,
|
|
4504
4399
|
buildTx: buildTx,
|
|
4505
4400
|
origin: from,
|
|
4506
4401
|
destination: to,
|
|
4507
|
-
|
|
4508
|
-
|
|
4402
|
+
sender: sender,
|
|
4403
|
+
recipient: recipient,
|
|
4509
4404
|
feeAsset: feeAsset,
|
|
4510
4405
|
version: version,
|
|
4511
4406
|
currency: currency,
|
|
4512
4407
|
builder: this
|
|
4513
4408
|
}));
|
|
4514
4409
|
}
|
|
4515
|
-
},
|
|
4410
|
+
}, _callee11, this);
|
|
4516
4411
|
}));
|
|
4517
4412
|
function getMinTransferableAmount$1() {
|
|
4518
4413
|
return _getMinTransferableAmount2.apply(this, arguments);
|
|
@@ -4528,34 +4423,34 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4528
4423
|
}, {
|
|
4529
4424
|
key: "verifyEdOnDestination",
|
|
4530
4425
|
value: (function () {
|
|
4531
|
-
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4532
|
-
var _yield$this$
|
|
4533
|
-
return _regenerator().w(function (
|
|
4534
|
-
while (1) switch (
|
|
4426
|
+
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
4427
|
+
var _yield$this$prepareNo7, normalizedOptions, buildTx, api, from, to, sender, recipient, currency, feeAsset, version, swapOptions;
|
|
4428
|
+
return _regenerator().w(function (_context12) {
|
|
4429
|
+
while (1) switch (_context12.n) {
|
|
4535
4430
|
case 0:
|
|
4536
|
-
|
|
4431
|
+
_context12.n = 1;
|
|
4537
4432
|
return this.prepareNormalizedOptions(this._options);
|
|
4538
4433
|
case 1:
|
|
4539
|
-
_yield$this$
|
|
4540
|
-
normalizedOptions = _yield$this$
|
|
4541
|
-
buildTx = _yield$this$
|
|
4542
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4434
|
+
_yield$this$prepareNo7 = _context12.v;
|
|
4435
|
+
normalizedOptions = _yield$this$prepareNo7.normalizedOptions;
|
|
4436
|
+
buildTx = _yield$this$prepareNo7.buildTx;
|
|
4437
|
+
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, sender = normalizedOptions.sender, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4543
4438
|
assertToIsString(to);
|
|
4544
|
-
assertAddressIsString(
|
|
4439
|
+
assertAddressIsString(recipient);
|
|
4545
4440
|
assertSwapSupport(swapOptions);
|
|
4546
|
-
return
|
|
4441
|
+
return _context12.a(2, verifyEdOnDestination({
|
|
4547
4442
|
api: api,
|
|
4548
4443
|
buildTx: buildTx,
|
|
4549
4444
|
origin: from,
|
|
4550
4445
|
destination: to,
|
|
4551
|
-
|
|
4446
|
+
sender: sender,
|
|
4447
|
+
recipient: recipient,
|
|
4552
4448
|
version: version,
|
|
4553
|
-
senderAddress: senderAddress,
|
|
4554
4449
|
feeAsset: feeAsset,
|
|
4555
4450
|
currency: currency
|
|
4556
4451
|
}));
|
|
4557
4452
|
}
|
|
4558
|
-
},
|
|
4453
|
+
}, _callee12, this);
|
|
4559
4454
|
}));
|
|
4560
4455
|
function verifyEdOnDestination$1() {
|
|
4561
4456
|
return _verifyEdOnDestination2.apply(this, arguments);
|
|
@@ -4571,35 +4466,35 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4571
4466
|
}, {
|
|
4572
4467
|
key: "getTransferInfo",
|
|
4573
4468
|
value: (function () {
|
|
4574
|
-
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4575
|
-
var _yield$this$
|
|
4576
|
-
return _regenerator().w(function (
|
|
4577
|
-
while (1) switch (
|
|
4469
|
+
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
4470
|
+
var _yield$this$prepareNo8, normalizedOptions, buildTx, api, from, to, recipient, currency, ahAddress, sender, feeAsset, version, swapOptions;
|
|
4471
|
+
return _regenerator().w(function (_context13) {
|
|
4472
|
+
while (1) switch (_context13.n) {
|
|
4578
4473
|
case 0:
|
|
4579
|
-
|
|
4474
|
+
_context13.n = 1;
|
|
4580
4475
|
return this.prepareNormalizedOptions(this._options);
|
|
4581
4476
|
case 1:
|
|
4582
|
-
_yield$this$
|
|
4583
|
-
normalizedOptions = _yield$this$
|
|
4584
|
-
buildTx = _yield$this$
|
|
4585
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4477
|
+
_yield$this$prepareNo8 = _context13.v;
|
|
4478
|
+
normalizedOptions = _yield$this$prepareNo8.normalizedOptions;
|
|
4479
|
+
buildTx = _yield$this$prepareNo8.buildTx;
|
|
4480
|
+
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, recipient = normalizedOptions.recipient, currency = normalizedOptions.currency, ahAddress = normalizedOptions.ahAddress, sender = normalizedOptions.sender, feeAsset = normalizedOptions.feeAsset, version = normalizedOptions.version, swapOptions = normalizedOptions.swapOptions;
|
|
4586
4481
|
assertToIsString(to);
|
|
4587
|
-
assertAddressIsString(
|
|
4482
|
+
assertAddressIsString(recipient);
|
|
4588
4483
|
assertSwapSupport(swapOptions);
|
|
4589
|
-
return
|
|
4484
|
+
return _context13.a(2, getTransferInfo({
|
|
4590
4485
|
api: api,
|
|
4591
4486
|
buildTx: buildTx,
|
|
4592
4487
|
origin: from,
|
|
4593
4488
|
destination: to,
|
|
4594
|
-
|
|
4595
|
-
|
|
4489
|
+
sender: sender,
|
|
4490
|
+
recipient: recipient,
|
|
4596
4491
|
ahAddress: ahAddress,
|
|
4597
4492
|
version: version,
|
|
4598
4493
|
currency: currency,
|
|
4599
4494
|
feeAsset: feeAsset
|
|
4600
4495
|
}));
|
|
4601
4496
|
}
|
|
4602
|
-
},
|
|
4497
|
+
}, _callee13, this);
|
|
4603
4498
|
}));
|
|
4604
4499
|
function getTransferInfo$1() {
|
|
4605
4500
|
return _getTransferInfo2.apply(this, arguments);
|
|
@@ -4616,25 +4511,25 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4616
4511
|
}, {
|
|
4617
4512
|
key: "getReceivableAmount",
|
|
4618
4513
|
value: (function () {
|
|
4619
|
-
var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4514
|
+
var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
4620
4515
|
var _yield$this$getTransf, receivedAmount;
|
|
4621
|
-
return _regenerator().w(function (
|
|
4622
|
-
while (1) switch (
|
|
4516
|
+
return _regenerator().w(function (_context14) {
|
|
4517
|
+
while (1) switch (_context14.n) {
|
|
4623
4518
|
case 0:
|
|
4624
|
-
|
|
4519
|
+
_context14.n = 1;
|
|
4625
4520
|
return this.getTransferInfo();
|
|
4626
4521
|
case 1:
|
|
4627
|
-
_yield$this$getTransf =
|
|
4522
|
+
_yield$this$getTransf = _context14.v;
|
|
4628
4523
|
receivedAmount = _yield$this$getTransf.destination.receivedCurrency.receivedAmount;
|
|
4629
4524
|
if (!(receivedAmount instanceof UnableToComputeError)) {
|
|
4630
|
-
|
|
4525
|
+
_context14.n = 2;
|
|
4631
4526
|
break;
|
|
4632
4527
|
}
|
|
4633
4528
|
throw receivedAmount;
|
|
4634
4529
|
case 2:
|
|
4635
|
-
return
|
|
4530
|
+
return _context14.a(2, receivedAmount);
|
|
4636
4531
|
}
|
|
4637
|
-
},
|
|
4532
|
+
}, _callee14, this);
|
|
4638
4533
|
}));
|
|
4639
4534
|
function getReceivableAmount() {
|
|
4640
4535
|
return _getReceivableAmount.apply(this, arguments);
|
|
@@ -4644,20 +4539,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4644
4539
|
}, {
|
|
4645
4540
|
key: "getBestAmountOut",
|
|
4646
4541
|
value: function () {
|
|
4647
|
-
var _getBestAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4542
|
+
var _getBestAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
4648
4543
|
var swapOptions;
|
|
4649
|
-
return _regenerator().w(function (
|
|
4650
|
-
while (1) switch (
|
|
4544
|
+
return _regenerator().w(function (_context15) {
|
|
4545
|
+
while (1) switch (_context15.n) {
|
|
4651
4546
|
case 0:
|
|
4652
4547
|
swapOptions = this._options.swapOptions;
|
|
4653
|
-
return
|
|
4548
|
+
return _context15.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4654
4549
|
api: this.api,
|
|
4655
4550
|
swapOptions: swapOptions
|
|
4656
4551
|
}), function (builder) {
|
|
4657
4552
|
return builder.getBestAmountOut();
|
|
4658
4553
|
}));
|
|
4659
4554
|
}
|
|
4660
|
-
},
|
|
4555
|
+
}, _callee15, this);
|
|
4661
4556
|
}));
|
|
4662
4557
|
function getBestAmountOut() {
|
|
4663
4558
|
return _getBestAmountOut.apply(this, arguments);
|
|
@@ -4667,52 +4562,93 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4667
4562
|
}, {
|
|
4668
4563
|
key: "signAndSubmit",
|
|
4669
4564
|
value: function () {
|
|
4670
|
-
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4671
|
-
var _this$_options,
|
|
4672
|
-
return _regenerator().w(function (
|
|
4673
|
-
while (1) switch (
|
|
4565
|
+
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
|
|
4566
|
+
var _this$_options, senderSource, swapOptions, txHashes, _yield$this$buildInte3, tx;
|
|
4567
|
+
return _regenerator().w(function (_context16) {
|
|
4568
|
+
while (1) switch (_context16.n) {
|
|
4674
4569
|
case 0:
|
|
4675
|
-
_this$_options = this._options,
|
|
4676
|
-
|
|
4570
|
+
_this$_options = this._options, senderSource = _this$_options.senderSource, swapOptions = _this$_options.swapOptions;
|
|
4571
|
+
assertSenderSource(senderSource);
|
|
4677
4572
|
if (!swapOptions) {
|
|
4678
|
-
|
|
4573
|
+
_context16.n = 3;
|
|
4679
4574
|
break;
|
|
4680
4575
|
}
|
|
4681
|
-
if (isSenderSigner(
|
|
4682
|
-
|
|
4576
|
+
if (isSenderSigner(senderSource)) {
|
|
4577
|
+
_context16.n = 1;
|
|
4683
4578
|
break;
|
|
4684
4579
|
}
|
|
4685
4580
|
throw new UnsupportedOperationError('Swap operations do not support local accounts yet. Please provider a signer');
|
|
4686
4581
|
case 1:
|
|
4687
|
-
|
|
4582
|
+
_context16.n = 2;
|
|
4688
4583
|
return executeWithRouter(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4689
4584
|
swapOptions: swapOptions,
|
|
4690
4585
|
api: this.api
|
|
4691
4586
|
}), function (builder) {
|
|
4692
|
-
return (
|
|
4693
|
-
// We need to cast this sender because RouterBuilder expects a PAPI signer but this part of sdk-core is generic
|
|
4694
|
-
// Will be removed in the future when we gradually move parts of swap package to sdk-core
|
|
4695
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
4696
|
-
builder.signer(sender).build()
|
|
4697
|
-
);
|
|
4587
|
+
return builder.signer(senderSource).signAndSubmit();
|
|
4698
4588
|
});
|
|
4699
4589
|
case 2:
|
|
4700
|
-
|
|
4590
|
+
txHashes = _context16.v;
|
|
4591
|
+
return _context16.a(2, txHashes[0]);
|
|
4701
4592
|
case 3:
|
|
4702
|
-
|
|
4593
|
+
_context16.n = 4;
|
|
4703
4594
|
return this.buildInternal();
|
|
4704
4595
|
case 4:
|
|
4705
|
-
_yield$this$buildInte3 =
|
|
4596
|
+
_yield$this$buildInte3 = _context16.v;
|
|
4706
4597
|
tx = _yield$this$buildInte3.tx;
|
|
4707
|
-
return
|
|
4598
|
+
return _context16.a(2, this.api.signAndSubmit(tx, senderSource));
|
|
4708
4599
|
}
|
|
4709
|
-
},
|
|
4600
|
+
}, _callee16, this);
|
|
4710
4601
|
}));
|
|
4711
4602
|
function signAndSubmit() {
|
|
4712
4603
|
return _signAndSubmit.apply(this, arguments);
|
|
4713
4604
|
}
|
|
4714
4605
|
return signAndSubmit;
|
|
4715
4606
|
}()
|
|
4607
|
+
}, {
|
|
4608
|
+
key: "signAndSubmitAll",
|
|
4609
|
+
value: function () {
|
|
4610
|
+
var _signAndSubmitAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
4611
|
+
var _this$_options2, senderSource, swapOptions, _yield$this$buildInte4, tx, txHash;
|
|
4612
|
+
return _regenerator().w(function (_context17) {
|
|
4613
|
+
while (1) switch (_context17.n) {
|
|
4614
|
+
case 0:
|
|
4615
|
+
_this$_options2 = this._options, senderSource = _this$_options2.senderSource, swapOptions = _this$_options2.swapOptions;
|
|
4616
|
+
assertSenderSource(senderSource);
|
|
4617
|
+
if (!swapOptions) {
|
|
4618
|
+
_context17.n = 2;
|
|
4619
|
+
break;
|
|
4620
|
+
}
|
|
4621
|
+
if (isSenderSigner(senderSource)) {
|
|
4622
|
+
_context17.n = 1;
|
|
4623
|
+
break;
|
|
4624
|
+
}
|
|
4625
|
+
throw new UnsupportedOperationError('Swap operations do not support local accounts yet. Please provider a signer');
|
|
4626
|
+
case 1:
|
|
4627
|
+
return _context17.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4628
|
+
swapOptions: swapOptions,
|
|
4629
|
+
api: this.api
|
|
4630
|
+
}), function (builder) {
|
|
4631
|
+
return builder.signer(senderSource).signAndSubmit();
|
|
4632
|
+
}));
|
|
4633
|
+
case 2:
|
|
4634
|
+
_context17.n = 3;
|
|
4635
|
+
return this.buildInternal();
|
|
4636
|
+
case 3:
|
|
4637
|
+
_yield$this$buildInte4 = _context17.v;
|
|
4638
|
+
tx = _yield$this$buildInte4.tx;
|
|
4639
|
+
_context17.n = 4;
|
|
4640
|
+
return this.api.signAndSubmit(tx, senderSource);
|
|
4641
|
+
case 4:
|
|
4642
|
+
txHash = _context17.v;
|
|
4643
|
+
return _context17.a(2, [txHash]);
|
|
4644
|
+
}
|
|
4645
|
+
}, _callee17, this);
|
|
4646
|
+
}));
|
|
4647
|
+
function signAndSubmitAll() {
|
|
4648
|
+
return _signAndSubmitAll.apply(this, arguments);
|
|
4649
|
+
}
|
|
4650
|
+
return signAndSubmitAll;
|
|
4651
|
+
}()
|
|
4716
4652
|
/**
|
|
4717
4653
|
* Returns the API instance used by the builder.
|
|
4718
4654
|
*
|
|
@@ -4745,29 +4681,29 @@ var Builder = function Builder(api) {
|
|
|
4745
4681
|
return new GeneralBuilder(api, new BatchTransactionManager());
|
|
4746
4682
|
};
|
|
4747
4683
|
|
|
4748
|
-
var determineAddress = function determineAddress(chain,
|
|
4684
|
+
var determineAddress = function determineAddress(chain, recipient, sender) {
|
|
4749
4685
|
if (isChainEvm(chain)) {
|
|
4750
|
-
return isAddress(
|
|
4686
|
+
return isAddress(recipient) ? recipient : sender;
|
|
4751
4687
|
}
|
|
4752
|
-
return isAddress(
|
|
4688
|
+
return isAddress(recipient) ? sender : recipient;
|
|
4753
4689
|
};
|
|
4754
4690
|
var getReverseTxFee = /*#__PURE__*/function () {
|
|
4755
4691
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, currencyInput) {
|
|
4756
|
-
var api, origin, destination,
|
|
4692
|
+
var api, origin, destination, sender, recipient, skipReverseFeeCalculation, toAddress, fromAddress, _yield$Builder$from$t, tx, _yield$api$getPayment, partialFee;
|
|
4757
4693
|
return _regenerator().w(function (_context) {
|
|
4758
4694
|
while (1) switch (_context.n) {
|
|
4759
4695
|
case 0:
|
|
4760
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination,
|
|
4696
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, sender = _ref.sender, recipient = _ref.recipient, skipReverseFeeCalculation = _ref.skipReverseFeeCalculation;
|
|
4761
4697
|
if (!skipReverseFeeCalculation) {
|
|
4762
4698
|
_context.n = 1;
|
|
4763
4699
|
break;
|
|
4764
4700
|
}
|
|
4765
4701
|
return _context.a(2, 0n);
|
|
4766
4702
|
case 1:
|
|
4767
|
-
toAddress = determineAddress(origin,
|
|
4768
|
-
fromAddress = determineAddress(destination,
|
|
4703
|
+
toAddress = determineAddress(origin, recipient, sender);
|
|
4704
|
+
fromAddress = determineAddress(destination, recipient, sender);
|
|
4769
4705
|
_context.n = 2;
|
|
4770
|
-
return Builder(api).from(destination).to(origin).
|
|
4706
|
+
return Builder(api).from(destination).to(origin).sender(fromAddress).recipient(toAddress).currency(currencyInput)['buildInternal']();
|
|
4771
4707
|
case 2:
|
|
4772
4708
|
_yield$Builder$from$t = _context.v;
|
|
4773
4709
|
tx = _yield$Builder$from$t.tx;
|
|
@@ -5221,7 +5157,7 @@ var resolveId = function resolveId(asset, chain) {
|
|
|
5221
5157
|
var isEthAsset = !asset.isNative && ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.startsWith('0x'));
|
|
5222
5158
|
var resolvedAsset = isEthAsset ? findAssetInfoOrThrow(chain, {
|
|
5223
5159
|
location: asset.location
|
|
5224
|
-
}
|
|
5160
|
+
}) : asset;
|
|
5225
5161
|
return getChain(chain).getCustomCurrencyId(resolvedAsset);
|
|
5226
5162
|
} else {
|
|
5227
5163
|
assertHasId(asset);
|
|
@@ -5400,7 +5336,7 @@ var getBalanceInternal = /*#__PURE__*/function () {
|
|
|
5400
5336
|
while (1) switch (_context2.n) {
|
|
5401
5337
|
case 0:
|
|
5402
5338
|
chain = options.chain, currency = options.currency;
|
|
5403
|
-
asset = currency ? findAssetInfoOrThrow(chain, currency
|
|
5339
|
+
asset = currency ? findAssetInfoOrThrow(chain, currency) : findNativeAssetInfoOrThrow(chain);
|
|
5404
5340
|
return _context2.a(2, getAssetBalanceInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
5405
5341
|
asset: asset
|
|
5406
5342
|
})));
|
|
@@ -5481,7 +5417,7 @@ var getMoonbeamErc20Balance = /*#__PURE__*/function () {
|
|
|
5481
5417
|
}();
|
|
5482
5418
|
|
|
5483
5419
|
var isSufficientOrigin = /*#__PURE__*/function () {
|
|
5484
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, origin, destination,
|
|
5420
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, origin, destination, sender, feeNative, currency, asset, feeAsset) {
|
|
5485
5421
|
var edNative, balanceNative, isNativeAssetToOrigin, isNativeAssetToDest, isSufficientNative, balanceAsset, edAsset, isSufficientAsset;
|
|
5486
5422
|
return _regenerator().w(function (_context) {
|
|
5487
5423
|
while (1) switch (_context.n) {
|
|
@@ -5497,7 +5433,7 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
5497
5433
|
return getBalanceInternal({
|
|
5498
5434
|
api: api,
|
|
5499
5435
|
chain: origin,
|
|
5500
|
-
address:
|
|
5436
|
+
address: sender
|
|
5501
5437
|
});
|
|
5502
5438
|
case 2:
|
|
5503
5439
|
balanceNative = _context.v;
|
|
@@ -5518,7 +5454,7 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
5518
5454
|
return getAssetBalanceInternal({
|
|
5519
5455
|
api: api,
|
|
5520
5456
|
chain: origin,
|
|
5521
|
-
address:
|
|
5457
|
+
address: sender,
|
|
5522
5458
|
asset: asset
|
|
5523
5459
|
});
|
|
5524
5460
|
case 4:
|
|
@@ -5581,11 +5517,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
5581
5517
|
};
|
|
5582
5518
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
5583
5519
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
5584
|
-
var api, origin, hopChain, destination, currency, forwardedXcms, asset,
|
|
5520
|
+
var api, origin, hopChain, destination, currency, forwardedXcms, asset, recipient, feeAsset, originFee, tx, version, disableFallback, swapConfig, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
5585
5521
|
return _regenerator().w(function (_context3) {
|
|
5586
5522
|
while (1) switch (_context3.n) {
|
|
5587
5523
|
case 0:
|
|
5588
|
-
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset,
|
|
5524
|
+
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, recipient = options.recipient, feeAsset = options.feeAsset, originFee = options.originFee, tx = options.tx, version = options.version, disableFallback = options.disableFallback, swapConfig = options.swapConfig;
|
|
5589
5525
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5590
5526
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
5591
5527
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
@@ -5677,7 +5613,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
5677
5613
|
case 1:
|
|
5678
5614
|
_fee = _context3.v;
|
|
5679
5615
|
_context3.n = 2;
|
|
5680
|
-
return isSufficientDestination(api, destination,
|
|
5616
|
+
return isSufficientDestination(api, destination, recipient, currency.amount, asset, _fee);
|
|
5681
5617
|
case 2:
|
|
5682
5618
|
sufficient = _context3.v;
|
|
5683
5619
|
return _context3.a(2, {
|
|
@@ -5979,11 +5915,11 @@ var abi$1 = [{
|
|
|
5979
5915
|
}];
|
|
5980
5916
|
var transferMoonbeamLocal = /*#__PURE__*/function () {
|
|
5981
5917
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(client, assetInfo, _ref) {
|
|
5982
|
-
var signer,
|
|
5918
|
+
var signer, recipient, contract;
|
|
5983
5919
|
return _regenerator().w(function (_context) {
|
|
5984
5920
|
while (1) switch (_context.n) {
|
|
5985
5921
|
case 0:
|
|
5986
|
-
signer = _ref.signer,
|
|
5922
|
+
signer = _ref.signer, recipient = _ref.recipient;
|
|
5987
5923
|
assertHasId(assetInfo);
|
|
5988
5924
|
contract = getContract({
|
|
5989
5925
|
abi: abi$1,
|
|
@@ -5993,7 +5929,7 @@ var transferMoonbeamLocal = /*#__PURE__*/function () {
|
|
|
5993
5929
|
wallet: signer
|
|
5994
5930
|
}
|
|
5995
5931
|
});
|
|
5996
|
-
return _context.a(2, contract.write.transfer([
|
|
5932
|
+
return _context.a(2, contract.write.transfer([recipient, assetInfo.amount]));
|
|
5997
5933
|
}
|
|
5998
5934
|
}, _callee);
|
|
5999
5935
|
}));
|
|
@@ -6009,11 +5945,11 @@ var NATIVE_ASSET_ID = '0x0000000000000000000000000000000000000802';
|
|
|
6009
5945
|
var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
6010
5946
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
6011
5947
|
var _usdtAsset$assetId;
|
|
6012
|
-
var api, from, to, signer,
|
|
5948
|
+
var api, from, to, signer, recipient, currency, foundAsset, amount, client, contract, asset, destLocation, weight, createTx, multiCurrencySymbols, useMultiAssets, usdtAsset, tx, _t;
|
|
6013
5949
|
return _regenerator().w(function (_context) {
|
|
6014
5950
|
while (1) switch (_context.n) {
|
|
6015
5951
|
case 0:
|
|
6016
|
-
api = options.api, from = options.from, to = options.to, signer = options.signer,
|
|
5952
|
+
api = options.api, from = options.from, to = options.to, signer = options.signer, recipient = options.recipient, currency = options.currency;
|
|
6017
5953
|
if (!Array.isArray(currency)) {
|
|
6018
5954
|
_context.n = 1;
|
|
6019
5955
|
break;
|
|
@@ -6064,7 +6000,7 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
6064
6000
|
case 5:
|
|
6065
6001
|
asset = formatAssetIdToERC20(foundAsset.assetId);
|
|
6066
6002
|
case 6:
|
|
6067
|
-
destLocation = getDestinationLocation(api,
|
|
6003
|
+
destLocation = getDestinationLocation(api, recipient, to);
|
|
6068
6004
|
weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
|
|
6069
6005
|
// https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
|
|
6070
6006
|
createTx = function createTx(func, args) {
|
|
@@ -6133,22 +6069,22 @@ var createAccountPayload = function createAccountPayload(api, address) {
|
|
|
6133
6069
|
};
|
|
6134
6070
|
var createBeneficiaryLocXTokens = function createBeneficiaryLocXTokens(_ref) {
|
|
6135
6071
|
var api = _ref.api,
|
|
6136
|
-
|
|
6072
|
+
recipient = _ref.recipient,
|
|
6137
6073
|
origin = _ref.origin,
|
|
6138
6074
|
destination = _ref.destination,
|
|
6139
6075
|
version = _ref.version,
|
|
6140
6076
|
paraId = _ref.paraId;
|
|
6141
|
-
if (isTLocation(
|
|
6142
|
-
return
|
|
6077
|
+
if (isTLocation(recipient)) {
|
|
6078
|
+
return recipient;
|
|
6143
6079
|
}
|
|
6144
6080
|
var scenario = resolveScenario(origin, destination);
|
|
6145
|
-
var accountPayload = createAccountPayload(api,
|
|
6081
|
+
var accountPayload = createAccountPayload(api, recipient);
|
|
6146
6082
|
if (scenario === 'ParaToRelay') {
|
|
6147
6083
|
return {
|
|
6148
6084
|
parents: Parents.ONE,
|
|
6149
6085
|
interior: createX1Payload(version, {
|
|
6150
6086
|
AccountId32: {
|
|
6151
|
-
id: api.accountToHex(
|
|
6087
|
+
id: api.accountToHex(recipient)
|
|
6152
6088
|
}
|
|
6153
6089
|
})
|
|
6154
6090
|
};
|
|
@@ -6339,7 +6275,7 @@ var reverseTransformLocation = function reverseTransformLocation(location) {
|
|
|
6339
6275
|
});
|
|
6340
6276
|
};
|
|
6341
6277
|
|
|
6342
|
-
var createMainInstruction = function createMainInstruction(origin, asset, ethAsset,
|
|
6278
|
+
var createMainInstruction = function createMainInstruction(origin, asset, ethAsset, recipient, messageId) {
|
|
6343
6279
|
assertHasId(ethAsset);
|
|
6344
6280
|
var interiorSb = ethAsset.symbol === 'ETH' ? {
|
|
6345
6281
|
Here: null
|
|
@@ -6363,7 +6299,7 @@ var createMainInstruction = function createMainInstruction(origin, asset, ethAss
|
|
|
6363
6299
|
X1: [{
|
|
6364
6300
|
AccountKey20: {
|
|
6365
6301
|
network: null,
|
|
6366
|
-
key:
|
|
6302
|
+
key: recipient
|
|
6367
6303
|
}
|
|
6368
6304
|
}]
|
|
6369
6305
|
}
|
|
@@ -6456,12 +6392,12 @@ var createMainInstruction = function createMainInstruction(origin, asset, ethAss
|
|
|
6456
6392
|
};
|
|
6457
6393
|
var createEthereumBridgeInstructions = function createEthereumBridgeInstructions(_ref, origin, messageId, ethAsset) {
|
|
6458
6394
|
var api = _ref.api,
|
|
6459
|
-
|
|
6395
|
+
sender = _ref.sender,
|
|
6396
|
+
recipient = _ref.recipient,
|
|
6460
6397
|
assetInfo = _ref.assetInfo,
|
|
6461
|
-
senderAddress = _ref.senderAddress,
|
|
6462
6398
|
ahAddress = _ref.ahAddress,
|
|
6463
6399
|
version = _ref.version;
|
|
6464
|
-
|
|
6400
|
+
assertSender(sender);
|
|
6465
6401
|
if (isChainEvm(origin) && !ahAddress) {
|
|
6466
6402
|
throw new MissingParameterError('ahAddress');
|
|
6467
6403
|
}
|
|
@@ -6473,27 +6409,28 @@ var createEthereumBridgeInstructions = function createEthereumBridgeInstructions
|
|
|
6473
6409
|
},
|
|
6474
6410
|
beneficiary: createBeneficiaryLocation({
|
|
6475
6411
|
api: api,
|
|
6476
|
-
address: isChainEvm(origin) ? ahAddress :
|
|
6412
|
+
address: isChainEvm(origin) ? ahAddress : sender,
|
|
6477
6413
|
version: version
|
|
6478
6414
|
})
|
|
6479
6415
|
}
|
|
6480
6416
|
}]
|
|
6481
|
-
}, createMainInstruction(origin, assetInfo, ethAsset,
|
|
6417
|
+
}, createMainInstruction(origin, assetInfo, ethAsset, recipient, messageId), {
|
|
6482
6418
|
SetTopic: messageId
|
|
6483
6419
|
}];
|
|
6484
6420
|
};
|
|
6485
6421
|
var createCustomXcmOnDest = function createCustomXcmOnDest(options, origin, messageId, ethAsset) {
|
|
6486
6422
|
var api = options.api,
|
|
6487
|
-
|
|
6423
|
+
sender = options.sender,
|
|
6424
|
+
recipient = options.recipient,
|
|
6488
6425
|
assetInfo = options.assetInfo,
|
|
6489
|
-
senderAddress = options.senderAddress,
|
|
6490
6426
|
ahAddress = options.ahAddress,
|
|
6491
6427
|
version = options.version;
|
|
6428
|
+
assertSender(sender);
|
|
6492
6429
|
var instructions = createEthereumBridgeInstructions({
|
|
6493
6430
|
api: api,
|
|
6494
|
-
|
|
6431
|
+
sender: sender,
|
|
6432
|
+
recipient: recipient,
|
|
6495
6433
|
assetInfo: assetInfo,
|
|
6496
|
-
senderAddress: senderAddress,
|
|
6497
6434
|
ahAddress: ahAddress,
|
|
6498
6435
|
version: version
|
|
6499
6436
|
}, origin, messageId, ethAsset);
|
|
@@ -6501,7 +6438,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(options, origin, mess
|
|
|
6501
6438
|
};
|
|
6502
6439
|
|
|
6503
6440
|
var generateMessageId = /*#__PURE__*/function () {
|
|
6504
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, senderAddress, sourceParaId, tokenAddress,
|
|
6441
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, senderAddress, sourceParaId, tokenAddress, recipient, amount) {
|
|
6505
6442
|
var accountNextId, sourceAccountHex, entropy;
|
|
6506
6443
|
return _regenerator().w(function (_context) {
|
|
6507
6444
|
while (1) switch (_context.n) {
|
|
@@ -6511,7 +6448,7 @@ var generateMessageId = /*#__PURE__*/function () {
|
|
|
6511
6448
|
case 1:
|
|
6512
6449
|
accountNextId = _context.v;
|
|
6513
6450
|
sourceAccountHex = api.accountToHex(senderAddress);
|
|
6514
|
-
entropy = new Uint8Array([].concat(_toConsumableArray(api.stringToUint8a(sourceParaId.toString())), _toConsumableArray(api.hexToUint8a(sourceAccountHex)), _toConsumableArray(api.stringToUint8a(accountNextId)), _toConsumableArray(api.hexToUint8a(tokenAddress)), _toConsumableArray(api.stringToUint8a(
|
|
6451
|
+
entropy = new Uint8Array([].concat(_toConsumableArray(api.stringToUint8a(sourceParaId.toString())), _toConsumableArray(api.hexToUint8a(sourceAccountHex)), _toConsumableArray(api.stringToUint8a(accountNextId)), _toConsumableArray(api.hexToUint8a(tokenAddress)), _toConsumableArray(api.stringToUint8a(recipient)), _toConsumableArray(api.stringToUint8a(amount.toString()))));
|
|
6515
6452
|
return _context.a(2, api.blake2AsHex(entropy));
|
|
6516
6453
|
}
|
|
6517
6454
|
}, _callee);
|
|
@@ -6622,11 +6559,11 @@ var XCDOT = '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080';
|
|
|
6622
6559
|
var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
6623
6560
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(from, _ref) {
|
|
6624
6561
|
var _signer$account;
|
|
6625
|
-
var api, to, signer,
|
|
6562
|
+
var api, to, signer, recipient, ahAddress, currency, bridgeStatus, foundAsset, amount, ethAsset, contract, sender, messageId, version, customXcm, customXcmOnDest, assetHubApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, transferFee, createTx, numberToHex32, tx;
|
|
6626
6563
|
return _regenerator().w(function (_context) {
|
|
6627
6564
|
while (1) switch (_context.n) {
|
|
6628
6565
|
case 0:
|
|
6629
|
-
api = _ref.api, to = _ref.to, signer = _ref.signer,
|
|
6566
|
+
api = _ref.api, to = _ref.to, signer = _ref.signer, recipient = _ref.recipient, ahAddress = _ref.ahAddress, currency = _ref.currency;
|
|
6630
6567
|
if (ahAddress) {
|
|
6631
6568
|
_context.n = 1;
|
|
6632
6569
|
break;
|
|
@@ -6659,7 +6596,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
6659
6596
|
amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
|
|
6660
6597
|
ethAsset = findAssetInfoOrThrow('Ethereum', {
|
|
6661
6598
|
symbol: foundAsset.symbol
|
|
6662
|
-
}
|
|
6599
|
+
});
|
|
6663
6600
|
contract = getContract({
|
|
6664
6601
|
abi: abi,
|
|
6665
6602
|
address: xcmInterfacePrecompile,
|
|
@@ -6671,21 +6608,21 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
6671
6608
|
wallet: signer
|
|
6672
6609
|
}
|
|
6673
6610
|
});
|
|
6674
|
-
|
|
6675
|
-
|
|
6611
|
+
sender = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
|
|
6612
|
+
assertSender(sender);
|
|
6676
6613
|
assertHasId(ethAsset);
|
|
6677
6614
|
_context.n = 6;
|
|
6678
6615
|
return api.init(from, TX_CLIENT_TIMEOUT_MS);
|
|
6679
6616
|
case 6:
|
|
6680
6617
|
_context.n = 7;
|
|
6681
|
-
return generateMessageId(api,
|
|
6618
|
+
return generateMessageId(api, sender, getParaId(from), ethAsset.assetId, recipient, amount);
|
|
6682
6619
|
case 7:
|
|
6683
6620
|
messageId = _context.v;
|
|
6684
6621
|
version = Version.V4;
|
|
6685
6622
|
customXcm = createCustomXcmOnDest({
|
|
6686
6623
|
api: api,
|
|
6687
|
-
|
|
6688
|
-
|
|
6624
|
+
recipient: recipient,
|
|
6625
|
+
sender: sender,
|
|
6689
6626
|
ahAddress: ahAddress,
|
|
6690
6627
|
assetInfo: _objectSpread2(_objectSpread2({}, foundAsset), {}, {
|
|
6691
6628
|
amount: amount
|
|
@@ -6751,7 +6688,7 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
6751
6688
|
forwardedXcms = initialForwardedXcms;
|
|
6752
6689
|
nextParaId = initialDestParaId;
|
|
6753
6690
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
6754
|
-
currentAsset = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain) ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo
|
|
6691
|
+
currentAsset = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain) ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo) : asset;
|
|
6755
6692
|
hasPassedExchange = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain);
|
|
6756
6693
|
hops = [];
|
|
6757
6694
|
case 1:
|
|
@@ -6870,11 +6807,11 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
|
|
|
6870
6807
|
|
|
6871
6808
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
6872
6809
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
6873
|
-
var api, origin, destination, currency, tx,
|
|
6810
|
+
var api, origin, destination, currency, tx, sender, feeAsset, swapConfig, version, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, resolvedVersion, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, bridgeHubChain, assetHubChain, bridgeHubHop, processedBridgeHub, bridgeHubHopIndex, result, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
6874
6811
|
return _regenerator().w(function (_context2) {
|
|
6875
6812
|
while (1) switch (_context2.n) {
|
|
6876
6813
|
case 0:
|
|
6877
|
-
api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, tx = options.tx,
|
|
6814
|
+
api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, tx = options.tx, sender = options.sender, feeAsset = options.feeAsset, swapConfig = options.swapConfig, version = options.version, bypassOptions = options.bypassOptions, _options$useRootOrigi = options.useRootOrigin, useRootOrigin = _options$useRootOrigi === void 0 ? false : _options$useRootOrigi;
|
|
6878
6815
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
6879
6816
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
6880
6817
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
@@ -6884,7 +6821,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
6884
6821
|
tx: tx,
|
|
6885
6822
|
chain: origin,
|
|
6886
6823
|
destination: destination,
|
|
6887
|
-
address:
|
|
6824
|
+
address: sender,
|
|
6888
6825
|
asset: _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6889
6826
|
amount: amount
|
|
6890
6827
|
}),
|
|
@@ -7063,12 +7000,12 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
7063
7000
|
|
|
7064
7001
|
var dryRun = /*#__PURE__*/function () {
|
|
7065
7002
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
7066
|
-
var api,
|
|
7003
|
+
var api, sender, origin;
|
|
7067
7004
|
return _regenerator().w(function (_context) {
|
|
7068
7005
|
while (1) switch (_context.p = _context.n) {
|
|
7069
7006
|
case 0:
|
|
7070
|
-
api = options.api,
|
|
7071
|
-
validateAddress(api,
|
|
7007
|
+
api = options.api, sender = options.sender, origin = options.origin;
|
|
7008
|
+
validateAddress(api, sender, origin, false);
|
|
7072
7009
|
_context.n = 1;
|
|
7073
7010
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
7074
7011
|
case 1:
|
|
@@ -7153,7 +7090,7 @@ var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountH
|
|
|
7153
7090
|
}), balance, address, api);
|
|
7154
7091
|
};
|
|
7155
7092
|
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
7156
|
-
var asset = findAssetInfo(chain, currency
|
|
7093
|
+
var asset = findAssetInfo(chain, currency);
|
|
7157
7094
|
if (!asset) return null;
|
|
7158
7095
|
var amount = parseUnits(amountHuman, asset.decimals);
|
|
7159
7096
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
@@ -7242,7 +7179,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
7242
7179
|
}
|
|
7243
7180
|
};
|
|
7244
7181
|
nativeInfo = mintFeeAssets ? findNativeAssetInfo(chain) : null;
|
|
7245
|
-
relayInfo = mintFeeAssets ? findAssetInfo(chain, relayCurrency
|
|
7182
|
+
relayInfo = mintFeeAssets ? findAssetInfo(chain, relayCurrency) : null;
|
|
7246
7183
|
sameNativeRelay = !!(nativeInfo && relayInfo && isAssetXcEqual(nativeInfo, relayInfo));
|
|
7247
7184
|
if (!mintFeeAssets) {
|
|
7248
7185
|
_context.n = 2;
|
|
@@ -7544,11 +7481,11 @@ var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
|
7544
7481
|
|
|
7545
7482
|
var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
7546
7483
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
7547
|
-
var api, tx, origin, destination,
|
|
7484
|
+
var api, tx, origin, destination, sender, disableFallback, feeAsset, currency, version, _ref$useRootOrigin, useRootOrigin, asset, amount, resolvedFeeAsset, _yield$api$getPayment, rawFee, paddedFee, sufficient, resolvedVersion, dryRunResult, _yield$api$getPayment2, _rawFee, _paddedFee, fee, forwardedXcms, destParaId, weight;
|
|
7548
7485
|
return _regenerator().w(function (_context) {
|
|
7549
7486
|
while (1) switch (_context.n) {
|
|
7550
7487
|
case 0:
|
|
7551
|
-
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination,
|
|
7488
|
+
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, sender = _ref.sender, disableFallback = _ref.disableFallback, feeAsset = _ref.feeAsset, currency = _ref.currency, version = _ref.version, _ref$useRootOrigin = _ref.useRootOrigin, useRootOrigin = _ref$useRootOrigin === void 0 ? false : _ref$useRootOrigin;
|
|
7552
7489
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
7553
7490
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
7554
7491
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
@@ -7560,13 +7497,13 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7560
7497
|
break;
|
|
7561
7498
|
}
|
|
7562
7499
|
_context.n = 2;
|
|
7563
|
-
return api.getPaymentInfo(tx,
|
|
7500
|
+
return api.getPaymentInfo(tx, sender);
|
|
7564
7501
|
case 2:
|
|
7565
7502
|
_yield$api$getPayment = _context.v;
|
|
7566
7503
|
rawFee = _yield$api$getPayment.partialFee;
|
|
7567
7504
|
paddedFee = padFee(rawFee, origin, destination, 'origin');
|
|
7568
7505
|
_context.n = 3;
|
|
7569
|
-
return isSufficientOrigin(api, origin, destination,
|
|
7506
|
+
return isSufficientOrigin(api, origin, destination, sender, paddedFee, _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7570
7507
|
amount: amount
|
|
7571
7508
|
}), asset, resolvedFeeAsset);
|
|
7572
7509
|
case 3:
|
|
@@ -7584,7 +7521,7 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7584
7521
|
tx: tx,
|
|
7585
7522
|
chain: origin,
|
|
7586
7523
|
destination: destination,
|
|
7587
|
-
address:
|
|
7524
|
+
address: sender,
|
|
7588
7525
|
asset: _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
7589
7526
|
amount: amount
|
|
7590
7527
|
}),
|
|
@@ -7610,7 +7547,7 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7610
7547
|
});
|
|
7611
7548
|
case 6:
|
|
7612
7549
|
_context.n = 7;
|
|
7613
|
-
return api.getPaymentInfo(tx,
|
|
7550
|
+
return api.getPaymentInfo(tx, sender);
|
|
7614
7551
|
case 7:
|
|
7615
7552
|
_yield$api$getPayment2 = _context.v;
|
|
7616
7553
|
_rawFee = _yield$api$getPayment2.partialFee;
|
|
@@ -7692,49 +7629,6 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
7692
7629
|
};
|
|
7693
7630
|
}();
|
|
7694
7631
|
|
|
7695
|
-
/**
|
|
7696
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
7697
|
-
* Please use `builder.getOriginXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
7698
|
-
* Will be removed in v13.
|
|
7699
|
-
* For more details, see the documentation:
|
|
7700
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
7701
|
-
*/
|
|
7702
|
-
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
7703
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
7704
|
-
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, amount, _yield$api$getPayment, rawOriginFee, originFee, resolvedFeeAsset, sufficient, asset;
|
|
7705
|
-
return _regenerator().w(function (_context) {
|
|
7706
|
-
while (1) switch (_context.n) {
|
|
7707
|
-
case 0:
|
|
7708
|
-
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, currency = _ref.currency, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset;
|
|
7709
|
-
originAsset = findAssetInfoOrThrow(origin, currency, destination);
|
|
7710
|
-
amount = abstractDecimals(currency.amount, originAsset.decimals, api);
|
|
7711
|
-
_context.n = 1;
|
|
7712
|
-
return api.getPaymentInfo(tx, senderAddress);
|
|
7713
|
-
case 1:
|
|
7714
|
-
_yield$api$getPayment = _context.v;
|
|
7715
|
-
rawOriginFee = _yield$api$getPayment.partialFee;
|
|
7716
|
-
originFee = padFee(rawOriginFee, origin, destination, 'origin');
|
|
7717
|
-
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
7718
|
-
_context.n = 2;
|
|
7719
|
-
return isSufficientOrigin(api, origin, destination, senderAddress, originFee, _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7720
|
-
amount: amount
|
|
7721
|
-
}), originAsset, resolvedFeeAsset);
|
|
7722
|
-
case 2:
|
|
7723
|
-
sufficient = _context.v;
|
|
7724
|
-
asset = resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset;
|
|
7725
|
-
return _context.a(2, {
|
|
7726
|
-
fee: originFee,
|
|
7727
|
-
asset: asset,
|
|
7728
|
-
sufficient: sufficient
|
|
7729
|
-
});
|
|
7730
|
-
}
|
|
7731
|
-
}, _callee);
|
|
7732
|
-
}));
|
|
7733
|
-
return function getOriginXcmFeeEstimate(_x) {
|
|
7734
|
-
return _ref2.apply(this, arguments);
|
|
7735
|
-
};
|
|
7736
|
-
}();
|
|
7737
|
-
|
|
7738
7632
|
var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
7739
7633
|
var _chains$origin, _chains$destination;
|
|
7740
7634
|
// Check standard chains first for backwards compatibility
|
|
@@ -7771,11 +7665,11 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
7771
7665
|
};
|
|
7772
7666
|
var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
7773
7667
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
7774
|
-
var api, tx, origin, destination,
|
|
7668
|
+
var api, tx, origin, destination, sender, recipient, currency, feeAsset, version, disableFallback, swapConfig, useRootOrigin, skipReverseFeeCalculation, asset, amount, resolvedVersion, _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;
|
|
7775
7669
|
return _regenerator().w(function (_context2) {
|
|
7776
7670
|
while (1) switch (_context2.p = _context2.n) {
|
|
7777
7671
|
case 0:
|
|
7778
|
-
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination,
|
|
7672
|
+
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, sender = _ref.sender, recipient = _ref.recipient, currency = _ref.currency, feeAsset = _ref.feeAsset, version = _ref.version, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig, useRootOrigin = _ref.useRootOrigin, skipReverseFeeCalculation = _ref.skipReverseFeeCalculation;
|
|
7779
7673
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
7780
7674
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
7781
7675
|
resolvedVersion = pickCompatibleXcmVersion(origin, destination, version);
|
|
@@ -7785,7 +7679,7 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7785
7679
|
tx: tx,
|
|
7786
7680
|
origin: origin,
|
|
7787
7681
|
destination: destination,
|
|
7788
|
-
|
|
7682
|
+
sender: sender,
|
|
7789
7683
|
feeAsset: feeAsset,
|
|
7790
7684
|
currency: currency,
|
|
7791
7685
|
version: resolvedVersion,
|
|
@@ -7841,12 +7735,12 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7841
7735
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7842
7736
|
amount: amount
|
|
7843
7737
|
}),
|
|
7844
|
-
|
|
7738
|
+
sender: sender,
|
|
7739
|
+
recipient: recipient,
|
|
7845
7740
|
asset: asset,
|
|
7846
7741
|
version: resolvedVersion,
|
|
7847
7742
|
tx: tx,
|
|
7848
7743
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
7849
|
-
senderAddress: senderAddress,
|
|
7850
7744
|
disableFallback: disableFallback,
|
|
7851
7745
|
swapConfig: swapConfig,
|
|
7852
7746
|
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
@@ -7923,8 +7817,8 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7923
7817
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7924
7818
|
amount: amount
|
|
7925
7819
|
}),
|
|
7926
|
-
|
|
7927
|
-
|
|
7820
|
+
sender: sender,
|
|
7821
|
+
recipient: recipient,
|
|
7928
7822
|
asset: hopAsset,
|
|
7929
7823
|
version: resolvedVersion,
|
|
7930
7824
|
feeAsset: feeAsset,
|
|
@@ -8000,12 +7894,12 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
8000
7894
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8001
7895
|
amount: amount
|
|
8002
7896
|
}),
|
|
8003
|
-
|
|
7897
|
+
sender: sender,
|
|
7898
|
+
recipient: recipient,
|
|
8004
7899
|
asset: asset,
|
|
8005
7900
|
version: resolvedVersion,
|
|
8006
7901
|
tx: tx,
|
|
8007
7902
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
8008
|
-
senderAddress: senderAddress,
|
|
8009
7903
|
disableFallback: disableFallback,
|
|
8010
7904
|
swapConfig: swapConfig,
|
|
8011
7905
|
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
@@ -8213,113 +8107,13 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
8213
8107
|
};
|
|
8214
8108
|
}();
|
|
8215
8109
|
|
|
8216
|
-
var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
|
|
8217
|
-
var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
|
|
8218
|
-
/**
|
|
8219
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
8220
|
-
* Please use `builder.getXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
8221
|
-
* Will be removed in v13.
|
|
8222
|
-
* For more details, see the documentation:
|
|
8223
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
8224
|
-
*/
|
|
8225
|
-
var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
8226
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
8227
|
-
var api, origin, destination, currency, feeAsset, address, senderAddress, originAsset, destAsset, amount, resolvedFeeAsset, destApi, _ref2, _ref3, fixedOriginFee, fixedDestinationFee, originSufficient, _destinationSufficient, originFeeDetails, destinationFee, destinationSufficient, destFeeDetails, _t;
|
|
8228
|
-
return _regenerator().w(function (_context) {
|
|
8229
|
-
while (1) switch (_context.n) {
|
|
8230
|
-
case 0:
|
|
8231
|
-
api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, feeAsset = options.feeAsset, address = options.address, senderAddress = options.senderAddress;
|
|
8232
|
-
originAsset = findAssetInfoOrThrow(origin, currency, destination);
|
|
8233
|
-
destAsset = findAssetOnDestOrThrow(origin, destination, currency);
|
|
8234
|
-
amount = abstractDecimals(currency.amount, originAsset.decimals, api);
|
|
8235
|
-
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
8236
|
-
_context.n = 1;
|
|
8237
|
-
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
8238
|
-
case 1:
|
|
8239
|
-
destApi = api.clone();
|
|
8240
|
-
_context.n = 2;
|
|
8241
|
-
return destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
8242
|
-
case 2:
|
|
8243
|
-
if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
|
|
8244
|
-
_context.n = 5;
|
|
8245
|
-
break;
|
|
8246
|
-
}
|
|
8247
|
-
_ref2 = origin === 'AssetHubPolkadot' ? [BRIDGE_FEE_DOT, BRIDGE_FEE_KSM] : [BRIDGE_FEE_KSM, BRIDGE_FEE_DOT], _ref3 = _slicedToArray(_ref2, 2), fixedOriginFee = _ref3[0], fixedDestinationFee = _ref3[1];
|
|
8248
|
-
_context.n = 3;
|
|
8249
|
-
return isSufficientOrigin(api, origin, destination, senderAddress, fixedOriginFee, _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8250
|
-
amount: amount
|
|
8251
|
-
}), originAsset, resolvedFeeAsset);
|
|
8252
|
-
case 3:
|
|
8253
|
-
originSufficient = _context.v;
|
|
8254
|
-
_context.n = 4;
|
|
8255
|
-
return isSufficientDestination(destApi, destination, address, amount, originAsset, fixedDestinationFee);
|
|
8256
|
-
case 4:
|
|
8257
|
-
_destinationSufficient = _context.v;
|
|
8258
|
-
return _context.a(2, {
|
|
8259
|
-
origin: {
|
|
8260
|
-
fee: fixedOriginFee,
|
|
8261
|
-
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset,
|
|
8262
|
-
sufficient: originSufficient
|
|
8263
|
-
},
|
|
8264
|
-
destination: {
|
|
8265
|
-
fee: fixedDestinationFee,
|
|
8266
|
-
asset: destAsset,
|
|
8267
|
-
sufficient: _destinationSufficient
|
|
8268
|
-
}
|
|
8269
|
-
});
|
|
8270
|
-
case 5:
|
|
8271
|
-
_context.n = 6;
|
|
8272
|
-
return getOriginXcmFeeEstimate(options);
|
|
8273
|
-
case 6:
|
|
8274
|
-
originFeeDetails = _context.v;
|
|
8275
|
-
if (!isExternalChain(destination)) {
|
|
8276
|
-
_context.n = 7;
|
|
8277
|
-
break;
|
|
8278
|
-
}
|
|
8279
|
-
_t = 0n;
|
|
8280
|
-
_context.n = 9;
|
|
8281
|
-
break;
|
|
8282
|
-
case 7:
|
|
8283
|
-
_context.n = 8;
|
|
8284
|
-
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8285
|
-
api: destApi,
|
|
8286
|
-
destination: destination
|
|
8287
|
-
}), {
|
|
8288
|
-
location: originAsset.location,
|
|
8289
|
-
amount: amount
|
|
8290
|
-
});
|
|
8291
|
-
case 8:
|
|
8292
|
-
_t = _context.v;
|
|
8293
|
-
case 9:
|
|
8294
|
-
destinationFee = _t;
|
|
8295
|
-
_context.n = 10;
|
|
8296
|
-
return isSufficientDestination(destApi, destination, address, amount, originAsset, destinationFee);
|
|
8297
|
-
case 10:
|
|
8298
|
-
destinationSufficient = _context.v;
|
|
8299
|
-
destFeeDetails = {
|
|
8300
|
-
fee: destinationFee,
|
|
8301
|
-
asset: destAsset,
|
|
8302
|
-
sufficient: destinationSufficient
|
|
8303
|
-
};
|
|
8304
|
-
return _context.a(2, {
|
|
8305
|
-
origin: originFeeDetails,
|
|
8306
|
-
destination: destFeeDetails
|
|
8307
|
-
});
|
|
8308
|
-
}
|
|
8309
|
-
}, _callee);
|
|
8310
|
-
}));
|
|
8311
|
-
return function getXcmFeeEstimate(_x) {
|
|
8312
|
-
return _ref.apply(this, arguments);
|
|
8313
|
-
};
|
|
8314
|
-
}();
|
|
8315
|
-
|
|
8316
8110
|
var buildDestInfo = /*#__PURE__*/function () {
|
|
8317
8111
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
8318
|
-
var api, origin, destination,
|
|
8112
|
+
var api, origin, destination, recipient, currency, originFee, isFeeAssetAh, destFeeDetail, totalHopFee, bridgeFee, destApi, destAsset, edDest, destBalance, destAmount, destFeeAssetEqual, effectiveDestFee, effectiveAmountForBalance, destBalanceSufficient, destBalanceAfter, createUnableToComputeError, isUnableToCompute, destbalanceAfterResult, destBalanceSufficientResult, receivedAmount, isSubBridge, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
|
|
8319
8113
|
return _regenerator().w(function (_context) {
|
|
8320
8114
|
while (1) switch (_context.n) {
|
|
8321
8115
|
case 0:
|
|
8322
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination,
|
|
8116
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, recipient = _ref.recipient, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail, totalHopFee = _ref.totalHopFee, bridgeFee = _ref.bridgeFee;
|
|
8323
8117
|
destApi = api.clone();
|
|
8324
8118
|
_context.n = 1;
|
|
8325
8119
|
return destApi.init(destination);
|
|
@@ -8329,7 +8123,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
8329
8123
|
_context.n = 2;
|
|
8330
8124
|
return getAssetBalanceInternal({
|
|
8331
8125
|
api: destApi,
|
|
8332
|
-
address:
|
|
8126
|
+
address: recipient,
|
|
8333
8127
|
chain: destination,
|
|
8334
8128
|
asset: destAsset
|
|
8335
8129
|
});
|
|
@@ -8377,7 +8171,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
8377
8171
|
}
|
|
8378
8172
|
_context.n = 3;
|
|
8379
8173
|
return getBalanceInternal({
|
|
8380
|
-
address:
|
|
8174
|
+
address: recipient,
|
|
8381
8175
|
chain: destination,
|
|
8382
8176
|
api: destApi
|
|
8383
8177
|
});
|
|
@@ -8469,11 +8263,11 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
8469
8263
|
|
|
8470
8264
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
8471
8265
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
8472
|
-
var api, buildTx, origin, destination,
|
|
8266
|
+
var api, buildTx, origin, destination, sender, ahAddress, recipient, currency, feeAsset, version, resolvedFeeAsset, originAsset, amount, originBalance, edOrigin, _yield$getXcmFeeInter, _yield$getXcmFeeInter2, originFee, originFeeAsset, destFeeDetail, hops, originBalanceFee, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, builtHops, totalHopFee, bridgeHop, destinationInfo;
|
|
8473
8267
|
return _regenerator().w(function (_context2) {
|
|
8474
8268
|
while (1) switch (_context2.p = _context2.n) {
|
|
8475
8269
|
case 0:
|
|
8476
|
-
api = _ref.api, buildTx = _ref.buildTx, origin = _ref.origin, destination = _ref.destination,
|
|
8270
|
+
api = _ref.api, buildTx = _ref.buildTx, origin = _ref.origin, destination = _ref.destination, sender = _ref.sender, ahAddress = _ref.ahAddress, recipient = _ref.recipient, currency = _ref.currency, feeAsset = _ref.feeAsset, version = _ref.version;
|
|
8477
8271
|
if (!(isChainEvm(origin) && !ahAddress)) {
|
|
8478
8272
|
_context2.n = 1;
|
|
8479
8273
|
break;
|
|
@@ -8491,7 +8285,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8491
8285
|
_context2.n = 4;
|
|
8492
8286
|
return getAssetBalanceInternal({
|
|
8493
8287
|
api: api,
|
|
8494
|
-
address:
|
|
8288
|
+
address: sender,
|
|
8495
8289
|
chain: origin,
|
|
8496
8290
|
asset: originAsset
|
|
8497
8291
|
});
|
|
@@ -8504,8 +8298,8 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8504
8298
|
buildTx: buildTx,
|
|
8505
8299
|
origin: origin,
|
|
8506
8300
|
destination: destination,
|
|
8507
|
-
|
|
8508
|
-
|
|
8301
|
+
sender: sender,
|
|
8302
|
+
recipient: recipient,
|
|
8509
8303
|
currency: currency,
|
|
8510
8304
|
feeAsset: feeAsset,
|
|
8511
8305
|
version: version,
|
|
@@ -8521,7 +8315,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8521
8315
|
_context2.n = 6;
|
|
8522
8316
|
return getAssetBalanceInternal({
|
|
8523
8317
|
api: api,
|
|
8524
|
-
address:
|
|
8318
|
+
address: sender,
|
|
8525
8319
|
chain: origin,
|
|
8526
8320
|
asset: originFeeAsset
|
|
8527
8321
|
});
|
|
@@ -8552,7 +8346,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8552
8346
|
originChain: origin,
|
|
8553
8347
|
currency: currency,
|
|
8554
8348
|
asset: hop.result.asset,
|
|
8555
|
-
|
|
8349
|
+
sender: sender,
|
|
8556
8350
|
ahAddress: ahAddress
|
|
8557
8351
|
});
|
|
8558
8352
|
case 1:
|
|
@@ -8582,7 +8376,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8582
8376
|
api: api,
|
|
8583
8377
|
origin: origin,
|
|
8584
8378
|
destination: destination,
|
|
8585
|
-
|
|
8379
|
+
recipient: recipient,
|
|
8586
8380
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8587
8381
|
amount: amount
|
|
8588
8382
|
}),
|
|
@@ -8647,13 +8441,13 @@ var sumHopFees = function sumHopFees(result, _ref) {
|
|
|
8647
8441
|
};
|
|
8648
8442
|
var computeAllFees = /*#__PURE__*/function () {
|
|
8649
8443
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, buildTx) {
|
|
8650
|
-
var origin, dest, _context$options,
|
|
8444
|
+
var origin, dest, _context$options, sender, recipient, currency, feeCurrency, version, result, hopFees, destFee;
|
|
8651
8445
|
return _regenerator().w(function (_context) {
|
|
8652
8446
|
while (1) switch (_context.n) {
|
|
8653
8447
|
case 0:
|
|
8654
|
-
origin = context.origin, dest = context.dest, _context$options = context.options,
|
|
8655
|
-
|
|
8656
|
-
assertAddressIsString(
|
|
8448
|
+
origin = context.origin, dest = context.dest, _context$options = context.options, sender = _context$options.sender, recipient = _context$options.recipient, currency = _context$options.currency, feeCurrency = _context$options.feeCurrency, version = _context$options.version;
|
|
8449
|
+
assertSender(sender);
|
|
8450
|
+
assertAddressIsString(recipient);
|
|
8657
8451
|
if (hasDryRunSupport(context.origin.chain)) {
|
|
8658
8452
|
_context.n = 1;
|
|
8659
8453
|
break;
|
|
@@ -8666,8 +8460,8 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
8666
8460
|
buildTx: buildTx,
|
|
8667
8461
|
origin: origin.chain,
|
|
8668
8462
|
destination: dest.chain,
|
|
8669
|
-
|
|
8670
|
-
|
|
8463
|
+
sender: sender,
|
|
8464
|
+
recipient: recipient,
|
|
8671
8465
|
version: version,
|
|
8672
8466
|
currency: currency,
|
|
8673
8467
|
feeAsset: feeCurrency,
|
|
@@ -8692,14 +8486,14 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
8692
8486
|
|
|
8693
8487
|
var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
8694
8488
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
8695
|
-
var api, origin,
|
|
8489
|
+
var api, origin, sender, recipient, chain, destination, currency, feeAsset, buildTx, builder, version, resolvedFeeAsset, asset, destAsset, destApi, destBalance, destEd, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, amount, result, originFee, hopFeeTotal, destinationFee, edComponent, minAmount, createTx, tx, dryRunResult, _t;
|
|
8696
8490
|
return _regenerator().w(function (_context2) {
|
|
8697
8491
|
while (1) switch (_context2.p = _context2.n) {
|
|
8698
8492
|
case 0:
|
|
8699
|
-
api = _ref.api, origin = _ref.origin,
|
|
8700
|
-
validateAddress(api,
|
|
8493
|
+
api = _ref.api, origin = _ref.origin, sender = _ref.sender, recipient = _ref.recipient, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, feeAsset = _ref.feeAsset, buildTx = _ref.buildTx, builder = _ref.builder, version = _ref.version;
|
|
8494
|
+
validateAddress(api, sender, chain, false);
|
|
8701
8495
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
8702
|
-
asset = findAssetInfoOrThrow(chain, currency
|
|
8496
|
+
asset = findAssetInfoOrThrow(chain, currency);
|
|
8703
8497
|
destAsset = findAssetOnDestOrThrow(origin, destination, currency);
|
|
8704
8498
|
destApi = api.clone();
|
|
8705
8499
|
_context2.n = 1;
|
|
@@ -8708,7 +8502,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8708
8502
|
_context2.n = 2;
|
|
8709
8503
|
return getAssetBalanceInternal({
|
|
8710
8504
|
api: destApi,
|
|
8711
|
-
address:
|
|
8505
|
+
address: recipient,
|
|
8712
8506
|
chain: destination,
|
|
8713
8507
|
asset: destAsset
|
|
8714
8508
|
});
|
|
@@ -8725,8 +8519,8 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8725
8519
|
origin: origin,
|
|
8726
8520
|
destination: destination,
|
|
8727
8521
|
buildTx: buildTx,
|
|
8728
|
-
|
|
8729
|
-
|
|
8522
|
+
sender: sender,
|
|
8523
|
+
recipient: recipient,
|
|
8730
8524
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8731
8525
|
amount: amount
|
|
8732
8526
|
}),
|
|
@@ -8802,8 +8596,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8802
8596
|
tx: tx,
|
|
8803
8597
|
origin: chain,
|
|
8804
8598
|
destination: destination,
|
|
8805
|
-
|
|
8806
|
-
address: address,
|
|
8599
|
+
sender: sender,
|
|
8807
8600
|
version: version,
|
|
8808
8601
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8809
8602
|
amount: minAmount
|
|
@@ -8858,19 +8651,19 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
8858
8651
|
|
|
8859
8652
|
var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
8860
8653
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
8861
|
-
var api,
|
|
8654
|
+
var api, sender, chain, destination, currency, buildTx, feeAsset, version, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
|
|
8862
8655
|
return _regenerator().w(function (_context) {
|
|
8863
8656
|
while (1) switch (_context.n) {
|
|
8864
8657
|
case 0:
|
|
8865
|
-
api = _ref.api,
|
|
8866
|
-
validateAddress(api,
|
|
8658
|
+
api = _ref.api, sender = _ref.sender, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, buildTx = _ref.buildTx, feeAsset = _ref.feeAsset, version = _ref.version;
|
|
8659
|
+
validateAddress(api, sender, chain, false);
|
|
8867
8660
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
8868
|
-
asset = findAssetInfoOrThrow(chain, currency
|
|
8661
|
+
asset = findAssetInfoOrThrow(chain, currency);
|
|
8869
8662
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
8870
8663
|
_context.n = 1;
|
|
8871
8664
|
return getAssetBalanceInternal({
|
|
8872
8665
|
api: api,
|
|
8873
|
-
address:
|
|
8666
|
+
address: sender,
|
|
8874
8667
|
chain: chain,
|
|
8875
8668
|
asset: asset
|
|
8876
8669
|
});
|
|
@@ -8891,7 +8684,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8891
8684
|
buildTx: buildTx,
|
|
8892
8685
|
origin: chain,
|
|
8893
8686
|
destination: chain,
|
|
8894
|
-
|
|
8687
|
+
sender: sender,
|
|
8895
8688
|
feeAsset: feeAsset,
|
|
8896
8689
|
version: version,
|
|
8897
8690
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
@@ -9117,8 +8910,8 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9117
8910
|
options,
|
|
9118
8911
|
destination,
|
|
9119
8912
|
version,
|
|
9120
|
-
|
|
9121
|
-
|
|
8913
|
+
sender,
|
|
8914
|
+
recipient,
|
|
9122
8915
|
paraIdTo,
|
|
9123
8916
|
hopFees,
|
|
9124
8917
|
destFee,
|
|
@@ -9143,7 +8936,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9143
8936
|
destFee: 0n
|
|
9144
8937
|
};
|
|
9145
8938
|
origin = context.origin, dest = context.dest, reserve = context.reserve, isSubBridge = context.isSubBridge, isSnowbridge = context.isSnowbridge, isRelayAsset = context.isRelayAsset, assetInfo = context.assetInfo, options = context.options;
|
|
9146
|
-
destination = options.destination, version = options.version,
|
|
8939
|
+
destination = options.destination, version = options.version, sender = options.sender, recipient = options.recipient, paraIdTo = options.paraIdTo;
|
|
9147
8940
|
hopFees = fees.hopFees, destFee = fees.destFee;
|
|
9148
8941
|
feeAssetLocation = !isRelayAsset ? RELAY_LOCATION : assetInfo.location;
|
|
9149
8942
|
feeLocLocalized = localizeLocation(dest.chain, feeAssetLocation, origin.chain);
|
|
@@ -9164,7 +8957,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9164
8957
|
},
|
|
9165
8958
|
beneficiary: createBeneficiaryLocation({
|
|
9166
8959
|
api: isSubBridge ? dest.api : origin.api,
|
|
9167
|
-
address:
|
|
8960
|
+
address: recipient,
|
|
9168
8961
|
version: version
|
|
9169
8962
|
})
|
|
9170
8963
|
}
|
|
@@ -9228,9 +9021,9 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9228
9021
|
_context.n = 6;
|
|
9229
9022
|
break;
|
|
9230
9023
|
}
|
|
9231
|
-
|
|
9024
|
+
assertSender(sender);
|
|
9232
9025
|
_context.n = 5;
|
|
9233
|
-
return generateMessageId(origin.api,
|
|
9026
|
+
return generateMessageId(origin.api, sender, getParaId(origin.chain), JSON.stringify(assetInfo.location), JSON.stringify(recipient), assetInfo.amount);
|
|
9234
9027
|
case 5:
|
|
9235
9028
|
messageId = _context.v;
|
|
9236
9029
|
return _context.a(2, [depositInstruction, {
|
|
@@ -9246,7 +9039,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9246
9039
|
};
|
|
9247
9040
|
}();
|
|
9248
9041
|
|
|
9249
|
-
var createRefundInstruction = function createRefundInstruction(api,
|
|
9042
|
+
var createRefundInstruction = function createRefundInstruction(api, address, version, assetCount) {
|
|
9250
9043
|
return {
|
|
9251
9044
|
SetAppendix: [{
|
|
9252
9045
|
DepositAsset: {
|
|
@@ -9257,7 +9050,7 @@ var createRefundInstruction = function createRefundInstruction(api, senderAddres
|
|
|
9257
9050
|
},
|
|
9258
9051
|
beneficiary: createBeneficiaryLocation({
|
|
9259
9052
|
api: api,
|
|
9260
|
-
address:
|
|
9053
|
+
address: address,
|
|
9261
9054
|
version: version
|
|
9262
9055
|
})
|
|
9263
9056
|
}
|
|
@@ -9295,7 +9088,7 @@ var constructTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
9295
9088
|
isSubBridge,
|
|
9296
9089
|
isRelayAsset,
|
|
9297
9090
|
options,
|
|
9298
|
-
|
|
9091
|
+
sender,
|
|
9299
9092
|
version,
|
|
9300
9093
|
assetCount,
|
|
9301
9094
|
refundInstruction,
|
|
@@ -9310,9 +9103,9 @@ var constructTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
9310
9103
|
case 0:
|
|
9311
9104
|
fees = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
|
|
9312
9105
|
origin = context.origin, assetInfo = context.assetInfo, isSubBridge = context.isSubBridge, isRelayAsset = context.isRelayAsset, options = context.options;
|
|
9313
|
-
|
|
9106
|
+
sender = options.sender, version = options.version;
|
|
9314
9107
|
assetCount = isRelayAsset ? 1 : 2;
|
|
9315
|
-
refundInstruction =
|
|
9108
|
+
refundInstruction = sender && !isSubBridge ? createRefundInstruction(origin.api, sender, version, assetCount) : null;
|
|
9316
9109
|
resolvedFees = fees !== null && fees !== void 0 ? fees : {
|
|
9317
9110
|
hopFees: 0n,
|
|
9318
9111
|
destFee: 0n
|
|
@@ -9409,20 +9202,20 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
9409
9202
|
|
|
9410
9203
|
var createCallForReserve = /*#__PURE__*/function () {
|
|
9411
9204
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, reserveChain, options) {
|
|
9412
|
-
var api, destination,
|
|
9205
|
+
var api, destination, sender, recipient, currency, feeCurrency, version, serialized, tx, dryRunResult, success;
|
|
9413
9206
|
return _regenerator().w(function (_context) {
|
|
9414
9207
|
while (1) switch (_context.n) {
|
|
9415
9208
|
case 0:
|
|
9416
|
-
api = options.api, destination = options.destination,
|
|
9209
|
+
api = options.api, destination = options.destination, sender = options.sender, recipient = options.recipient, currency = options.currency, feeCurrency = options.feeCurrency, version = options.version;
|
|
9417
9210
|
_context.n = 1;
|
|
9418
9211
|
return createTypeAndThenCall(options, {
|
|
9419
9212
|
reserveChain: reserveChain
|
|
9420
9213
|
});
|
|
9421
9214
|
case 1:
|
|
9422
9215
|
serialized = _context.v;
|
|
9423
|
-
|
|
9216
|
+
assertSender(sender);
|
|
9217
|
+
assertAddressIsString(recipient);
|
|
9424
9218
|
assertToIsString(destination, 'Location destination is not supported for reserve auto-selection.');
|
|
9425
|
-
assertSenderAddress(senderAddress);
|
|
9426
9219
|
tx = api.deserializeExtrinsics(serialized);
|
|
9427
9220
|
_context.n = 2;
|
|
9428
9221
|
return dryRunInternal({
|
|
@@ -9430,8 +9223,7 @@ var createCallForReserve = /*#__PURE__*/function () {
|
|
|
9430
9223
|
tx: tx,
|
|
9431
9224
|
origin: chain,
|
|
9432
9225
|
destination: destination,
|
|
9433
|
-
|
|
9434
|
-
senderAddress: senderAddress,
|
|
9226
|
+
sender: sender,
|
|
9435
9227
|
currency: currency,
|
|
9436
9228
|
version: version,
|
|
9437
9229
|
feeAsset: feeCurrency,
|
|
@@ -9514,18 +9306,18 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(asset, feeResult) {
|
|
|
9514
9306
|
};
|
|
9515
9307
|
var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
9516
9308
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
9517
|
-
var api, buildTx, origin, destination, currency,
|
|
9309
|
+
var api, buildTx, origin, destination, currency, sender, recipient, feeAsset, version, isSubBridge, destApi, asset, amount, destAsset, ed, balance, xcmFeeResult, dryRunError, hops, _xcmFeeResult$destina, destFee, destFeeType, destFeeAsset, destDryRunError, erroredHop, hopError, isUnableToCompute, tx, totalFee, method, feeToSubtract;
|
|
9518
9310
|
return _regenerator().w(function (_context) {
|
|
9519
9311
|
while (1) switch (_context.n) {
|
|
9520
9312
|
case 0:
|
|
9521
|
-
api = options.api, buildTx = options.buildTx, origin = options.origin, destination = options.destination, currency = options.currency,
|
|
9313
|
+
api = options.api, buildTx = options.buildTx, origin = options.origin, destination = options.destination, currency = options.currency, sender = options.sender, recipient = options.recipient, feeAsset = options.feeAsset, version = options.version;
|
|
9522
9314
|
if (!isExternalChain(destination)) {
|
|
9523
9315
|
_context.n = 1;
|
|
9524
9316
|
break;
|
|
9525
9317
|
}
|
|
9526
9318
|
return _context.a(2, true);
|
|
9527
9319
|
case 1:
|
|
9528
|
-
validateAddress(api,
|
|
9320
|
+
validateAddress(api, recipient, destination, true);
|
|
9529
9321
|
isSubBridge = isSubstrateBridge(origin, destination);
|
|
9530
9322
|
if (!isSubBridge) {
|
|
9531
9323
|
_context.n = 2;
|
|
@@ -9543,7 +9335,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9543
9335
|
ed = getEdFromAssetOrThrow(destAsset);
|
|
9544
9336
|
_context.n = 4;
|
|
9545
9337
|
return getAssetBalanceInternal({
|
|
9546
|
-
address:
|
|
9338
|
+
address: recipient,
|
|
9547
9339
|
chain: destination,
|
|
9548
9340
|
api: destApi,
|
|
9549
9341
|
asset: destAsset
|
|
@@ -9556,8 +9348,8 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9556
9348
|
buildTx: buildTx,
|
|
9557
9349
|
origin: origin,
|
|
9558
9350
|
destination: destination,
|
|
9559
|
-
|
|
9560
|
-
|
|
9351
|
+
sender: sender,
|
|
9352
|
+
recipient: recipient,
|
|
9561
9353
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
9562
9354
|
amount: amount
|
|
9563
9355
|
}),
|
|
@@ -9693,9 +9485,6 @@ var createRouterBuilder = function createRouterBuilder(options) {
|
|
|
9693
9485
|
if ((_options$transactOpti = options.transactOptions) !== null && _options$transactOpti !== void 0 && _options$transactOpti.call) {
|
|
9694
9486
|
throw new UnsupportedOperationError('Cannot use transact options together with swap options.');
|
|
9695
9487
|
}
|
|
9696
|
-
if (api.getType() !== 'PAPI') {
|
|
9697
|
-
throw new UnsupportedOperationError('Swaps are only supported when using PAPI SDK.');
|
|
9698
|
-
}
|
|
9699
9488
|
var _getSwapExtensionOrTh = getSwapExtensionOrThrow(),
|
|
9700
9489
|
RouterBuilder = _getSwapExtensionOrTh.RouterBuilder;
|
|
9701
9490
|
var from = options.from,
|
|
@@ -9707,27 +9496,16 @@ var createRouterBuilder = function createRouterBuilder(options) {
|
|
|
9707
9496
|
exchange = _options$swapOptions.exchange,
|
|
9708
9497
|
slippage = _options$swapOptions.slippage,
|
|
9709
9498
|
onStatusChange = _options$swapOptions.onStatusChange,
|
|
9710
|
-
|
|
9711
|
-
address = options.
|
|
9499
|
+
sender = options.sender,
|
|
9500
|
+
address = options.recipient;
|
|
9712
9501
|
assertToIsString(to);
|
|
9713
9502
|
assertAddressIsString(address);
|
|
9714
|
-
|
|
9503
|
+
assertSender(sender);
|
|
9715
9504
|
if (Array.isArray(currency)) {
|
|
9716
9505
|
throw new UnsupportedOperationError('Swaps with multiple currencies are not supported.');
|
|
9717
9506
|
}
|
|
9718
|
-
var
|
|
9719
|
-
var routerConfig = convertBuilderConfig(config);
|
|
9720
|
-
var builder = RouterBuilder(routerConfig)
|
|
9721
|
-
// Temporarily use type cast till the swap pkg dep is released and updated
|
|
9722
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
9723
|
-
.from(from).exchange(exchange)
|
|
9724
|
-
// Temporarily use type cast till the swap pkg dep is released and updated
|
|
9725
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-explicit-any
|
|
9726
|
-
.to(to).currencyFrom(currency).currencyTo(currencyTo).amount(currency.amount).senderAddress(senderAddress).evmSenderAddress(evmSenderAddress).recipientAddress(address).slippagePct((_slippage$toString = slippage === null || slippage === void 0 ? void 0 : slippage.toString()) !== null && _slippage$toString !== void 0 ? _slippage$toString : DEFAULT_SWAP_SLIPPAGE.toString());
|
|
9507
|
+
var builder = RouterBuilder(api).from(from).exchange(exchange).to(to).currencyFrom(currency).currencyTo(currencyTo).amount(currency.amount).sender(sender).evmSenderAddress(evmSenderAddress).recipient(address).slippagePct((_slippage$toString = slippage === null || slippage === void 0 ? void 0 : slippage.toString()) !== null && _slippage$toString !== void 0 ? _slippage$toString : DEFAULT_SWAP_SLIPPAGE.toString());
|
|
9727
9508
|
if (onStatusChange) {
|
|
9728
|
-
// We cast because router types are bind to specific PAPI types
|
|
9729
|
-
// Will be resolved when we make RouterBuilder generic
|
|
9730
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
9731
9509
|
builder = builder.onStatusChange(onStatusChange);
|
|
9732
9510
|
}
|
|
9733
9511
|
return builder;
|
|
@@ -9766,7 +9544,7 @@ var computeOverridenAmount = function computeOverridenAmount(options, increaseAm
|
|
|
9766
9544
|
api = options.api;
|
|
9767
9545
|
var amount = options.currency.amount;
|
|
9768
9546
|
var config = api.getConfig();
|
|
9769
|
-
if (isConfig(config) && config.abstractDecimals && typeof amount !== 'bigint') {
|
|
9547
|
+
if (!(isConfig(config) && config.abstractDecimals === false) && typeof amount !== 'bigint') {
|
|
9770
9548
|
var base = relative ? Number(amount) : 0;
|
|
9771
9549
|
return Number(increaseAmount) + base;
|
|
9772
9550
|
} else {
|
|
@@ -9828,30 +9606,26 @@ var createTxOverrideAmount = /*#__PURE__*/function () {
|
|
|
9828
9606
|
}();
|
|
9829
9607
|
var createTransferOrSwapAll = /*#__PURE__*/function () {
|
|
9830
9608
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
9831
|
-
var api, from, swapOptions,
|
|
9609
|
+
var api, from, swapOptions, _t, _t2, _t3, _t4;
|
|
9832
9610
|
return _regenerator().w(function (_context3) {
|
|
9833
9611
|
while (1) switch (_context3.n) {
|
|
9834
9612
|
case 0:
|
|
9835
9613
|
api = options.api, from = options.from, swapOptions = options.swapOptions;
|
|
9836
9614
|
if (!swapOptions) {
|
|
9837
|
-
_context3.n =
|
|
9615
|
+
_context3.n = 1;
|
|
9838
9616
|
break;
|
|
9839
9617
|
}
|
|
9840
|
-
_context3.
|
|
9841
|
-
return executeWithRouter(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
9618
|
+
return _context3.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
9842
9619
|
swapOptions: swapOptions
|
|
9843
9620
|
}), function (builder) {
|
|
9844
|
-
return builder.
|
|
9845
|
-
});
|
|
9621
|
+
return builder.build();
|
|
9622
|
+
}));
|
|
9846
9623
|
case 1:
|
|
9847
|
-
transactions = _context3.v;
|
|
9848
|
-
return _context3.a(2, transactions);
|
|
9849
|
-
case 2:
|
|
9850
9624
|
_t = api.getApi();
|
|
9851
9625
|
_t2 = from;
|
|
9852
|
-
_context3.n =
|
|
9626
|
+
_context3.n = 2;
|
|
9853
9627
|
return createTransfer(options);
|
|
9854
|
-
case
|
|
9628
|
+
case 2:
|
|
9855
9629
|
_t3 = _context3.v;
|
|
9856
9630
|
_t4 = {
|
|
9857
9631
|
type: 'TRANSFER',
|
|
@@ -9968,7 +9742,7 @@ var resolveParaId = function resolveParaId(paraId, destination) {
|
|
|
9968
9742
|
|
|
9969
9743
|
var abstractDecimals = function abstractDecimals(amount, decimals, api) {
|
|
9970
9744
|
var config = api.getConfig();
|
|
9971
|
-
var abstractDecimals = isConfig(config) && config.abstractDecimals
|
|
9745
|
+
var abstractDecimals = !(isConfig(config) && config.abstractDecimals === false);
|
|
9972
9746
|
return applyDecimalAbstraction(amount, decimals, abstractDecimals);
|
|
9973
9747
|
};
|
|
9974
9748
|
var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals, shouldAbstract) {
|
|
@@ -10192,11 +9966,11 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, origin,
|
|
|
10192
9966
|
asset = input.assetInfo,
|
|
10193
9967
|
destination = input.destination,
|
|
10194
9968
|
paraIdTo = input.paraIdTo,
|
|
10195
|
-
|
|
9969
|
+
recipient = input.recipient;
|
|
10196
9970
|
var dest = createDestination(version, origin, destination, paraIdTo);
|
|
10197
9971
|
var beneficiary = createBeneficiaryLocation({
|
|
10198
9972
|
api: api,
|
|
10199
|
-
address:
|
|
9973
|
+
address: recipient,
|
|
10200
9974
|
version: version
|
|
10201
9975
|
});
|
|
10202
9976
|
var transformedLocation = localizeLocation(origin, asset.location);
|
|
@@ -10279,7 +10053,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10279
10053
|
var api = options.api,
|
|
10280
10054
|
feeAsset = options.feeAssetInfo,
|
|
10281
10055
|
useJitWithdraw = options.useJitWithdraw,
|
|
10282
|
-
|
|
10056
|
+
recipient = options.recipient,
|
|
10283
10057
|
version = options.version;
|
|
10284
10058
|
var context = prepareExecuteContext(options);
|
|
10285
10059
|
var assetLocalized = context.assetLocalized,
|
|
@@ -10304,7 +10078,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10304
10078
|
}
|
|
10305
10079
|
var beneficiary = createBeneficiaryLocation({
|
|
10306
10080
|
api: api,
|
|
10307
|
-
address:
|
|
10081
|
+
address: recipient,
|
|
10308
10082
|
version: version
|
|
10309
10083
|
});
|
|
10310
10084
|
var depositInstruction = {
|
|
@@ -10321,18 +10095,18 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10321
10095
|
|
|
10322
10096
|
var createDirectExecuteXcm = /*#__PURE__*/function () {
|
|
10323
10097
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10324
|
-
var api, version, transactOptions, destChain,
|
|
10098
|
+
var api, version, transactOptions, destChain, recipient, _prepareCommonExecute, prefix, depositInstruction, transact, baseXcm, fullXcm, _t;
|
|
10325
10099
|
return _regenerator().w(function (_context) {
|
|
10326
10100
|
while (1) switch (_context.n) {
|
|
10327
10101
|
case 0:
|
|
10328
|
-
api = options.api, version = options.version, transactOptions = options.transactOptions, destChain = options.destChain,
|
|
10102
|
+
api = options.api, version = options.version, transactOptions = options.transactOptions, destChain = options.destChain, recipient = options.recipient;
|
|
10329
10103
|
_prepareCommonExecute = prepareCommonExecuteXcm(options), prefix = _prepareCommonExecute.prefix, depositInstruction = _prepareCommonExecute.depositInstruction;
|
|
10330
10104
|
if (!(transactOptions !== null && transactOptions !== void 0 && transactOptions.call)) {
|
|
10331
10105
|
_context.n = 2;
|
|
10332
10106
|
break;
|
|
10333
10107
|
}
|
|
10334
10108
|
_context.n = 1;
|
|
10335
|
-
return createTransactInstructions(api, transactOptions, version, destChain,
|
|
10109
|
+
return createTransactInstructions(api, transactOptions, version, destChain, recipient);
|
|
10336
10110
|
case 1:
|
|
10337
10111
|
_t = _context.v;
|
|
10338
10112
|
_context.n = 3;
|
|
@@ -10363,13 +10137,13 @@ var getReserveFeeFromHops = function getReserveFeeFromHops(hops) {
|
|
|
10363
10137
|
var FEE_PADDING_PERCENTAGE$1 = 40;
|
|
10364
10138
|
var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
10365
10139
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10366
|
-
var api, chain,
|
|
10140
|
+
var api, chain, sender, paraIdTo, destChain, assetInfo, currency, feeCurrency, recipient, feeAssetInfo, version, transactOptions, checkAmount, internalOptions, FEE_ASSET_AMOUNT, feeAssetAmount, call, dryRunResult, originFeeEstimate, originFee, reserveFeeEstimate, reserveFee, xcm, weight, _t, _t2;
|
|
10367
10141
|
return _regenerator().w(function (_context) {
|
|
10368
10142
|
while (1) switch (_context.n) {
|
|
10369
10143
|
case 0:
|
|
10370
|
-
api = options.api, chain = options.chain,
|
|
10371
|
-
|
|
10372
|
-
assertAddressIsString(
|
|
10144
|
+
api = options.api, chain = options.chain, sender = options.sender, paraIdTo = options.paraIdTo, destChain = options.destChain, assetInfo = options.assetInfo, currency = options.currency, feeCurrency = options.feeCurrency, recipient = options.recipient, feeAssetInfo = options.feeAssetInfo, version = options.version, transactOptions = options.transactOptions;
|
|
10145
|
+
assertSender(sender);
|
|
10146
|
+
assertAddressIsString(recipient);
|
|
10373
10147
|
checkAmount = function checkAmount(fee) {
|
|
10374
10148
|
if (assetInfo.amount <= fee) throw new AmountTooLowError();
|
|
10375
10149
|
};
|
|
@@ -10384,13 +10158,12 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10384
10158
|
api: api,
|
|
10385
10159
|
chain: chain,
|
|
10386
10160
|
destChain: destChain,
|
|
10387
|
-
address: address,
|
|
10388
10161
|
assetInfo: assetInfo,
|
|
10389
10162
|
currency: currency,
|
|
10390
10163
|
feeAssetInfo: feeAssetInfo,
|
|
10391
10164
|
feeCurrency: feeCurrency,
|
|
10392
|
-
|
|
10393
|
-
|
|
10165
|
+
sender: sender,
|
|
10166
|
+
recipient: recipient,
|
|
10394
10167
|
version: version,
|
|
10395
10168
|
paraIdTo: paraIdTo,
|
|
10396
10169
|
transactOptions: transactOptions
|
|
@@ -10414,8 +10187,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10414
10187
|
tx: api.deserializeExtrinsics(call),
|
|
10415
10188
|
origin: chain,
|
|
10416
10189
|
destination: destChain,
|
|
10417
|
-
|
|
10418
|
-
address: address,
|
|
10190
|
+
sender: sender,
|
|
10419
10191
|
currency: currency,
|
|
10420
10192
|
version: version,
|
|
10421
10193
|
feeAsset: feeCurrency,
|
|
@@ -10473,7 +10245,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
10473
10245
|
needsMultiHop = isMultiHopSwap(exchangeChain, assetInfoFrom, assetInfoTo);
|
|
10474
10246
|
nativeAsset = findAssetInfoOrThrow(exchangeChain, {
|
|
10475
10247
|
symbol: Native(nativeSymbol)
|
|
10476
|
-
}
|
|
10248
|
+
});
|
|
10477
10249
|
if (needsMultiHop) {
|
|
10478
10250
|
_context.n = 1;
|
|
10479
10251
|
break;
|
|
@@ -10514,11 +10286,11 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
10514
10286
|
var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
10515
10287
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
10516
10288
|
var _ref3, _ref4;
|
|
10517
|
-
var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, feeAssetInfo, _options$fees2, originFee, originReserveFee, destReserveFee,
|
|
10289
|
+
var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, feeAssetInfo, _options$fees2, originFee, originReserveFee, destReserveFee, sender, recipient, version, paraIdTo, isEthereumDest, resolvedDestChain, assetFrom, amountOut, assetTo, assetToLocalizedToDest, ethFeeAssetInfo, ethBridgeFee, isMainAssetDot, nativeFeeAssetInfo, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, executionFee, resolvedFeeAssetInfo, hasSeparateFeeAsset, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, ethAsset, messageId, snowbridgeInstructions, finalXcm, fullXcm;
|
|
10518
10290
|
return _regenerator().w(function (_context2) {
|
|
10519
10291
|
while (1) switch (_context2.n) {
|
|
10520
10292
|
case 0:
|
|
10521
|
-
api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, feeAssetInfo = options.feeAssetInfo, _options$fees2 = options.fees, originFee = _options$fees2.originFee, originReserveFee = _options$fees2.originReserveFee, destReserveFee = _options$fees2.destReserveFee,
|
|
10293
|
+
api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, feeAssetInfo = options.feeAssetInfo, _options$fees2 = options.fees, originFee = _options$fees2.originFee, originReserveFee = _options$fees2.originReserveFee, destReserveFee = _options$fees2.destReserveFee, sender = options.sender, recipient = options.recipient, version = options.version, paraIdTo = options.paraIdTo;
|
|
10522
10294
|
isEthereumDest = destChain !== undefined && isExternalChain(destChain); // For Ethereum destination, the actual hop target is AssetHub (bridge hub)
|
|
10523
10295
|
resolvedDestChain = isEthereumDest ? "AssetHub".concat(getRelayChainOf(chain !== null && chain !== void 0 ? chain : exchangeChain)) : undefined;
|
|
10524
10296
|
assetFrom = createAsset(version, assetInfoFrom.amount, localizeLocation(exchangeChain, assetInfoFrom.location));
|
|
@@ -10559,7 +10331,7 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
10559
10331
|
assetInfo: assetInfoFrom,
|
|
10560
10332
|
feeAssetInfo: resolvedFeeAssetInfo,
|
|
10561
10333
|
useJitWithdraw: isEthereumDest,
|
|
10562
|
-
|
|
10334
|
+
recipient: recipient,
|
|
10563
10335
|
fees: {
|
|
10564
10336
|
originFee: hasSeparateFeeAsset ? ethBridgeFee || originFee : originFee,
|
|
10565
10337
|
reserveFee: originReserveFee
|
|
@@ -10576,16 +10348,16 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
10576
10348
|
}
|
|
10577
10349
|
ethAsset = findAssetInfoOrThrow('Ethereum', {
|
|
10578
10350
|
symbol: assetInfoTo.symbol
|
|
10579
|
-
}
|
|
10351
|
+
});
|
|
10580
10352
|
_context2.n = 5;
|
|
10581
|
-
return generateMessageId(api,
|
|
10353
|
+
return generateMessageId(api, sender, getParaId(chain !== null && chain !== void 0 ? chain : exchangeChain), ethAsset.assetId, recipient, amountOut);
|
|
10582
10354
|
case 5:
|
|
10583
10355
|
messageId = _context2.v;
|
|
10584
10356
|
snowbridgeInstructions = createEthereumBridgeInstructions({
|
|
10585
10357
|
api: api,
|
|
10586
|
-
|
|
10358
|
+
sender: sender,
|
|
10359
|
+
recipient: recipient,
|
|
10587
10360
|
assetInfo: assetInfoTo,
|
|
10588
|
-
senderAddress: senderAddress,
|
|
10589
10361
|
version: version
|
|
10590
10362
|
}, chain !== null && chain !== void 0 ? chain : exchangeChain, messageId, ethAsset); // If exchange chain is already AssetHub, instructions run directly there
|
|
10591
10363
|
// Otherwise, route from exchange chain to AssetHub with bridge instructions as suffix
|
|
@@ -10808,11 +10580,11 @@ var createXcmAndCall = /*#__PURE__*/function () {
|
|
|
10808
10580
|
}();
|
|
10809
10581
|
var handleSwapExecuteTransfer = /*#__PURE__*/function () {
|
|
10810
10582
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
10811
|
-
var api, chain, exchangeChain, destChain, assetFrom, assetTo, currencyTo, feeAssetInfo,
|
|
10583
|
+
var api, chain, exchangeChain, destChain, assetFrom, assetTo, currencyTo, feeAssetInfo, sender, recipient, calculateMinAmountOut, version, isEthereumDest, hasSeparateFeeAsset, internalOptions, dryRunParams, FEE_ASSET_AMOUNT, dummyOriginFee, fees, totalFeesPre, _yield$createXcmAndCa, initialCall, firstDryRunResult, exchangeHopIndex, extractedFees, totalFees, updatedAssetTo, amountAvailableForSwap, recalculatedMinAmountOut, _yield$createXcmAndCa2, finalCall;
|
|
10812
10584
|
return _regenerator().w(function (_context3) {
|
|
10813
10585
|
while (1) switch (_context3.n) {
|
|
10814
10586
|
case 0:
|
|
10815
|
-
api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetFrom = options.assetInfoFrom, assetTo = options.assetInfoTo, currencyTo = options.currencyTo, feeAssetInfo = options.feeAssetInfo,
|
|
10587
|
+
api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetFrom = options.assetInfoFrom, assetTo = options.assetInfoTo, currencyTo = options.currencyTo, feeAssetInfo = options.feeAssetInfo, sender = options.sender, recipient = options.recipient, calculateMinAmountOut = options.calculateMinAmountOut;
|
|
10816
10588
|
_context3.n = 1;
|
|
10817
10589
|
return api.init(chain !== null && chain !== void 0 ? chain : exchangeChain);
|
|
10818
10590
|
case 1:
|
|
@@ -10829,8 +10601,8 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10829
10601
|
api: api,
|
|
10830
10602
|
origin: chain !== null && chain !== void 0 ? chain : exchangeChain,
|
|
10831
10603
|
destination: destChain !== null && destChain !== void 0 ? destChain : exchangeChain,
|
|
10832
|
-
|
|
10833
|
-
|
|
10604
|
+
sender: sender,
|
|
10605
|
+
recipient: recipient,
|
|
10834
10606
|
version: version,
|
|
10835
10607
|
currency: {
|
|
10836
10608
|
location: assetFrom.location,
|
|
@@ -10947,27 +10719,26 @@ var getLocalTransferAmount = function getLocalTransferAmount(_ref) {
|
|
|
10947
10719
|
var handleToAhTeleport = /*#__PURE__*/function () {
|
|
10948
10720
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(origin, input, defaultTx) {
|
|
10949
10721
|
var _dryRunResult$destina, _feeResult$origin$wei;
|
|
10950
|
-
var api, destination,
|
|
10722
|
+
var api, destination, sender, recipient, asset, currency, version, dryRunResult, dummyTx, feeResult, originExecutionFee, destinationExecutionFee;
|
|
10951
10723
|
return _regenerator().w(function (_context) {
|
|
10952
10724
|
while (1) switch (_context.n) {
|
|
10953
10725
|
case 0:
|
|
10954
|
-
api = input.api, destination = input.destination,
|
|
10726
|
+
api = input.api, destination = input.destination, sender = input.sender, recipient = input.recipient, asset = input.assetInfo, currency = input.currency, version = input.version;
|
|
10955
10727
|
assertToIsString(destination, 'Location destination is not supported for AH teleport.');
|
|
10956
|
-
if (!isTLocation(
|
|
10728
|
+
if (!isTLocation(recipient)) {
|
|
10957
10729
|
_context.n = 1;
|
|
10958
10730
|
break;
|
|
10959
10731
|
}
|
|
10960
10732
|
throw new InvalidAddressError('Location address is not supported for this scenario');
|
|
10961
10733
|
case 1:
|
|
10962
|
-
|
|
10734
|
+
assertSender(sender);
|
|
10963
10735
|
_context.n = 2;
|
|
10964
10736
|
return dryRunInternal({
|
|
10965
10737
|
api: api,
|
|
10966
10738
|
tx: defaultTx,
|
|
10967
10739
|
origin: origin,
|
|
10968
10740
|
destination: destination,
|
|
10969
|
-
|
|
10970
|
-
address: address,
|
|
10741
|
+
sender: sender,
|
|
10971
10742
|
currency: currency,
|
|
10972
10743
|
version: version
|
|
10973
10744
|
});
|
|
@@ -10989,8 +10760,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
10989
10760
|
tx: dummyTx,
|
|
10990
10761
|
origin: origin,
|
|
10991
10762
|
destination: destination,
|
|
10992
|
-
|
|
10993
|
-
|
|
10763
|
+
sender: sender,
|
|
10764
|
+
recipient: recipient,
|
|
10994
10765
|
version: version,
|
|
10995
10766
|
currency: currency,
|
|
10996
10767
|
disableFallback: false,
|
|
@@ -11024,11 +10795,11 @@ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain
|
|
|
11024
10795
|
|
|
11025
10796
|
var handleTransactUsingSend = /*#__PURE__*/function () {
|
|
11026
10797
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11027
|
-
var api, version, chain, destination, destChain,
|
|
10798
|
+
var api, version, chain, destination, destChain, recipient, paraIdTo, asset, transactOptions, dest, transactInstructions, message;
|
|
11028
10799
|
return _regenerator().w(function (_context) {
|
|
11029
10800
|
while (1) switch (_context.n) {
|
|
11030
10801
|
case 0:
|
|
11031
|
-
api = _ref.api, version = _ref.version, chain = _ref.chain, destination = _ref.destination, destChain = _ref.destChain,
|
|
10802
|
+
api = _ref.api, version = _ref.version, chain = _ref.chain, destination = _ref.destination, destChain = _ref.destChain, recipient = _ref.recipient, paraIdTo = _ref.paraIdTo, asset = _ref.asset, transactOptions = _ref.transactOptions;
|
|
11032
10803
|
dest = createDestination(version, chain, destination, paraIdTo);
|
|
11033
10804
|
if (transactOptions !== null && transactOptions !== void 0 && transactOptions.call) {
|
|
11034
10805
|
_context.n = 1;
|
|
@@ -11042,9 +10813,9 @@ var handleTransactUsingSend = /*#__PURE__*/function () {
|
|
|
11042
10813
|
}
|
|
11043
10814
|
throw new UnsupportedOperationError('destChain must be provided when using handleTransactUsingSend');
|
|
11044
10815
|
case 2:
|
|
11045
|
-
assertAddressIsString(
|
|
10816
|
+
assertAddressIsString(recipient);
|
|
11046
10817
|
_context.n = 3;
|
|
11047
|
-
return createTransactInstructions(api, transactOptions, version, destChain,
|
|
10818
|
+
return createTransactInstructions(api, transactOptions, version, destChain, recipient);
|
|
11048
10819
|
case 3:
|
|
11049
10820
|
transactInstructions = _context.v;
|
|
11050
10821
|
message = [{
|
|
@@ -11060,7 +10831,7 @@ var handleTransactUsingSend = /*#__PURE__*/function () {
|
|
|
11060
10831
|
},
|
|
11061
10832
|
beneficiary: createBeneficiaryLocation({
|
|
11062
10833
|
api: api,
|
|
11063
|
-
address:
|
|
10834
|
+
address: recipient,
|
|
11064
10835
|
version: version
|
|
11065
10836
|
})
|
|
11066
10837
|
}
|
|
@@ -11231,7 +11002,7 @@ var buildXTokensCall = function buildXTokensCall(input, currencySelection, fees)
|
|
|
11231
11002
|
origin = input.origin,
|
|
11232
11003
|
destination = input.destination,
|
|
11233
11004
|
overriddenAsset = input.overriddenAsset,
|
|
11234
|
-
|
|
11005
|
+
recipient = input.recipient,
|
|
11235
11006
|
asset = input.asset,
|
|
11236
11007
|
pallet = input.pallet,
|
|
11237
11008
|
version = input.version,
|
|
@@ -11244,7 +11015,7 @@ var buildXTokensCall = function buildXTokensCall(input, currencySelection, fees)
|
|
|
11244
11015
|
api: api,
|
|
11245
11016
|
origin: origin,
|
|
11246
11017
|
destination: destination,
|
|
11247
|
-
|
|
11018
|
+
recipient: recipient,
|
|
11248
11019
|
version: version,
|
|
11249
11020
|
paraId: paraIdTo
|
|
11250
11021
|
});
|
|
@@ -11303,12 +11074,12 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11303
11074
|
}, {
|
|
11304
11075
|
key: "transfer",
|
|
11305
11076
|
value: function () {
|
|
11306
|
-
var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(
|
|
11307
|
-
var api, asset, currency, feeAsset, feeCurrency,
|
|
11077
|
+
var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(transferOptions) {
|
|
11078
|
+
var api, asset, currency, feeAsset, feeCurrency, recipient, destination, paraIdTo, overriddenAsset, version, sender, ahAddress, pallet, method, keepAlive, transactOptions, scenario, paraId, destChain, isLocalTransfer, isRelayAsset, mythAsset, isMythAsset, assetNeedsTypeThen, supportsTypeThen, isSubBridge, useTypeAndThen, options, promise, shouldUseTeleport, isAhToOtherPara, isOtherParaToAh, isAllowedAhTransfer, isAHOrigin, isAHDest, isExternalAsset, isEthDest, isExternalAssetViaAh, isExternalAssetToAh, call, isBifrostOrigin, isJamtonOrigin, isAssetHubDest, useMultiAssets, input, _t;
|
|
11308
11079
|
return _regenerator().w(function (_context) {
|
|
11309
11080
|
while (1) switch (_context.n) {
|
|
11310
11081
|
case 0:
|
|
11311
|
-
api =
|
|
11082
|
+
api = transferOptions.api, asset = transferOptions.assetInfo, currency = transferOptions.currency, feeAsset = transferOptions.feeAsset, feeCurrency = transferOptions.feeCurrency, recipient = transferOptions.recipient, destination = transferOptions.to, paraIdTo = transferOptions.paraIdTo, overriddenAsset = transferOptions.overriddenAsset, version = transferOptions.version, sender = transferOptions.sender, ahAddress = transferOptions.ahAddress, pallet = transferOptions.pallet, method = transferOptions.method, keepAlive = transferOptions.keepAlive, transactOptions = transferOptions.transactOptions;
|
|
11312
11083
|
scenario = resolveScenario(this.chain, destination);
|
|
11313
11084
|
paraId = resolveParaId(paraIdTo, destination);
|
|
11314
11085
|
destChain = resolveDestChain(this.chain, paraId);
|
|
@@ -11317,7 +11088,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11317
11088
|
_context.n = 1;
|
|
11318
11089
|
break;
|
|
11319
11090
|
}
|
|
11320
|
-
return _context.a(2, this.transferLocal(_objectSpread2(_objectSpread2({},
|
|
11091
|
+
return _context.a(2, this.transferLocal(_objectSpread2(_objectSpread2({}, transferOptions), {}, {
|
|
11321
11092
|
keepAlive: keepAlive !== null && keepAlive !== void 0 ? keepAlive : true
|
|
11322
11093
|
})));
|
|
11323
11094
|
case 1:
|
|
@@ -11327,7 +11098,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11327
11098
|
}
|
|
11328
11099
|
throw new UnsupportedOperationError('Keep alive option is not yet supported for XCM transfers.');
|
|
11329
11100
|
case 2:
|
|
11330
|
-
this.throwIfTempDisabled(
|
|
11101
|
+
this.throwIfTempDisabled(transferOptions, destChain);
|
|
11331
11102
|
this.throwIfCantReceive(destChain);
|
|
11332
11103
|
isRelayAsset = deepEqual(asset.location, RELAY_LOCATION) && isSymbolMatch(getRelayChainSymbol(this.chain), asset.symbol);
|
|
11333
11104
|
mythAsset = findNativeAssetInfoOrThrow('Mythos');
|
|
@@ -11354,10 +11125,11 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11354
11125
|
chain: this.chain,
|
|
11355
11126
|
beneficiaryLocation: createBeneficiaryLocation({
|
|
11356
11127
|
api: api,
|
|
11357
|
-
address:
|
|
11128
|
+
address: recipient,
|
|
11358
11129
|
version: version
|
|
11359
11130
|
}),
|
|
11360
|
-
|
|
11131
|
+
sender: sender,
|
|
11132
|
+
recipient: recipient,
|
|
11361
11133
|
asset: this.createAsset(asset, version),
|
|
11362
11134
|
overriddenAsset: overriddenAsset,
|
|
11363
11135
|
assetInfo: asset,
|
|
@@ -11369,7 +11141,6 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11369
11141
|
destChain: destChain,
|
|
11370
11142
|
paraIdTo: paraId,
|
|
11371
11143
|
version: version,
|
|
11372
|
-
senderAddress: senderAddress,
|
|
11373
11144
|
ahAddress: ahAddress,
|
|
11374
11145
|
pallet: pallet,
|
|
11375
11146
|
method: method,
|
|
@@ -11393,7 +11164,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11393
11164
|
case 6:
|
|
11394
11165
|
return _context.a(2, _t.deserializeExtrinsics.call(_t, _context.v));
|
|
11395
11166
|
case 7:
|
|
11396
|
-
shouldUseTeleport = this.shouldUseNativeAssetTeleport(
|
|
11167
|
+
shouldUseTeleport = this.shouldUseNativeAssetTeleport(transferOptions);
|
|
11397
11168
|
isAhToOtherPara = this.chain.startsWith('AssetHub') && destChain && !isTrustedChain(destChain);
|
|
11398
11169
|
isOtherParaToAh = (destChain === null || destChain === void 0 ? void 0 : destChain.startsWith('AssetHub')) && !isTrustedChain(this.chain);
|
|
11399
11170
|
isAllowedAhTransfer = function isAllowedAhTransfer(chain) {
|
|
@@ -11448,7 +11219,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11448
11219
|
input = {
|
|
11449
11220
|
api: api,
|
|
11450
11221
|
asset: asset,
|
|
11451
|
-
|
|
11222
|
+
recipient: recipient,
|
|
11452
11223
|
origin: this.chain,
|
|
11453
11224
|
scenario: scenario,
|
|
11454
11225
|
paraIdTo: paraId,
|
|
@@ -11542,7 +11313,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11542
11313
|
var assetHubChain = "AssetHub".concat(getRelayChainOf(this.chain));
|
|
11543
11314
|
var isRegisteredOnAh = findAssetInfo(assetHubChain, {
|
|
11544
11315
|
location: asset.location
|
|
11545
|
-
}
|
|
11316
|
+
});
|
|
11546
11317
|
return Boolean(isNativeAsset) && Boolean(isRegisteredOnAh) && (isAHPOrigin || isAHPDest);
|
|
11547
11318
|
}
|
|
11548
11319
|
}, {
|
|
@@ -11561,12 +11332,12 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11561
11332
|
key: "transferLocal",
|
|
11562
11333
|
value: function () {
|
|
11563
11334
|
var _transferLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
11564
|
-
var api, asset, feeAsset,
|
|
11335
|
+
var api, asset, feeAsset, recipient, sender, isAmountAll, validatedOptions, isNativeAsset, balance, localOptions;
|
|
11565
11336
|
return _regenerator().w(function (_context2) {
|
|
11566
11337
|
while (1) switch (_context2.n) {
|
|
11567
11338
|
case 0:
|
|
11568
|
-
api = options.api, asset = options.assetInfo, feeAsset = options.feeAsset,
|
|
11569
|
-
if (!isTLocation(
|
|
11339
|
+
api = options.api, asset = options.assetInfo, feeAsset = options.feeAsset, recipient = options.recipient, sender = options.sender, isAmountAll = options.isAmountAll;
|
|
11340
|
+
if (!isTLocation(recipient)) {
|
|
11570
11341
|
_context2.n = 1;
|
|
11571
11342
|
break;
|
|
11572
11343
|
}
|
|
@@ -11579,19 +11350,19 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11579
11350
|
throw new UnsupportedOperationError('Fee asset is not supported for local transfers');
|
|
11580
11351
|
case 2:
|
|
11581
11352
|
validatedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
11582
|
-
|
|
11353
|
+
recipient: recipient
|
|
11583
11354
|
});
|
|
11584
11355
|
isNativeAsset = asset.symbol === this.getNativeAssetSymbol() && asset.isNative;
|
|
11585
11356
|
if (!isAmountAll) {
|
|
11586
11357
|
_context2.n = 4;
|
|
11587
11358
|
break;
|
|
11588
11359
|
}
|
|
11589
|
-
|
|
11360
|
+
assertSender(sender);
|
|
11590
11361
|
_context2.n = 3;
|
|
11591
11362
|
return getAssetBalanceInternal({
|
|
11592
11363
|
api: api,
|
|
11593
11364
|
chain: this.chain,
|
|
11594
|
-
address:
|
|
11365
|
+
address: sender,
|
|
11595
11366
|
asset: asset
|
|
11596
11367
|
});
|
|
11597
11368
|
case 3:
|
|
@@ -11626,11 +11397,11 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11626
11397
|
value: function transferLocalNativeAsset(options) {
|
|
11627
11398
|
var api = options.api,
|
|
11628
11399
|
asset = options.assetInfo,
|
|
11629
|
-
|
|
11400
|
+
recipient = options.recipient,
|
|
11630
11401
|
isAmountAll = options.isAmountAll,
|
|
11631
11402
|
keepAlive = options.keepAlive;
|
|
11632
|
-
var dest = isChainEvm(this.chain) ?
|
|
11633
|
-
Id:
|
|
11403
|
+
var dest = isChainEvm(this.chain) ? recipient : {
|
|
11404
|
+
Id: recipient
|
|
11634
11405
|
};
|
|
11635
11406
|
if (isAmountAll) {
|
|
11636
11407
|
return Promise.resolve(api.deserializeExtrinsics({
|
|
@@ -11656,12 +11427,12 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11656
11427
|
value: function transferLocalNonNativeAsset(options) {
|
|
11657
11428
|
var api = options.api,
|
|
11658
11429
|
asset = options.assetInfo,
|
|
11659
|
-
|
|
11430
|
+
recipient = options.recipient,
|
|
11660
11431
|
isAmountAll = options.isAmountAll,
|
|
11661
11432
|
keepAlive = options.keepAlive;
|
|
11662
11433
|
assertHasId(asset);
|
|
11663
11434
|
var dest = {
|
|
11664
|
-
Id:
|
|
11435
|
+
Id: recipient
|
|
11665
11436
|
};
|
|
11666
11437
|
var currencyId = BigInt(asset.assetId);
|
|
11667
11438
|
if (isAmountAll) {
|
|
@@ -11694,8 +11465,8 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11694
11465
|
api,
|
|
11695
11466
|
asset,
|
|
11696
11467
|
version,
|
|
11697
|
-
|
|
11698
|
-
|
|
11468
|
+
sender,
|
|
11469
|
+
recipient,
|
|
11699
11470
|
feeAsset,
|
|
11700
11471
|
bridgeStatus,
|
|
11701
11472
|
ethAsset,
|
|
@@ -11718,7 +11489,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11718
11489
|
while (1) switch (_context3.n) {
|
|
11719
11490
|
case 0:
|
|
11720
11491
|
useOnlyDepositInstruction = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
|
11721
|
-
api = input.api, asset = input.assetInfo, version = input.version,
|
|
11492
|
+
api = input.api, asset = input.assetInfo, version = input.version, sender = input.sender, recipient = input.recipient, feeAsset = input.feeAssetInfo;
|
|
11722
11493
|
_context3.n = 1;
|
|
11723
11494
|
return getBridgeStatus(api.clone());
|
|
11724
11495
|
case 1:
|
|
@@ -11729,8 +11500,8 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11729
11500
|
}
|
|
11730
11501
|
throw new BridgeHaltedError();
|
|
11731
11502
|
case 2:
|
|
11732
|
-
assertAddressIsString(
|
|
11733
|
-
|
|
11503
|
+
assertAddressIsString(recipient);
|
|
11504
|
+
assertSender(sender);
|
|
11734
11505
|
ethAsset = createAsset(version, asset.amount, asset.location);
|
|
11735
11506
|
_context3.n = 3;
|
|
11736
11507
|
return api.createApiForChain('AssetHubPolkadot');
|
|
@@ -11747,7 +11518,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11747
11518
|
fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
|
|
11748
11519
|
ethAssetInfo = findAssetInfoOrThrow('Ethereum', {
|
|
11749
11520
|
symbol: asset.symbol
|
|
11750
|
-
}
|
|
11521
|
+
});
|
|
11751
11522
|
systemAssetInfo = findNativeAssetInfoOrThrow(getRelayChainOf(this.chain));
|
|
11752
11523
|
shouldIncludeFeeAsset = feeAsset && !isAssetEqual(feeAsset, asset) || !isAssetEqual(asset, systemAssetInfo);
|
|
11753
11524
|
if (!useOnlyDepositInstruction) {
|
|
@@ -11763,7 +11534,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11763
11534
|
},
|
|
11764
11535
|
beneficiary: createBeneficiaryLocation({
|
|
11765
11536
|
api: api,
|
|
11766
|
-
address:
|
|
11537
|
+
address: recipient,
|
|
11767
11538
|
version: version
|
|
11768
11539
|
})
|
|
11769
11540
|
}
|
|
@@ -11773,7 +11544,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11773
11544
|
case 5:
|
|
11774
11545
|
assertHasId(ethAssetInfo);
|
|
11775
11546
|
_context3.n = 6;
|
|
11776
|
-
return generateMessageId(api,
|
|
11547
|
+
return generateMessageId(api, sender, getParaId(this.chain), ethAssetInfo.assetId, recipient, asset.amount);
|
|
11777
11548
|
case 6:
|
|
11778
11549
|
messageId = _context3.v;
|
|
11779
11550
|
customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId, ethAssetInfo);
|
|
@@ -11907,18 +11678,18 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11907
11678
|
key: "transferLocalNativeAsset",
|
|
11908
11679
|
value: function () {
|
|
11909
11680
|
var _transferLocalNativeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
11910
|
-
var api,
|
|
11681
|
+
var api, recipient, sender, isAmountAll, keepAlive, createTx, fee, _yield$api$getPayment, partialFee, amount;
|
|
11911
11682
|
return _regenerator().w(function (_context) {
|
|
11912
11683
|
while (1) switch (_context.n) {
|
|
11913
11684
|
case 0:
|
|
11914
|
-
api = options.api,
|
|
11685
|
+
api = options.api, recipient = options.recipient, sender = options.sender, isAmountAll = options.isAmountAll, keepAlive = options.keepAlive;
|
|
11915
11686
|
createTx = function createTx(amount) {
|
|
11916
11687
|
return api.deserializeExtrinsics({
|
|
11917
11688
|
module: 'Currencies',
|
|
11918
11689
|
method: 'transfer_native_currency',
|
|
11919
11690
|
params: {
|
|
11920
11691
|
dest: {
|
|
11921
|
-
Id:
|
|
11692
|
+
Id: recipient
|
|
11922
11693
|
},
|
|
11923
11694
|
amount: amount
|
|
11924
11695
|
}
|
|
@@ -11929,9 +11700,9 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11929
11700
|
_context.n = 2;
|
|
11930
11701
|
break;
|
|
11931
11702
|
}
|
|
11932
|
-
|
|
11703
|
+
assertSender(sender);
|
|
11933
11704
|
_context.n = 1;
|
|
11934
|
-
return api.getPaymentInfo(createTx(MIN_AMOUNT),
|
|
11705
|
+
return api.getPaymentInfo(createTx(MIN_AMOUNT), sender);
|
|
11935
11706
|
case 1:
|
|
11936
11707
|
_yield$api$getPayment = _context.v;
|
|
11937
11708
|
partialFee = _yield$api$getPayment.partialFee;
|
|
@@ -11952,7 +11723,7 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11952
11723
|
value: function transferLocalNonNativeAsset(options) {
|
|
11953
11724
|
var api = options.api,
|
|
11954
11725
|
asset = options.assetInfo,
|
|
11955
|
-
|
|
11726
|
+
recipient = options.recipient;
|
|
11956
11727
|
if (asset.symbol.toLowerCase() === 'lcdot') {
|
|
11957
11728
|
throw new InvalidCurrencyError('LcDOT local transfers are not supported');
|
|
11958
11729
|
}
|
|
@@ -11962,7 +11733,7 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11962
11733
|
method: 'transfer',
|
|
11963
11734
|
params: {
|
|
11964
11735
|
dest: {
|
|
11965
|
-
Id:
|
|
11736
|
+
Id: recipient
|
|
11966
11737
|
},
|
|
11967
11738
|
currency_id: this.getCustomCurrencyId(asset),
|
|
11968
11739
|
amount: amount
|
|
@@ -12015,13 +11786,13 @@ var Ajuna = /*#__PURE__*/function (_Chain) {
|
|
|
12015
11786
|
value: function transferLocalNonNativeAsset(options) {
|
|
12016
11787
|
var api = options.api,
|
|
12017
11788
|
asset = options.assetInfo,
|
|
12018
|
-
|
|
11789
|
+
recipient = options.recipient,
|
|
12019
11790
|
isAmountAll = options.isAmountAll,
|
|
12020
11791
|
keepAlive = options.keepAlive;
|
|
12021
11792
|
assertHasId(asset);
|
|
12022
11793
|
var assetId = Number(asset.assetId);
|
|
12023
11794
|
var dest = {
|
|
12024
|
-
Id:
|
|
11795
|
+
Id: recipient
|
|
12025
11796
|
};
|
|
12026
11797
|
if (isAmountAll) {
|
|
12027
11798
|
return api.deserializeExtrinsics({
|
|
@@ -12099,14 +11870,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12099
11870
|
key: "handleEthBridgeNativeTransfer",
|
|
12100
11871
|
value: function () {
|
|
12101
11872
|
var _handleEthBridgeNativeTransfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
|
|
12102
|
-
var api, version, destination,
|
|
11873
|
+
var api, version, destination, sender, recipient, paraIdTo, asset, messageId, location, call;
|
|
12103
11874
|
return _regenerator().w(function (_context) {
|
|
12104
11875
|
while (1) switch (_context.n) {
|
|
12105
11876
|
case 0:
|
|
12106
|
-
api = input.api, version = input.version, destination = input.destination,
|
|
12107
|
-
|
|
11877
|
+
api = input.api, version = input.version, destination = input.destination, sender = input.sender, recipient = input.recipient, paraIdTo = input.paraIdTo, asset = input.assetInfo;
|
|
11878
|
+
assertSender(sender);
|
|
12108
11879
|
_context.n = 1;
|
|
12109
|
-
return generateMessageId(api,
|
|
11880
|
+
return generateMessageId(api, sender, getParaId(this.chain), JSON.stringify(asset.location), JSON.stringify(recipient), asset.amount);
|
|
12110
11881
|
case 1:
|
|
12111
11882
|
messageId = _context.v;
|
|
12112
11883
|
location = asset.symbol === this.getNativeAssetSymbol() ? DOT_LOCATION : asset.location;
|
|
@@ -12128,7 +11899,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12128
11899
|
},
|
|
12129
11900
|
beneficiary: createBeneficiaryLocation({
|
|
12130
11901
|
api: api,
|
|
12131
|
-
address:
|
|
11902
|
+
address: recipient,
|
|
12132
11903
|
version: version
|
|
12133
11904
|
})
|
|
12134
11905
|
}
|
|
@@ -12198,13 +11969,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12198
11969
|
value: function transferLocalNonNativeAsset(options) {
|
|
12199
11970
|
var api = options.api,
|
|
12200
11971
|
asset = options.assetInfo,
|
|
12201
|
-
|
|
11972
|
+
recipient = options.recipient,
|
|
12202
11973
|
isAmountAll = options.isAmountAll,
|
|
12203
11974
|
keepAlive = options.keepAlive;
|
|
12204
11975
|
if (asset.assetId !== undefined) {
|
|
12205
11976
|
var assetId = Number(asset.assetId);
|
|
12206
11977
|
var dest = {
|
|
12207
|
-
Id:
|
|
11978
|
+
Id: recipient
|
|
12208
11979
|
};
|
|
12209
11980
|
if (isAmountAll) {
|
|
12210
11981
|
return api.deserializeExtrinsics({
|
|
@@ -12234,7 +12005,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12234
12005
|
params: {
|
|
12235
12006
|
id: asset.location,
|
|
12236
12007
|
dest: {
|
|
12237
|
-
Id:
|
|
12008
|
+
Id: recipient
|
|
12238
12009
|
},
|
|
12239
12010
|
keep_alive: keepAlive
|
|
12240
12011
|
}
|
|
@@ -12246,7 +12017,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12246
12017
|
params: {
|
|
12247
12018
|
id: asset.location,
|
|
12248
12019
|
target: {
|
|
12249
|
-
Id:
|
|
12020
|
+
Id: recipient
|
|
12250
12021
|
},
|
|
12251
12022
|
amount: asset.amount
|
|
12252
12023
|
}
|
|
@@ -12308,13 +12079,13 @@ var Astar = /*#__PURE__*/function (_Chain) {
|
|
|
12308
12079
|
value: function transferLocalNonNativeAsset(options) {
|
|
12309
12080
|
var api = options.api,
|
|
12310
12081
|
asset = options.assetInfo,
|
|
12311
|
-
|
|
12082
|
+
recipient = options.recipient,
|
|
12312
12083
|
isAmountAll = options.isAmountAll,
|
|
12313
12084
|
keepAlive = options.keepAlive;
|
|
12314
12085
|
assertHasId(asset);
|
|
12315
12086
|
var assetId = Number(asset.assetId);
|
|
12316
12087
|
var dest = {
|
|
12317
|
-
Id:
|
|
12088
|
+
Id: recipient
|
|
12318
12089
|
};
|
|
12319
12090
|
if (isAmountAll) {
|
|
12320
12091
|
return api.deserializeExtrinsics({
|
|
@@ -12423,7 +12194,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12423
12194
|
value: function transferLocalNativeAsset(options) {
|
|
12424
12195
|
var api = options.api,
|
|
12425
12196
|
asset = options.assetInfo,
|
|
12426
|
-
|
|
12197
|
+
recipient = options.recipient,
|
|
12427
12198
|
isAmountAll = options.isAmountAll,
|
|
12428
12199
|
keepAlive = options.keepAlive;
|
|
12429
12200
|
if (isAmountAll) {
|
|
@@ -12431,7 +12202,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12431
12202
|
module: 'Balances',
|
|
12432
12203
|
method: 'transfer_all',
|
|
12433
12204
|
params: {
|
|
12434
|
-
dest:
|
|
12205
|
+
dest: recipient,
|
|
12435
12206
|
keep_alive: keepAlive
|
|
12436
12207
|
}
|
|
12437
12208
|
}));
|
|
@@ -12440,7 +12211,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12440
12211
|
module: 'Balances',
|
|
12441
12212
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer_allow_death',
|
|
12442
12213
|
params: {
|
|
12443
|
-
dest:
|
|
12214
|
+
dest: recipient,
|
|
12444
12215
|
value: asset.amount
|
|
12445
12216
|
}
|
|
12446
12217
|
}));
|
|
@@ -12450,7 +12221,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12450
12221
|
value: function transferLocalNonNativeAsset(options) {
|
|
12451
12222
|
var api = options.api,
|
|
12452
12223
|
asset = options.assetInfo,
|
|
12453
|
-
|
|
12224
|
+
recipient = options.recipient,
|
|
12454
12225
|
isAmountAll = options.isAmountAll,
|
|
12455
12226
|
keepAlive = options.keepAlive;
|
|
12456
12227
|
assertHasId(asset);
|
|
@@ -12460,7 +12231,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12460
12231
|
module: 'Tokens',
|
|
12461
12232
|
method: 'transfer_all',
|
|
12462
12233
|
params: {
|
|
12463
|
-
dest:
|
|
12234
|
+
dest: recipient,
|
|
12464
12235
|
currency_id: currencyId,
|
|
12465
12236
|
keep_alive: keepAlive
|
|
12466
12237
|
}
|
|
@@ -12470,7 +12241,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12470
12241
|
module: 'Tokens',
|
|
12471
12242
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
12472
12243
|
params: {
|
|
12473
|
-
dest:
|
|
12244
|
+
dest: recipient,
|
|
12474
12245
|
currency_id: currencyId,
|
|
12475
12246
|
amount: asset.amount
|
|
12476
12247
|
}
|
|
@@ -12547,11 +12318,11 @@ var BifrostPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12547
12318
|
value: function transferLocalNonNativeAsset(options) {
|
|
12548
12319
|
var api = options.api,
|
|
12549
12320
|
asset = options.assetInfo,
|
|
12550
|
-
|
|
12321
|
+
recipient = options.recipient,
|
|
12551
12322
|
isAmountAll = options.isAmountAll,
|
|
12552
12323
|
keepAlive = options.keepAlive;
|
|
12553
12324
|
var dest = {
|
|
12554
|
-
Id:
|
|
12325
|
+
Id: recipient
|
|
12555
12326
|
};
|
|
12556
12327
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
12557
12328
|
if (isAmountAll) {
|
|
@@ -12682,11 +12453,11 @@ var Centrifuge = /*#__PURE__*/function (_Chain) {
|
|
|
12682
12453
|
value: function transferLocalNonNativeAsset(options) {
|
|
12683
12454
|
var api = options.api,
|
|
12684
12455
|
asset = options.assetInfo,
|
|
12685
|
-
|
|
12456
|
+
recipient = options.recipient,
|
|
12686
12457
|
isAmountAll = options.isAmountAll,
|
|
12687
12458
|
keepAlive = options.keepAlive;
|
|
12688
12459
|
var dest = {
|
|
12689
|
-
Id:
|
|
12460
|
+
Id: recipient
|
|
12690
12461
|
};
|
|
12691
12462
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
12692
12463
|
if (isAmountAll) {
|
|
@@ -12869,13 +12640,13 @@ var Crust = /*#__PURE__*/function (_Chain) {
|
|
|
12869
12640
|
value: function transferLocalNonNativeAsset(options) {
|
|
12870
12641
|
var api = options.api,
|
|
12871
12642
|
asset = options.assetInfo,
|
|
12872
|
-
|
|
12643
|
+
recipient = options.recipient,
|
|
12873
12644
|
isAmountAll = options.isAmountAll,
|
|
12874
12645
|
keepAlive = options.keepAlive;
|
|
12875
12646
|
assertHasId(asset);
|
|
12876
12647
|
var assetId = BigInt(asset.assetId);
|
|
12877
12648
|
var dest = {
|
|
12878
|
-
Id:
|
|
12649
|
+
Id: recipient
|
|
12879
12650
|
};
|
|
12880
12651
|
if (isAmountAll) {
|
|
12881
12652
|
return api.deserializeExtrinsics({
|
|
@@ -12957,7 +12728,7 @@ var Darwinia = /*#__PURE__*/function (_Chain) {
|
|
|
12957
12728
|
value: function transferLocalNonNativeAsset(options) {
|
|
12958
12729
|
var api = options.api,
|
|
12959
12730
|
asset = options.assetInfo,
|
|
12960
|
-
|
|
12731
|
+
recipient = options.recipient,
|
|
12961
12732
|
isAmountAll = options.isAmountAll,
|
|
12962
12733
|
keepAlive = options.keepAlive;
|
|
12963
12734
|
assertHasId(asset);
|
|
@@ -12968,7 +12739,7 @@ var Darwinia = /*#__PURE__*/function (_Chain) {
|
|
|
12968
12739
|
method: 'transfer_all',
|
|
12969
12740
|
params: {
|
|
12970
12741
|
id: assetId,
|
|
12971
|
-
dest:
|
|
12742
|
+
dest: recipient,
|
|
12972
12743
|
keep_alive: keepAlive
|
|
12973
12744
|
}
|
|
12974
12745
|
});
|
|
@@ -12978,7 +12749,7 @@ var Darwinia = /*#__PURE__*/function (_Chain) {
|
|
|
12978
12749
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
12979
12750
|
params: {
|
|
12980
12751
|
id: assetId,
|
|
12981
|
-
target:
|
|
12752
|
+
target: recipient,
|
|
12982
12753
|
amount: asset.amount
|
|
12983
12754
|
}
|
|
12984
12755
|
});
|
|
@@ -13151,7 +12922,7 @@ var Interlay = /*#__PURE__*/function (_Chain) {
|
|
|
13151
12922
|
value: function transferLocalNonNativeAsset(options) {
|
|
13152
12923
|
var api = options.api,
|
|
13153
12924
|
asset = options.assetInfo,
|
|
13154
|
-
|
|
12925
|
+
recipient = options.recipient,
|
|
13155
12926
|
isAmountAll = options.isAmountAll,
|
|
13156
12927
|
keepAlive = options.keepAlive;
|
|
13157
12928
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
@@ -13160,7 +12931,7 @@ var Interlay = /*#__PURE__*/function (_Chain) {
|
|
|
13160
12931
|
module: 'Tokens',
|
|
13161
12932
|
method: 'transfer_all',
|
|
13162
12933
|
params: {
|
|
13163
|
-
dest:
|
|
12934
|
+
dest: recipient,
|
|
13164
12935
|
currency_id: currencyId,
|
|
13165
12936
|
keep_alive: keepAlive
|
|
13166
12937
|
}
|
|
@@ -13170,7 +12941,7 @@ var Interlay = /*#__PURE__*/function (_Chain) {
|
|
|
13170
12941
|
module: 'Tokens',
|
|
13171
12942
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
13172
12943
|
params: {
|
|
13173
|
-
dest:
|
|
12944
|
+
dest: recipient,
|
|
13174
12945
|
currency_id: currencyId,
|
|
13175
12946
|
value: asset.amount
|
|
13176
12947
|
}
|
|
@@ -13214,7 +12985,7 @@ var Jamton = /*#__PURE__*/function (_Chain) {
|
|
|
13214
12985
|
if (isSymbolMatch(assetInfo.symbol, 'WUD')) {
|
|
13215
12986
|
var usdt = findAssetInfoOrThrow(this.chain, {
|
|
13216
12987
|
symbol: 'USDt'
|
|
13217
|
-
}
|
|
12988
|
+
});
|
|
13218
12989
|
var MIN_USDT_AMOUNT = 180000n; // 0.18 USDt
|
|
13219
12990
|
return transferPolkadotXcm(_objectSpread2(_objectSpread2({}, input), {}, {
|
|
13220
12991
|
overriddenAsset: [_objectSpread2(_objectSpread2({}, createAsset(version, MIN_USDT_AMOUNT, usdt.location)), {}, {
|
|
@@ -13268,7 +13039,7 @@ var Kintsugi = /*#__PURE__*/function (_Chain) {
|
|
|
13268
13039
|
value: function transferLocalNonNativeAsset(options) {
|
|
13269
13040
|
var api = options.api,
|
|
13270
13041
|
asset = options.assetInfo,
|
|
13271
|
-
|
|
13042
|
+
recipient = options.recipient,
|
|
13272
13043
|
isAmountAll = options.isAmountAll,
|
|
13273
13044
|
keepAlive = options.keepAlive;
|
|
13274
13045
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
@@ -13277,7 +13048,7 @@ var Kintsugi = /*#__PURE__*/function (_Chain) {
|
|
|
13277
13048
|
module: 'Tokens',
|
|
13278
13049
|
method: 'transfer_all',
|
|
13279
13050
|
params: {
|
|
13280
|
-
dest:
|
|
13051
|
+
dest: recipient,
|
|
13281
13052
|
currency_id: currencyId,
|
|
13282
13053
|
keep_alive: keepAlive
|
|
13283
13054
|
}
|
|
@@ -13287,7 +13058,7 @@ var Kintsugi = /*#__PURE__*/function (_Chain) {
|
|
|
13287
13058
|
module: 'Tokens',
|
|
13288
13059
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
13289
13060
|
params: {
|
|
13290
|
-
dest:
|
|
13061
|
+
dest: recipient,
|
|
13291
13062
|
currency_id: currencyId,
|
|
13292
13063
|
value: asset.amount
|
|
13293
13064
|
}
|
|
@@ -13402,7 +13173,7 @@ var Manta = /*#__PURE__*/function (_Chain) {
|
|
|
13402
13173
|
value: function transferLocalNonNativeAsset(options) {
|
|
13403
13174
|
var api = options.api,
|
|
13404
13175
|
asset = options.assetInfo,
|
|
13405
|
-
|
|
13176
|
+
recipient = options.recipient,
|
|
13406
13177
|
balance = options.balance,
|
|
13407
13178
|
isAmountAll = options.isAmountAll,
|
|
13408
13179
|
keepAlive = options.keepAlive;
|
|
@@ -13415,7 +13186,7 @@ var Manta = /*#__PURE__*/function (_Chain) {
|
|
|
13415
13186
|
params: {
|
|
13416
13187
|
id: assetId,
|
|
13417
13188
|
target: {
|
|
13418
|
-
Id:
|
|
13189
|
+
Id: recipient
|
|
13419
13190
|
},
|
|
13420
13191
|
amount: amount
|
|
13421
13192
|
}
|
|
@@ -13494,19 +13265,19 @@ var Moonriver = /*#__PURE__*/function (_Chain) {
|
|
|
13494
13265
|
|
|
13495
13266
|
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
13496
13267
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, chain, version) {
|
|
13497
|
-
var api, asset,
|
|
13268
|
+
var api, asset, sender, recipient, ethAsset, messageId, nativeMythAmount, hopDestination;
|
|
13498
13269
|
return _regenerator().w(function (_context) {
|
|
13499
13270
|
while (1) switch (_context.n) {
|
|
13500
13271
|
case 0:
|
|
13501
|
-
api = options.api, asset = options.assetInfo,
|
|
13272
|
+
api = options.api, asset = options.assetInfo, sender = options.sender, recipient = options.recipient;
|
|
13502
13273
|
ethAsset = findAssetInfoOrThrow('Ethereum', {
|
|
13503
13274
|
symbol: asset.symbol
|
|
13504
|
-
}
|
|
13275
|
+
});
|
|
13505
13276
|
assertHasId(ethAsset);
|
|
13506
|
-
assertAddressIsString(
|
|
13507
|
-
|
|
13277
|
+
assertAddressIsString(recipient);
|
|
13278
|
+
assertSender(sender);
|
|
13508
13279
|
_context.n = 1;
|
|
13509
|
-
return generateMessageId(api,
|
|
13280
|
+
return generateMessageId(api, sender, getParaId(chain), ethAsset.assetId, recipient, asset.amount);
|
|
13510
13281
|
case 1:
|
|
13511
13282
|
messageId = _context.v;
|
|
13512
13283
|
_context.n = 2;
|
|
@@ -13621,7 +13392,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13621
13392
|
value: function transferLocalNativeAsset(options) {
|
|
13622
13393
|
var api = options.api,
|
|
13623
13394
|
asset = options.assetInfo,
|
|
13624
|
-
|
|
13395
|
+
recipient = options.recipient,
|
|
13625
13396
|
isAmountAll = options.isAmountAll,
|
|
13626
13397
|
keepAlive = options.keepAlive;
|
|
13627
13398
|
if (isAmountAll) {
|
|
@@ -13629,7 +13400,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13629
13400
|
module: 'Balances',
|
|
13630
13401
|
method: 'transfer_all',
|
|
13631
13402
|
params: {
|
|
13632
|
-
dest:
|
|
13403
|
+
dest: recipient,
|
|
13633
13404
|
keep_alive: keepAlive
|
|
13634
13405
|
}
|
|
13635
13406
|
}));
|
|
@@ -13638,7 +13409,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13638
13409
|
module: 'Balances',
|
|
13639
13410
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer_allow_death',
|
|
13640
13411
|
params: {
|
|
13641
|
-
dest:
|
|
13412
|
+
dest: recipient,
|
|
13642
13413
|
value: asset.amount
|
|
13643
13414
|
}
|
|
13644
13415
|
}));
|
|
@@ -13648,7 +13419,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13648
13419
|
value: function transferLocalNonNativeAsset(options) {
|
|
13649
13420
|
var api = options.api,
|
|
13650
13421
|
asset = options.assetInfo,
|
|
13651
|
-
|
|
13422
|
+
recipient = options.recipient,
|
|
13652
13423
|
balance = options.balance,
|
|
13653
13424
|
isAmountAll = options.isAmountAll,
|
|
13654
13425
|
keepAlive = options.keepAlive;
|
|
@@ -13660,7 +13431,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13660
13431
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
13661
13432
|
params: {
|
|
13662
13433
|
id: assetId,
|
|
13663
|
-
target:
|
|
13434
|
+
target: recipient,
|
|
13664
13435
|
amount: amount
|
|
13665
13436
|
}
|
|
13666
13437
|
});
|
|
@@ -13716,13 +13487,13 @@ var Peaq = /*#__PURE__*/function (_Chain) {
|
|
|
13716
13487
|
value: function transferLocalNonNativeAsset(options) {
|
|
13717
13488
|
var api = options.api,
|
|
13718
13489
|
asset = options.assetInfo,
|
|
13719
|
-
|
|
13490
|
+
recipient = options.recipient,
|
|
13720
13491
|
isAmountAll = options.isAmountAll,
|
|
13721
13492
|
keepAlive = options.keepAlive;
|
|
13722
13493
|
assertHasId(asset);
|
|
13723
13494
|
var assetId = BigInt(asset.assetId);
|
|
13724
13495
|
var dest = {
|
|
13725
|
-
Id:
|
|
13496
|
+
Id: recipient
|
|
13726
13497
|
};
|
|
13727
13498
|
if (isAmountAll) {
|
|
13728
13499
|
return api.deserializeExtrinsics({
|
|
@@ -13888,13 +13659,13 @@ var RobonomicsPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
13888
13659
|
value: function transferLocalNonNativeAsset(options) {
|
|
13889
13660
|
var api = options.api,
|
|
13890
13661
|
asset = options.assetInfo,
|
|
13891
|
-
|
|
13662
|
+
recipient = options.recipient,
|
|
13892
13663
|
isAmountAll = options.isAmountAll,
|
|
13893
13664
|
keepAlive = options.keepAlive;
|
|
13894
13665
|
assertHasId(asset);
|
|
13895
13666
|
var assetId = BigInt(asset.assetId);
|
|
13896
13667
|
var dest = {
|
|
13897
|
-
Id:
|
|
13668
|
+
Id: recipient
|
|
13898
13669
|
};
|
|
13899
13670
|
if (isAmountAll) {
|
|
13900
13671
|
return api.deserializeExtrinsics({
|
|
@@ -14052,7 +13823,7 @@ var Zeitgeist = /*#__PURE__*/function (_Chain) {
|
|
|
14052
13823
|
value: function transferLocalNonNativeAsset(options) {
|
|
14053
13824
|
var api = options.api,
|
|
14054
13825
|
asset = options.assetInfo,
|
|
14055
|
-
|
|
13826
|
+
recipient = options.recipient;
|
|
14056
13827
|
assertHasId(asset);
|
|
14057
13828
|
var amount = getLocalTransferAmount(options);
|
|
14058
13829
|
return api.deserializeExtrinsics({
|
|
@@ -14060,7 +13831,7 @@ var Zeitgeist = /*#__PURE__*/function (_Chain) {
|
|
|
14060
13831
|
method: 'transfer',
|
|
14061
13832
|
params: {
|
|
14062
13833
|
dest: {
|
|
14063
|
-
Id:
|
|
13834
|
+
Id: recipient
|
|
14064
13835
|
},
|
|
14065
13836
|
currency_id: this.getCustomCurrencyId(asset),
|
|
14066
13837
|
amount: amount
|
|
@@ -14400,4 +14171,4 @@ var createClientCache = function createClientCache(maxSize, pingClient, onEvicti
|
|
|
14400
14171
|
};
|
|
14401
14172
|
};
|
|
14402
14173
|
|
|
14403
|
-
export { API_TYPES, AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiUnavailableError, ScenarioNotSupportedError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertSender,
|
|
14174
|
+
export { API_TYPES, AmountTooLowError, AssetClaimBuilder, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertSender, assertSenderSource, assertSwapSupport, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, compareAddresses, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createClientCache, createClientPoolHelpers, createDestination, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createId, createRouterBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithRouter, formatAssetIdToERC20, formatUnits, getAssetBalanceInternal, getAssetReserveChain, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getEthErc20Balance, getEvmPrivateKeyHex, getFailureInfo$1 as getFailureInfo, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getMoonbeamErc20Balance, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getSwapExtensionOrThrow, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, isSenderSigner, keyFromWs, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickRouterCompatibleXcmVersion, registerSwapExtension, resolveChainApi, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, transferMoonbeamEvm, transferMoonbeamToEth, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateTransact, verifyEdOnDestination, wrapTxBypass };
|