@paraspell/sdk-core 12.9.7 → 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 +483 -704
- 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
|
});
|
|
@@ -4176,7 +4197,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4176
4197
|
value: (function () {
|
|
4177
4198
|
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(options) {
|
|
4178
4199
|
var _options$disableFallb;
|
|
4179
|
-
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;
|
|
4180
4201
|
return _regenerator().w(function (_context0) {
|
|
4181
4202
|
while (1) switch (_context0.n) {
|
|
4182
4203
|
case 0:
|
|
@@ -4187,9 +4208,9 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4187
4208
|
_yield$this$prepareNo3 = _context0.v;
|
|
4188
4209
|
normalizedOptions = _yield$this$prepareNo3.normalizedOptions;
|
|
4189
4210
|
buildTx = _yield$this$prepareNo3.buildTx;
|
|
4190
|
-
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;
|
|
4191
4212
|
assertToIsString(to);
|
|
4192
|
-
assertAddressIsString(
|
|
4213
|
+
assertAddressIsString(recipient);
|
|
4193
4214
|
if (!swapOptions) {
|
|
4194
4215
|
_context0.n = 2;
|
|
4195
4216
|
break;
|
|
@@ -4205,8 +4226,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4205
4226
|
buildTx: buildTx,
|
|
4206
4227
|
origin: from,
|
|
4207
4228
|
destination: to,
|
|
4208
|
-
|
|
4209
|
-
|
|
4229
|
+
sender: sender,
|
|
4230
|
+
recipient: recipient,
|
|
4210
4231
|
version: version,
|
|
4211
4232
|
currency: currency,
|
|
4212
4233
|
feeAsset: feeAsset,
|
|
@@ -4238,7 +4259,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4238
4259
|
api,
|
|
4239
4260
|
from,
|
|
4240
4261
|
to,
|
|
4241
|
-
|
|
4262
|
+
sender,
|
|
4242
4263
|
currency,
|
|
4243
4264
|
feeAsset,
|
|
4244
4265
|
version,
|
|
@@ -4256,7 +4277,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4256
4277
|
_yield$this$prepareNo4 = _context1.v;
|
|
4257
4278
|
normalizedOptions = _yield$this$prepareNo4.normalizedOptions;
|
|
4258
4279
|
buildTx = _yield$this$prepareNo4.buildTx;
|
|
4259
|
-
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;
|
|
4260
4281
|
assertToIsString(to);
|
|
4261
4282
|
assertSwapSupport(swapOptions);
|
|
4262
4283
|
_context1.p = 2;
|
|
@@ -4266,7 +4287,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4266
4287
|
buildTx: buildTx,
|
|
4267
4288
|
origin: from,
|
|
4268
4289
|
destination: to,
|
|
4269
|
-
|
|
4290
|
+
sender: sender,
|
|
4270
4291
|
version: version,
|
|
4271
4292
|
currency: currency,
|
|
4272
4293
|
feeAsset: feeAsset,
|
|
@@ -4291,24 +4312,18 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4291
4312
|
return getOriginXcmFee$1;
|
|
4292
4313
|
}()
|
|
4293
4314
|
/**
|
|
4294
|
-
*
|
|
4295
|
-
*
|
|
4296
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
4297
|
-
* Please use `builder.getXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
4298
|
-
* Will be removed in v13.
|
|
4299
|
-
* For more details, see the documentation:
|
|
4300
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
4315
|
+
* Returns the max transferable amount for the transfer
|
|
4301
4316
|
*
|
|
4302
|
-
* @returns
|
|
4317
|
+
* @returns The max transferable amount.
|
|
4303
4318
|
*/
|
|
4304
4319
|
)
|
|
4305
4320
|
}, {
|
|
4306
|
-
key: "
|
|
4321
|
+
key: "getTransferableAmount",
|
|
4307
4322
|
value: (function () {
|
|
4308
|
-
var
|
|
4309
|
-
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;
|
|
4310
4325
|
return _regenerator().w(function (_context10) {
|
|
4311
|
-
while (1) switch (_context10.
|
|
4326
|
+
while (1) switch (_context10.n) {
|
|
4312
4327
|
case 0:
|
|
4313
4328
|
_context10.n = 1;
|
|
4314
4329
|
return this.prepareNormalizedOptions(this._options);
|
|
@@ -4316,148 +4331,30 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4316
4331
|
_yield$this$prepareNo5 = _context10.v;
|
|
4317
4332
|
normalizedOptions = _yield$this$prepareNo5.normalizedOptions;
|
|
4318
4333
|
buildTx = _yield$this$prepareNo5.buildTx;
|
|
4319
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to,
|
|
4320
|
-
assertToIsString(to);
|
|
4321
|
-
assertAddressIsString(address);
|
|
4322
|
-
assertSwapSupport(swapOptions);
|
|
4323
|
-
_context10.n = 2;
|
|
4324
|
-
return buildTx();
|
|
4325
|
-
case 2:
|
|
4326
|
-
tx = _context10.v;
|
|
4327
|
-
_context10.p = 3;
|
|
4328
|
-
_context10.n = 4;
|
|
4329
|
-
return getXcmFeeEstimate({
|
|
4330
|
-
api: api,
|
|
4331
|
-
tx: tx,
|
|
4332
|
-
origin: from,
|
|
4333
|
-
destination: to,
|
|
4334
|
-
address: address,
|
|
4335
|
-
senderAddress: senderAddress,
|
|
4336
|
-
currency: currency
|
|
4337
|
-
});
|
|
4338
|
-
case 4:
|
|
4339
|
-
return _context10.a(2, _context10.v);
|
|
4340
|
-
case 5:
|
|
4341
|
-
_context10.p = 5;
|
|
4342
|
-
_context10.n = 6;
|
|
4343
|
-
return this.api.disconnect();
|
|
4344
|
-
case 6:
|
|
4345
|
-
return _context10.f(5);
|
|
4346
|
-
case 7:
|
|
4347
|
-
return _context10.a(2);
|
|
4348
|
-
}
|
|
4349
|
-
}, _callee10, this, [[3,, 5, 7]]);
|
|
4350
|
-
}));
|
|
4351
|
-
function getXcmFeeEstimate$1() {
|
|
4352
|
-
return _getXcmFeeEstimate2.apply(this, arguments);
|
|
4353
|
-
}
|
|
4354
|
-
return getXcmFeeEstimate$1;
|
|
4355
|
-
}()
|
|
4356
|
-
/**
|
|
4357
|
-
* Estimates the origin XCM fee using paymentInfo function.
|
|
4358
|
-
*
|
|
4359
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
4360
|
-
* Please use `builder.getOriginXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
4361
|
-
* Will be removed in v13.
|
|
4362
|
-
* For more details, see the documentation:
|
|
4363
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
4364
|
-
*
|
|
4365
|
-
* @returns An origin fee estimate.
|
|
4366
|
-
*/
|
|
4367
|
-
)
|
|
4368
|
-
}, {
|
|
4369
|
-
key: "getOriginXcmFeeEstimate",
|
|
4370
|
-
value: (function () {
|
|
4371
|
-
var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
4372
|
-
var _yield$this$prepareNo6, normalizedOptions, buildTx, api, from, to, senderAddress, currency, swapOptions, tx;
|
|
4373
|
-
return _regenerator().w(function (_context11) {
|
|
4374
|
-
while (1) switch (_context11.p = _context11.n) {
|
|
4375
|
-
case 0:
|
|
4376
|
-
_context11.n = 1;
|
|
4377
|
-
return this.prepareNormalizedOptions(this._options);
|
|
4378
|
-
case 1:
|
|
4379
|
-
_yield$this$prepareNo6 = _context11.v;
|
|
4380
|
-
normalizedOptions = _yield$this$prepareNo6.normalizedOptions;
|
|
4381
|
-
buildTx = _yield$this$prepareNo6.buildTx;
|
|
4382
|
-
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, currency = normalizedOptions.currency, swapOptions = normalizedOptions.swapOptions;
|
|
4383
|
-
assertToIsString(to);
|
|
4384
|
-
assertSwapSupport(swapOptions);
|
|
4385
|
-
_context11.n = 2;
|
|
4386
|
-
return buildTx();
|
|
4387
|
-
case 2:
|
|
4388
|
-
tx = _context11.v;
|
|
4389
|
-
_context11.p = 3;
|
|
4390
|
-
_context11.n = 4;
|
|
4391
|
-
return getOriginXcmFeeEstimate({
|
|
4392
|
-
api: api,
|
|
4393
|
-
tx: tx,
|
|
4394
|
-
origin: from,
|
|
4395
|
-
destination: to,
|
|
4396
|
-
currency: currency,
|
|
4397
|
-
senderAddress: senderAddress
|
|
4398
|
-
});
|
|
4399
|
-
case 4:
|
|
4400
|
-
return _context11.a(2, _context11.v);
|
|
4401
|
-
case 5:
|
|
4402
|
-
_context11.p = 5;
|
|
4403
|
-
_context11.n = 6;
|
|
4404
|
-
return this.api.disconnect();
|
|
4405
|
-
case 6:
|
|
4406
|
-
return _context11.f(5);
|
|
4407
|
-
case 7:
|
|
4408
|
-
return _context11.a(2);
|
|
4409
|
-
}
|
|
4410
|
-
}, _callee11, this, [[3,, 5, 7]]);
|
|
4411
|
-
}));
|
|
4412
|
-
function getOriginXcmFeeEstimate$1() {
|
|
4413
|
-
return _getOriginXcmFeeEstimate2.apply(this, arguments);
|
|
4414
|
-
}
|
|
4415
|
-
return getOriginXcmFeeEstimate$1;
|
|
4416
|
-
}()
|
|
4417
|
-
/**
|
|
4418
|
-
* Returns the max transferable amount for the transfer
|
|
4419
|
-
*
|
|
4420
|
-
* @returns The max transferable amount.
|
|
4421
|
-
*/
|
|
4422
|
-
)
|
|
4423
|
-
}, {
|
|
4424
|
-
key: "getTransferableAmount",
|
|
4425
|
-
value: (function () {
|
|
4426
|
-
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
4427
|
-
var _yield$this$prepareNo7, normalizedOptions, buildTx, api, from, to, senderAddress, currency, feeAsset, version, swapOptions;
|
|
4428
|
-
return _regenerator().w(function (_context12) {
|
|
4429
|
-
while (1) switch (_context12.n) {
|
|
4430
|
-
case 0:
|
|
4431
|
-
_context12.n = 1;
|
|
4432
|
-
return this.prepareNormalizedOptions(this._options);
|
|
4433
|
-
case 1:
|
|
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, 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;
|
|
4438
4335
|
assertToIsString(to);
|
|
4439
4336
|
if (!swapOptions) {
|
|
4440
|
-
|
|
4337
|
+
_context10.n = 2;
|
|
4441
4338
|
break;
|
|
4442
4339
|
}
|
|
4443
|
-
return
|
|
4340
|
+
return _context10.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
|
|
4444
4341
|
swapOptions: swapOptions
|
|
4445
4342
|
}), function (builder) {
|
|
4446
4343
|
return builder.getTransferableAmount();
|
|
4447
4344
|
}));
|
|
4448
4345
|
case 2:
|
|
4449
|
-
return
|
|
4346
|
+
return _context10.a(2, getTransferableAmount({
|
|
4450
4347
|
api: api,
|
|
4451
4348
|
buildTx: buildTx,
|
|
4452
4349
|
origin: from,
|
|
4453
4350
|
destination: to,
|
|
4454
|
-
|
|
4351
|
+
sender: sender,
|
|
4455
4352
|
feeAsset: feeAsset,
|
|
4456
4353
|
version: version,
|
|
4457
4354
|
currency: currency
|
|
4458
4355
|
}));
|
|
4459
4356
|
}
|
|
4460
|
-
},
|
|
4357
|
+
}, _callee10, this);
|
|
4461
4358
|
}));
|
|
4462
4359
|
function getTransferableAmount$1() {
|
|
4463
4360
|
return _getTransferableAmount2.apply(this, arguments);
|
|
@@ -4473,44 +4370,44 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4473
4370
|
}, {
|
|
4474
4371
|
key: "getMinTransferableAmount",
|
|
4475
4372
|
value: (function () {
|
|
4476
|
-
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4477
|
-
var _yield$this$
|
|
4478
|
-
return _regenerator().w(function (
|
|
4479
|
-
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) {
|
|
4480
4377
|
case 0:
|
|
4481
|
-
|
|
4378
|
+
_context11.n = 1;
|
|
4482
4379
|
return this.prepareNormalizedOptions(this._options);
|
|
4483
4380
|
case 1:
|
|
4484
|
-
_yield$this$
|
|
4485
|
-
normalizedOptions = _yield$this$
|
|
4486
|
-
buildTx = _yield$this$
|
|
4487
|
-
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;
|
|
4488
4385
|
assertToIsString(to);
|
|
4489
|
-
assertAddressIsString(
|
|
4386
|
+
assertAddressIsString(recipient);
|
|
4490
4387
|
if (!swapOptions) {
|
|
4491
|
-
|
|
4388
|
+
_context11.n = 2;
|
|
4492
4389
|
break;
|
|
4493
4390
|
}
|
|
4494
|
-
return
|
|
4391
|
+
return _context11.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, normalizedOptions), {}, {
|
|
4495
4392
|
swapOptions: swapOptions
|
|
4496
4393
|
}), function (builder) {
|
|
4497
4394
|
return builder.getMinTransferableAmount();
|
|
4498
4395
|
}));
|
|
4499
4396
|
case 2:
|
|
4500
|
-
return
|
|
4397
|
+
return _context11.a(2, getMinTransferableAmount({
|
|
4501
4398
|
api: api,
|
|
4502
4399
|
buildTx: buildTx,
|
|
4503
4400
|
origin: from,
|
|
4504
4401
|
destination: to,
|
|
4505
|
-
|
|
4506
|
-
|
|
4402
|
+
sender: sender,
|
|
4403
|
+
recipient: recipient,
|
|
4507
4404
|
feeAsset: feeAsset,
|
|
4508
4405
|
version: version,
|
|
4509
4406
|
currency: currency,
|
|
4510
4407
|
builder: this
|
|
4511
4408
|
}));
|
|
4512
4409
|
}
|
|
4513
|
-
},
|
|
4410
|
+
}, _callee11, this);
|
|
4514
4411
|
}));
|
|
4515
4412
|
function getMinTransferableAmount$1() {
|
|
4516
4413
|
return _getMinTransferableAmount2.apply(this, arguments);
|
|
@@ -4526,34 +4423,34 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4526
4423
|
}, {
|
|
4527
4424
|
key: "verifyEdOnDestination",
|
|
4528
4425
|
value: (function () {
|
|
4529
|
-
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4530
|
-
var _yield$this$
|
|
4531
|
-
return _regenerator().w(function (
|
|
4532
|
-
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) {
|
|
4533
4430
|
case 0:
|
|
4534
|
-
|
|
4431
|
+
_context12.n = 1;
|
|
4535
4432
|
return this.prepareNormalizedOptions(this._options);
|
|
4536
4433
|
case 1:
|
|
4537
|
-
_yield$this$
|
|
4538
|
-
normalizedOptions = _yield$this$
|
|
4539
|
-
buildTx = _yield$this$
|
|
4540
|
-
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;
|
|
4541
4438
|
assertToIsString(to);
|
|
4542
|
-
assertAddressIsString(
|
|
4439
|
+
assertAddressIsString(recipient);
|
|
4543
4440
|
assertSwapSupport(swapOptions);
|
|
4544
|
-
return
|
|
4441
|
+
return _context12.a(2, verifyEdOnDestination({
|
|
4545
4442
|
api: api,
|
|
4546
4443
|
buildTx: buildTx,
|
|
4547
4444
|
origin: from,
|
|
4548
4445
|
destination: to,
|
|
4549
|
-
|
|
4446
|
+
sender: sender,
|
|
4447
|
+
recipient: recipient,
|
|
4550
4448
|
version: version,
|
|
4551
|
-
senderAddress: senderAddress,
|
|
4552
4449
|
feeAsset: feeAsset,
|
|
4553
4450
|
currency: currency
|
|
4554
4451
|
}));
|
|
4555
4452
|
}
|
|
4556
|
-
},
|
|
4453
|
+
}, _callee12, this);
|
|
4557
4454
|
}));
|
|
4558
4455
|
function verifyEdOnDestination$1() {
|
|
4559
4456
|
return _verifyEdOnDestination2.apply(this, arguments);
|
|
@@ -4569,35 +4466,35 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4569
4466
|
}, {
|
|
4570
4467
|
key: "getTransferInfo",
|
|
4571
4468
|
value: (function () {
|
|
4572
|
-
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4573
|
-
var _yield$this$
|
|
4574
|
-
return _regenerator().w(function (
|
|
4575
|
-
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) {
|
|
4576
4473
|
case 0:
|
|
4577
|
-
|
|
4474
|
+
_context13.n = 1;
|
|
4578
4475
|
return this.prepareNormalizedOptions(this._options);
|
|
4579
4476
|
case 1:
|
|
4580
|
-
_yield$this$
|
|
4581
|
-
normalizedOptions = _yield$this$
|
|
4582
|
-
buildTx = _yield$this$
|
|
4583
|
-
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;
|
|
4584
4481
|
assertToIsString(to);
|
|
4585
|
-
assertAddressIsString(
|
|
4482
|
+
assertAddressIsString(recipient);
|
|
4586
4483
|
assertSwapSupport(swapOptions);
|
|
4587
|
-
return
|
|
4484
|
+
return _context13.a(2, getTransferInfo({
|
|
4588
4485
|
api: api,
|
|
4589
4486
|
buildTx: buildTx,
|
|
4590
4487
|
origin: from,
|
|
4591
4488
|
destination: to,
|
|
4592
|
-
|
|
4593
|
-
|
|
4489
|
+
sender: sender,
|
|
4490
|
+
recipient: recipient,
|
|
4594
4491
|
ahAddress: ahAddress,
|
|
4595
4492
|
version: version,
|
|
4596
4493
|
currency: currency,
|
|
4597
4494
|
feeAsset: feeAsset
|
|
4598
4495
|
}));
|
|
4599
4496
|
}
|
|
4600
|
-
},
|
|
4497
|
+
}, _callee13, this);
|
|
4601
4498
|
}));
|
|
4602
4499
|
function getTransferInfo$1() {
|
|
4603
4500
|
return _getTransferInfo2.apply(this, arguments);
|
|
@@ -4614,25 +4511,25 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4614
4511
|
}, {
|
|
4615
4512
|
key: "getReceivableAmount",
|
|
4616
4513
|
value: (function () {
|
|
4617
|
-
var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4514
|
+
var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
4618
4515
|
var _yield$this$getTransf, receivedAmount;
|
|
4619
|
-
return _regenerator().w(function (
|
|
4620
|
-
while (1) switch (
|
|
4516
|
+
return _regenerator().w(function (_context14) {
|
|
4517
|
+
while (1) switch (_context14.n) {
|
|
4621
4518
|
case 0:
|
|
4622
|
-
|
|
4519
|
+
_context14.n = 1;
|
|
4623
4520
|
return this.getTransferInfo();
|
|
4624
4521
|
case 1:
|
|
4625
|
-
_yield$this$getTransf =
|
|
4522
|
+
_yield$this$getTransf = _context14.v;
|
|
4626
4523
|
receivedAmount = _yield$this$getTransf.destination.receivedCurrency.receivedAmount;
|
|
4627
4524
|
if (!(receivedAmount instanceof UnableToComputeError)) {
|
|
4628
|
-
|
|
4525
|
+
_context14.n = 2;
|
|
4629
4526
|
break;
|
|
4630
4527
|
}
|
|
4631
4528
|
throw receivedAmount;
|
|
4632
4529
|
case 2:
|
|
4633
|
-
return
|
|
4530
|
+
return _context14.a(2, receivedAmount);
|
|
4634
4531
|
}
|
|
4635
|
-
},
|
|
4532
|
+
}, _callee14, this);
|
|
4636
4533
|
}));
|
|
4637
4534
|
function getReceivableAmount() {
|
|
4638
4535
|
return _getReceivableAmount.apply(this, arguments);
|
|
@@ -4642,20 +4539,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4642
4539
|
}, {
|
|
4643
4540
|
key: "getBestAmountOut",
|
|
4644
4541
|
value: function () {
|
|
4645
|
-
var _getBestAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4542
|
+
var _getBestAmountOut = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
4646
4543
|
var swapOptions;
|
|
4647
|
-
return _regenerator().w(function (
|
|
4648
|
-
while (1) switch (
|
|
4544
|
+
return _regenerator().w(function (_context15) {
|
|
4545
|
+
while (1) switch (_context15.n) {
|
|
4649
4546
|
case 0:
|
|
4650
4547
|
swapOptions = this._options.swapOptions;
|
|
4651
|
-
return
|
|
4548
|
+
return _context15.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4652
4549
|
api: this.api,
|
|
4653
4550
|
swapOptions: swapOptions
|
|
4654
4551
|
}), function (builder) {
|
|
4655
4552
|
return builder.getBestAmountOut();
|
|
4656
4553
|
}));
|
|
4657
4554
|
}
|
|
4658
|
-
},
|
|
4555
|
+
}, _callee15, this);
|
|
4659
4556
|
}));
|
|
4660
4557
|
function getBestAmountOut() {
|
|
4661
4558
|
return _getBestAmountOut.apply(this, arguments);
|
|
@@ -4665,52 +4562,93 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4665
4562
|
}, {
|
|
4666
4563
|
key: "signAndSubmit",
|
|
4667
4564
|
value: function () {
|
|
4668
|
-
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4669
|
-
var _this$_options,
|
|
4670
|
-
return _regenerator().w(function (
|
|
4671
|
-
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) {
|
|
4672
4569
|
case 0:
|
|
4673
|
-
_this$_options = this._options,
|
|
4674
|
-
|
|
4570
|
+
_this$_options = this._options, senderSource = _this$_options.senderSource, swapOptions = _this$_options.swapOptions;
|
|
4571
|
+
assertSenderSource(senderSource);
|
|
4675
4572
|
if (!swapOptions) {
|
|
4676
|
-
|
|
4573
|
+
_context16.n = 3;
|
|
4677
4574
|
break;
|
|
4678
4575
|
}
|
|
4679
|
-
if (isSenderSigner(
|
|
4680
|
-
|
|
4576
|
+
if (isSenderSigner(senderSource)) {
|
|
4577
|
+
_context16.n = 1;
|
|
4681
4578
|
break;
|
|
4682
4579
|
}
|
|
4683
4580
|
throw new UnsupportedOperationError('Swap operations do not support local accounts yet. Please provider a signer');
|
|
4684
4581
|
case 1:
|
|
4685
|
-
|
|
4582
|
+
_context16.n = 2;
|
|
4686
4583
|
return executeWithRouter(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4687
4584
|
swapOptions: swapOptions,
|
|
4688
4585
|
api: this.api
|
|
4689
4586
|
}), function (builder) {
|
|
4690
|
-
return (
|
|
4691
|
-
// We need to cast this sender because RouterBuilder expects a PAPI signer but this part of sdk-core is generic
|
|
4692
|
-
// Will be removed in the future when we gradually move parts of swap package to sdk-core
|
|
4693
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
4694
|
-
builder.signer(sender).build()
|
|
4695
|
-
);
|
|
4587
|
+
return builder.signer(senderSource).signAndSubmit();
|
|
4696
4588
|
});
|
|
4697
4589
|
case 2:
|
|
4698
|
-
|
|
4590
|
+
txHashes = _context16.v;
|
|
4591
|
+
return _context16.a(2, txHashes[0]);
|
|
4699
4592
|
case 3:
|
|
4700
|
-
|
|
4593
|
+
_context16.n = 4;
|
|
4701
4594
|
return this.buildInternal();
|
|
4702
4595
|
case 4:
|
|
4703
|
-
_yield$this$buildInte3 =
|
|
4596
|
+
_yield$this$buildInte3 = _context16.v;
|
|
4704
4597
|
tx = _yield$this$buildInte3.tx;
|
|
4705
|
-
return
|
|
4598
|
+
return _context16.a(2, this.api.signAndSubmit(tx, senderSource));
|
|
4706
4599
|
}
|
|
4707
|
-
},
|
|
4600
|
+
}, _callee16, this);
|
|
4708
4601
|
}));
|
|
4709
4602
|
function signAndSubmit() {
|
|
4710
4603
|
return _signAndSubmit.apply(this, arguments);
|
|
4711
4604
|
}
|
|
4712
4605
|
return signAndSubmit;
|
|
4713
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
|
+
}()
|
|
4714
4652
|
/**
|
|
4715
4653
|
* Returns the API instance used by the builder.
|
|
4716
4654
|
*
|
|
@@ -4743,29 +4681,29 @@ var Builder = function Builder(api) {
|
|
|
4743
4681
|
return new GeneralBuilder(api, new BatchTransactionManager());
|
|
4744
4682
|
};
|
|
4745
4683
|
|
|
4746
|
-
var determineAddress = function determineAddress(chain,
|
|
4684
|
+
var determineAddress = function determineAddress(chain, recipient, sender) {
|
|
4747
4685
|
if (isChainEvm(chain)) {
|
|
4748
|
-
return isAddress(
|
|
4686
|
+
return isAddress(recipient) ? recipient : sender;
|
|
4749
4687
|
}
|
|
4750
|
-
return isAddress(
|
|
4688
|
+
return isAddress(recipient) ? sender : recipient;
|
|
4751
4689
|
};
|
|
4752
4690
|
var getReverseTxFee = /*#__PURE__*/function () {
|
|
4753
4691
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, currencyInput) {
|
|
4754
|
-
var api, origin, destination,
|
|
4692
|
+
var api, origin, destination, sender, recipient, skipReverseFeeCalculation, toAddress, fromAddress, _yield$Builder$from$t, tx, _yield$api$getPayment, partialFee;
|
|
4755
4693
|
return _regenerator().w(function (_context) {
|
|
4756
4694
|
while (1) switch (_context.n) {
|
|
4757
4695
|
case 0:
|
|
4758
|
-
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;
|
|
4759
4697
|
if (!skipReverseFeeCalculation) {
|
|
4760
4698
|
_context.n = 1;
|
|
4761
4699
|
break;
|
|
4762
4700
|
}
|
|
4763
4701
|
return _context.a(2, 0n);
|
|
4764
4702
|
case 1:
|
|
4765
|
-
toAddress = determineAddress(origin,
|
|
4766
|
-
fromAddress = determineAddress(destination,
|
|
4703
|
+
toAddress = determineAddress(origin, recipient, sender);
|
|
4704
|
+
fromAddress = determineAddress(destination, recipient, sender);
|
|
4767
4705
|
_context.n = 2;
|
|
4768
|
-
return Builder(api).from(destination).to(origin).
|
|
4706
|
+
return Builder(api).from(destination).to(origin).sender(fromAddress).recipient(toAddress).currency(currencyInput)['buildInternal']();
|
|
4769
4707
|
case 2:
|
|
4770
4708
|
_yield$Builder$from$t = _context.v;
|
|
4771
4709
|
tx = _yield$Builder$from$t.tx;
|
|
@@ -5219,7 +5157,7 @@ var resolveId = function resolveId(asset, chain) {
|
|
|
5219
5157
|
var isEthAsset = !asset.isNative && ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.startsWith('0x'));
|
|
5220
5158
|
var resolvedAsset = isEthAsset ? findAssetInfoOrThrow(chain, {
|
|
5221
5159
|
location: asset.location
|
|
5222
|
-
}
|
|
5160
|
+
}) : asset;
|
|
5223
5161
|
return getChain(chain).getCustomCurrencyId(resolvedAsset);
|
|
5224
5162
|
} else {
|
|
5225
5163
|
assertHasId(asset);
|
|
@@ -5398,7 +5336,7 @@ var getBalanceInternal = /*#__PURE__*/function () {
|
|
|
5398
5336
|
while (1) switch (_context2.n) {
|
|
5399
5337
|
case 0:
|
|
5400
5338
|
chain = options.chain, currency = options.currency;
|
|
5401
|
-
asset = currency ? findAssetInfoOrThrow(chain, currency
|
|
5339
|
+
asset = currency ? findAssetInfoOrThrow(chain, currency) : findNativeAssetInfoOrThrow(chain);
|
|
5402
5340
|
return _context2.a(2, getAssetBalanceInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
5403
5341
|
asset: asset
|
|
5404
5342
|
})));
|
|
@@ -5479,7 +5417,7 @@ var getMoonbeamErc20Balance = /*#__PURE__*/function () {
|
|
|
5479
5417
|
}();
|
|
5480
5418
|
|
|
5481
5419
|
var isSufficientOrigin = /*#__PURE__*/function () {
|
|
5482
|
-
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) {
|
|
5483
5421
|
var edNative, balanceNative, isNativeAssetToOrigin, isNativeAssetToDest, isSufficientNative, balanceAsset, edAsset, isSufficientAsset;
|
|
5484
5422
|
return _regenerator().w(function (_context) {
|
|
5485
5423
|
while (1) switch (_context.n) {
|
|
@@ -5495,7 +5433,7 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
5495
5433
|
return getBalanceInternal({
|
|
5496
5434
|
api: api,
|
|
5497
5435
|
chain: origin,
|
|
5498
|
-
address:
|
|
5436
|
+
address: sender
|
|
5499
5437
|
});
|
|
5500
5438
|
case 2:
|
|
5501
5439
|
balanceNative = _context.v;
|
|
@@ -5516,7 +5454,7 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
5516
5454
|
return getAssetBalanceInternal({
|
|
5517
5455
|
api: api,
|
|
5518
5456
|
chain: origin,
|
|
5519
|
-
address:
|
|
5457
|
+
address: sender,
|
|
5520
5458
|
asset: asset
|
|
5521
5459
|
});
|
|
5522
5460
|
case 4:
|
|
@@ -5579,11 +5517,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
5579
5517
|
};
|
|
5580
5518
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
5581
5519
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
5582
|
-
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;
|
|
5583
5521
|
return _regenerator().w(function (_context3) {
|
|
5584
5522
|
while (1) switch (_context3.n) {
|
|
5585
5523
|
case 0:
|
|
5586
|
-
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;
|
|
5587
5525
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5588
5526
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
5589
5527
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
@@ -5675,7 +5613,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
5675
5613
|
case 1:
|
|
5676
5614
|
_fee = _context3.v;
|
|
5677
5615
|
_context3.n = 2;
|
|
5678
|
-
return isSufficientDestination(api, destination,
|
|
5616
|
+
return isSufficientDestination(api, destination, recipient, currency.amount, asset, _fee);
|
|
5679
5617
|
case 2:
|
|
5680
5618
|
sufficient = _context3.v;
|
|
5681
5619
|
return _context3.a(2, {
|
|
@@ -5977,11 +5915,11 @@ var abi$1 = [{
|
|
|
5977
5915
|
}];
|
|
5978
5916
|
var transferMoonbeamLocal = /*#__PURE__*/function () {
|
|
5979
5917
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(client, assetInfo, _ref) {
|
|
5980
|
-
var signer,
|
|
5918
|
+
var signer, recipient, contract;
|
|
5981
5919
|
return _regenerator().w(function (_context) {
|
|
5982
5920
|
while (1) switch (_context.n) {
|
|
5983
5921
|
case 0:
|
|
5984
|
-
signer = _ref.signer,
|
|
5922
|
+
signer = _ref.signer, recipient = _ref.recipient;
|
|
5985
5923
|
assertHasId(assetInfo);
|
|
5986
5924
|
contract = getContract({
|
|
5987
5925
|
abi: abi$1,
|
|
@@ -5991,7 +5929,7 @@ var transferMoonbeamLocal = /*#__PURE__*/function () {
|
|
|
5991
5929
|
wallet: signer
|
|
5992
5930
|
}
|
|
5993
5931
|
});
|
|
5994
|
-
return _context.a(2, contract.write.transfer([
|
|
5932
|
+
return _context.a(2, contract.write.transfer([recipient, assetInfo.amount]));
|
|
5995
5933
|
}
|
|
5996
5934
|
}, _callee);
|
|
5997
5935
|
}));
|
|
@@ -6007,11 +5945,11 @@ var NATIVE_ASSET_ID = '0x0000000000000000000000000000000000000802';
|
|
|
6007
5945
|
var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
6008
5946
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
6009
5947
|
var _usdtAsset$assetId;
|
|
6010
|
-
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;
|
|
6011
5949
|
return _regenerator().w(function (_context) {
|
|
6012
5950
|
while (1) switch (_context.n) {
|
|
6013
5951
|
case 0:
|
|
6014
|
-
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;
|
|
6015
5953
|
if (!Array.isArray(currency)) {
|
|
6016
5954
|
_context.n = 1;
|
|
6017
5955
|
break;
|
|
@@ -6062,7 +6000,7 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
6062
6000
|
case 5:
|
|
6063
6001
|
asset = formatAssetIdToERC20(foundAsset.assetId);
|
|
6064
6002
|
case 6:
|
|
6065
|
-
destLocation = getDestinationLocation(api,
|
|
6003
|
+
destLocation = getDestinationLocation(api, recipient, to);
|
|
6066
6004
|
weight = U_64_MAX; // Partially inspired by Moonbeam XCM-SDK
|
|
6067
6005
|
// https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/sdk/src/contract/contracts/Xtokens/Xtokens.ts#L53
|
|
6068
6006
|
createTx = function createTx(func, args) {
|
|
@@ -6131,22 +6069,22 @@ var createAccountPayload = function createAccountPayload(api, address) {
|
|
|
6131
6069
|
};
|
|
6132
6070
|
var createBeneficiaryLocXTokens = function createBeneficiaryLocXTokens(_ref) {
|
|
6133
6071
|
var api = _ref.api,
|
|
6134
|
-
|
|
6072
|
+
recipient = _ref.recipient,
|
|
6135
6073
|
origin = _ref.origin,
|
|
6136
6074
|
destination = _ref.destination,
|
|
6137
6075
|
version = _ref.version,
|
|
6138
6076
|
paraId = _ref.paraId;
|
|
6139
|
-
if (isTLocation(
|
|
6140
|
-
return
|
|
6077
|
+
if (isTLocation(recipient)) {
|
|
6078
|
+
return recipient;
|
|
6141
6079
|
}
|
|
6142
6080
|
var scenario = resolveScenario(origin, destination);
|
|
6143
|
-
var accountPayload = createAccountPayload(api,
|
|
6081
|
+
var accountPayload = createAccountPayload(api, recipient);
|
|
6144
6082
|
if (scenario === 'ParaToRelay') {
|
|
6145
6083
|
return {
|
|
6146
6084
|
parents: Parents.ONE,
|
|
6147
6085
|
interior: createX1Payload(version, {
|
|
6148
6086
|
AccountId32: {
|
|
6149
|
-
id: api.accountToHex(
|
|
6087
|
+
id: api.accountToHex(recipient)
|
|
6150
6088
|
}
|
|
6151
6089
|
})
|
|
6152
6090
|
};
|
|
@@ -6337,7 +6275,7 @@ var reverseTransformLocation = function reverseTransformLocation(location) {
|
|
|
6337
6275
|
});
|
|
6338
6276
|
};
|
|
6339
6277
|
|
|
6340
|
-
var createMainInstruction = function createMainInstruction(origin, asset, ethAsset,
|
|
6278
|
+
var createMainInstruction = function createMainInstruction(origin, asset, ethAsset, recipient, messageId) {
|
|
6341
6279
|
assertHasId(ethAsset);
|
|
6342
6280
|
var interiorSb = ethAsset.symbol === 'ETH' ? {
|
|
6343
6281
|
Here: null
|
|
@@ -6361,7 +6299,7 @@ var createMainInstruction = function createMainInstruction(origin, asset, ethAss
|
|
|
6361
6299
|
X1: [{
|
|
6362
6300
|
AccountKey20: {
|
|
6363
6301
|
network: null,
|
|
6364
|
-
key:
|
|
6302
|
+
key: recipient
|
|
6365
6303
|
}
|
|
6366
6304
|
}]
|
|
6367
6305
|
}
|
|
@@ -6454,12 +6392,12 @@ var createMainInstruction = function createMainInstruction(origin, asset, ethAss
|
|
|
6454
6392
|
};
|
|
6455
6393
|
var createEthereumBridgeInstructions = function createEthereumBridgeInstructions(_ref, origin, messageId, ethAsset) {
|
|
6456
6394
|
var api = _ref.api,
|
|
6457
|
-
|
|
6395
|
+
sender = _ref.sender,
|
|
6396
|
+
recipient = _ref.recipient,
|
|
6458
6397
|
assetInfo = _ref.assetInfo,
|
|
6459
|
-
senderAddress = _ref.senderAddress,
|
|
6460
6398
|
ahAddress = _ref.ahAddress,
|
|
6461
6399
|
version = _ref.version;
|
|
6462
|
-
|
|
6400
|
+
assertSender(sender);
|
|
6463
6401
|
if (isChainEvm(origin) && !ahAddress) {
|
|
6464
6402
|
throw new MissingParameterError('ahAddress');
|
|
6465
6403
|
}
|
|
@@ -6471,27 +6409,28 @@ var createEthereumBridgeInstructions = function createEthereumBridgeInstructions
|
|
|
6471
6409
|
},
|
|
6472
6410
|
beneficiary: createBeneficiaryLocation({
|
|
6473
6411
|
api: api,
|
|
6474
|
-
address: isChainEvm(origin) ? ahAddress :
|
|
6412
|
+
address: isChainEvm(origin) ? ahAddress : sender,
|
|
6475
6413
|
version: version
|
|
6476
6414
|
})
|
|
6477
6415
|
}
|
|
6478
6416
|
}]
|
|
6479
|
-
}, createMainInstruction(origin, assetInfo, ethAsset,
|
|
6417
|
+
}, createMainInstruction(origin, assetInfo, ethAsset, recipient, messageId), {
|
|
6480
6418
|
SetTopic: messageId
|
|
6481
6419
|
}];
|
|
6482
6420
|
};
|
|
6483
6421
|
var createCustomXcmOnDest = function createCustomXcmOnDest(options, origin, messageId, ethAsset) {
|
|
6484
6422
|
var api = options.api,
|
|
6485
|
-
|
|
6423
|
+
sender = options.sender,
|
|
6424
|
+
recipient = options.recipient,
|
|
6486
6425
|
assetInfo = options.assetInfo,
|
|
6487
|
-
senderAddress = options.senderAddress,
|
|
6488
6426
|
ahAddress = options.ahAddress,
|
|
6489
6427
|
version = options.version;
|
|
6428
|
+
assertSender(sender);
|
|
6490
6429
|
var instructions = createEthereumBridgeInstructions({
|
|
6491
6430
|
api: api,
|
|
6492
|
-
|
|
6431
|
+
sender: sender,
|
|
6432
|
+
recipient: recipient,
|
|
6493
6433
|
assetInfo: assetInfo,
|
|
6494
|
-
senderAddress: senderAddress,
|
|
6495
6434
|
ahAddress: ahAddress,
|
|
6496
6435
|
version: version
|
|
6497
6436
|
}, origin, messageId, ethAsset);
|
|
@@ -6499,7 +6438,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(options, origin, mess
|
|
|
6499
6438
|
};
|
|
6500
6439
|
|
|
6501
6440
|
var generateMessageId = /*#__PURE__*/function () {
|
|
6502
|
-
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) {
|
|
6503
6442
|
var accountNextId, sourceAccountHex, entropy;
|
|
6504
6443
|
return _regenerator().w(function (_context) {
|
|
6505
6444
|
while (1) switch (_context.n) {
|
|
@@ -6509,7 +6448,7 @@ var generateMessageId = /*#__PURE__*/function () {
|
|
|
6509
6448
|
case 1:
|
|
6510
6449
|
accountNextId = _context.v;
|
|
6511
6450
|
sourceAccountHex = api.accountToHex(senderAddress);
|
|
6512
|
-
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()))));
|
|
6513
6452
|
return _context.a(2, api.blake2AsHex(entropy));
|
|
6514
6453
|
}
|
|
6515
6454
|
}, _callee);
|
|
@@ -6620,11 +6559,11 @@ var XCDOT = '0xFfFFfFff1FcaCBd218EDc0EbA20Fc2308C778080';
|
|
|
6620
6559
|
var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
6621
6560
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(from, _ref) {
|
|
6622
6561
|
var _signer$account;
|
|
6623
|
-
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;
|
|
6624
6563
|
return _regenerator().w(function (_context) {
|
|
6625
6564
|
while (1) switch (_context.n) {
|
|
6626
6565
|
case 0:
|
|
6627
|
-
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;
|
|
6628
6567
|
if (ahAddress) {
|
|
6629
6568
|
_context.n = 1;
|
|
6630
6569
|
break;
|
|
@@ -6657,7 +6596,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
6657
6596
|
amount = abstractDecimals(currency.amount, foundAsset.decimals, api);
|
|
6658
6597
|
ethAsset = findAssetInfoOrThrow('Ethereum', {
|
|
6659
6598
|
symbol: foundAsset.symbol
|
|
6660
|
-
}
|
|
6599
|
+
});
|
|
6661
6600
|
contract = getContract({
|
|
6662
6601
|
abi: abi,
|
|
6663
6602
|
address: xcmInterfacePrecompile,
|
|
@@ -6669,21 +6608,21 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
6669
6608
|
wallet: signer
|
|
6670
6609
|
}
|
|
6671
6610
|
});
|
|
6672
|
-
|
|
6673
|
-
|
|
6611
|
+
sender = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
|
|
6612
|
+
assertSender(sender);
|
|
6674
6613
|
assertHasId(ethAsset);
|
|
6675
6614
|
_context.n = 6;
|
|
6676
6615
|
return api.init(from, TX_CLIENT_TIMEOUT_MS);
|
|
6677
6616
|
case 6:
|
|
6678
6617
|
_context.n = 7;
|
|
6679
|
-
return generateMessageId(api,
|
|
6618
|
+
return generateMessageId(api, sender, getParaId(from), ethAsset.assetId, recipient, amount);
|
|
6680
6619
|
case 7:
|
|
6681
6620
|
messageId = _context.v;
|
|
6682
6621
|
version = Version.V4;
|
|
6683
6622
|
customXcm = createCustomXcmOnDest({
|
|
6684
6623
|
api: api,
|
|
6685
|
-
|
|
6686
|
-
|
|
6624
|
+
recipient: recipient,
|
|
6625
|
+
sender: sender,
|
|
6687
6626
|
ahAddress: ahAddress,
|
|
6688
6627
|
assetInfo: _objectSpread2(_objectSpread2({}, foundAsset), {}, {
|
|
6689
6628
|
amount: amount
|
|
@@ -6749,7 +6688,7 @@ var traverseXcmHops = /*#__PURE__*/function () {
|
|
|
6749
6688
|
forwardedXcms = initialForwardedXcms;
|
|
6750
6689
|
nextParaId = initialDestParaId;
|
|
6751
6690
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
6752
|
-
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;
|
|
6753
6692
|
hasPassedExchange = origin === (swapConfig === null || swapConfig === void 0 ? void 0 : swapConfig.exchangeChain);
|
|
6754
6693
|
hops = [];
|
|
6755
6694
|
case 1:
|
|
@@ -6868,11 +6807,11 @@ var addEthereumBridgeFees = /*#__PURE__*/function () {
|
|
|
6868
6807
|
|
|
6869
6808
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
6870
6809
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
6871
|
-
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;
|
|
6872
6811
|
return _regenerator().w(function (_context2) {
|
|
6873
6812
|
while (1) switch (_context2.n) {
|
|
6874
6813
|
case 0:
|
|
6875
|
-
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;
|
|
6876
6815
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
6877
6816
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
6878
6817
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
@@ -6882,7 +6821,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
6882
6821
|
tx: tx,
|
|
6883
6822
|
chain: origin,
|
|
6884
6823
|
destination: destination,
|
|
6885
|
-
address:
|
|
6824
|
+
address: sender,
|
|
6886
6825
|
asset: _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6887
6826
|
amount: amount
|
|
6888
6827
|
}),
|
|
@@ -7061,12 +7000,12 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
7061
7000
|
|
|
7062
7001
|
var dryRun = /*#__PURE__*/function () {
|
|
7063
7002
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
7064
|
-
var api,
|
|
7003
|
+
var api, sender, origin;
|
|
7065
7004
|
return _regenerator().w(function (_context) {
|
|
7066
7005
|
while (1) switch (_context.p = _context.n) {
|
|
7067
7006
|
case 0:
|
|
7068
|
-
api = options.api,
|
|
7069
|
-
validateAddress(api,
|
|
7007
|
+
api = options.api, sender = options.sender, origin = options.origin;
|
|
7008
|
+
validateAddress(api, sender, origin, false);
|
|
7070
7009
|
_context.n = 1;
|
|
7071
7010
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
7072
7011
|
case 1:
|
|
@@ -7151,7 +7090,7 @@ var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountH
|
|
|
7151
7090
|
}), balance, address, api);
|
|
7152
7091
|
};
|
|
7153
7092
|
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
7154
|
-
var asset = findAssetInfo(chain, currency
|
|
7093
|
+
var asset = findAssetInfo(chain, currency);
|
|
7155
7094
|
if (!asset) return null;
|
|
7156
7095
|
var amount = parseUnits(amountHuman, asset.decimals);
|
|
7157
7096
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
@@ -7240,7 +7179,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
7240
7179
|
}
|
|
7241
7180
|
};
|
|
7242
7181
|
nativeInfo = mintFeeAssets ? findNativeAssetInfo(chain) : null;
|
|
7243
|
-
relayInfo = mintFeeAssets ? findAssetInfo(chain, relayCurrency
|
|
7182
|
+
relayInfo = mintFeeAssets ? findAssetInfo(chain, relayCurrency) : null;
|
|
7244
7183
|
sameNativeRelay = !!(nativeInfo && relayInfo && isAssetXcEqual(nativeInfo, relayInfo));
|
|
7245
7184
|
if (!mintFeeAssets) {
|
|
7246
7185
|
_context.n = 2;
|
|
@@ -7542,11 +7481,11 @@ var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
|
7542
7481
|
|
|
7543
7482
|
var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
7544
7483
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
7545
|
-
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;
|
|
7546
7485
|
return _regenerator().w(function (_context) {
|
|
7547
7486
|
while (1) switch (_context.n) {
|
|
7548
7487
|
case 0:
|
|
7549
|
-
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;
|
|
7550
7489
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
7551
7490
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
7552
7491
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
@@ -7558,13 +7497,13 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7558
7497
|
break;
|
|
7559
7498
|
}
|
|
7560
7499
|
_context.n = 2;
|
|
7561
|
-
return api.getPaymentInfo(tx,
|
|
7500
|
+
return api.getPaymentInfo(tx, sender);
|
|
7562
7501
|
case 2:
|
|
7563
7502
|
_yield$api$getPayment = _context.v;
|
|
7564
7503
|
rawFee = _yield$api$getPayment.partialFee;
|
|
7565
7504
|
paddedFee = padFee(rawFee, origin, destination, 'origin');
|
|
7566
7505
|
_context.n = 3;
|
|
7567
|
-
return isSufficientOrigin(api, origin, destination,
|
|
7506
|
+
return isSufficientOrigin(api, origin, destination, sender, paddedFee, _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7568
7507
|
amount: amount
|
|
7569
7508
|
}), asset, resolvedFeeAsset);
|
|
7570
7509
|
case 3:
|
|
@@ -7582,7 +7521,7 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7582
7521
|
tx: tx,
|
|
7583
7522
|
chain: origin,
|
|
7584
7523
|
destination: destination,
|
|
7585
|
-
address:
|
|
7524
|
+
address: sender,
|
|
7586
7525
|
asset: _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
7587
7526
|
amount: amount
|
|
7588
7527
|
}),
|
|
@@ -7608,7 +7547,7 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
7608
7547
|
});
|
|
7609
7548
|
case 6:
|
|
7610
7549
|
_context.n = 7;
|
|
7611
|
-
return api.getPaymentInfo(tx,
|
|
7550
|
+
return api.getPaymentInfo(tx, sender);
|
|
7612
7551
|
case 7:
|
|
7613
7552
|
_yield$api$getPayment2 = _context.v;
|
|
7614
7553
|
_rawFee = _yield$api$getPayment2.partialFee;
|
|
@@ -7690,49 +7629,6 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
7690
7629
|
};
|
|
7691
7630
|
}();
|
|
7692
7631
|
|
|
7693
|
-
/**
|
|
7694
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
7695
|
-
* Please use `builder.getOriginXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
7696
|
-
* Will be removed in v13.
|
|
7697
|
-
* For more details, see the documentation:
|
|
7698
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
7699
|
-
*/
|
|
7700
|
-
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
7701
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
7702
|
-
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, amount, _yield$api$getPayment, rawOriginFee, originFee, resolvedFeeAsset, sufficient, asset;
|
|
7703
|
-
return _regenerator().w(function (_context) {
|
|
7704
|
-
while (1) switch (_context.n) {
|
|
7705
|
-
case 0:
|
|
7706
|
-
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, currency = _ref.currency, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset;
|
|
7707
|
-
originAsset = findAssetInfoOrThrow(origin, currency, destination);
|
|
7708
|
-
amount = abstractDecimals(currency.amount, originAsset.decimals, api);
|
|
7709
|
-
_context.n = 1;
|
|
7710
|
-
return api.getPaymentInfo(tx, senderAddress);
|
|
7711
|
-
case 1:
|
|
7712
|
-
_yield$api$getPayment = _context.v;
|
|
7713
|
-
rawOriginFee = _yield$api$getPayment.partialFee;
|
|
7714
|
-
originFee = padFee(rawOriginFee, origin, destination, 'origin');
|
|
7715
|
-
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
7716
|
-
_context.n = 2;
|
|
7717
|
-
return isSufficientOrigin(api, origin, destination, senderAddress, originFee, _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7718
|
-
amount: amount
|
|
7719
|
-
}), originAsset, resolvedFeeAsset);
|
|
7720
|
-
case 2:
|
|
7721
|
-
sufficient = _context.v;
|
|
7722
|
-
asset = resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset;
|
|
7723
|
-
return _context.a(2, {
|
|
7724
|
-
fee: originFee,
|
|
7725
|
-
asset: asset,
|
|
7726
|
-
sufficient: sufficient
|
|
7727
|
-
});
|
|
7728
|
-
}
|
|
7729
|
-
}, _callee);
|
|
7730
|
-
}));
|
|
7731
|
-
return function getOriginXcmFeeEstimate(_x) {
|
|
7732
|
-
return _ref2.apply(this, arguments);
|
|
7733
|
-
};
|
|
7734
|
-
}();
|
|
7735
|
-
|
|
7736
7632
|
var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
7737
7633
|
var _chains$origin, _chains$destination;
|
|
7738
7634
|
// Check standard chains first for backwards compatibility
|
|
@@ -7769,11 +7665,11 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
7769
7665
|
};
|
|
7770
7666
|
var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
7771
7667
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
7772
|
-
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;
|
|
7773
7669
|
return _regenerator().w(function (_context2) {
|
|
7774
7670
|
while (1) switch (_context2.p = _context2.n) {
|
|
7775
7671
|
case 0:
|
|
7776
|
-
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;
|
|
7777
7673
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
7778
7674
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
7779
7675
|
resolvedVersion = pickCompatibleXcmVersion(origin, destination, version);
|
|
@@ -7783,7 +7679,7 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7783
7679
|
tx: tx,
|
|
7784
7680
|
origin: origin,
|
|
7785
7681
|
destination: destination,
|
|
7786
|
-
|
|
7682
|
+
sender: sender,
|
|
7787
7683
|
feeAsset: feeAsset,
|
|
7788
7684
|
currency: currency,
|
|
7789
7685
|
version: resolvedVersion,
|
|
@@ -7839,12 +7735,12 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7839
7735
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7840
7736
|
amount: amount
|
|
7841
7737
|
}),
|
|
7842
|
-
|
|
7738
|
+
sender: sender,
|
|
7739
|
+
recipient: recipient,
|
|
7843
7740
|
asset: asset,
|
|
7844
7741
|
version: resolvedVersion,
|
|
7845
7742
|
tx: tx,
|
|
7846
7743
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
7847
|
-
senderAddress: senderAddress,
|
|
7848
7744
|
disableFallback: disableFallback,
|
|
7849
7745
|
swapConfig: swapConfig,
|
|
7850
7746
|
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
@@ -7921,8 +7817,8 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7921
7817
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7922
7818
|
amount: amount
|
|
7923
7819
|
}),
|
|
7924
|
-
|
|
7925
|
-
|
|
7820
|
+
sender: sender,
|
|
7821
|
+
recipient: recipient,
|
|
7926
7822
|
asset: hopAsset,
|
|
7927
7823
|
version: resolvedVersion,
|
|
7928
7824
|
feeAsset: feeAsset,
|
|
@@ -7998,12 +7894,12 @@ var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
|
7998
7894
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
7999
7895
|
amount: amount
|
|
8000
7896
|
}),
|
|
8001
|
-
|
|
7897
|
+
sender: sender,
|
|
7898
|
+
recipient: recipient,
|
|
8002
7899
|
asset: asset,
|
|
8003
7900
|
version: resolvedVersion,
|
|
8004
7901
|
tx: tx,
|
|
8005
7902
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
8006
|
-
senderAddress: senderAddress,
|
|
8007
7903
|
disableFallback: disableFallback,
|
|
8008
7904
|
swapConfig: swapConfig,
|
|
8009
7905
|
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
@@ -8211,113 +8107,13 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
8211
8107
|
};
|
|
8212
8108
|
}();
|
|
8213
8109
|
|
|
8214
|
-
var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
|
|
8215
|
-
var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
|
|
8216
|
-
/**
|
|
8217
|
-
* @deprecated This function is deprecated and will be removed in a future version.
|
|
8218
|
-
* Please use `builder.getXcmFee()` instead, where `builder` is an instance of `Builder()`.
|
|
8219
|
-
* Will be removed in v13.
|
|
8220
|
-
* For more details, see the documentation:
|
|
8221
|
-
* {@link https://paraspell.github.io/docs/sdk/xcmPallet.html#xcm-fee-origin-and-dest}
|
|
8222
|
-
*/
|
|
8223
|
-
var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
8224
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
8225
|
-
var api, origin, destination, currency, feeAsset, address, senderAddress, originAsset, destAsset, amount, resolvedFeeAsset, destApi, _ref2, _ref3, fixedOriginFee, fixedDestinationFee, originSufficient, _destinationSufficient, originFeeDetails, destinationFee, destinationSufficient, destFeeDetails, _t;
|
|
8226
|
-
return _regenerator().w(function (_context) {
|
|
8227
|
-
while (1) switch (_context.n) {
|
|
8228
|
-
case 0:
|
|
8229
|
-
api = options.api, origin = options.origin, destination = options.destination, currency = options.currency, feeAsset = options.feeAsset, address = options.address, senderAddress = options.senderAddress;
|
|
8230
|
-
originAsset = findAssetInfoOrThrow(origin, currency, destination);
|
|
8231
|
-
destAsset = findAssetOnDestOrThrow(origin, destination, currency);
|
|
8232
|
-
amount = abstractDecimals(currency.amount, originAsset.decimals, api);
|
|
8233
|
-
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
8234
|
-
_context.n = 1;
|
|
8235
|
-
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
8236
|
-
case 1:
|
|
8237
|
-
destApi = api.clone();
|
|
8238
|
-
_context.n = 2;
|
|
8239
|
-
return destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
8240
|
-
case 2:
|
|
8241
|
-
if (!(origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot')) {
|
|
8242
|
-
_context.n = 5;
|
|
8243
|
-
break;
|
|
8244
|
-
}
|
|
8245
|
-
_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];
|
|
8246
|
-
_context.n = 3;
|
|
8247
|
-
return isSufficientOrigin(api, origin, destination, senderAddress, fixedOriginFee, _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8248
|
-
amount: amount
|
|
8249
|
-
}), originAsset, resolvedFeeAsset);
|
|
8250
|
-
case 3:
|
|
8251
|
-
originSufficient = _context.v;
|
|
8252
|
-
_context.n = 4;
|
|
8253
|
-
return isSufficientDestination(destApi, destination, address, amount, originAsset, fixedDestinationFee);
|
|
8254
|
-
case 4:
|
|
8255
|
-
_destinationSufficient = _context.v;
|
|
8256
|
-
return _context.a(2, {
|
|
8257
|
-
origin: {
|
|
8258
|
-
fee: fixedOriginFee,
|
|
8259
|
-
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : originAsset,
|
|
8260
|
-
sufficient: originSufficient
|
|
8261
|
-
},
|
|
8262
|
-
destination: {
|
|
8263
|
-
fee: fixedDestinationFee,
|
|
8264
|
-
asset: destAsset,
|
|
8265
|
-
sufficient: _destinationSufficient
|
|
8266
|
-
}
|
|
8267
|
-
});
|
|
8268
|
-
case 5:
|
|
8269
|
-
_context.n = 6;
|
|
8270
|
-
return getOriginXcmFeeEstimate(options);
|
|
8271
|
-
case 6:
|
|
8272
|
-
originFeeDetails = _context.v;
|
|
8273
|
-
if (!isExternalChain(destination)) {
|
|
8274
|
-
_context.n = 7;
|
|
8275
|
-
break;
|
|
8276
|
-
}
|
|
8277
|
-
_t = 0n;
|
|
8278
|
-
_context.n = 9;
|
|
8279
|
-
break;
|
|
8280
|
-
case 7:
|
|
8281
|
-
_context.n = 8;
|
|
8282
|
-
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8283
|
-
api: destApi,
|
|
8284
|
-
destination: destination
|
|
8285
|
-
}), {
|
|
8286
|
-
location: originAsset.location,
|
|
8287
|
-
amount: amount
|
|
8288
|
-
});
|
|
8289
|
-
case 8:
|
|
8290
|
-
_t = _context.v;
|
|
8291
|
-
case 9:
|
|
8292
|
-
destinationFee = _t;
|
|
8293
|
-
_context.n = 10;
|
|
8294
|
-
return isSufficientDestination(destApi, destination, address, amount, originAsset, destinationFee);
|
|
8295
|
-
case 10:
|
|
8296
|
-
destinationSufficient = _context.v;
|
|
8297
|
-
destFeeDetails = {
|
|
8298
|
-
fee: destinationFee,
|
|
8299
|
-
asset: destAsset,
|
|
8300
|
-
sufficient: destinationSufficient
|
|
8301
|
-
};
|
|
8302
|
-
return _context.a(2, {
|
|
8303
|
-
origin: originFeeDetails,
|
|
8304
|
-
destination: destFeeDetails
|
|
8305
|
-
});
|
|
8306
|
-
}
|
|
8307
|
-
}, _callee);
|
|
8308
|
-
}));
|
|
8309
|
-
return function getXcmFeeEstimate(_x) {
|
|
8310
|
-
return _ref.apply(this, arguments);
|
|
8311
|
-
};
|
|
8312
|
-
}();
|
|
8313
|
-
|
|
8314
8110
|
var buildDestInfo = /*#__PURE__*/function () {
|
|
8315
8111
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
8316
|
-
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;
|
|
8317
8113
|
return _regenerator().w(function (_context) {
|
|
8318
8114
|
while (1) switch (_context.n) {
|
|
8319
8115
|
case 0:
|
|
8320
|
-
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;
|
|
8321
8117
|
destApi = api.clone();
|
|
8322
8118
|
_context.n = 1;
|
|
8323
8119
|
return destApi.init(destination);
|
|
@@ -8327,7 +8123,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
8327
8123
|
_context.n = 2;
|
|
8328
8124
|
return getAssetBalanceInternal({
|
|
8329
8125
|
api: destApi,
|
|
8330
|
-
address:
|
|
8126
|
+
address: recipient,
|
|
8331
8127
|
chain: destination,
|
|
8332
8128
|
asset: destAsset
|
|
8333
8129
|
});
|
|
@@ -8375,7 +8171,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
8375
8171
|
}
|
|
8376
8172
|
_context.n = 3;
|
|
8377
8173
|
return getBalanceInternal({
|
|
8378
|
-
address:
|
|
8174
|
+
address: recipient,
|
|
8379
8175
|
chain: destination,
|
|
8380
8176
|
api: destApi
|
|
8381
8177
|
});
|
|
@@ -8467,11 +8263,11 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
8467
8263
|
|
|
8468
8264
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
8469
8265
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
8470
|
-
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;
|
|
8471
8267
|
return _regenerator().w(function (_context2) {
|
|
8472
8268
|
while (1) switch (_context2.p = _context2.n) {
|
|
8473
8269
|
case 0:
|
|
8474
|
-
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;
|
|
8475
8271
|
if (!(isChainEvm(origin) && !ahAddress)) {
|
|
8476
8272
|
_context2.n = 1;
|
|
8477
8273
|
break;
|
|
@@ -8489,7 +8285,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8489
8285
|
_context2.n = 4;
|
|
8490
8286
|
return getAssetBalanceInternal({
|
|
8491
8287
|
api: api,
|
|
8492
|
-
address:
|
|
8288
|
+
address: sender,
|
|
8493
8289
|
chain: origin,
|
|
8494
8290
|
asset: originAsset
|
|
8495
8291
|
});
|
|
@@ -8502,8 +8298,8 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8502
8298
|
buildTx: buildTx,
|
|
8503
8299
|
origin: origin,
|
|
8504
8300
|
destination: destination,
|
|
8505
|
-
|
|
8506
|
-
|
|
8301
|
+
sender: sender,
|
|
8302
|
+
recipient: recipient,
|
|
8507
8303
|
currency: currency,
|
|
8508
8304
|
feeAsset: feeAsset,
|
|
8509
8305
|
version: version,
|
|
@@ -8519,7 +8315,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8519
8315
|
_context2.n = 6;
|
|
8520
8316
|
return getAssetBalanceInternal({
|
|
8521
8317
|
api: api,
|
|
8522
|
-
address:
|
|
8318
|
+
address: sender,
|
|
8523
8319
|
chain: origin,
|
|
8524
8320
|
asset: originFeeAsset
|
|
8525
8321
|
});
|
|
@@ -8550,7 +8346,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8550
8346
|
originChain: origin,
|
|
8551
8347
|
currency: currency,
|
|
8552
8348
|
asset: hop.result.asset,
|
|
8553
|
-
|
|
8349
|
+
sender: sender,
|
|
8554
8350
|
ahAddress: ahAddress
|
|
8555
8351
|
});
|
|
8556
8352
|
case 1:
|
|
@@ -8580,7 +8376,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
8580
8376
|
api: api,
|
|
8581
8377
|
origin: origin,
|
|
8582
8378
|
destination: destination,
|
|
8583
|
-
|
|
8379
|
+
recipient: recipient,
|
|
8584
8380
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8585
8381
|
amount: amount
|
|
8586
8382
|
}),
|
|
@@ -8645,13 +8441,13 @@ var sumHopFees = function sumHopFees(result, _ref) {
|
|
|
8645
8441
|
};
|
|
8646
8442
|
var computeAllFees = /*#__PURE__*/function () {
|
|
8647
8443
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, buildTx) {
|
|
8648
|
-
var origin, dest, _context$options,
|
|
8444
|
+
var origin, dest, _context$options, sender, recipient, currency, feeCurrency, version, result, hopFees, destFee;
|
|
8649
8445
|
return _regenerator().w(function (_context) {
|
|
8650
8446
|
while (1) switch (_context.n) {
|
|
8651
8447
|
case 0:
|
|
8652
|
-
origin = context.origin, dest = context.dest, _context$options = context.options,
|
|
8653
|
-
|
|
8654
|
-
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);
|
|
8655
8451
|
if (hasDryRunSupport(context.origin.chain)) {
|
|
8656
8452
|
_context.n = 1;
|
|
8657
8453
|
break;
|
|
@@ -8664,8 +8460,8 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
8664
8460
|
buildTx: buildTx,
|
|
8665
8461
|
origin: origin.chain,
|
|
8666
8462
|
destination: dest.chain,
|
|
8667
|
-
|
|
8668
|
-
|
|
8463
|
+
sender: sender,
|
|
8464
|
+
recipient: recipient,
|
|
8669
8465
|
version: version,
|
|
8670
8466
|
currency: currency,
|
|
8671
8467
|
feeAsset: feeCurrency,
|
|
@@ -8690,14 +8486,14 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
8690
8486
|
|
|
8691
8487
|
var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
8692
8488
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
8693
|
-
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;
|
|
8694
8490
|
return _regenerator().w(function (_context2) {
|
|
8695
8491
|
while (1) switch (_context2.p = _context2.n) {
|
|
8696
8492
|
case 0:
|
|
8697
|
-
api = _ref.api, origin = _ref.origin,
|
|
8698
|
-
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);
|
|
8699
8495
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
8700
|
-
asset = findAssetInfoOrThrow(chain, currency
|
|
8496
|
+
asset = findAssetInfoOrThrow(chain, currency);
|
|
8701
8497
|
destAsset = findAssetOnDestOrThrow(origin, destination, currency);
|
|
8702
8498
|
destApi = api.clone();
|
|
8703
8499
|
_context2.n = 1;
|
|
@@ -8706,7 +8502,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8706
8502
|
_context2.n = 2;
|
|
8707
8503
|
return getAssetBalanceInternal({
|
|
8708
8504
|
api: destApi,
|
|
8709
|
-
address:
|
|
8505
|
+
address: recipient,
|
|
8710
8506
|
chain: destination,
|
|
8711
8507
|
asset: destAsset
|
|
8712
8508
|
});
|
|
@@ -8723,8 +8519,8 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8723
8519
|
origin: origin,
|
|
8724
8520
|
destination: destination,
|
|
8725
8521
|
buildTx: buildTx,
|
|
8726
|
-
|
|
8727
|
-
|
|
8522
|
+
sender: sender,
|
|
8523
|
+
recipient: recipient,
|
|
8728
8524
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8729
8525
|
amount: amount
|
|
8730
8526
|
}),
|
|
@@ -8800,8 +8596,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8800
8596
|
tx: tx,
|
|
8801
8597
|
origin: chain,
|
|
8802
8598
|
destination: destination,
|
|
8803
|
-
|
|
8804
|
-
address: address,
|
|
8599
|
+
sender: sender,
|
|
8805
8600
|
version: version,
|
|
8806
8601
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
8807
8602
|
amount: minAmount
|
|
@@ -8856,19 +8651,19 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
8856
8651
|
|
|
8857
8652
|
var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
8858
8653
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
8859
|
-
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;
|
|
8860
8655
|
return _regenerator().w(function (_context) {
|
|
8861
8656
|
while (1) switch (_context.n) {
|
|
8862
8657
|
case 0:
|
|
8863
|
-
api = _ref.api,
|
|
8864
|
-
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);
|
|
8865
8660
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
8866
|
-
asset = findAssetInfoOrThrow(chain, currency
|
|
8661
|
+
asset = findAssetInfoOrThrow(chain, currency);
|
|
8867
8662
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
8868
8663
|
_context.n = 1;
|
|
8869
8664
|
return getAssetBalanceInternal({
|
|
8870
8665
|
api: api,
|
|
8871
|
-
address:
|
|
8666
|
+
address: sender,
|
|
8872
8667
|
chain: chain,
|
|
8873
8668
|
asset: asset
|
|
8874
8669
|
});
|
|
@@ -8889,7 +8684,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
8889
8684
|
buildTx: buildTx,
|
|
8890
8685
|
origin: chain,
|
|
8891
8686
|
destination: chain,
|
|
8892
|
-
|
|
8687
|
+
sender: sender,
|
|
8893
8688
|
feeAsset: feeAsset,
|
|
8894
8689
|
version: version,
|
|
8895
8690
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
@@ -9115,8 +8910,8 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9115
8910
|
options,
|
|
9116
8911
|
destination,
|
|
9117
8912
|
version,
|
|
9118
|
-
|
|
9119
|
-
|
|
8913
|
+
sender,
|
|
8914
|
+
recipient,
|
|
9120
8915
|
paraIdTo,
|
|
9121
8916
|
hopFees,
|
|
9122
8917
|
destFee,
|
|
@@ -9141,7 +8936,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9141
8936
|
destFee: 0n
|
|
9142
8937
|
};
|
|
9143
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;
|
|
9144
|
-
destination = options.destination, version = options.version,
|
|
8939
|
+
destination = options.destination, version = options.version, sender = options.sender, recipient = options.recipient, paraIdTo = options.paraIdTo;
|
|
9145
8940
|
hopFees = fees.hopFees, destFee = fees.destFee;
|
|
9146
8941
|
feeAssetLocation = !isRelayAsset ? RELAY_LOCATION : assetInfo.location;
|
|
9147
8942
|
feeLocLocalized = localizeLocation(dest.chain, feeAssetLocation, origin.chain);
|
|
@@ -9162,7 +8957,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9162
8957
|
},
|
|
9163
8958
|
beneficiary: createBeneficiaryLocation({
|
|
9164
8959
|
api: isSubBridge ? dest.api : origin.api,
|
|
9165
|
-
address:
|
|
8960
|
+
address: recipient,
|
|
9166
8961
|
version: version
|
|
9167
8962
|
})
|
|
9168
8963
|
}
|
|
@@ -9226,9 +9021,9 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9226
9021
|
_context.n = 6;
|
|
9227
9022
|
break;
|
|
9228
9023
|
}
|
|
9229
|
-
|
|
9024
|
+
assertSender(sender);
|
|
9230
9025
|
_context.n = 5;
|
|
9231
|
-
return generateMessageId(origin.api,
|
|
9026
|
+
return generateMessageId(origin.api, sender, getParaId(origin.chain), JSON.stringify(assetInfo.location), JSON.stringify(recipient), assetInfo.amount);
|
|
9232
9027
|
case 5:
|
|
9233
9028
|
messageId = _context.v;
|
|
9234
9029
|
return _context.a(2, [depositInstruction, {
|
|
@@ -9244,7 +9039,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
9244
9039
|
};
|
|
9245
9040
|
}();
|
|
9246
9041
|
|
|
9247
|
-
var createRefundInstruction = function createRefundInstruction(api,
|
|
9042
|
+
var createRefundInstruction = function createRefundInstruction(api, address, version, assetCount) {
|
|
9248
9043
|
return {
|
|
9249
9044
|
SetAppendix: [{
|
|
9250
9045
|
DepositAsset: {
|
|
@@ -9255,7 +9050,7 @@ var createRefundInstruction = function createRefundInstruction(api, senderAddres
|
|
|
9255
9050
|
},
|
|
9256
9051
|
beneficiary: createBeneficiaryLocation({
|
|
9257
9052
|
api: api,
|
|
9258
|
-
address:
|
|
9053
|
+
address: address,
|
|
9259
9054
|
version: version
|
|
9260
9055
|
})
|
|
9261
9056
|
}
|
|
@@ -9293,7 +9088,7 @@ var constructTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
9293
9088
|
isSubBridge,
|
|
9294
9089
|
isRelayAsset,
|
|
9295
9090
|
options,
|
|
9296
|
-
|
|
9091
|
+
sender,
|
|
9297
9092
|
version,
|
|
9298
9093
|
assetCount,
|
|
9299
9094
|
refundInstruction,
|
|
@@ -9308,9 +9103,9 @@ var constructTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
9308
9103
|
case 0:
|
|
9309
9104
|
fees = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
|
|
9310
9105
|
origin = context.origin, assetInfo = context.assetInfo, isSubBridge = context.isSubBridge, isRelayAsset = context.isRelayAsset, options = context.options;
|
|
9311
|
-
|
|
9106
|
+
sender = options.sender, version = options.version;
|
|
9312
9107
|
assetCount = isRelayAsset ? 1 : 2;
|
|
9313
|
-
refundInstruction =
|
|
9108
|
+
refundInstruction = sender && !isSubBridge ? createRefundInstruction(origin.api, sender, version, assetCount) : null;
|
|
9314
9109
|
resolvedFees = fees !== null && fees !== void 0 ? fees : {
|
|
9315
9110
|
hopFees: 0n,
|
|
9316
9111
|
destFee: 0n
|
|
@@ -9407,20 +9202,20 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
9407
9202
|
|
|
9408
9203
|
var createCallForReserve = /*#__PURE__*/function () {
|
|
9409
9204
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, reserveChain, options) {
|
|
9410
|
-
var api, destination,
|
|
9205
|
+
var api, destination, sender, recipient, currency, feeCurrency, version, serialized, tx, dryRunResult, success;
|
|
9411
9206
|
return _regenerator().w(function (_context) {
|
|
9412
9207
|
while (1) switch (_context.n) {
|
|
9413
9208
|
case 0:
|
|
9414
|
-
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;
|
|
9415
9210
|
_context.n = 1;
|
|
9416
9211
|
return createTypeAndThenCall(options, {
|
|
9417
9212
|
reserveChain: reserveChain
|
|
9418
9213
|
});
|
|
9419
9214
|
case 1:
|
|
9420
9215
|
serialized = _context.v;
|
|
9421
|
-
|
|
9216
|
+
assertSender(sender);
|
|
9217
|
+
assertAddressIsString(recipient);
|
|
9422
9218
|
assertToIsString(destination, 'Location destination is not supported for reserve auto-selection.');
|
|
9423
|
-
assertSenderAddress(senderAddress);
|
|
9424
9219
|
tx = api.deserializeExtrinsics(serialized);
|
|
9425
9220
|
_context.n = 2;
|
|
9426
9221
|
return dryRunInternal({
|
|
@@ -9428,8 +9223,7 @@ var createCallForReserve = /*#__PURE__*/function () {
|
|
|
9428
9223
|
tx: tx,
|
|
9429
9224
|
origin: chain,
|
|
9430
9225
|
destination: destination,
|
|
9431
|
-
|
|
9432
|
-
senderAddress: senderAddress,
|
|
9226
|
+
sender: sender,
|
|
9433
9227
|
currency: currency,
|
|
9434
9228
|
version: version,
|
|
9435
9229
|
feeAsset: feeCurrency,
|
|
@@ -9512,18 +9306,18 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(asset, feeResult) {
|
|
|
9512
9306
|
};
|
|
9513
9307
|
var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
9514
9308
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
9515
|
-
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;
|
|
9516
9310
|
return _regenerator().w(function (_context) {
|
|
9517
9311
|
while (1) switch (_context.n) {
|
|
9518
9312
|
case 0:
|
|
9519
|
-
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;
|
|
9520
9314
|
if (!isExternalChain(destination)) {
|
|
9521
9315
|
_context.n = 1;
|
|
9522
9316
|
break;
|
|
9523
9317
|
}
|
|
9524
9318
|
return _context.a(2, true);
|
|
9525
9319
|
case 1:
|
|
9526
|
-
validateAddress(api,
|
|
9320
|
+
validateAddress(api, recipient, destination, true);
|
|
9527
9321
|
isSubBridge = isSubstrateBridge(origin, destination);
|
|
9528
9322
|
if (!isSubBridge) {
|
|
9529
9323
|
_context.n = 2;
|
|
@@ -9541,7 +9335,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9541
9335
|
ed = getEdFromAssetOrThrow(destAsset);
|
|
9542
9336
|
_context.n = 4;
|
|
9543
9337
|
return getAssetBalanceInternal({
|
|
9544
|
-
address:
|
|
9338
|
+
address: recipient,
|
|
9545
9339
|
chain: destination,
|
|
9546
9340
|
api: destApi,
|
|
9547
9341
|
asset: destAsset
|
|
@@ -9554,8 +9348,8 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
9554
9348
|
buildTx: buildTx,
|
|
9555
9349
|
origin: origin,
|
|
9556
9350
|
destination: destination,
|
|
9557
|
-
|
|
9558
|
-
|
|
9351
|
+
sender: sender,
|
|
9352
|
+
recipient: recipient,
|
|
9559
9353
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
9560
9354
|
amount: amount
|
|
9561
9355
|
}),
|
|
@@ -9691,9 +9485,6 @@ var createRouterBuilder = function createRouterBuilder(options) {
|
|
|
9691
9485
|
if ((_options$transactOpti = options.transactOptions) !== null && _options$transactOpti !== void 0 && _options$transactOpti.call) {
|
|
9692
9486
|
throw new UnsupportedOperationError('Cannot use transact options together with swap options.');
|
|
9693
9487
|
}
|
|
9694
|
-
if (api.getType() !== 'PAPI') {
|
|
9695
|
-
throw new UnsupportedOperationError('Swaps are only supported when using PAPI SDK.');
|
|
9696
|
-
}
|
|
9697
9488
|
var _getSwapExtensionOrTh = getSwapExtensionOrThrow(),
|
|
9698
9489
|
RouterBuilder = _getSwapExtensionOrTh.RouterBuilder;
|
|
9699
9490
|
var from = options.from,
|
|
@@ -9705,21 +9496,16 @@ var createRouterBuilder = function createRouterBuilder(options) {
|
|
|
9705
9496
|
exchange = _options$swapOptions.exchange,
|
|
9706
9497
|
slippage = _options$swapOptions.slippage,
|
|
9707
9498
|
onStatusChange = _options$swapOptions.onStatusChange,
|
|
9708
|
-
|
|
9709
|
-
address = options.
|
|
9499
|
+
sender = options.sender,
|
|
9500
|
+
address = options.recipient;
|
|
9710
9501
|
assertToIsString(to);
|
|
9711
9502
|
assertAddressIsString(address);
|
|
9712
|
-
|
|
9503
|
+
assertSender(sender);
|
|
9713
9504
|
if (Array.isArray(currency)) {
|
|
9714
9505
|
throw new UnsupportedOperationError('Swaps with multiple currencies are not supported.');
|
|
9715
9506
|
}
|
|
9716
|
-
var
|
|
9717
|
-
var routerConfig = convertBuilderConfig(config);
|
|
9718
|
-
var builder = RouterBuilder(routerConfig).from(from).exchange(exchange).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());
|
|
9719
9508
|
if (onStatusChange) {
|
|
9720
|
-
// We cast because router types are bind to specific PAPI types
|
|
9721
|
-
// Will be resolved when we make RouterBuilder generic
|
|
9722
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
9723
9509
|
builder = builder.onStatusChange(onStatusChange);
|
|
9724
9510
|
}
|
|
9725
9511
|
return builder;
|
|
@@ -9758,7 +9544,7 @@ var computeOverridenAmount = function computeOverridenAmount(options, increaseAm
|
|
|
9758
9544
|
api = options.api;
|
|
9759
9545
|
var amount = options.currency.amount;
|
|
9760
9546
|
var config = api.getConfig();
|
|
9761
|
-
if (isConfig(config) && config.abstractDecimals && typeof amount !== 'bigint') {
|
|
9547
|
+
if (!(isConfig(config) && config.abstractDecimals === false) && typeof amount !== 'bigint') {
|
|
9762
9548
|
var base = relative ? Number(amount) : 0;
|
|
9763
9549
|
return Number(increaseAmount) + base;
|
|
9764
9550
|
} else {
|
|
@@ -9820,30 +9606,26 @@ var createTxOverrideAmount = /*#__PURE__*/function () {
|
|
|
9820
9606
|
}();
|
|
9821
9607
|
var createTransferOrSwapAll = /*#__PURE__*/function () {
|
|
9822
9608
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
9823
|
-
var api, from, swapOptions,
|
|
9609
|
+
var api, from, swapOptions, _t, _t2, _t3, _t4;
|
|
9824
9610
|
return _regenerator().w(function (_context3) {
|
|
9825
9611
|
while (1) switch (_context3.n) {
|
|
9826
9612
|
case 0:
|
|
9827
9613
|
api = options.api, from = options.from, swapOptions = options.swapOptions;
|
|
9828
9614
|
if (!swapOptions) {
|
|
9829
|
-
_context3.n =
|
|
9615
|
+
_context3.n = 1;
|
|
9830
9616
|
break;
|
|
9831
9617
|
}
|
|
9832
|
-
_context3.
|
|
9833
|
-
return executeWithRouter(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
9618
|
+
return _context3.a(2, executeWithRouter(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
9834
9619
|
swapOptions: swapOptions
|
|
9835
9620
|
}), function (builder) {
|
|
9836
|
-
return builder.
|
|
9837
|
-
});
|
|
9621
|
+
return builder.build();
|
|
9622
|
+
}));
|
|
9838
9623
|
case 1:
|
|
9839
|
-
transactions = _context3.v;
|
|
9840
|
-
return _context3.a(2, transactions);
|
|
9841
|
-
case 2:
|
|
9842
9624
|
_t = api.getApi();
|
|
9843
9625
|
_t2 = from;
|
|
9844
|
-
_context3.n =
|
|
9626
|
+
_context3.n = 2;
|
|
9845
9627
|
return createTransfer(options);
|
|
9846
|
-
case
|
|
9628
|
+
case 2:
|
|
9847
9629
|
_t3 = _context3.v;
|
|
9848
9630
|
_t4 = {
|
|
9849
9631
|
type: 'TRANSFER',
|
|
@@ -9960,7 +9742,7 @@ var resolveParaId = function resolveParaId(paraId, destination) {
|
|
|
9960
9742
|
|
|
9961
9743
|
var abstractDecimals = function abstractDecimals(amount, decimals, api) {
|
|
9962
9744
|
var config = api.getConfig();
|
|
9963
|
-
var abstractDecimals = isConfig(config) && config.abstractDecimals
|
|
9745
|
+
var abstractDecimals = !(isConfig(config) && config.abstractDecimals === false);
|
|
9964
9746
|
return applyDecimalAbstraction(amount, decimals, abstractDecimals);
|
|
9965
9747
|
};
|
|
9966
9748
|
var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals, shouldAbstract) {
|
|
@@ -10184,11 +9966,11 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, origin,
|
|
|
10184
9966
|
asset = input.assetInfo,
|
|
10185
9967
|
destination = input.destination,
|
|
10186
9968
|
paraIdTo = input.paraIdTo,
|
|
10187
|
-
|
|
9969
|
+
recipient = input.recipient;
|
|
10188
9970
|
var dest = createDestination(version, origin, destination, paraIdTo);
|
|
10189
9971
|
var beneficiary = createBeneficiaryLocation({
|
|
10190
9972
|
api: api,
|
|
10191
|
-
address:
|
|
9973
|
+
address: recipient,
|
|
10192
9974
|
version: version
|
|
10193
9975
|
});
|
|
10194
9976
|
var transformedLocation = localizeLocation(origin, asset.location);
|
|
@@ -10271,7 +10053,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10271
10053
|
var api = options.api,
|
|
10272
10054
|
feeAsset = options.feeAssetInfo,
|
|
10273
10055
|
useJitWithdraw = options.useJitWithdraw,
|
|
10274
|
-
|
|
10056
|
+
recipient = options.recipient,
|
|
10275
10057
|
version = options.version;
|
|
10276
10058
|
var context = prepareExecuteContext(options);
|
|
10277
10059
|
var assetLocalized = context.assetLocalized,
|
|
@@ -10296,7 +10078,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10296
10078
|
}
|
|
10297
10079
|
var beneficiary = createBeneficiaryLocation({
|
|
10298
10080
|
api: api,
|
|
10299
|
-
address:
|
|
10081
|
+
address: recipient,
|
|
10300
10082
|
version: version
|
|
10301
10083
|
});
|
|
10302
10084
|
var depositInstruction = {
|
|
@@ -10313,18 +10095,18 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
10313
10095
|
|
|
10314
10096
|
var createDirectExecuteXcm = /*#__PURE__*/function () {
|
|
10315
10097
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10316
|
-
var api, version, transactOptions, destChain,
|
|
10098
|
+
var api, version, transactOptions, destChain, recipient, _prepareCommonExecute, prefix, depositInstruction, transact, baseXcm, fullXcm, _t;
|
|
10317
10099
|
return _regenerator().w(function (_context) {
|
|
10318
10100
|
while (1) switch (_context.n) {
|
|
10319
10101
|
case 0:
|
|
10320
|
-
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;
|
|
10321
10103
|
_prepareCommonExecute = prepareCommonExecuteXcm(options), prefix = _prepareCommonExecute.prefix, depositInstruction = _prepareCommonExecute.depositInstruction;
|
|
10322
10104
|
if (!(transactOptions !== null && transactOptions !== void 0 && transactOptions.call)) {
|
|
10323
10105
|
_context.n = 2;
|
|
10324
10106
|
break;
|
|
10325
10107
|
}
|
|
10326
10108
|
_context.n = 1;
|
|
10327
|
-
return createTransactInstructions(api, transactOptions, version, destChain,
|
|
10109
|
+
return createTransactInstructions(api, transactOptions, version, destChain, recipient);
|
|
10328
10110
|
case 1:
|
|
10329
10111
|
_t = _context.v;
|
|
10330
10112
|
_context.n = 3;
|
|
@@ -10355,13 +10137,13 @@ var getReserveFeeFromHops = function getReserveFeeFromHops(hops) {
|
|
|
10355
10137
|
var FEE_PADDING_PERCENTAGE$1 = 40;
|
|
10356
10138
|
var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
10357
10139
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10358
|
-
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;
|
|
10359
10141
|
return _regenerator().w(function (_context) {
|
|
10360
10142
|
while (1) switch (_context.n) {
|
|
10361
10143
|
case 0:
|
|
10362
|
-
api = options.api, chain = options.chain,
|
|
10363
|
-
|
|
10364
|
-
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);
|
|
10365
10147
|
checkAmount = function checkAmount(fee) {
|
|
10366
10148
|
if (assetInfo.amount <= fee) throw new AmountTooLowError();
|
|
10367
10149
|
};
|
|
@@ -10376,13 +10158,12 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10376
10158
|
api: api,
|
|
10377
10159
|
chain: chain,
|
|
10378
10160
|
destChain: destChain,
|
|
10379
|
-
address: address,
|
|
10380
10161
|
assetInfo: assetInfo,
|
|
10381
10162
|
currency: currency,
|
|
10382
10163
|
feeAssetInfo: feeAssetInfo,
|
|
10383
10164
|
feeCurrency: feeCurrency,
|
|
10384
|
-
|
|
10385
|
-
|
|
10165
|
+
sender: sender,
|
|
10166
|
+
recipient: recipient,
|
|
10386
10167
|
version: version,
|
|
10387
10168
|
paraIdTo: paraIdTo,
|
|
10388
10169
|
transactOptions: transactOptions
|
|
@@ -10406,8 +10187,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10406
10187
|
tx: api.deserializeExtrinsics(call),
|
|
10407
10188
|
origin: chain,
|
|
10408
10189
|
destination: destChain,
|
|
10409
|
-
|
|
10410
|
-
address: address,
|
|
10190
|
+
sender: sender,
|
|
10411
10191
|
currency: currency,
|
|
10412
10192
|
version: version,
|
|
10413
10193
|
feeAsset: feeCurrency,
|
|
@@ -10465,7 +10245,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
10465
10245
|
needsMultiHop = isMultiHopSwap(exchangeChain, assetInfoFrom, assetInfoTo);
|
|
10466
10246
|
nativeAsset = findAssetInfoOrThrow(exchangeChain, {
|
|
10467
10247
|
symbol: Native(nativeSymbol)
|
|
10468
|
-
}
|
|
10248
|
+
});
|
|
10469
10249
|
if (needsMultiHop) {
|
|
10470
10250
|
_context.n = 1;
|
|
10471
10251
|
break;
|
|
@@ -10506,11 +10286,11 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
10506
10286
|
var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
10507
10287
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
10508
10288
|
var _ref3, _ref4;
|
|
10509
|
-
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;
|
|
10510
10290
|
return _regenerator().w(function (_context2) {
|
|
10511
10291
|
while (1) switch (_context2.n) {
|
|
10512
10292
|
case 0:
|
|
10513
|
-
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;
|
|
10514
10294
|
isEthereumDest = destChain !== undefined && isExternalChain(destChain); // For Ethereum destination, the actual hop target is AssetHub (bridge hub)
|
|
10515
10295
|
resolvedDestChain = isEthereumDest ? "AssetHub".concat(getRelayChainOf(chain !== null && chain !== void 0 ? chain : exchangeChain)) : undefined;
|
|
10516
10296
|
assetFrom = createAsset(version, assetInfoFrom.amount, localizeLocation(exchangeChain, assetInfoFrom.location));
|
|
@@ -10551,7 +10331,7 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
10551
10331
|
assetInfo: assetInfoFrom,
|
|
10552
10332
|
feeAssetInfo: resolvedFeeAssetInfo,
|
|
10553
10333
|
useJitWithdraw: isEthereumDest,
|
|
10554
|
-
|
|
10334
|
+
recipient: recipient,
|
|
10555
10335
|
fees: {
|
|
10556
10336
|
originFee: hasSeparateFeeAsset ? ethBridgeFee || originFee : originFee,
|
|
10557
10337
|
reserveFee: originReserveFee
|
|
@@ -10568,16 +10348,16 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
10568
10348
|
}
|
|
10569
10349
|
ethAsset = findAssetInfoOrThrow('Ethereum', {
|
|
10570
10350
|
symbol: assetInfoTo.symbol
|
|
10571
|
-
}
|
|
10351
|
+
});
|
|
10572
10352
|
_context2.n = 5;
|
|
10573
|
-
return generateMessageId(api,
|
|
10353
|
+
return generateMessageId(api, sender, getParaId(chain !== null && chain !== void 0 ? chain : exchangeChain), ethAsset.assetId, recipient, amountOut);
|
|
10574
10354
|
case 5:
|
|
10575
10355
|
messageId = _context2.v;
|
|
10576
10356
|
snowbridgeInstructions = createEthereumBridgeInstructions({
|
|
10577
10357
|
api: api,
|
|
10578
|
-
|
|
10358
|
+
sender: sender,
|
|
10359
|
+
recipient: recipient,
|
|
10579
10360
|
assetInfo: assetInfoTo,
|
|
10580
|
-
senderAddress: senderAddress,
|
|
10581
10361
|
version: version
|
|
10582
10362
|
}, chain !== null && chain !== void 0 ? chain : exchangeChain, messageId, ethAsset); // If exchange chain is already AssetHub, instructions run directly there
|
|
10583
10363
|
// Otherwise, route from exchange chain to AssetHub with bridge instructions as suffix
|
|
@@ -10800,11 +10580,11 @@ var createXcmAndCall = /*#__PURE__*/function () {
|
|
|
10800
10580
|
}();
|
|
10801
10581
|
var handleSwapExecuteTransfer = /*#__PURE__*/function () {
|
|
10802
10582
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
10803
|
-
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;
|
|
10804
10584
|
return _regenerator().w(function (_context3) {
|
|
10805
10585
|
while (1) switch (_context3.n) {
|
|
10806
10586
|
case 0:
|
|
10807
|
-
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;
|
|
10808
10588
|
_context3.n = 1;
|
|
10809
10589
|
return api.init(chain !== null && chain !== void 0 ? chain : exchangeChain);
|
|
10810
10590
|
case 1:
|
|
@@ -10821,8 +10601,8 @@ var handleSwapExecuteTransfer = /*#__PURE__*/function () {
|
|
|
10821
10601
|
api: api,
|
|
10822
10602
|
origin: chain !== null && chain !== void 0 ? chain : exchangeChain,
|
|
10823
10603
|
destination: destChain !== null && destChain !== void 0 ? destChain : exchangeChain,
|
|
10824
|
-
|
|
10825
|
-
|
|
10604
|
+
sender: sender,
|
|
10605
|
+
recipient: recipient,
|
|
10826
10606
|
version: version,
|
|
10827
10607
|
currency: {
|
|
10828
10608
|
location: assetFrom.location,
|
|
@@ -10939,27 +10719,26 @@ var getLocalTransferAmount = function getLocalTransferAmount(_ref) {
|
|
|
10939
10719
|
var handleToAhTeleport = /*#__PURE__*/function () {
|
|
10940
10720
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(origin, input, defaultTx) {
|
|
10941
10721
|
var _dryRunResult$destina, _feeResult$origin$wei;
|
|
10942
|
-
var api, destination,
|
|
10722
|
+
var api, destination, sender, recipient, asset, currency, version, dryRunResult, dummyTx, feeResult, originExecutionFee, destinationExecutionFee;
|
|
10943
10723
|
return _regenerator().w(function (_context) {
|
|
10944
10724
|
while (1) switch (_context.n) {
|
|
10945
10725
|
case 0:
|
|
10946
|
-
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;
|
|
10947
10727
|
assertToIsString(destination, 'Location destination is not supported for AH teleport.');
|
|
10948
|
-
if (!isTLocation(
|
|
10728
|
+
if (!isTLocation(recipient)) {
|
|
10949
10729
|
_context.n = 1;
|
|
10950
10730
|
break;
|
|
10951
10731
|
}
|
|
10952
10732
|
throw new InvalidAddressError('Location address is not supported for this scenario');
|
|
10953
10733
|
case 1:
|
|
10954
|
-
|
|
10734
|
+
assertSender(sender);
|
|
10955
10735
|
_context.n = 2;
|
|
10956
10736
|
return dryRunInternal({
|
|
10957
10737
|
api: api,
|
|
10958
10738
|
tx: defaultTx,
|
|
10959
10739
|
origin: origin,
|
|
10960
10740
|
destination: destination,
|
|
10961
|
-
|
|
10962
|
-
address: address,
|
|
10741
|
+
sender: sender,
|
|
10963
10742
|
currency: currency,
|
|
10964
10743
|
version: version
|
|
10965
10744
|
});
|
|
@@ -10981,8 +10760,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
10981
10760
|
tx: dummyTx,
|
|
10982
10761
|
origin: origin,
|
|
10983
10762
|
destination: destination,
|
|
10984
|
-
|
|
10985
|
-
|
|
10763
|
+
sender: sender,
|
|
10764
|
+
recipient: recipient,
|
|
10986
10765
|
version: version,
|
|
10987
10766
|
currency: currency,
|
|
10988
10767
|
disableFallback: false,
|
|
@@ -11016,11 +10795,11 @@ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain
|
|
|
11016
10795
|
|
|
11017
10796
|
var handleTransactUsingSend = /*#__PURE__*/function () {
|
|
11018
10797
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11019
|
-
var api, version, chain, destination, destChain,
|
|
10798
|
+
var api, version, chain, destination, destChain, recipient, paraIdTo, asset, transactOptions, dest, transactInstructions, message;
|
|
11020
10799
|
return _regenerator().w(function (_context) {
|
|
11021
10800
|
while (1) switch (_context.n) {
|
|
11022
10801
|
case 0:
|
|
11023
|
-
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;
|
|
11024
10803
|
dest = createDestination(version, chain, destination, paraIdTo);
|
|
11025
10804
|
if (transactOptions !== null && transactOptions !== void 0 && transactOptions.call) {
|
|
11026
10805
|
_context.n = 1;
|
|
@@ -11034,9 +10813,9 @@ var handleTransactUsingSend = /*#__PURE__*/function () {
|
|
|
11034
10813
|
}
|
|
11035
10814
|
throw new UnsupportedOperationError('destChain must be provided when using handleTransactUsingSend');
|
|
11036
10815
|
case 2:
|
|
11037
|
-
assertAddressIsString(
|
|
10816
|
+
assertAddressIsString(recipient);
|
|
11038
10817
|
_context.n = 3;
|
|
11039
|
-
return createTransactInstructions(api, transactOptions, version, destChain,
|
|
10818
|
+
return createTransactInstructions(api, transactOptions, version, destChain, recipient);
|
|
11040
10819
|
case 3:
|
|
11041
10820
|
transactInstructions = _context.v;
|
|
11042
10821
|
message = [{
|
|
@@ -11052,7 +10831,7 @@ var handleTransactUsingSend = /*#__PURE__*/function () {
|
|
|
11052
10831
|
},
|
|
11053
10832
|
beneficiary: createBeneficiaryLocation({
|
|
11054
10833
|
api: api,
|
|
11055
|
-
address:
|
|
10834
|
+
address: recipient,
|
|
11056
10835
|
version: version
|
|
11057
10836
|
})
|
|
11058
10837
|
}
|
|
@@ -11223,7 +11002,7 @@ var buildXTokensCall = function buildXTokensCall(input, currencySelection, fees)
|
|
|
11223
11002
|
origin = input.origin,
|
|
11224
11003
|
destination = input.destination,
|
|
11225
11004
|
overriddenAsset = input.overriddenAsset,
|
|
11226
|
-
|
|
11005
|
+
recipient = input.recipient,
|
|
11227
11006
|
asset = input.asset,
|
|
11228
11007
|
pallet = input.pallet,
|
|
11229
11008
|
version = input.version,
|
|
@@ -11236,7 +11015,7 @@ var buildXTokensCall = function buildXTokensCall(input, currencySelection, fees)
|
|
|
11236
11015
|
api: api,
|
|
11237
11016
|
origin: origin,
|
|
11238
11017
|
destination: destination,
|
|
11239
|
-
|
|
11018
|
+
recipient: recipient,
|
|
11240
11019
|
version: version,
|
|
11241
11020
|
paraId: paraIdTo
|
|
11242
11021
|
});
|
|
@@ -11295,12 +11074,12 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11295
11074
|
}, {
|
|
11296
11075
|
key: "transfer",
|
|
11297
11076
|
value: function () {
|
|
11298
|
-
var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(
|
|
11299
|
-
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;
|
|
11300
11079
|
return _regenerator().w(function (_context) {
|
|
11301
11080
|
while (1) switch (_context.n) {
|
|
11302
11081
|
case 0:
|
|
11303
|
-
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;
|
|
11304
11083
|
scenario = resolveScenario(this.chain, destination);
|
|
11305
11084
|
paraId = resolveParaId(paraIdTo, destination);
|
|
11306
11085
|
destChain = resolveDestChain(this.chain, paraId);
|
|
@@ -11309,7 +11088,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11309
11088
|
_context.n = 1;
|
|
11310
11089
|
break;
|
|
11311
11090
|
}
|
|
11312
|
-
return _context.a(2, this.transferLocal(_objectSpread2(_objectSpread2({},
|
|
11091
|
+
return _context.a(2, this.transferLocal(_objectSpread2(_objectSpread2({}, transferOptions), {}, {
|
|
11313
11092
|
keepAlive: keepAlive !== null && keepAlive !== void 0 ? keepAlive : true
|
|
11314
11093
|
})));
|
|
11315
11094
|
case 1:
|
|
@@ -11319,7 +11098,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11319
11098
|
}
|
|
11320
11099
|
throw new UnsupportedOperationError('Keep alive option is not yet supported for XCM transfers.');
|
|
11321
11100
|
case 2:
|
|
11322
|
-
this.throwIfTempDisabled(
|
|
11101
|
+
this.throwIfTempDisabled(transferOptions, destChain);
|
|
11323
11102
|
this.throwIfCantReceive(destChain);
|
|
11324
11103
|
isRelayAsset = deepEqual(asset.location, RELAY_LOCATION) && isSymbolMatch(getRelayChainSymbol(this.chain), asset.symbol);
|
|
11325
11104
|
mythAsset = findNativeAssetInfoOrThrow('Mythos');
|
|
@@ -11346,10 +11125,11 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11346
11125
|
chain: this.chain,
|
|
11347
11126
|
beneficiaryLocation: createBeneficiaryLocation({
|
|
11348
11127
|
api: api,
|
|
11349
|
-
address:
|
|
11128
|
+
address: recipient,
|
|
11350
11129
|
version: version
|
|
11351
11130
|
}),
|
|
11352
|
-
|
|
11131
|
+
sender: sender,
|
|
11132
|
+
recipient: recipient,
|
|
11353
11133
|
asset: this.createAsset(asset, version),
|
|
11354
11134
|
overriddenAsset: overriddenAsset,
|
|
11355
11135
|
assetInfo: asset,
|
|
@@ -11361,7 +11141,6 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11361
11141
|
destChain: destChain,
|
|
11362
11142
|
paraIdTo: paraId,
|
|
11363
11143
|
version: version,
|
|
11364
|
-
senderAddress: senderAddress,
|
|
11365
11144
|
ahAddress: ahAddress,
|
|
11366
11145
|
pallet: pallet,
|
|
11367
11146
|
method: method,
|
|
@@ -11385,7 +11164,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11385
11164
|
case 6:
|
|
11386
11165
|
return _context.a(2, _t.deserializeExtrinsics.call(_t, _context.v));
|
|
11387
11166
|
case 7:
|
|
11388
|
-
shouldUseTeleport = this.shouldUseNativeAssetTeleport(
|
|
11167
|
+
shouldUseTeleport = this.shouldUseNativeAssetTeleport(transferOptions);
|
|
11389
11168
|
isAhToOtherPara = this.chain.startsWith('AssetHub') && destChain && !isTrustedChain(destChain);
|
|
11390
11169
|
isOtherParaToAh = (destChain === null || destChain === void 0 ? void 0 : destChain.startsWith('AssetHub')) && !isTrustedChain(this.chain);
|
|
11391
11170
|
isAllowedAhTransfer = function isAllowedAhTransfer(chain) {
|
|
@@ -11440,7 +11219,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11440
11219
|
input = {
|
|
11441
11220
|
api: api,
|
|
11442
11221
|
asset: asset,
|
|
11443
|
-
|
|
11222
|
+
recipient: recipient,
|
|
11444
11223
|
origin: this.chain,
|
|
11445
11224
|
scenario: scenario,
|
|
11446
11225
|
paraIdTo: paraId,
|
|
@@ -11534,7 +11313,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11534
11313
|
var assetHubChain = "AssetHub".concat(getRelayChainOf(this.chain));
|
|
11535
11314
|
var isRegisteredOnAh = findAssetInfo(assetHubChain, {
|
|
11536
11315
|
location: asset.location
|
|
11537
|
-
}
|
|
11316
|
+
});
|
|
11538
11317
|
return Boolean(isNativeAsset) && Boolean(isRegisteredOnAh) && (isAHPOrigin || isAHPDest);
|
|
11539
11318
|
}
|
|
11540
11319
|
}, {
|
|
@@ -11553,12 +11332,12 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11553
11332
|
key: "transferLocal",
|
|
11554
11333
|
value: function () {
|
|
11555
11334
|
var _transferLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
11556
|
-
var api, asset, feeAsset,
|
|
11335
|
+
var api, asset, feeAsset, recipient, sender, isAmountAll, validatedOptions, isNativeAsset, balance, localOptions;
|
|
11557
11336
|
return _regenerator().w(function (_context2) {
|
|
11558
11337
|
while (1) switch (_context2.n) {
|
|
11559
11338
|
case 0:
|
|
11560
|
-
api = options.api, asset = options.assetInfo, feeAsset = options.feeAsset,
|
|
11561
|
-
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)) {
|
|
11562
11341
|
_context2.n = 1;
|
|
11563
11342
|
break;
|
|
11564
11343
|
}
|
|
@@ -11571,19 +11350,19 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11571
11350
|
throw new UnsupportedOperationError('Fee asset is not supported for local transfers');
|
|
11572
11351
|
case 2:
|
|
11573
11352
|
validatedOptions = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
11574
|
-
|
|
11353
|
+
recipient: recipient
|
|
11575
11354
|
});
|
|
11576
11355
|
isNativeAsset = asset.symbol === this.getNativeAssetSymbol() && asset.isNative;
|
|
11577
11356
|
if (!isAmountAll) {
|
|
11578
11357
|
_context2.n = 4;
|
|
11579
11358
|
break;
|
|
11580
11359
|
}
|
|
11581
|
-
|
|
11360
|
+
assertSender(sender);
|
|
11582
11361
|
_context2.n = 3;
|
|
11583
11362
|
return getAssetBalanceInternal({
|
|
11584
11363
|
api: api,
|
|
11585
11364
|
chain: this.chain,
|
|
11586
|
-
address:
|
|
11365
|
+
address: sender,
|
|
11587
11366
|
asset: asset
|
|
11588
11367
|
});
|
|
11589
11368
|
case 3:
|
|
@@ -11618,11 +11397,11 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11618
11397
|
value: function transferLocalNativeAsset(options) {
|
|
11619
11398
|
var api = options.api,
|
|
11620
11399
|
asset = options.assetInfo,
|
|
11621
|
-
|
|
11400
|
+
recipient = options.recipient,
|
|
11622
11401
|
isAmountAll = options.isAmountAll,
|
|
11623
11402
|
keepAlive = options.keepAlive;
|
|
11624
|
-
var dest = isChainEvm(this.chain) ?
|
|
11625
|
-
Id:
|
|
11403
|
+
var dest = isChainEvm(this.chain) ? recipient : {
|
|
11404
|
+
Id: recipient
|
|
11626
11405
|
};
|
|
11627
11406
|
if (isAmountAll) {
|
|
11628
11407
|
return Promise.resolve(api.deserializeExtrinsics({
|
|
@@ -11648,12 +11427,12 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11648
11427
|
value: function transferLocalNonNativeAsset(options) {
|
|
11649
11428
|
var api = options.api,
|
|
11650
11429
|
asset = options.assetInfo,
|
|
11651
|
-
|
|
11430
|
+
recipient = options.recipient,
|
|
11652
11431
|
isAmountAll = options.isAmountAll,
|
|
11653
11432
|
keepAlive = options.keepAlive;
|
|
11654
11433
|
assertHasId(asset);
|
|
11655
11434
|
var dest = {
|
|
11656
|
-
Id:
|
|
11435
|
+
Id: recipient
|
|
11657
11436
|
};
|
|
11658
11437
|
var currencyId = BigInt(asset.assetId);
|
|
11659
11438
|
if (isAmountAll) {
|
|
@@ -11686,8 +11465,8 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11686
11465
|
api,
|
|
11687
11466
|
asset,
|
|
11688
11467
|
version,
|
|
11689
|
-
|
|
11690
|
-
|
|
11468
|
+
sender,
|
|
11469
|
+
recipient,
|
|
11691
11470
|
feeAsset,
|
|
11692
11471
|
bridgeStatus,
|
|
11693
11472
|
ethAsset,
|
|
@@ -11710,7 +11489,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11710
11489
|
while (1) switch (_context3.n) {
|
|
11711
11490
|
case 0:
|
|
11712
11491
|
useOnlyDepositInstruction = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
|
11713
|
-
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;
|
|
11714
11493
|
_context3.n = 1;
|
|
11715
11494
|
return getBridgeStatus(api.clone());
|
|
11716
11495
|
case 1:
|
|
@@ -11721,8 +11500,8 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11721
11500
|
}
|
|
11722
11501
|
throw new BridgeHaltedError();
|
|
11723
11502
|
case 2:
|
|
11724
|
-
assertAddressIsString(
|
|
11725
|
-
|
|
11503
|
+
assertAddressIsString(recipient);
|
|
11504
|
+
assertSender(sender);
|
|
11726
11505
|
ethAsset = createAsset(version, asset.amount, asset.location);
|
|
11727
11506
|
_context3.n = 3;
|
|
11728
11507
|
return api.createApiForChain('AssetHubPolkadot');
|
|
@@ -11739,7 +11518,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11739
11518
|
fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
|
|
11740
11519
|
ethAssetInfo = findAssetInfoOrThrow('Ethereum', {
|
|
11741
11520
|
symbol: asset.symbol
|
|
11742
|
-
}
|
|
11521
|
+
});
|
|
11743
11522
|
systemAssetInfo = findNativeAssetInfoOrThrow(getRelayChainOf(this.chain));
|
|
11744
11523
|
shouldIncludeFeeAsset = feeAsset && !isAssetEqual(feeAsset, asset) || !isAssetEqual(asset, systemAssetInfo);
|
|
11745
11524
|
if (!useOnlyDepositInstruction) {
|
|
@@ -11755,7 +11534,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11755
11534
|
},
|
|
11756
11535
|
beneficiary: createBeneficiaryLocation({
|
|
11757
11536
|
api: api,
|
|
11758
|
-
address:
|
|
11537
|
+
address: recipient,
|
|
11759
11538
|
version: version
|
|
11760
11539
|
})
|
|
11761
11540
|
}
|
|
@@ -11765,7 +11544,7 @@ var Chain = /*#__PURE__*/function () {
|
|
|
11765
11544
|
case 5:
|
|
11766
11545
|
assertHasId(ethAssetInfo);
|
|
11767
11546
|
_context3.n = 6;
|
|
11768
|
-
return generateMessageId(api,
|
|
11547
|
+
return generateMessageId(api, sender, getParaId(this.chain), ethAssetInfo.assetId, recipient, asset.amount);
|
|
11769
11548
|
case 6:
|
|
11770
11549
|
messageId = _context3.v;
|
|
11771
11550
|
customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId, ethAssetInfo);
|
|
@@ -11899,18 +11678,18 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11899
11678
|
key: "transferLocalNativeAsset",
|
|
11900
11679
|
value: function () {
|
|
11901
11680
|
var _transferLocalNativeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
11902
|
-
var api,
|
|
11681
|
+
var api, recipient, sender, isAmountAll, keepAlive, createTx, fee, _yield$api$getPayment, partialFee, amount;
|
|
11903
11682
|
return _regenerator().w(function (_context) {
|
|
11904
11683
|
while (1) switch (_context.n) {
|
|
11905
11684
|
case 0:
|
|
11906
|
-
api = options.api,
|
|
11685
|
+
api = options.api, recipient = options.recipient, sender = options.sender, isAmountAll = options.isAmountAll, keepAlive = options.keepAlive;
|
|
11907
11686
|
createTx = function createTx(amount) {
|
|
11908
11687
|
return api.deserializeExtrinsics({
|
|
11909
11688
|
module: 'Currencies',
|
|
11910
11689
|
method: 'transfer_native_currency',
|
|
11911
11690
|
params: {
|
|
11912
11691
|
dest: {
|
|
11913
|
-
Id:
|
|
11692
|
+
Id: recipient
|
|
11914
11693
|
},
|
|
11915
11694
|
amount: amount
|
|
11916
11695
|
}
|
|
@@ -11921,9 +11700,9 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11921
11700
|
_context.n = 2;
|
|
11922
11701
|
break;
|
|
11923
11702
|
}
|
|
11924
|
-
|
|
11703
|
+
assertSender(sender);
|
|
11925
11704
|
_context.n = 1;
|
|
11926
|
-
return api.getPaymentInfo(createTx(MIN_AMOUNT),
|
|
11705
|
+
return api.getPaymentInfo(createTx(MIN_AMOUNT), sender);
|
|
11927
11706
|
case 1:
|
|
11928
11707
|
_yield$api$getPayment = _context.v;
|
|
11929
11708
|
partialFee = _yield$api$getPayment.partialFee;
|
|
@@ -11944,7 +11723,7 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11944
11723
|
value: function transferLocalNonNativeAsset(options) {
|
|
11945
11724
|
var api = options.api,
|
|
11946
11725
|
asset = options.assetInfo,
|
|
11947
|
-
|
|
11726
|
+
recipient = options.recipient;
|
|
11948
11727
|
if (asset.symbol.toLowerCase() === 'lcdot') {
|
|
11949
11728
|
throw new InvalidCurrencyError('LcDOT local transfers are not supported');
|
|
11950
11729
|
}
|
|
@@ -11954,7 +11733,7 @@ var Acala = /*#__PURE__*/function (_Chain) {
|
|
|
11954
11733
|
method: 'transfer',
|
|
11955
11734
|
params: {
|
|
11956
11735
|
dest: {
|
|
11957
|
-
Id:
|
|
11736
|
+
Id: recipient
|
|
11958
11737
|
},
|
|
11959
11738
|
currency_id: this.getCustomCurrencyId(asset),
|
|
11960
11739
|
amount: amount
|
|
@@ -12007,13 +11786,13 @@ var Ajuna = /*#__PURE__*/function (_Chain) {
|
|
|
12007
11786
|
value: function transferLocalNonNativeAsset(options) {
|
|
12008
11787
|
var api = options.api,
|
|
12009
11788
|
asset = options.assetInfo,
|
|
12010
|
-
|
|
11789
|
+
recipient = options.recipient,
|
|
12011
11790
|
isAmountAll = options.isAmountAll,
|
|
12012
11791
|
keepAlive = options.keepAlive;
|
|
12013
11792
|
assertHasId(asset);
|
|
12014
11793
|
var assetId = Number(asset.assetId);
|
|
12015
11794
|
var dest = {
|
|
12016
|
-
Id:
|
|
11795
|
+
Id: recipient
|
|
12017
11796
|
};
|
|
12018
11797
|
if (isAmountAll) {
|
|
12019
11798
|
return api.deserializeExtrinsics({
|
|
@@ -12091,14 +11870,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12091
11870
|
key: "handleEthBridgeNativeTransfer",
|
|
12092
11871
|
value: function () {
|
|
12093
11872
|
var _handleEthBridgeNativeTransfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
|
|
12094
|
-
var api, version, destination,
|
|
11873
|
+
var api, version, destination, sender, recipient, paraIdTo, asset, messageId, location, call;
|
|
12095
11874
|
return _regenerator().w(function (_context) {
|
|
12096
11875
|
while (1) switch (_context.n) {
|
|
12097
11876
|
case 0:
|
|
12098
|
-
api = input.api, version = input.version, destination = input.destination,
|
|
12099
|
-
|
|
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);
|
|
12100
11879
|
_context.n = 1;
|
|
12101
|
-
return generateMessageId(api,
|
|
11880
|
+
return generateMessageId(api, sender, getParaId(this.chain), JSON.stringify(asset.location), JSON.stringify(recipient), asset.amount);
|
|
12102
11881
|
case 1:
|
|
12103
11882
|
messageId = _context.v;
|
|
12104
11883
|
location = asset.symbol === this.getNativeAssetSymbol() ? DOT_LOCATION : asset.location;
|
|
@@ -12120,7 +11899,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12120
11899
|
},
|
|
12121
11900
|
beneficiary: createBeneficiaryLocation({
|
|
12122
11901
|
api: api,
|
|
12123
|
-
address:
|
|
11902
|
+
address: recipient,
|
|
12124
11903
|
version: version
|
|
12125
11904
|
})
|
|
12126
11905
|
}
|
|
@@ -12190,13 +11969,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12190
11969
|
value: function transferLocalNonNativeAsset(options) {
|
|
12191
11970
|
var api = options.api,
|
|
12192
11971
|
asset = options.assetInfo,
|
|
12193
|
-
|
|
11972
|
+
recipient = options.recipient,
|
|
12194
11973
|
isAmountAll = options.isAmountAll,
|
|
12195
11974
|
keepAlive = options.keepAlive;
|
|
12196
11975
|
if (asset.assetId !== undefined) {
|
|
12197
11976
|
var assetId = Number(asset.assetId);
|
|
12198
11977
|
var dest = {
|
|
12199
|
-
Id:
|
|
11978
|
+
Id: recipient
|
|
12200
11979
|
};
|
|
12201
11980
|
if (isAmountAll) {
|
|
12202
11981
|
return api.deserializeExtrinsics({
|
|
@@ -12226,7 +12005,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12226
12005
|
params: {
|
|
12227
12006
|
id: asset.location,
|
|
12228
12007
|
dest: {
|
|
12229
|
-
Id:
|
|
12008
|
+
Id: recipient
|
|
12230
12009
|
},
|
|
12231
12010
|
keep_alive: keepAlive
|
|
12232
12011
|
}
|
|
@@ -12238,7 +12017,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12238
12017
|
params: {
|
|
12239
12018
|
id: asset.location,
|
|
12240
12019
|
target: {
|
|
12241
|
-
Id:
|
|
12020
|
+
Id: recipient
|
|
12242
12021
|
},
|
|
12243
12022
|
amount: asset.amount
|
|
12244
12023
|
}
|
|
@@ -12300,13 +12079,13 @@ var Astar = /*#__PURE__*/function (_Chain) {
|
|
|
12300
12079
|
value: function transferLocalNonNativeAsset(options) {
|
|
12301
12080
|
var api = options.api,
|
|
12302
12081
|
asset = options.assetInfo,
|
|
12303
|
-
|
|
12082
|
+
recipient = options.recipient,
|
|
12304
12083
|
isAmountAll = options.isAmountAll,
|
|
12305
12084
|
keepAlive = options.keepAlive;
|
|
12306
12085
|
assertHasId(asset);
|
|
12307
12086
|
var assetId = Number(asset.assetId);
|
|
12308
12087
|
var dest = {
|
|
12309
|
-
Id:
|
|
12088
|
+
Id: recipient
|
|
12310
12089
|
};
|
|
12311
12090
|
if (isAmountAll) {
|
|
12312
12091
|
return api.deserializeExtrinsics({
|
|
@@ -12415,7 +12194,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12415
12194
|
value: function transferLocalNativeAsset(options) {
|
|
12416
12195
|
var api = options.api,
|
|
12417
12196
|
asset = options.assetInfo,
|
|
12418
|
-
|
|
12197
|
+
recipient = options.recipient,
|
|
12419
12198
|
isAmountAll = options.isAmountAll,
|
|
12420
12199
|
keepAlive = options.keepAlive;
|
|
12421
12200
|
if (isAmountAll) {
|
|
@@ -12423,7 +12202,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12423
12202
|
module: 'Balances',
|
|
12424
12203
|
method: 'transfer_all',
|
|
12425
12204
|
params: {
|
|
12426
|
-
dest:
|
|
12205
|
+
dest: recipient,
|
|
12427
12206
|
keep_alive: keepAlive
|
|
12428
12207
|
}
|
|
12429
12208
|
}));
|
|
@@ -12432,7 +12211,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12432
12211
|
module: 'Balances',
|
|
12433
12212
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer_allow_death',
|
|
12434
12213
|
params: {
|
|
12435
|
-
dest:
|
|
12214
|
+
dest: recipient,
|
|
12436
12215
|
value: asset.amount
|
|
12437
12216
|
}
|
|
12438
12217
|
}));
|
|
@@ -12442,7 +12221,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12442
12221
|
value: function transferLocalNonNativeAsset(options) {
|
|
12443
12222
|
var api = options.api,
|
|
12444
12223
|
asset = options.assetInfo,
|
|
12445
|
-
|
|
12224
|
+
recipient = options.recipient,
|
|
12446
12225
|
isAmountAll = options.isAmountAll,
|
|
12447
12226
|
keepAlive = options.keepAlive;
|
|
12448
12227
|
assertHasId(asset);
|
|
@@ -12452,7 +12231,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12452
12231
|
module: 'Tokens',
|
|
12453
12232
|
method: 'transfer_all',
|
|
12454
12233
|
params: {
|
|
12455
|
-
dest:
|
|
12234
|
+
dest: recipient,
|
|
12456
12235
|
currency_id: currencyId,
|
|
12457
12236
|
keep_alive: keepAlive
|
|
12458
12237
|
}
|
|
@@ -12462,7 +12241,7 @@ var Hydration = /*#__PURE__*/function (_Chain) {
|
|
|
12462
12241
|
module: 'Tokens',
|
|
12463
12242
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
12464
12243
|
params: {
|
|
12465
|
-
dest:
|
|
12244
|
+
dest: recipient,
|
|
12466
12245
|
currency_id: currencyId,
|
|
12467
12246
|
amount: asset.amount
|
|
12468
12247
|
}
|
|
@@ -12539,11 +12318,11 @@ var BifrostPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
12539
12318
|
value: function transferLocalNonNativeAsset(options) {
|
|
12540
12319
|
var api = options.api,
|
|
12541
12320
|
asset = options.assetInfo,
|
|
12542
|
-
|
|
12321
|
+
recipient = options.recipient,
|
|
12543
12322
|
isAmountAll = options.isAmountAll,
|
|
12544
12323
|
keepAlive = options.keepAlive;
|
|
12545
12324
|
var dest = {
|
|
12546
|
-
Id:
|
|
12325
|
+
Id: recipient
|
|
12547
12326
|
};
|
|
12548
12327
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
12549
12328
|
if (isAmountAll) {
|
|
@@ -12674,11 +12453,11 @@ var Centrifuge = /*#__PURE__*/function (_Chain) {
|
|
|
12674
12453
|
value: function transferLocalNonNativeAsset(options) {
|
|
12675
12454
|
var api = options.api,
|
|
12676
12455
|
asset = options.assetInfo,
|
|
12677
|
-
|
|
12456
|
+
recipient = options.recipient,
|
|
12678
12457
|
isAmountAll = options.isAmountAll,
|
|
12679
12458
|
keepAlive = options.keepAlive;
|
|
12680
12459
|
var dest = {
|
|
12681
|
-
Id:
|
|
12460
|
+
Id: recipient
|
|
12682
12461
|
};
|
|
12683
12462
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
12684
12463
|
if (isAmountAll) {
|
|
@@ -12861,13 +12640,13 @@ var Crust = /*#__PURE__*/function (_Chain) {
|
|
|
12861
12640
|
value: function transferLocalNonNativeAsset(options) {
|
|
12862
12641
|
var api = options.api,
|
|
12863
12642
|
asset = options.assetInfo,
|
|
12864
|
-
|
|
12643
|
+
recipient = options.recipient,
|
|
12865
12644
|
isAmountAll = options.isAmountAll,
|
|
12866
12645
|
keepAlive = options.keepAlive;
|
|
12867
12646
|
assertHasId(asset);
|
|
12868
12647
|
var assetId = BigInt(asset.assetId);
|
|
12869
12648
|
var dest = {
|
|
12870
|
-
Id:
|
|
12649
|
+
Id: recipient
|
|
12871
12650
|
};
|
|
12872
12651
|
if (isAmountAll) {
|
|
12873
12652
|
return api.deserializeExtrinsics({
|
|
@@ -12949,7 +12728,7 @@ var Darwinia = /*#__PURE__*/function (_Chain) {
|
|
|
12949
12728
|
value: function transferLocalNonNativeAsset(options) {
|
|
12950
12729
|
var api = options.api,
|
|
12951
12730
|
asset = options.assetInfo,
|
|
12952
|
-
|
|
12731
|
+
recipient = options.recipient,
|
|
12953
12732
|
isAmountAll = options.isAmountAll,
|
|
12954
12733
|
keepAlive = options.keepAlive;
|
|
12955
12734
|
assertHasId(asset);
|
|
@@ -12960,7 +12739,7 @@ var Darwinia = /*#__PURE__*/function (_Chain) {
|
|
|
12960
12739
|
method: 'transfer_all',
|
|
12961
12740
|
params: {
|
|
12962
12741
|
id: assetId,
|
|
12963
|
-
dest:
|
|
12742
|
+
dest: recipient,
|
|
12964
12743
|
keep_alive: keepAlive
|
|
12965
12744
|
}
|
|
12966
12745
|
});
|
|
@@ -12970,7 +12749,7 @@ var Darwinia = /*#__PURE__*/function (_Chain) {
|
|
|
12970
12749
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
12971
12750
|
params: {
|
|
12972
12751
|
id: assetId,
|
|
12973
|
-
target:
|
|
12752
|
+
target: recipient,
|
|
12974
12753
|
amount: asset.amount
|
|
12975
12754
|
}
|
|
12976
12755
|
});
|
|
@@ -13143,7 +12922,7 @@ var Interlay = /*#__PURE__*/function (_Chain) {
|
|
|
13143
12922
|
value: function transferLocalNonNativeAsset(options) {
|
|
13144
12923
|
var api = options.api,
|
|
13145
12924
|
asset = options.assetInfo,
|
|
13146
|
-
|
|
12925
|
+
recipient = options.recipient,
|
|
13147
12926
|
isAmountAll = options.isAmountAll,
|
|
13148
12927
|
keepAlive = options.keepAlive;
|
|
13149
12928
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
@@ -13152,7 +12931,7 @@ var Interlay = /*#__PURE__*/function (_Chain) {
|
|
|
13152
12931
|
module: 'Tokens',
|
|
13153
12932
|
method: 'transfer_all',
|
|
13154
12933
|
params: {
|
|
13155
|
-
dest:
|
|
12934
|
+
dest: recipient,
|
|
13156
12935
|
currency_id: currencyId,
|
|
13157
12936
|
keep_alive: keepAlive
|
|
13158
12937
|
}
|
|
@@ -13162,7 +12941,7 @@ var Interlay = /*#__PURE__*/function (_Chain) {
|
|
|
13162
12941
|
module: 'Tokens',
|
|
13163
12942
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
13164
12943
|
params: {
|
|
13165
|
-
dest:
|
|
12944
|
+
dest: recipient,
|
|
13166
12945
|
currency_id: currencyId,
|
|
13167
12946
|
value: asset.amount
|
|
13168
12947
|
}
|
|
@@ -13206,7 +12985,7 @@ var Jamton = /*#__PURE__*/function (_Chain) {
|
|
|
13206
12985
|
if (isSymbolMatch(assetInfo.symbol, 'WUD')) {
|
|
13207
12986
|
var usdt = findAssetInfoOrThrow(this.chain, {
|
|
13208
12987
|
symbol: 'USDt'
|
|
13209
|
-
}
|
|
12988
|
+
});
|
|
13210
12989
|
var MIN_USDT_AMOUNT = 180000n; // 0.18 USDt
|
|
13211
12990
|
return transferPolkadotXcm(_objectSpread2(_objectSpread2({}, input), {}, {
|
|
13212
12991
|
overriddenAsset: [_objectSpread2(_objectSpread2({}, createAsset(version, MIN_USDT_AMOUNT, usdt.location)), {}, {
|
|
@@ -13260,7 +13039,7 @@ var Kintsugi = /*#__PURE__*/function (_Chain) {
|
|
|
13260
13039
|
value: function transferLocalNonNativeAsset(options) {
|
|
13261
13040
|
var api = options.api,
|
|
13262
13041
|
asset = options.assetInfo,
|
|
13263
|
-
|
|
13042
|
+
recipient = options.recipient,
|
|
13264
13043
|
isAmountAll = options.isAmountAll,
|
|
13265
13044
|
keepAlive = options.keepAlive;
|
|
13266
13045
|
var currencyId = this.getCustomCurrencyId(asset);
|
|
@@ -13269,7 +13048,7 @@ var Kintsugi = /*#__PURE__*/function (_Chain) {
|
|
|
13269
13048
|
module: 'Tokens',
|
|
13270
13049
|
method: 'transfer_all',
|
|
13271
13050
|
params: {
|
|
13272
|
-
dest:
|
|
13051
|
+
dest: recipient,
|
|
13273
13052
|
currency_id: currencyId,
|
|
13274
13053
|
keep_alive: keepAlive
|
|
13275
13054
|
}
|
|
@@ -13279,7 +13058,7 @@ var Kintsugi = /*#__PURE__*/function (_Chain) {
|
|
|
13279
13058
|
module: 'Tokens',
|
|
13280
13059
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
13281
13060
|
params: {
|
|
13282
|
-
dest:
|
|
13061
|
+
dest: recipient,
|
|
13283
13062
|
currency_id: currencyId,
|
|
13284
13063
|
value: asset.amount
|
|
13285
13064
|
}
|
|
@@ -13394,7 +13173,7 @@ var Manta = /*#__PURE__*/function (_Chain) {
|
|
|
13394
13173
|
value: function transferLocalNonNativeAsset(options) {
|
|
13395
13174
|
var api = options.api,
|
|
13396
13175
|
asset = options.assetInfo,
|
|
13397
|
-
|
|
13176
|
+
recipient = options.recipient,
|
|
13398
13177
|
balance = options.balance,
|
|
13399
13178
|
isAmountAll = options.isAmountAll,
|
|
13400
13179
|
keepAlive = options.keepAlive;
|
|
@@ -13407,7 +13186,7 @@ var Manta = /*#__PURE__*/function (_Chain) {
|
|
|
13407
13186
|
params: {
|
|
13408
13187
|
id: assetId,
|
|
13409
13188
|
target: {
|
|
13410
|
-
Id:
|
|
13189
|
+
Id: recipient
|
|
13411
13190
|
},
|
|
13412
13191
|
amount: amount
|
|
13413
13192
|
}
|
|
@@ -13486,19 +13265,19 @@ var Moonriver = /*#__PURE__*/function (_Chain) {
|
|
|
13486
13265
|
|
|
13487
13266
|
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
13488
13267
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, chain, version) {
|
|
13489
|
-
var api, asset,
|
|
13268
|
+
var api, asset, sender, recipient, ethAsset, messageId, nativeMythAmount, hopDestination;
|
|
13490
13269
|
return _regenerator().w(function (_context) {
|
|
13491
13270
|
while (1) switch (_context.n) {
|
|
13492
13271
|
case 0:
|
|
13493
|
-
api = options.api, asset = options.assetInfo,
|
|
13272
|
+
api = options.api, asset = options.assetInfo, sender = options.sender, recipient = options.recipient;
|
|
13494
13273
|
ethAsset = findAssetInfoOrThrow('Ethereum', {
|
|
13495
13274
|
symbol: asset.symbol
|
|
13496
|
-
}
|
|
13275
|
+
});
|
|
13497
13276
|
assertHasId(ethAsset);
|
|
13498
|
-
assertAddressIsString(
|
|
13499
|
-
|
|
13277
|
+
assertAddressIsString(recipient);
|
|
13278
|
+
assertSender(sender);
|
|
13500
13279
|
_context.n = 1;
|
|
13501
|
-
return generateMessageId(api,
|
|
13280
|
+
return generateMessageId(api, sender, getParaId(chain), ethAsset.assetId, recipient, asset.amount);
|
|
13502
13281
|
case 1:
|
|
13503
13282
|
messageId = _context.v;
|
|
13504
13283
|
_context.n = 2;
|
|
@@ -13613,7 +13392,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13613
13392
|
value: function transferLocalNativeAsset(options) {
|
|
13614
13393
|
var api = options.api,
|
|
13615
13394
|
asset = options.assetInfo,
|
|
13616
|
-
|
|
13395
|
+
recipient = options.recipient,
|
|
13617
13396
|
isAmountAll = options.isAmountAll,
|
|
13618
13397
|
keepAlive = options.keepAlive;
|
|
13619
13398
|
if (isAmountAll) {
|
|
@@ -13621,7 +13400,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13621
13400
|
module: 'Balances',
|
|
13622
13401
|
method: 'transfer_all',
|
|
13623
13402
|
params: {
|
|
13624
|
-
dest:
|
|
13403
|
+
dest: recipient,
|
|
13625
13404
|
keep_alive: keepAlive
|
|
13626
13405
|
}
|
|
13627
13406
|
}));
|
|
@@ -13630,7 +13409,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13630
13409
|
module: 'Balances',
|
|
13631
13410
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer_allow_death',
|
|
13632
13411
|
params: {
|
|
13633
|
-
dest:
|
|
13412
|
+
dest: recipient,
|
|
13634
13413
|
value: asset.amount
|
|
13635
13414
|
}
|
|
13636
13415
|
}));
|
|
@@ -13640,7 +13419,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13640
13419
|
value: function transferLocalNonNativeAsset(options) {
|
|
13641
13420
|
var api = options.api,
|
|
13642
13421
|
asset = options.assetInfo,
|
|
13643
|
-
|
|
13422
|
+
recipient = options.recipient,
|
|
13644
13423
|
balance = options.balance,
|
|
13645
13424
|
isAmountAll = options.isAmountAll,
|
|
13646
13425
|
keepAlive = options.keepAlive;
|
|
@@ -13652,7 +13431,7 @@ var NeuroWeb = /*#__PURE__*/function (_Chain) {
|
|
|
13652
13431
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
13653
13432
|
params: {
|
|
13654
13433
|
id: assetId,
|
|
13655
|
-
target:
|
|
13434
|
+
target: recipient,
|
|
13656
13435
|
amount: amount
|
|
13657
13436
|
}
|
|
13658
13437
|
});
|
|
@@ -13708,13 +13487,13 @@ var Peaq = /*#__PURE__*/function (_Chain) {
|
|
|
13708
13487
|
value: function transferLocalNonNativeAsset(options) {
|
|
13709
13488
|
var api = options.api,
|
|
13710
13489
|
asset = options.assetInfo,
|
|
13711
|
-
|
|
13490
|
+
recipient = options.recipient,
|
|
13712
13491
|
isAmountAll = options.isAmountAll,
|
|
13713
13492
|
keepAlive = options.keepAlive;
|
|
13714
13493
|
assertHasId(asset);
|
|
13715
13494
|
var assetId = BigInt(asset.assetId);
|
|
13716
13495
|
var dest = {
|
|
13717
|
-
Id:
|
|
13496
|
+
Id: recipient
|
|
13718
13497
|
};
|
|
13719
13498
|
if (isAmountAll) {
|
|
13720
13499
|
return api.deserializeExtrinsics({
|
|
@@ -13880,13 +13659,13 @@ var RobonomicsPolkadot = /*#__PURE__*/function (_Chain) {
|
|
|
13880
13659
|
value: function transferLocalNonNativeAsset(options) {
|
|
13881
13660
|
var api = options.api,
|
|
13882
13661
|
asset = options.assetInfo,
|
|
13883
|
-
|
|
13662
|
+
recipient = options.recipient,
|
|
13884
13663
|
isAmountAll = options.isAmountAll,
|
|
13885
13664
|
keepAlive = options.keepAlive;
|
|
13886
13665
|
assertHasId(asset);
|
|
13887
13666
|
var assetId = BigInt(asset.assetId);
|
|
13888
13667
|
var dest = {
|
|
13889
|
-
Id:
|
|
13668
|
+
Id: recipient
|
|
13890
13669
|
};
|
|
13891
13670
|
if (isAmountAll) {
|
|
13892
13671
|
return api.deserializeExtrinsics({
|
|
@@ -14044,7 +13823,7 @@ var Zeitgeist = /*#__PURE__*/function (_Chain) {
|
|
|
14044
13823
|
value: function transferLocalNonNativeAsset(options) {
|
|
14045
13824
|
var api = options.api,
|
|
14046
13825
|
asset = options.assetInfo,
|
|
14047
|
-
|
|
13826
|
+
recipient = options.recipient;
|
|
14048
13827
|
assertHasId(asset);
|
|
14049
13828
|
var amount = getLocalTransferAmount(options);
|
|
14050
13829
|
return api.deserializeExtrinsics({
|
|
@@ -14052,7 +13831,7 @@ var Zeitgeist = /*#__PURE__*/function (_Chain) {
|
|
|
14052
13831
|
method: 'transfer',
|
|
14053
13832
|
params: {
|
|
14054
13833
|
dest: {
|
|
14055
|
-
Id:
|
|
13834
|
+
Id: recipient
|
|
14056
13835
|
},
|
|
14057
13836
|
currency_id: this.getCustomCurrencyId(asset),
|
|
14058
13837
|
amount: amount
|
|
@@ -14392,4 +14171,4 @@ var createClientCache = function createClientCache(maxSize, pingClient, onEvicti
|
|
|
14392
14171
|
};
|
|
14393
14172
|
};
|
|
14394
14173
|
|
|
14395
|
-
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 };
|