@paraspell/sdk-core 10.1.3 → 10.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +38 -37
- package/dist/index.mjs +39 -38
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -4557,7 +4557,7 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
4557
4557
|
|
|
4558
4558
|
var getXcmFee = /*#__PURE__*/function () {
|
|
4559
4559
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
4560
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, asset, _yield$getOriginXcmFe, originFee, originCurrency, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, assetHubNode, bridgeHubNode, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, _destApi, destFallback, processedBridgeHubData, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee;
|
|
4560
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, asset, _yield$getOriginXcmFe, originFee, originCurrency, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, assetHubNode, bridgeHubNode, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, _destApi, destFallback, processedBridgeHubData, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, destCurrency;
|
|
4561
4561
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4562
4562
|
while (1) switch (_context.prev = _context.next) {
|
|
4563
4563
|
case 0:
|
|
@@ -4790,6 +4790,7 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
4790
4790
|
});
|
|
4791
4791
|
case 85:
|
|
4792
4792
|
intermediateFees.bridgeHub = processedBridgeHubData;
|
|
4793
|
+
destCurrency = destinationFeeType === 'dryRun' ? assets.findAssetOnDestOrThrow(origin, destination, currency).symbol : assets.getNativeAssetSymbol(destination);
|
|
4793
4794
|
return _context.abrupt("return", _objectSpread2(_objectSpread2({
|
|
4794
4795
|
origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
|
|
4795
4796
|
fee: originFee
|
|
@@ -4806,12 +4807,12 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
4806
4807
|
}), destinationFeeType && {
|
|
4807
4808
|
feeType: destinationFeeType
|
|
4808
4809
|
}), {}, {
|
|
4809
|
-
currency:
|
|
4810
|
+
currency: destCurrency
|
|
4810
4811
|
}, destinationDryRunError && {
|
|
4811
4812
|
dryRunError: destinationDryRunError
|
|
4812
4813
|
})
|
|
4813
4814
|
}));
|
|
4814
|
-
case
|
|
4815
|
+
case 88:
|
|
4815
4816
|
case "end":
|
|
4816
4817
|
return _context.stop();
|
|
4817
4818
|
}
|
|
@@ -8991,11 +8992,11 @@ function _getEthErc20Balance() {
|
|
|
8991
8992
|
|
|
8992
8993
|
var buildDestInfo = /*#__PURE__*/function () {
|
|
8993
8994
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
8994
|
-
var api, origin, destination, address, currency, originFee,
|
|
8995
|
+
var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail, assetHubFee, bridgeFee, destApi, destAsset, edDest, edDestBn, destCurrency, destBalance, destAmount, effectiveAmountForBalance, destBalanceSufficient, destBalanceSufficientResult, destBalanceAfter, destbalanceAfterResult, receivedAmount, isAssetHubToAssetHubRoute, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
|
|
8995
8996
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8996
8997
|
while (1) switch (_context.prev = _context.next) {
|
|
8997
8998
|
case 0:
|
|
8998
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee,
|
|
8999
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail, assetHubFee = _ref.assetHubFee, bridgeFee = _ref.bridgeFee;
|
|
8999
9000
|
destApi = api.clone();
|
|
9000
9001
|
if (!(destination !== 'Ethereum')) {
|
|
9001
9002
|
_context.next = 5;
|
|
@@ -9004,12 +9005,8 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9004
9005
|
_context.next = 5;
|
|
9005
9006
|
return destApi.init(destination);
|
|
9006
9007
|
case 5:
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
} : {
|
|
9010
|
-
symbol: destAsset.symbol
|
|
9011
|
-
};
|
|
9012
|
-
edDest = assets.getExistentialDeposit(destination, destCurrency);
|
|
9008
|
+
destAsset = assets.findAssetOnDestOrThrow(origin, destination, currency);
|
|
9009
|
+
edDest = destAsset.existentialDeposit;
|
|
9013
9010
|
if (edDest) {
|
|
9014
9011
|
_context.next = 9;
|
|
9015
9012
|
break;
|
|
@@ -9017,27 +9014,32 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9017
9014
|
throw new InvalidParameterError("Existential deposit not found for ".concat(destination, " with currency ").concat(JSON.stringify(currency)));
|
|
9018
9015
|
case 9:
|
|
9019
9016
|
edDestBn = BigInt(edDest);
|
|
9017
|
+
destCurrency = destAsset.multiLocation ? {
|
|
9018
|
+
multilocation: destAsset.multiLocation
|
|
9019
|
+
} : {
|
|
9020
|
+
symbol: destAsset.symbol
|
|
9021
|
+
};
|
|
9020
9022
|
if (!(destination === 'Ethereum')) {
|
|
9021
|
-
_context.next =
|
|
9023
|
+
_context.next = 17;
|
|
9022
9024
|
break;
|
|
9023
9025
|
}
|
|
9024
|
-
_context.next =
|
|
9026
|
+
_context.next = 14;
|
|
9025
9027
|
return getEthErc20Balance(destCurrency, address);
|
|
9026
|
-
case
|
|
9028
|
+
case 14:
|
|
9027
9029
|
_context.t0 = _context.sent;
|
|
9028
|
-
_context.next =
|
|
9030
|
+
_context.next = 20;
|
|
9029
9031
|
break;
|
|
9030
|
-
case
|
|
9031
|
-
_context.next =
|
|
9032
|
+
case 17:
|
|
9033
|
+
_context.next = 19;
|
|
9032
9034
|
return getAssetBalanceInternal({
|
|
9033
9035
|
api: destApi,
|
|
9034
9036
|
address: address,
|
|
9035
9037
|
node: destination,
|
|
9036
9038
|
currency: destCurrency
|
|
9037
9039
|
});
|
|
9038
|
-
case 18:
|
|
9039
|
-
_context.t0 = _context.sent;
|
|
9040
9040
|
case 19:
|
|
9041
|
+
_context.t0 = _context.sent;
|
|
9042
|
+
case 20:
|
|
9041
9043
|
destBalance = _context.t0;
|
|
9042
9044
|
destAmount = isFeeAssetAh ? BigInt(currency.amount) - originFee : BigInt(currency.amount);
|
|
9043
9045
|
effectiveAmountForBalance = destAmount;
|
|
@@ -9073,38 +9075,38 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9073
9075
|
}
|
|
9074
9076
|
isDestFeeInNativeCurrency = destFeeDetail.currency === assets.getNativeAssetSymbol(destination);
|
|
9075
9077
|
if (!isDestFeeInNativeCurrency) {
|
|
9076
|
-
_context.next =
|
|
9078
|
+
_context.next = 45;
|
|
9077
9079
|
break;
|
|
9078
9080
|
}
|
|
9079
9081
|
if (!(destination === 'Ethereum')) {
|
|
9080
|
-
_context.next =
|
|
9082
|
+
_context.next = 38;
|
|
9081
9083
|
break;
|
|
9082
9084
|
}
|
|
9083
|
-
_context.next =
|
|
9085
|
+
_context.next = 35;
|
|
9084
9086
|
return getEthErc20Balance({
|
|
9085
9087
|
symbol: assets.getNativeAssetSymbol(destination)
|
|
9086
9088
|
}, address);
|
|
9087
|
-
case
|
|
9089
|
+
case 35:
|
|
9088
9090
|
_context.t1 = _context.sent;
|
|
9089
|
-
_context.next =
|
|
9091
|
+
_context.next = 41;
|
|
9090
9092
|
break;
|
|
9091
|
-
case
|
|
9092
|
-
_context.next =
|
|
9093
|
+
case 38:
|
|
9094
|
+
_context.next = 40;
|
|
9093
9095
|
return getBalanceNativeInternal({
|
|
9094
9096
|
address: address,
|
|
9095
9097
|
node: destination,
|
|
9096
9098
|
api: destApi
|
|
9097
9099
|
});
|
|
9098
|
-
case 39:
|
|
9099
|
-
_context.t1 = _context.sent;
|
|
9100
9100
|
case 40:
|
|
9101
|
+
_context.t1 = _context.sent;
|
|
9102
|
+
case 41:
|
|
9101
9103
|
destRecipientNativeBalance = _context.t1;
|
|
9102
9104
|
destXcmFeeBalance = destRecipientNativeBalance;
|
|
9103
|
-
_context.next =
|
|
9105
|
+
_context.next = 46;
|
|
9104
9106
|
break;
|
|
9105
|
-
case 44:
|
|
9106
|
-
destXcmFeeBalance = destBalance;
|
|
9107
9107
|
case 45:
|
|
9108
|
+
destXcmFeeBalance = destBalance;
|
|
9109
|
+
case 46:
|
|
9108
9110
|
destXcmFeeBalanceAfter = isFeeAssetAh ? destBalanceAfter : destXcmFeeBalance - destFeeDetail.fee + (destFeeDetail.currency === destAsset.symbol ? effectiveAmountForBalance : 0n);
|
|
9109
9111
|
return _context.abrupt("return", {
|
|
9110
9112
|
receivedCurrency: {
|
|
@@ -9122,7 +9124,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9122
9124
|
currencySymbol: destFeeDetail.currency
|
|
9123
9125
|
}
|
|
9124
9126
|
});
|
|
9125
|
-
case
|
|
9127
|
+
case 48:
|
|
9126
9128
|
case "end":
|
|
9127
9129
|
return _context.stop();
|
|
9128
9130
|
}
|
|
@@ -9219,7 +9221,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
9219
9221
|
|
|
9220
9222
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
9221
9223
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9222
|
-
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset,
|
|
9224
|
+
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, originBalanceFee, originBalance, edOrigin, edOriginBn, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubNode, destinationInfo;
|
|
9223
9225
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9224
9226
|
while (1) switch (_context.prev = _context.next) {
|
|
9225
9227
|
case 0:
|
|
@@ -9236,7 +9238,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9236
9238
|
case 6:
|
|
9237
9239
|
api.setDisconnectAllowed(false);
|
|
9238
9240
|
_context.prev = 7;
|
|
9239
|
-
|
|
9241
|
+
originAsset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
9240
9242
|
if (!(feeAsset && resolvedFeeAsset)) {
|
|
9241
9243
|
_context.next = 15;
|
|
9242
9244
|
break;
|
|
@@ -9306,7 +9308,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9306
9308
|
}
|
|
9307
9309
|
throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(origin, "."));
|
|
9308
9310
|
case 37:
|
|
9309
|
-
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && assets.isAssetEqual(resolvedFeeAsset,
|
|
9311
|
+
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && assets.isAssetEqual(resolvedFeeAsset, originAsset);
|
|
9310
9312
|
originBalanceAfter = originBalance - BigInt(currency.amount);
|
|
9311
9313
|
originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - BigInt(currency.amount) : originBalanceFee - originFee;
|
|
9312
9314
|
originBalanceNativeSufficient = originBalanceFee >= originFee;
|
|
@@ -9353,7 +9355,6 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9353
9355
|
destination: destination,
|
|
9354
9356
|
address: address,
|
|
9355
9357
|
currency: currency,
|
|
9356
|
-
destAsset: destAsset,
|
|
9357
9358
|
originFee: originFee,
|
|
9358
9359
|
isFeeAssetAh: !!isFeeAssetAh,
|
|
9359
9360
|
destFeeDetail: destFeeDetail,
|
|
@@ -9373,7 +9374,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9373
9374
|
sufficient: originBalanceSufficient,
|
|
9374
9375
|
balance: originBalance,
|
|
9375
9376
|
balanceAfter: originBalanceAfter,
|
|
9376
|
-
currencySymbol:
|
|
9377
|
+
currencySymbol: originAsset.symbol,
|
|
9377
9378
|
existentialDeposit: edOriginBn
|
|
9378
9379
|
},
|
|
9379
9380
|
xcmFee: {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isNodeEvm, getAssetsObject, InvalidCurrencyError, getNativeAssetSymbol, getOtherAssets, getRelayChainSymbol, isForeignAsset, findAssetForNodeOrThrow, findAsset, isOverrideMultiLocationSpecifier, findAssetByMultiLocation, isTMultiAsset, hasDryRunSupport, hasSupportForAsset, extractMultiAssetLoc, isAssetEqual, isSymbolSpecifier, getAssetId, getExistentialDeposit,
|
|
2
|
+
import { isNodeEvm, getAssetsObject, InvalidCurrencyError, getNativeAssetSymbol, getOtherAssets, getRelayChainSymbol, isForeignAsset, findAssetForNodeOrThrow, findAsset, isOverrideMultiLocationSpecifier, findAssetByMultiLocation, isTMultiAsset, hasDryRunSupport, findAssetOnDestOrThrow, hasSupportForAsset, extractMultiAssetLoc, isAssetEqual, isSymbolSpecifier, getAssetId, getExistentialDeposit, normalizeSymbol } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { ethers, Contract } from 'ethers';
|
|
@@ -4558,7 +4558,7 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
4558
4558
|
|
|
4559
4559
|
var getXcmFee = /*#__PURE__*/function () {
|
|
4560
4560
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
4561
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, asset, _yield$getOriginXcmFe, originFee, originCurrency, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, assetHubNode, bridgeHubNode, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, _destApi, destFallback, processedBridgeHubData, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee;
|
|
4561
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, asset, _yield$getOriginXcmFe, originFee, originCurrency, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, destApi, destFeeRes, assetHubNode, bridgeHubNode, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationFee, destinationFeeType, destinationDryRunError, nextChain, hopApi, hopResult, failingRecord, hopIsDestination, _destApi, destFallback, processedBridgeHubData, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, destCurrency;
|
|
4562
4562
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4563
4563
|
while (1) switch (_context.prev = _context.next) {
|
|
4564
4564
|
case 0:
|
|
@@ -4791,6 +4791,7 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
4791
4791
|
});
|
|
4792
4792
|
case 85:
|
|
4793
4793
|
intermediateFees.bridgeHub = processedBridgeHubData;
|
|
4794
|
+
destCurrency = destinationFeeType === 'dryRun' ? findAssetOnDestOrThrow(origin, destination, currency).symbol : getNativeAssetSymbol(destination);
|
|
4794
4795
|
return _context.abrupt("return", _objectSpread2(_objectSpread2({
|
|
4795
4796
|
origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
|
|
4796
4797
|
fee: originFee
|
|
@@ -4807,12 +4808,12 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
4807
4808
|
}), destinationFeeType && {
|
|
4808
4809
|
feeType: destinationFeeType
|
|
4809
4810
|
}), {}, {
|
|
4810
|
-
currency:
|
|
4811
|
+
currency: destCurrency
|
|
4811
4812
|
}, destinationDryRunError && {
|
|
4812
4813
|
dryRunError: destinationDryRunError
|
|
4813
4814
|
})
|
|
4814
4815
|
}));
|
|
4815
|
-
case
|
|
4816
|
+
case 88:
|
|
4816
4817
|
case "end":
|
|
4817
4818
|
return _context.stop();
|
|
4818
4819
|
}
|
|
@@ -8992,11 +8993,11 @@ function _getEthErc20Balance() {
|
|
|
8992
8993
|
|
|
8993
8994
|
var buildDestInfo = /*#__PURE__*/function () {
|
|
8994
8995
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
8995
|
-
var api, origin, destination, address, currency, originFee,
|
|
8996
|
+
var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail, assetHubFee, bridgeFee, destApi, destAsset, edDest, edDestBn, destCurrency, destBalance, destAmount, effectiveAmountForBalance, destBalanceSufficient, destBalanceSufficientResult, destBalanceAfter, destbalanceAfterResult, receivedAmount, isAssetHubToAssetHubRoute, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
|
|
8996
8997
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8997
8998
|
while (1) switch (_context.prev = _context.next) {
|
|
8998
8999
|
case 0:
|
|
8999
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee,
|
|
9000
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail, assetHubFee = _ref.assetHubFee, bridgeFee = _ref.bridgeFee;
|
|
9000
9001
|
destApi = api.clone();
|
|
9001
9002
|
if (!(destination !== 'Ethereum')) {
|
|
9002
9003
|
_context.next = 5;
|
|
@@ -9005,12 +9006,8 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9005
9006
|
_context.next = 5;
|
|
9006
9007
|
return destApi.init(destination);
|
|
9007
9008
|
case 5:
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
} : {
|
|
9011
|
-
symbol: destAsset.symbol
|
|
9012
|
-
};
|
|
9013
|
-
edDest = getExistentialDeposit(destination, destCurrency);
|
|
9009
|
+
destAsset = findAssetOnDestOrThrow(origin, destination, currency);
|
|
9010
|
+
edDest = destAsset.existentialDeposit;
|
|
9014
9011
|
if (edDest) {
|
|
9015
9012
|
_context.next = 9;
|
|
9016
9013
|
break;
|
|
@@ -9018,27 +9015,32 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9018
9015
|
throw new InvalidParameterError("Existential deposit not found for ".concat(destination, " with currency ").concat(JSON.stringify(currency)));
|
|
9019
9016
|
case 9:
|
|
9020
9017
|
edDestBn = BigInt(edDest);
|
|
9018
|
+
destCurrency = destAsset.multiLocation ? {
|
|
9019
|
+
multilocation: destAsset.multiLocation
|
|
9020
|
+
} : {
|
|
9021
|
+
symbol: destAsset.symbol
|
|
9022
|
+
};
|
|
9021
9023
|
if (!(destination === 'Ethereum')) {
|
|
9022
|
-
_context.next =
|
|
9024
|
+
_context.next = 17;
|
|
9023
9025
|
break;
|
|
9024
9026
|
}
|
|
9025
|
-
_context.next =
|
|
9027
|
+
_context.next = 14;
|
|
9026
9028
|
return getEthErc20Balance(destCurrency, address);
|
|
9027
|
-
case
|
|
9029
|
+
case 14:
|
|
9028
9030
|
_context.t0 = _context.sent;
|
|
9029
|
-
_context.next =
|
|
9031
|
+
_context.next = 20;
|
|
9030
9032
|
break;
|
|
9031
|
-
case
|
|
9032
|
-
_context.next =
|
|
9033
|
+
case 17:
|
|
9034
|
+
_context.next = 19;
|
|
9033
9035
|
return getAssetBalanceInternal({
|
|
9034
9036
|
api: destApi,
|
|
9035
9037
|
address: address,
|
|
9036
9038
|
node: destination,
|
|
9037
9039
|
currency: destCurrency
|
|
9038
9040
|
});
|
|
9039
|
-
case 18:
|
|
9040
|
-
_context.t0 = _context.sent;
|
|
9041
9041
|
case 19:
|
|
9042
|
+
_context.t0 = _context.sent;
|
|
9043
|
+
case 20:
|
|
9042
9044
|
destBalance = _context.t0;
|
|
9043
9045
|
destAmount = isFeeAssetAh ? BigInt(currency.amount) - originFee : BigInt(currency.amount);
|
|
9044
9046
|
effectiveAmountForBalance = destAmount;
|
|
@@ -9074,38 +9076,38 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9074
9076
|
}
|
|
9075
9077
|
isDestFeeInNativeCurrency = destFeeDetail.currency === getNativeAssetSymbol(destination);
|
|
9076
9078
|
if (!isDestFeeInNativeCurrency) {
|
|
9077
|
-
_context.next =
|
|
9079
|
+
_context.next = 45;
|
|
9078
9080
|
break;
|
|
9079
9081
|
}
|
|
9080
9082
|
if (!(destination === 'Ethereum')) {
|
|
9081
|
-
_context.next =
|
|
9083
|
+
_context.next = 38;
|
|
9082
9084
|
break;
|
|
9083
9085
|
}
|
|
9084
|
-
_context.next =
|
|
9086
|
+
_context.next = 35;
|
|
9085
9087
|
return getEthErc20Balance({
|
|
9086
9088
|
symbol: getNativeAssetSymbol(destination)
|
|
9087
9089
|
}, address);
|
|
9088
|
-
case
|
|
9090
|
+
case 35:
|
|
9089
9091
|
_context.t1 = _context.sent;
|
|
9090
|
-
_context.next =
|
|
9092
|
+
_context.next = 41;
|
|
9091
9093
|
break;
|
|
9092
|
-
case
|
|
9093
|
-
_context.next =
|
|
9094
|
+
case 38:
|
|
9095
|
+
_context.next = 40;
|
|
9094
9096
|
return getBalanceNativeInternal({
|
|
9095
9097
|
address: address,
|
|
9096
9098
|
node: destination,
|
|
9097
9099
|
api: destApi
|
|
9098
9100
|
});
|
|
9099
|
-
case 39:
|
|
9100
|
-
_context.t1 = _context.sent;
|
|
9101
9101
|
case 40:
|
|
9102
|
+
_context.t1 = _context.sent;
|
|
9103
|
+
case 41:
|
|
9102
9104
|
destRecipientNativeBalance = _context.t1;
|
|
9103
9105
|
destXcmFeeBalance = destRecipientNativeBalance;
|
|
9104
|
-
_context.next =
|
|
9106
|
+
_context.next = 46;
|
|
9105
9107
|
break;
|
|
9106
|
-
case 44:
|
|
9107
|
-
destXcmFeeBalance = destBalance;
|
|
9108
9108
|
case 45:
|
|
9109
|
+
destXcmFeeBalance = destBalance;
|
|
9110
|
+
case 46:
|
|
9109
9111
|
destXcmFeeBalanceAfter = isFeeAssetAh ? destBalanceAfter : destXcmFeeBalance - destFeeDetail.fee + (destFeeDetail.currency === destAsset.symbol ? effectiveAmountForBalance : 0n);
|
|
9110
9112
|
return _context.abrupt("return", {
|
|
9111
9113
|
receivedCurrency: {
|
|
@@ -9123,7 +9125,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
9123
9125
|
currencySymbol: destFeeDetail.currency
|
|
9124
9126
|
}
|
|
9125
9127
|
});
|
|
9126
|
-
case
|
|
9128
|
+
case 48:
|
|
9127
9129
|
case "end":
|
|
9128
9130
|
return _context.stop();
|
|
9129
9131
|
}
|
|
@@ -9220,7 +9222,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
9220
9222
|
|
|
9221
9223
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
9222
9224
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9223
|
-
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset,
|
|
9225
|
+
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, originBalanceFee, originBalance, edOrigin, edOriginBn, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubNode, destinationInfo;
|
|
9224
9226
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9225
9227
|
while (1) switch (_context.prev = _context.next) {
|
|
9226
9228
|
case 0:
|
|
@@ -9237,7 +9239,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9237
9239
|
case 6:
|
|
9238
9240
|
api.setDisconnectAllowed(false);
|
|
9239
9241
|
_context.prev = 7;
|
|
9240
|
-
|
|
9242
|
+
originAsset = findAssetForNodeOrThrow(origin, currency, destination);
|
|
9241
9243
|
if (!(feeAsset && resolvedFeeAsset)) {
|
|
9242
9244
|
_context.next = 15;
|
|
9243
9245
|
break;
|
|
@@ -9307,7 +9309,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9307
9309
|
}
|
|
9308
9310
|
throw new InvalidParameterError("Cannot get origin xcm fee for currency ".concat(JSON.stringify(currency), " on node ").concat(origin, "."));
|
|
9309
9311
|
case 37:
|
|
9310
|
-
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset,
|
|
9312
|
+
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
|
|
9311
9313
|
originBalanceAfter = originBalance - BigInt(currency.amount);
|
|
9312
9314
|
originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - BigInt(currency.amount) : originBalanceFee - originFee;
|
|
9313
9315
|
originBalanceNativeSufficient = originBalanceFee >= originFee;
|
|
@@ -9354,7 +9356,6 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9354
9356
|
destination: destination,
|
|
9355
9357
|
address: address,
|
|
9356
9358
|
currency: currency,
|
|
9357
|
-
destAsset: destAsset,
|
|
9358
9359
|
originFee: originFee,
|
|
9359
9360
|
isFeeAssetAh: !!isFeeAssetAh,
|
|
9360
9361
|
destFeeDetail: destFeeDetail,
|
|
@@ -9374,7 +9375,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
9374
9375
|
sufficient: originBalanceSufficient,
|
|
9375
9376
|
balance: originBalance,
|
|
9376
9377
|
balanceAfter: originBalanceAfter,
|
|
9377
|
-
currencySymbol:
|
|
9378
|
+
currencySymbol: originAsset.symbol,
|
|
9378
9379
|
existentialDeposit: edOriginBn
|
|
9379
9380
|
},
|
|
9380
9381
|
xcmFee: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.5",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@scure/base": "^1.2.5",
|
|
28
28
|
"ethers": "^6.13.7",
|
|
29
29
|
"viem": "^2.28.1",
|
|
30
|
-
"@paraspell/
|
|
31
|
-
"@paraspell/
|
|
32
|
-
"@paraspell/
|
|
30
|
+
"@paraspell/assets": "10.1.5",
|
|
31
|
+
"@paraspell/pallets": "10.1.5",
|
|
32
|
+
"@paraspell/sdk-common": "10.1.5"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|