@paraspell/sdk-core 11.5.0 → 11.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -17
- package/dist/index.d.ts +9 -6
- package/dist/index.mjs +22 -18
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -4300,11 +4300,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4300
4300
|
};
|
|
4301
4301
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4302
4302
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4303
|
-
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4303
|
+
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4304
4304
|
return _regenerator().w(function (_context2) {
|
|
4305
4305
|
while (1) switch (_context2.n) {
|
|
4306
4306
|
case 0:
|
|
4307
|
-
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, disableFallback = options.disableFallback;
|
|
4307
|
+
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, tx = options.tx, disableFallback = options.disableFallback;
|
|
4308
4308
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
4309
4309
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
4310
4310
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
@@ -4386,6 +4386,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4386
4386
|
_context2.n = 4;
|
|
4387
4387
|
return api.getDryRunXcm({
|
|
4388
4388
|
originLocation: addXcmVersionHeader(createOriginLocation(hopChain, destination), sdkCommon.Version.V4),
|
|
4389
|
+
tx: tx,
|
|
4389
4390
|
xcm: forwardedXcms[1][0],
|
|
4390
4391
|
chain: destination,
|
|
4391
4392
|
origin: origin,
|
|
@@ -5263,6 +5264,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5263
5264
|
_context.n = 2;
|
|
5264
5265
|
return hopApi.getDryRunXcm({
|
|
5265
5266
|
originLocation: addXcmVersionHeader(createOriginLocation(currentOrigin, currentChain), sdkCommon.Version.V4),
|
|
5267
|
+
tx: tx,
|
|
5266
5268
|
xcm: forwardedXcms[1][0],
|
|
5267
5269
|
chain: currentChain,
|
|
5268
5270
|
origin: currentOrigin,
|
|
@@ -10041,7 +10043,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
|
|
|
10041
10043
|
return true;
|
|
10042
10044
|
});
|
|
10043
10045
|
return preminted.some(function (a) {
|
|
10044
|
-
return assets.
|
|
10046
|
+
return assets.isAssetXcEqual(a, sent);
|
|
10045
10047
|
}) ? viem.parseUnits(MINT_AMOUNT.toString(), sent.decimals) : 0n;
|
|
10046
10048
|
};
|
|
10047
10049
|
var wrapTxBypass = /*#__PURE__*/function () {
|
|
@@ -10092,7 +10094,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10092
10094
|
};
|
|
10093
10095
|
nativeInfo = mintFeeAssets ? assets.findNativeAssetInfo(chain) : null;
|
|
10094
10096
|
relayInfo = mintFeeAssets ? assets.findAssetInfo(chain, relayCurrency, null) : null;
|
|
10095
|
-
sameNativeRelay = !!(nativeInfo && relayInfo && assets.
|
|
10097
|
+
sameNativeRelay = !!(nativeInfo && relayInfo && assets.isAssetXcEqual(nativeInfo, relayInfo));
|
|
10096
10098
|
if (!mintFeeAssets) {
|
|
10097
10099
|
_context.n = 2;
|
|
10098
10100
|
break;
|
|
@@ -10582,6 +10584,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10582
10584
|
}),
|
|
10583
10585
|
address: address,
|
|
10584
10586
|
asset: asset,
|
|
10587
|
+
tx: tx,
|
|
10585
10588
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10586
10589
|
senderAddress: senderAddress,
|
|
10587
10590
|
disableFallback: disableFallback
|
|
@@ -10651,6 +10654,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10651
10654
|
senderAddress: senderAddress,
|
|
10652
10655
|
asset: currentAsset,
|
|
10653
10656
|
feeAsset: feeAsset,
|
|
10657
|
+
tx: tx,
|
|
10654
10658
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10655
10659
|
disableFallback: disableFallback
|
|
10656
10660
|
});
|
|
@@ -10743,6 +10747,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10743
10747
|
}),
|
|
10744
10748
|
address: address,
|
|
10745
10749
|
asset: asset,
|
|
10750
|
+
tx: tx,
|
|
10746
10751
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10747
10752
|
senderAddress: senderAddress,
|
|
10748
10753
|
disableFallback: disableFallback
|
|
@@ -11153,18 +11158,17 @@ var send = /*#__PURE__*/function () {
|
|
|
11153
11158
|
|
|
11154
11159
|
var buildDestInfo = /*#__PURE__*/function () {
|
|
11155
11160
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11156
|
-
var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail,
|
|
11161
|
+
var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail, totalHopFee, bridgeFee, destApi, destAsset, edDest, destCurrency, destBalance, destAmount, effectiveAmountForBalance, destBalanceSufficient, destBalanceSufficientResult, destBalanceAfter, destbalanceAfterResult, receivedAmount, isAssetHubToAssetHubRoute, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
|
|
11157
11162
|
return _regenerator().w(function (_context) {
|
|
11158
11163
|
while (1) switch (_context.n) {
|
|
11159
11164
|
case 0:
|
|
11160
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail,
|
|
11165
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail, totalHopFee = _ref.totalHopFee, bridgeFee = _ref.bridgeFee;
|
|
11161
11166
|
destApi = api.clone();
|
|
11162
11167
|
_context.n = 1;
|
|
11163
11168
|
return destApi.init(destination);
|
|
11164
11169
|
case 1:
|
|
11165
11170
|
destAsset = assets.findAssetOnDestOrThrow(origin, destination, currency);
|
|
11166
11171
|
edDest = assets.getEdFromAssetOrThrow(destAsset);
|
|
11167
|
-
edDestBn = BigInt(edDest);
|
|
11168
11172
|
destCurrency = destAsset.location ? {
|
|
11169
11173
|
location: destAsset.location
|
|
11170
11174
|
} : {
|
|
@@ -11179,12 +11183,9 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
11179
11183
|
});
|
|
11180
11184
|
case 2:
|
|
11181
11185
|
destBalance = _context.v;
|
|
11182
|
-
destAmount = isFeeAssetAh ?
|
|
11183
|
-
effectiveAmountForBalance = destAmount;
|
|
11184
|
-
|
|
11185
|
-
effectiveAmountForBalance -= assetHubFee;
|
|
11186
|
-
}
|
|
11187
|
-
destBalanceSufficient = effectiveAmountForBalance - destFeeDetail.fee > (destBalance < edDestBn ? edDestBn : 0);
|
|
11186
|
+
destAmount = isFeeAssetAh ? currency.amount - originFee : currency.amount;
|
|
11187
|
+
effectiveAmountForBalance = destAmount - totalHopFee;
|
|
11188
|
+
destBalanceSufficient = effectiveAmountForBalance - destFeeDetail.fee > (destBalance < edDest ? edDest : 0n);
|
|
11188
11189
|
destBalanceSufficientResult = destFeeDetail.currency !== destAsset.symbol && destination !== 'Ethereum' ? new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same') : destBalanceSufficient;
|
|
11189
11190
|
destBalanceAfter = destBalance - (destFeeDetail.currency === destAsset.symbol ? destFeeDetail.fee : 0n) + effectiveAmountForBalance;
|
|
11190
11191
|
destbalanceAfterResult = destFeeDetail.currency !== destAsset.symbol && destination !== 'Ethereum' ? new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same') : destBalanceAfter;
|
|
@@ -11199,7 +11200,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
11199
11200
|
if (bridgeFee === undefined) {
|
|
11200
11201
|
receivedAmount = new UnableToComputeError("bridgeFee is required for native asset transfer from ".concat(origin, " to ").concat(destination, " but was not provided."));
|
|
11201
11202
|
} else {
|
|
11202
|
-
receivedAmount =
|
|
11203
|
+
receivedAmount = currency.amount - originFee - bridgeFee;
|
|
11203
11204
|
}
|
|
11204
11205
|
} else {
|
|
11205
11206
|
receivedAmount = new UnableToComputeError("Unable to compute received amount: The transferred asset (".concat(destAsset.symbol, ") is not the native asset (").concat(nativeAssetOfOriginSymbol, ") of origin ").concat(origin, " for the ").concat(origin, "->").concat(destination, " route."));
|
|
@@ -11239,7 +11240,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
11239
11240
|
balanceAfter: destbalanceAfterResult,
|
|
11240
11241
|
currencySymbol: destAsset.symbol,
|
|
11241
11242
|
asset: destAsset,
|
|
11242
|
-
existentialDeposit:
|
|
11243
|
+
existentialDeposit: edDest
|
|
11243
11244
|
},
|
|
11244
11245
|
xcmFee: {
|
|
11245
11246
|
fee: destFeeDetail.fee,
|
|
@@ -11344,7 +11345,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
11344
11345
|
|
|
11345
11346
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
11346
11347
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11347
|
-
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, destinationInfo, _t;
|
|
11348
|
+
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
|
|
11348
11349
|
return _regenerator().w(function (_context2) {
|
|
11349
11350
|
while (1) switch (_context2.p = _context2.n) {
|
|
11350
11351
|
case 0:
|
|
@@ -11502,6 +11503,9 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11502
11503
|
case 14:
|
|
11503
11504
|
builtHops = _context2.v;
|
|
11504
11505
|
case 15:
|
|
11506
|
+
totalHopFee = hops.reduce(function (acc, hop) {
|
|
11507
|
+
return assets.isAssetXcEqual(hop.result.asset, originAsset) ? acc + hop.result.fee : acc;
|
|
11508
|
+
}, 0n);
|
|
11505
11509
|
_context2.n = 16;
|
|
11506
11510
|
return buildDestInfo({
|
|
11507
11511
|
api: api,
|
|
@@ -11514,7 +11518,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11514
11518
|
originFee: originFee,
|
|
11515
11519
|
isFeeAssetAh: !!isFeeAssetAh,
|
|
11516
11520
|
destFeeDetail: destFeeDetail,
|
|
11517
|
-
|
|
11521
|
+
totalHopFee: totalHopFee,
|
|
11518
11522
|
bridgeFee: bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.fee
|
|
11519
11523
|
});
|
|
11520
11524
|
case 16:
|
package/dist/index.d.ts
CHANGED
|
@@ -846,12 +846,14 @@ type TDryRunCallBaseOptions<TRes> = {
|
|
|
846
846
|
};
|
|
847
847
|
type TDryRunBypassOptions<TApi, TRes> = WithApi<Omit<TDryRunCallBaseOptions<TRes>, 'useRootOrigin'>, TApi, TRes>;
|
|
848
848
|
type TDryRunCallOptions<TApi, TRes> = WithApi<TDryRunCallBaseOptions<TRes>, TApi, TRes>;
|
|
849
|
-
type TDryRunXcmBaseOptions = {
|
|
849
|
+
type TDryRunXcmBaseOptions<TRes> = {
|
|
850
850
|
originLocation: any;
|
|
851
851
|
/**
|
|
852
852
|
* The XCM instructions
|
|
853
853
|
*/
|
|
854
854
|
xcm: any;
|
|
855
|
+
/** The transaction to dry-run */
|
|
856
|
+
tx: TRes;
|
|
855
857
|
/**
|
|
856
858
|
* The chain to dry-run on
|
|
857
859
|
*/
|
|
@@ -865,7 +867,7 @@ type TDryRunXcmBaseOptions = {
|
|
|
865
867
|
amount: bigint;
|
|
866
868
|
originFee: bigint;
|
|
867
869
|
};
|
|
868
|
-
type TDryRunXcmOptions<TApi, TRes> = WithApi<TDryRunXcmBaseOptions
|
|
870
|
+
type TDryRunXcmOptions<TApi, TRes> = WithApi<TDryRunXcmBaseOptions<TRes>, TApi, TRes>;
|
|
869
871
|
type TDryRunResBase = {
|
|
870
872
|
/** @deprecated Use `asset` property instead. */
|
|
871
873
|
currency: string;
|
|
@@ -1177,7 +1179,7 @@ type TGetOriginXcmFeeOptions<TApi, TRes> = WithApi<TGetOriginXcmFeeBaseOptions<T
|
|
|
1177
1179
|
type TAttemptDryRunFeeOptions<TApi, TRes> = Omit<TGetOriginXcmFeeOptions<TApi, TRes>, 'tx'> & {
|
|
1178
1180
|
builder: GeneralBuilder<TApi, TRes, TSendBaseOptions>;
|
|
1179
1181
|
};
|
|
1180
|
-
type TGetFeeForDestChainBaseOptions = {
|
|
1182
|
+
type TGetFeeForDestChainBaseOptions<TRes> = {
|
|
1181
1183
|
prevChain: TSubstrateChain;
|
|
1182
1184
|
origin: TSubstrateChain;
|
|
1183
1185
|
destination: TChain;
|
|
@@ -1185,12 +1187,13 @@ type TGetFeeForDestChainBaseOptions = {
|
|
|
1185
1187
|
address: string;
|
|
1186
1188
|
currency: WithAmount<TCurrencyCore>;
|
|
1187
1189
|
forwardedXcms: any;
|
|
1190
|
+
tx: TRes;
|
|
1188
1191
|
asset: TAssetInfo;
|
|
1189
1192
|
originFee: bigint;
|
|
1190
1193
|
feeAsset?: TCurrencyInput;
|
|
1191
1194
|
disableFallback: boolean;
|
|
1192
1195
|
};
|
|
1193
|
-
type TGetFeeForDestChainOptions<TApi, TRes> = WithApi<TGetFeeForDestChainBaseOptions
|
|
1196
|
+
type TGetFeeForDestChainOptions<TApi, TRes> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes>;
|
|
1194
1197
|
type TGetReverseTxFeeOptions<TApi, TRes> = Omit<TGetFeeForDestChainOptions<TApi, TRes>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain'> & {
|
|
1195
1198
|
destination: TSubstrateChain;
|
|
1196
1199
|
};
|
|
@@ -1353,7 +1356,7 @@ type TBuildDestInfoOptions<TApi, TRes> = {
|
|
|
1353
1356
|
originFee: bigint;
|
|
1354
1357
|
isFeeAssetAh: boolean;
|
|
1355
1358
|
destFeeDetail: TXcmFeeDetail;
|
|
1356
|
-
|
|
1359
|
+
totalHopFee: bigint;
|
|
1357
1360
|
bridgeFee?: bigint;
|
|
1358
1361
|
};
|
|
1359
1362
|
type TOriginFeeDetails = {
|
|
@@ -1423,7 +1426,7 @@ interface IPolkadotApi<TApi, TRes> {
|
|
|
1423
1426
|
clone(): IPolkadotApi<TApi, TRes>;
|
|
1424
1427
|
createApiForChain(chain: TSubstrateChain): Promise<IPolkadotApi<TApi, TRes>>;
|
|
1425
1428
|
getDryRunCall(options: TDryRunCallBaseOptions<TRes>): Promise<TDryRunChainResult>;
|
|
1426
|
-
getDryRunXcm(options: TDryRunXcmBaseOptions): Promise<TDryRunChainResult>;
|
|
1429
|
+
getDryRunXcm(options: TDryRunXcmBaseOptions<TRes>): Promise<TDryRunChainResult>;
|
|
1427
1430
|
getBridgeStatus(): Promise<TBridgeStatus>;
|
|
1428
1431
|
setDisconnectAllowed(allowed: boolean): void;
|
|
1429
1432
|
getDisconnectAllowed(): boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findAssetInfo, isTAsset, findAssetInfoOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, findNativeAssetInfoOrThrow, Native, hasXcmPaymentApiSupport, getRelayChainSymbol, getNativeAssets, findNativeAssetInfo, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
|
|
2
|
+
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findAssetInfo, isTAsset, findAssetInfoOrThrow, getExistentialDeposit, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, findNativeAssetInfoOrThrow, Native, hasXcmPaymentApiSupport, getRelayChainSymbol, getNativeAssets, findNativeAssetInfo, isAssetXcEqual, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { isAddress, parseUnits, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
@@ -4301,11 +4301,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4301
4301
|
};
|
|
4302
4302
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4303
4303
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4304
|
-
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4304
|
+
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4305
4305
|
return _regenerator().w(function (_context2) {
|
|
4306
4306
|
while (1) switch (_context2.n) {
|
|
4307
4307
|
case 0:
|
|
4308
|
-
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, disableFallback = options.disableFallback;
|
|
4308
|
+
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, tx = options.tx, disableFallback = options.disableFallback;
|
|
4309
4309
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
4310
4310
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
4311
4311
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
@@ -4387,6 +4387,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4387
4387
|
_context2.n = 4;
|
|
4388
4388
|
return api.getDryRunXcm({
|
|
4389
4389
|
originLocation: addXcmVersionHeader(createOriginLocation(hopChain, destination), Version.V4),
|
|
4390
|
+
tx: tx,
|
|
4390
4391
|
xcm: forwardedXcms[1][0],
|
|
4391
4392
|
chain: destination,
|
|
4392
4393
|
origin: origin,
|
|
@@ -5264,6 +5265,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5264
5265
|
_context.n = 2;
|
|
5265
5266
|
return hopApi.getDryRunXcm({
|
|
5266
5267
|
originLocation: addXcmVersionHeader(createOriginLocation(currentOrigin, currentChain), Version.V4),
|
|
5268
|
+
tx: tx,
|
|
5267
5269
|
xcm: forwardedXcms[1][0],
|
|
5268
5270
|
chain: currentChain,
|
|
5269
5271
|
origin: currentOrigin,
|
|
@@ -10042,7 +10044,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
|
|
|
10042
10044
|
return true;
|
|
10043
10045
|
});
|
|
10044
10046
|
return preminted.some(function (a) {
|
|
10045
|
-
return
|
|
10047
|
+
return isAssetXcEqual(a, sent);
|
|
10046
10048
|
}) ? parseUnits(MINT_AMOUNT.toString(), sent.decimals) : 0n;
|
|
10047
10049
|
};
|
|
10048
10050
|
var wrapTxBypass = /*#__PURE__*/function () {
|
|
@@ -10093,7 +10095,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10093
10095
|
};
|
|
10094
10096
|
nativeInfo = mintFeeAssets ? findNativeAssetInfo(chain) : null;
|
|
10095
10097
|
relayInfo = mintFeeAssets ? findAssetInfo(chain, relayCurrency, null) : null;
|
|
10096
|
-
sameNativeRelay = !!(nativeInfo && relayInfo &&
|
|
10098
|
+
sameNativeRelay = !!(nativeInfo && relayInfo && isAssetXcEqual(nativeInfo, relayInfo));
|
|
10097
10099
|
if (!mintFeeAssets) {
|
|
10098
10100
|
_context.n = 2;
|
|
10099
10101
|
break;
|
|
@@ -10583,6 +10585,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10583
10585
|
}),
|
|
10584
10586
|
address: address,
|
|
10585
10587
|
asset: asset,
|
|
10588
|
+
tx: tx,
|
|
10586
10589
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10587
10590
|
senderAddress: senderAddress,
|
|
10588
10591
|
disableFallback: disableFallback
|
|
@@ -10652,6 +10655,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10652
10655
|
senderAddress: senderAddress,
|
|
10653
10656
|
asset: currentAsset,
|
|
10654
10657
|
feeAsset: feeAsset,
|
|
10658
|
+
tx: tx,
|
|
10655
10659
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10656
10660
|
disableFallback: disableFallback
|
|
10657
10661
|
});
|
|
@@ -10744,6 +10748,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10744
10748
|
}),
|
|
10745
10749
|
address: address,
|
|
10746
10750
|
asset: asset,
|
|
10751
|
+
tx: tx,
|
|
10747
10752
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10748
10753
|
senderAddress: senderAddress,
|
|
10749
10754
|
disableFallback: disableFallback
|
|
@@ -11154,18 +11159,17 @@ var send = /*#__PURE__*/function () {
|
|
|
11154
11159
|
|
|
11155
11160
|
var buildDestInfo = /*#__PURE__*/function () {
|
|
11156
11161
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11157
|
-
var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail,
|
|
11162
|
+
var api, origin, destination, address, currency, originFee, isFeeAssetAh, destFeeDetail, totalHopFee, bridgeFee, destApi, destAsset, edDest, destCurrency, destBalance, destAmount, effectiveAmountForBalance, destBalanceSufficient, destBalanceSufficientResult, destBalanceAfter, destbalanceAfterResult, receivedAmount, isAssetHubToAssetHubRoute, nativeAssetOfOriginSymbol, isOriginAssetNative, destXcmFeeBalance, isDestFeeInNativeCurrency, destRecipientNativeBalance, destXcmFeeBalanceAfter;
|
|
11158
11163
|
return _regenerator().w(function (_context) {
|
|
11159
11164
|
while (1) switch (_context.n) {
|
|
11160
11165
|
case 0:
|
|
11161
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail,
|
|
11166
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, address = _ref.address, currency = _ref.currency, originFee = _ref.originFee, isFeeAssetAh = _ref.isFeeAssetAh, destFeeDetail = _ref.destFeeDetail, totalHopFee = _ref.totalHopFee, bridgeFee = _ref.bridgeFee;
|
|
11162
11167
|
destApi = api.clone();
|
|
11163
11168
|
_context.n = 1;
|
|
11164
11169
|
return destApi.init(destination);
|
|
11165
11170
|
case 1:
|
|
11166
11171
|
destAsset = findAssetOnDestOrThrow(origin, destination, currency);
|
|
11167
11172
|
edDest = getEdFromAssetOrThrow(destAsset);
|
|
11168
|
-
edDestBn = BigInt(edDest);
|
|
11169
11173
|
destCurrency = destAsset.location ? {
|
|
11170
11174
|
location: destAsset.location
|
|
11171
11175
|
} : {
|
|
@@ -11180,12 +11184,9 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
11180
11184
|
});
|
|
11181
11185
|
case 2:
|
|
11182
11186
|
destBalance = _context.v;
|
|
11183
|
-
destAmount = isFeeAssetAh ?
|
|
11184
|
-
effectiveAmountForBalance = destAmount;
|
|
11185
|
-
|
|
11186
|
-
effectiveAmountForBalance -= assetHubFee;
|
|
11187
|
-
}
|
|
11188
|
-
destBalanceSufficient = effectiveAmountForBalance - destFeeDetail.fee > (destBalance < edDestBn ? edDestBn : 0);
|
|
11187
|
+
destAmount = isFeeAssetAh ? currency.amount - originFee : currency.amount;
|
|
11188
|
+
effectiveAmountForBalance = destAmount - totalHopFee;
|
|
11189
|
+
destBalanceSufficient = effectiveAmountForBalance - destFeeDetail.fee > (destBalance < edDest ? edDest : 0n);
|
|
11189
11190
|
destBalanceSufficientResult = destFeeDetail.currency !== destAsset.symbol && destination !== 'Ethereum' ? new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same') : destBalanceSufficient;
|
|
11190
11191
|
destBalanceAfter = destBalance - (destFeeDetail.currency === destAsset.symbol ? destFeeDetail.fee : 0n) + effectiveAmountForBalance;
|
|
11191
11192
|
destbalanceAfterResult = destFeeDetail.currency !== destAsset.symbol && destination !== 'Ethereum' ? new UnableToComputeError('Unable to compute if dest balance will be sufficient. Fee currency is not the same') : destBalanceAfter;
|
|
@@ -11200,7 +11201,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
11200
11201
|
if (bridgeFee === undefined) {
|
|
11201
11202
|
receivedAmount = new UnableToComputeError("bridgeFee is required for native asset transfer from ".concat(origin, " to ").concat(destination, " but was not provided."));
|
|
11202
11203
|
} else {
|
|
11203
|
-
receivedAmount =
|
|
11204
|
+
receivedAmount = currency.amount - originFee - bridgeFee;
|
|
11204
11205
|
}
|
|
11205
11206
|
} else {
|
|
11206
11207
|
receivedAmount = new UnableToComputeError("Unable to compute received amount: The transferred asset (".concat(destAsset.symbol, ") is not the native asset (").concat(nativeAssetOfOriginSymbol, ") of origin ").concat(origin, " for the ").concat(origin, "->").concat(destination, " route."));
|
|
@@ -11240,7 +11241,7 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
11240
11241
|
balanceAfter: destbalanceAfterResult,
|
|
11241
11242
|
currencySymbol: destAsset.symbol,
|
|
11242
11243
|
asset: destAsset,
|
|
11243
|
-
existentialDeposit:
|
|
11244
|
+
existentialDeposit: edDest
|
|
11244
11245
|
},
|
|
11245
11246
|
xcmFee: {
|
|
11246
11247
|
fee: destFeeDetail.fee,
|
|
@@ -11345,7 +11346,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
11345
11346
|
|
|
11346
11347
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
11347
11348
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11348
|
-
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, destinationInfo, _t;
|
|
11349
|
+
var api, tx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
|
|
11349
11350
|
return _regenerator().w(function (_context2) {
|
|
11350
11351
|
while (1) switch (_context2.p = _context2.n) {
|
|
11351
11352
|
case 0:
|
|
@@ -11503,6 +11504,9 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11503
11504
|
case 14:
|
|
11504
11505
|
builtHops = _context2.v;
|
|
11505
11506
|
case 15:
|
|
11507
|
+
totalHopFee = hops.reduce(function (acc, hop) {
|
|
11508
|
+
return isAssetXcEqual(hop.result.asset, originAsset) ? acc + hop.result.fee : acc;
|
|
11509
|
+
}, 0n);
|
|
11506
11510
|
_context2.n = 16;
|
|
11507
11511
|
return buildDestInfo({
|
|
11508
11512
|
api: api,
|
|
@@ -11515,7 +11519,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11515
11519
|
originFee: originFee,
|
|
11516
11520
|
isFeeAssetAh: !!isFeeAssetAh,
|
|
11517
11521
|
destFeeDetail: destFeeDetail,
|
|
11518
|
-
|
|
11522
|
+
totalHopFee: totalHopFee,
|
|
11519
11523
|
bridgeFee: bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.fee
|
|
11520
11524
|
});
|
|
11521
11525
|
case 16:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "11.5.
|
|
3
|
+
"version": "11.5.1",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"@scure/base": "^2.0.0",
|
|
28
28
|
"viem": "^2.36.0",
|
|
29
|
-
"@paraspell/assets": "11.5.
|
|
30
|
-
"@paraspell/pallets": "11.5.
|
|
31
|
-
"@paraspell/sdk-common": "11.5.
|
|
29
|
+
"@paraspell/assets": "11.5.1",
|
|
30
|
+
"@paraspell/pallets": "11.5.1",
|
|
31
|
+
"@paraspell/sdk-common": "11.5.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|