@paraspell/sdk-core 11.6.0 → 11.6.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 +62 -35
- package/dist/index.d.ts +9 -5
- package/dist/index.mjs +62 -35
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -4312,11 +4312,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4312
4312
|
};
|
|
4313
4313
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4314
4314
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4315
|
-
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4315
|
+
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, swapConfig, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4316
4316
|
return _regenerator().w(function (_context2) {
|
|
4317
4317
|
while (1) switch (_context2.n) {
|
|
4318
4318
|
case 0:
|
|
4319
|
-
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;
|
|
4319
|
+
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, swapConfig = options.swapConfig;
|
|
4320
4320
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
4321
4321
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
4322
4322
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
@@ -4330,7 +4330,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4330
4330
|
}
|
|
4331
4331
|
return _context.a(2, 0n);
|
|
4332
4332
|
case 1:
|
|
4333
|
-
originAsset = assets.findAssetInfoOrThrow(origin, currency, destination);
|
|
4333
|
+
originAsset = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? assets.findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, destination) : assets.findAssetInfoOrThrow(origin, currency, destination);
|
|
4334
4334
|
if (!originAsset.location) {
|
|
4335
4335
|
_context.n = 7;
|
|
4336
4336
|
break;
|
|
@@ -9609,6 +9609,8 @@ var MAX_WEIGHT = {
|
|
|
9609
9609
|
proofSize: MAX_U64,
|
|
9610
9610
|
refTime: MAX_U64
|
|
9611
9611
|
};
|
|
9612
|
+
var BYPASS_MINT_AMOUNT = '1000';
|
|
9613
|
+
var BYPASS_CURRENCY_AMOUNT = '800';
|
|
9612
9614
|
|
|
9613
9615
|
var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
|
|
9614
9616
|
var assets = options.assets,
|
|
@@ -9990,7 +9992,6 @@ var getPalletInstance = function getPalletInstance(type) {
|
|
|
9990
9992
|
return new HandlerClass();
|
|
9991
9993
|
};
|
|
9992
9994
|
|
|
9993
|
-
var MINT_AMOUNT = 1000n; // Mint 1000 units of asset
|
|
9994
9995
|
var getCurrencySelection = function getCurrencySelection(asset) {
|
|
9995
9996
|
if (asset.location) return {
|
|
9996
9997
|
location: asset.location
|
|
@@ -10023,7 +10024,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
|
|
|
10023
10024
|
return palletInstance.mint(address, asset, balance, chain, api);
|
|
10024
10025
|
};
|
|
10025
10026
|
var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountHuman, balance, address, api) {
|
|
10026
|
-
var amount = viem.parseUnits(amountHuman
|
|
10027
|
+
var amount = viem.parseUnits(amountHuman, asset.decimals);
|
|
10027
10028
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
10028
10029
|
amount: amount
|
|
10029
10030
|
}), balance, address, api);
|
|
@@ -10031,7 +10032,7 @@ var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountH
|
|
|
10031
10032
|
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
10032
10033
|
var asset = assets.findAssetInfo(chain, currency, null);
|
|
10033
10034
|
if (!asset) return null;
|
|
10034
|
-
var amount = viem.parseUnits(amountHuman
|
|
10035
|
+
var amount = viem.parseUnits(amountHuman, asset.decimals);
|
|
10035
10036
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
10036
10037
|
amount: amount
|
|
10037
10038
|
}), balance, address, api);
|
|
@@ -10072,7 +10073,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
|
|
|
10072
10073
|
});
|
|
10073
10074
|
return preminted.some(function (a) {
|
|
10074
10075
|
return assets.isAssetXcEqual(a, sent);
|
|
10075
|
-
}) ? viem.parseUnits(
|
|
10076
|
+
}) ? viem.parseUnits(BYPASS_MINT_AMOUNT, sent.decimals) : 0n;
|
|
10076
10077
|
};
|
|
10077
10078
|
var wrapTxBypass = /*#__PURE__*/function () {
|
|
10078
10079
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dryRunOptions) {
|
|
@@ -10128,7 +10129,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10128
10129
|
break;
|
|
10129
10130
|
}
|
|
10130
10131
|
_context.n = 1;
|
|
10131
|
-
return createRequiredMintTxs(chain, assets.findNativeAssetInfoOrThrow(chain),
|
|
10132
|
+
return createRequiredMintTxs(chain, assets.findNativeAssetInfoOrThrow(chain), BYPASS_MINT_AMOUNT, 0n, address, api);
|
|
10132
10133
|
case 1:
|
|
10133
10134
|
_t = _context.v;
|
|
10134
10135
|
_context.n = 3;
|
|
@@ -10142,7 +10143,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10142
10143
|
break;
|
|
10143
10144
|
}
|
|
10144
10145
|
_context.n = 4;
|
|
10145
|
-
return createOptionalMintTxs(chain, relayCurrency,
|
|
10146
|
+
return createOptionalMintTxs(chain, relayCurrency, BYPASS_MINT_AMOUNT, 0n, address, api);
|
|
10146
10147
|
case 4:
|
|
10147
10148
|
_t2 = _context.v;
|
|
10148
10149
|
_context.n = 6;
|
|
@@ -10155,7 +10156,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10155
10156
|
_context.n = 8;
|
|
10156
10157
|
break;
|
|
10157
10158
|
}
|
|
10158
|
-
amount = viem.parseUnits(
|
|
10159
|
+
amount = viem.parseUnits(BYPASS_MINT_AMOUNT, feeAsset.decimals);
|
|
10159
10160
|
_context.n = 7;
|
|
10160
10161
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, feeAsset), {}, {
|
|
10161
10162
|
amount: amount
|
|
@@ -10174,7 +10175,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10174
10175
|
balance = _context.v;
|
|
10175
10176
|
bonus = mintBonusForSent(chain, asset, feeAsset, !!mintFeeAssets);
|
|
10176
10177
|
if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
|
|
10177
|
-
mintAmount = viem.parseUnits(
|
|
10178
|
+
mintAmount = viem.parseUnits(BYPASS_MINT_AMOUNT, asset.decimals) + asset.amount;
|
|
10178
10179
|
} else {
|
|
10179
10180
|
missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, asset.amount)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
|
|
10180
10181
|
total = missing + bonus;
|
|
@@ -10615,7 +10616,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10615
10616
|
tx: tx,
|
|
10616
10617
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10617
10618
|
senderAddress: senderAddress,
|
|
10618
|
-
disableFallback: disableFallback
|
|
10619
|
+
disableFallback: disableFallback,
|
|
10620
|
+
swapConfig: swapConfig
|
|
10619
10621
|
});
|
|
10620
10622
|
case 4:
|
|
10621
10623
|
destFeeRes = _context2.v;
|
|
@@ -11691,7 +11693,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11691
11693
|
_context.n = 6;
|
|
11692
11694
|
break;
|
|
11693
11695
|
}
|
|
11694
|
-
|
|
11696
|
+
return _context.a(2, 0n);
|
|
11695
11697
|
case 6:
|
|
11696
11698
|
return _context.a(2, minAmount);
|
|
11697
11699
|
}
|
|
@@ -12688,6 +12690,31 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12688
12690
|
}
|
|
12689
12691
|
return build;
|
|
12690
12692
|
}())
|
|
12693
|
+
}, {
|
|
12694
|
+
key: "computeOverridenAmount",
|
|
12695
|
+
value: function computeOverridenAmount() {
|
|
12696
|
+
var _this$_options2 = this._options,
|
|
12697
|
+
from = _this$_options2.from,
|
|
12698
|
+
to = _this$_options2.to,
|
|
12699
|
+
currency = _this$_options2.currency;
|
|
12700
|
+
var config = this.api.getConfig();
|
|
12701
|
+
if (isConfig(config) && config.abstractDecimals) {
|
|
12702
|
+
return BYPASS_CURRENCY_AMOUNT;
|
|
12703
|
+
} else {
|
|
12704
|
+
assertToIsString(to);
|
|
12705
|
+
var asset = assets.findAssetInfoOrThrow(from, currency, to);
|
|
12706
|
+
return viem.parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
|
|
12707
|
+
}
|
|
12708
|
+
}
|
|
12709
|
+
}, {
|
|
12710
|
+
key: "overrideTxAmount",
|
|
12711
|
+
value: function overrideTxAmount() {
|
|
12712
|
+
var currency = this._options.currency;
|
|
12713
|
+
var modifiedBuilder = this.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
|
|
12714
|
+
amount: this.computeOverridenAmount()
|
|
12715
|
+
}));
|
|
12716
|
+
return modifiedBuilder.build();
|
|
12717
|
+
}
|
|
12691
12718
|
}, {
|
|
12692
12719
|
key: "dryRun",
|
|
12693
12720
|
value: function () {
|
|
@@ -12743,15 +12770,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12743
12770
|
value: (function () {
|
|
12744
12771
|
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(options) {
|
|
12745
12772
|
var _options$disableFallb;
|
|
12746
|
-
var _this$
|
|
12773
|
+
var _this$_options3, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
|
|
12747
12774
|
return _regenerator().w(function (_context5) {
|
|
12748
12775
|
while (1) switch (_context5.p = _context5.n) {
|
|
12749
12776
|
case 0:
|
|
12750
|
-
_this$
|
|
12777
|
+
_this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress, feeAsset = _this$_options3.feeAsset, currency = _this$_options3.currency;
|
|
12751
12778
|
assertToIsString(to);
|
|
12752
12779
|
assertAddressIsString(address);
|
|
12753
12780
|
_context5.n = 1;
|
|
12754
|
-
return this.
|
|
12781
|
+
return this.overrideTxAmount();
|
|
12755
12782
|
case 1:
|
|
12756
12783
|
tx = _context5.v;
|
|
12757
12784
|
disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
|
|
@@ -12798,7 +12825,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12798
12825
|
var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
12799
12826
|
var _ref,
|
|
12800
12827
|
disableFallback,
|
|
12801
|
-
_this$
|
|
12828
|
+
_this$_options4,
|
|
12802
12829
|
from,
|
|
12803
12830
|
to,
|
|
12804
12831
|
senderAddress,
|
|
@@ -12812,10 +12839,10 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12812
12839
|
_ref = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {
|
|
12813
12840
|
disableFallback: false
|
|
12814
12841
|
}, disableFallback = _ref.disableFallback;
|
|
12815
|
-
_this$
|
|
12842
|
+
_this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency, feeAsset = _this$_options4.feeAsset;
|
|
12816
12843
|
assertToIsString(to);
|
|
12817
12844
|
_context6.n = 1;
|
|
12818
|
-
return this.
|
|
12845
|
+
return this.overrideTxAmount();
|
|
12819
12846
|
case 1:
|
|
12820
12847
|
tx = _context6.v;
|
|
12821
12848
|
_context6.p = 2;
|
|
@@ -12858,11 +12885,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12858
12885
|
key: "getXcmFeeEstimate",
|
|
12859
12886
|
value: (function () {
|
|
12860
12887
|
var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
12861
|
-
var _this$
|
|
12888
|
+
var _this$_options5, from, to, address, senderAddress, currency, tx;
|
|
12862
12889
|
return _regenerator().w(function (_context7) {
|
|
12863
12890
|
while (1) switch (_context7.p = _context7.n) {
|
|
12864
12891
|
case 0:
|
|
12865
|
-
_this$
|
|
12892
|
+
_this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, address = _this$_options5.address, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
|
|
12866
12893
|
assertToIsString(to);
|
|
12867
12894
|
assertAddressIsString(address);
|
|
12868
12895
|
_context7.n = 1;
|
|
@@ -12908,11 +12935,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12908
12935
|
key: "getOriginXcmFeeEstimate",
|
|
12909
12936
|
value: (function () {
|
|
12910
12937
|
var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
12911
|
-
var _this$
|
|
12938
|
+
var _this$_options6, from, to, senderAddress, currency, tx;
|
|
12912
12939
|
return _regenerator().w(function (_context8) {
|
|
12913
12940
|
while (1) switch (_context8.p = _context8.n) {
|
|
12914
12941
|
case 0:
|
|
12915
|
-
_this$
|
|
12942
|
+
_this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency;
|
|
12916
12943
|
assertToIsString(to);
|
|
12917
12944
|
_context8.n = 1;
|
|
12918
12945
|
return this.build();
|
|
@@ -12956,14 +12983,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12956
12983
|
key: "getTransferableAmount",
|
|
12957
12984
|
value: (function () {
|
|
12958
12985
|
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
12959
|
-
var _this$
|
|
12986
|
+
var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
|
|
12960
12987
|
return _regenerator().w(function (_context9) {
|
|
12961
12988
|
while (1) switch (_context9.n) {
|
|
12962
12989
|
case 0:
|
|
12963
|
-
_this$
|
|
12990
|
+
_this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
|
|
12964
12991
|
assertToIsString(to);
|
|
12965
12992
|
_context9.n = 1;
|
|
12966
|
-
return this.
|
|
12993
|
+
return this.overrideTxAmount();
|
|
12967
12994
|
case 1:
|
|
12968
12995
|
tx = _context9.v;
|
|
12969
12996
|
return _context9.a(2, getTransferableAmount({
|
|
@@ -12993,15 +13020,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12993
13020
|
key: "getMinTransferableAmount",
|
|
12994
13021
|
value: (function () {
|
|
12995
13022
|
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
12996
|
-
var _this$
|
|
13023
|
+
var _this$_options8, from, to, senderAddress, address, currency, feeAsset, tx;
|
|
12997
13024
|
return _regenerator().w(function (_context0) {
|
|
12998
13025
|
while (1) switch (_context0.n) {
|
|
12999
13026
|
case 0:
|
|
13000
|
-
_this$
|
|
13027
|
+
_this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, senderAddress = _this$_options8.senderAddress, address = _this$_options8.address, currency = _this$_options8.currency, feeAsset = _this$_options8.feeAsset;
|
|
13001
13028
|
assertToIsString(to);
|
|
13002
13029
|
assertAddressIsString(address);
|
|
13003
13030
|
_context0.n = 1;
|
|
13004
|
-
return this.
|
|
13031
|
+
return this.overrideTxAmount();
|
|
13005
13032
|
case 1:
|
|
13006
13033
|
tx = _context0.v;
|
|
13007
13034
|
return _context0.a(2, getMinTransferableAmount({
|
|
@@ -13033,15 +13060,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13033
13060
|
key: "verifyEdOnDestination",
|
|
13034
13061
|
value: (function () {
|
|
13035
13062
|
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
13036
|
-
var _this$
|
|
13063
|
+
var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
|
|
13037
13064
|
return _regenerator().w(function (_context1) {
|
|
13038
13065
|
while (1) switch (_context1.n) {
|
|
13039
13066
|
case 0:
|
|
13040
|
-
_this$
|
|
13067
|
+
_this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
|
|
13041
13068
|
assertToIsString(to);
|
|
13042
13069
|
assertAddressIsString(address);
|
|
13043
13070
|
_context1.n = 1;
|
|
13044
|
-
return this.
|
|
13071
|
+
return this.overrideTxAmount();
|
|
13045
13072
|
case 1:
|
|
13046
13073
|
tx = _context1.v;
|
|
13047
13074
|
return _context1.a(2, verifyEdOnDestination({
|
|
@@ -13072,15 +13099,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13072
13099
|
key: "getTransferInfo",
|
|
13073
13100
|
value: (function () {
|
|
13074
13101
|
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
13075
|
-
var _this$
|
|
13102
|
+
var _this$_options0, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
|
|
13076
13103
|
return _regenerator().w(function (_context10) {
|
|
13077
13104
|
while (1) switch (_context10.n) {
|
|
13078
13105
|
case 0:
|
|
13079
|
-
_this$
|
|
13106
|
+
_this$_options0 = this._options, from = _this$_options0.from, to = _this$_options0.to, address = _this$_options0.address, currency = _this$_options0.currency, ahAddress = _this$_options0.ahAddress, senderAddress = _this$_options0.senderAddress, feeAsset = _this$_options0.feeAsset;
|
|
13080
13107
|
assertToIsString(to);
|
|
13081
13108
|
assertAddressIsString(address);
|
|
13082
13109
|
_context10.n = 1;
|
|
13083
|
-
return this.
|
|
13110
|
+
return this.overrideTxAmount();
|
|
13084
13111
|
case 1:
|
|
13085
13112
|
tx = _context10.v;
|
|
13086
13113
|
return _context10.a(2, getTransferInfo({
|
package/dist/index.d.ts
CHANGED
|
@@ -449,6 +449,8 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
|
|
|
449
449
|
* @returns A Promise that resolves to the transfer extrinsic.
|
|
450
450
|
*/
|
|
451
451
|
build(this: GeneralBuilder<TApi, TRes, TSendBaseOptions>): Promise<TRes>;
|
|
452
|
+
protected computeOverridenAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): bigint | "800";
|
|
453
|
+
protected overrideTxAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TRes>;
|
|
452
454
|
dryRun(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TDryRunResult>;
|
|
453
455
|
dryRunPreview(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>, options?: TDryRunPreviewOptions): Promise<TDryRunResult>;
|
|
454
456
|
/**
|
|
@@ -1154,10 +1156,7 @@ type TGetXcmFeeBaseOptions<TRes, TDisableFallback extends boolean = boolean> = {
|
|
|
1154
1156
|
currency: WithAmount<TCurrencyCore>;
|
|
1155
1157
|
feeAsset?: TCurrencyInput;
|
|
1156
1158
|
disableFallback: TDisableFallback;
|
|
1157
|
-
swapConfig?:
|
|
1158
|
-
currencyTo: TCurrencyCore;
|
|
1159
|
-
exchangeChain: TParachain;
|
|
1160
|
-
};
|
|
1159
|
+
swapConfig?: TSwapConfig;
|
|
1161
1160
|
};
|
|
1162
1161
|
type TGetXcmFeeOptions<TApi, TRes, TDisableFallback extends boolean = boolean> = WithApi<TGetXcmFeeBaseOptions<TRes, TDisableFallback>, TApi, TRes>;
|
|
1163
1162
|
type TGetXcmFeeEstimateOptions<TApi, TRes> = Omit<TGetXcmFeeOptions<TApi, TRes>, 'disableFallback'>;
|
|
@@ -1179,6 +1178,10 @@ type TGetOriginXcmFeeOptions<TApi, TRes> = WithApi<TGetOriginXcmFeeBaseOptions<T
|
|
|
1179
1178
|
type TAttemptDryRunFeeOptions<TApi, TRes> = Omit<TGetOriginXcmFeeOptions<TApi, TRes>, 'tx'> & {
|
|
1180
1179
|
builder: GeneralBuilder<TApi, TRes, TSendBaseOptions>;
|
|
1181
1180
|
};
|
|
1181
|
+
type TSwapConfig = {
|
|
1182
|
+
currencyTo: TCurrencyCore;
|
|
1183
|
+
exchangeChain: TParachain;
|
|
1184
|
+
};
|
|
1182
1185
|
type TGetFeeForDestChainBaseOptions<TRes> = {
|
|
1183
1186
|
prevChain: TSubstrateChain;
|
|
1184
1187
|
origin: TSubstrateChain;
|
|
@@ -1192,6 +1195,7 @@ type TGetFeeForDestChainBaseOptions<TRes> = {
|
|
|
1192
1195
|
originFee: bigint;
|
|
1193
1196
|
feeAsset?: TCurrencyInput;
|
|
1194
1197
|
disableFallback: boolean;
|
|
1198
|
+
swapConfig?: TSwapConfig;
|
|
1195
1199
|
};
|
|
1196
1200
|
type TGetFeeForDestChainOptions<TApi, TRes> = WithApi<TGetFeeForDestChainBaseOptions<TRes>, TApi, TRes>;
|
|
1197
1201
|
type TGetReverseTxFeeOptions<TApi, TRes> = Omit<TGetFeeForDestChainOptions<TApi, TRes>, 'destination' | 'disableFallback' | 'forwardedXcms' | 'asset' | 'originFee' | 'prevChain'> & {
|
|
@@ -2254,4 +2258,4 @@ declare const handleToAhTeleport: <TApi, TRes>(origin: TParachain, input: TPolka
|
|
|
2254
2258
|
declare const validateAddress: (address: TAddress, chain: TChain, isDestination?: boolean) => void;
|
|
2255
2259
|
|
|
2256
2260
|
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
|
|
2257
|
-
export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBatchOptions, TBifrostToken, TBridgeStatus, TBuildDestInfoOptions, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
|
|
2261
|
+
export type { BuildHopInfoOptions, HopProcessParams, HopTraversalConfig, HopTraversalResult, IPolkadotApi, IPolkadotXCMTransfer, IXTokensTransfer, IXTransferTransfer, OneKey, TAddress, TApiOrUrl, TAssetClaimInternalOptions, TAssetClaimOptions, TAssetClaimOptionsBase, TAttemptDryRunFeeOptions, TBatchOptions, TBifrostToken, TBridgeStatus, TBuildDestInfoOptions, TBuilderConfig, TBuilderOptions, TBypassOptions, TChainConfig, TChainConfigMap, TChainWithApi, TConditionalXcmFeeDetail, TConditionalXcmFeeHopInfo, TCreateBaseSwapXcmOptions, TCreateBaseTransferXcmOptions, TCreateBeneficiaryOptions, TCreateBeneficiaryXTokensOptions, TCreateSwapXcmInternalOptions, TCreateSwapXcmOptions, TCreateTransferXcmOptions, TDestWeight, TDestXcmFeeDetail, TDestination, TDryRunBaseOptions, TDryRunBypassOptions, TDryRunCallBaseOptions, TDryRunCallOptions, TDryRunChain, TDryRunChainFailure, TDryRunChainResult, TDryRunChainSuccess, TDryRunOptions, TDryRunPreviewOptions, TDryRunResBase, TDryRunResult, TDryRunXcmBaseOptions, TDryRunXcmOptions, TEvmBuilderOptions, TEvmBuilderOptionsBase, TEvmChainFrom, TFeeType, TForeignAssetId, TForeignOrNativeAsset, TForeignOrTokenAsset, TGetAssetBalanceOptions, TGetAssetBalanceOptionsBase, TGetBalanceForeignByAssetOptions, TGetBalanceForeignOptions, TGetBalanceForeignOptionsBase, TGetBalanceNativeOptions, TGetBalanceNativeOptionsBase, TGetFeeForDestChainBaseOptions, TGetFeeForDestChainOptions, TGetMinTransferableAmountOptions, TGetOriginFeeDetailsOptions, TGetOriginFeeDetailsOptionsBase, TGetOriginXcmFeeBaseOptions, TGetOriginXcmFeeEstimateOptions, TGetOriginXcmFeeOptions, TGetReverseTxFeeOptions, TGetTransferInfoOptions, TGetTransferInfoOptionsBase, TGetTransferableAmountOptions, TGetTransferableAmountOptionsBase, TGetXcmFeeBaseOptions, TGetXcmFeeBuilderOptions, TGetXcmFeeEstimateDetail, TGetXcmFeeEstimateOptions, TGetXcmFeeEstimateResult, TGetXcmFeeOptions, TGetXcmFeeResult, THopInfo, THopTransferInfo, THubKey, TMantaAsset, TModuleError, TNativeTokenAsset, TNodleAsset, TOriginFeeDetails, TOtherReserveAsset, TPolkadotXCMTransferOptions, TPolkadotXcmMethod, TProviderEntry, TRelayToParaDestination, TRelayToParaOptions, TRelayToParaOverrides, TReserveAsset, TScenario, TSelfReserveAsset, TSendBaseOptions, TSendBaseOptionsWithSenderAddress, TSendInternalOptions, TSendOptions, TSerializeEthTransferOptions, TSerializedApiCall, TSerializedEthTransfer, TSwapConfig, TSwapFeeEstimates, TTransferFeeEstimates, TTransferInfo, TTransferLocalOptions, TTypeAndThenCallContext, TTypeAndThenFees, TVerifyEdOnDestinationOptions, TVerifyEdOnDestinationOptionsBase, TWeight, TXTokensCurrencySelection, TXTokensMethod, TXTokensTransferOptions, TXTransferMethod, TXTransferTransferOptions, TXcmAsset, TXcmFeeBase, TXcmFeeChain, TXcmFeeDetail, TXcmFeeDetailError, TXcmFeeDetailSuccess, TXcmFeeDetailWithFallback, TXcmFeeHopInfo, TXcmFeeHopResult, TXcmForeignAsset, TXcmPalletMethod, TXcmVersioned, TZeitgeistAsset, WithApi, WithRequiredSenderAddress };
|
package/dist/index.mjs
CHANGED
|
@@ -4313,11 +4313,11 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4313
4313
|
};
|
|
4314
4314
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4315
4315
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4316
|
-
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4316
|
+
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, swapConfig, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4317
4317
|
return _regenerator().w(function (_context2) {
|
|
4318
4318
|
while (1) switch (_context2.n) {
|
|
4319
4319
|
case 0:
|
|
4320
|
-
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;
|
|
4320
|
+
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, swapConfig = options.swapConfig;
|
|
4321
4321
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
4322
4322
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
4323
4323
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
@@ -4331,7 +4331,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4331
4331
|
}
|
|
4332
4332
|
return _context.a(2, 0n);
|
|
4333
4333
|
case 1:
|
|
4334
|
-
originAsset = findAssetInfoOrThrow(origin, currency, destination);
|
|
4334
|
+
originAsset = swapConfig !== null && swapConfig !== void 0 && swapConfig.currencyTo ? findAssetInfoOrThrow(swapConfig.exchangeChain, swapConfig.currencyTo, destination) : findAssetInfoOrThrow(origin, currency, destination);
|
|
4335
4335
|
if (!originAsset.location) {
|
|
4336
4336
|
_context.n = 7;
|
|
4337
4337
|
break;
|
|
@@ -9610,6 +9610,8 @@ var MAX_WEIGHT = {
|
|
|
9610
9610
|
proofSize: MAX_U64,
|
|
9611
9611
|
refTime: MAX_U64
|
|
9612
9612
|
};
|
|
9613
|
+
var BYPASS_MINT_AMOUNT = '1000';
|
|
9614
|
+
var BYPASS_CURRENCY_AMOUNT = '800';
|
|
9613
9615
|
|
|
9614
9616
|
var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
|
|
9615
9617
|
var assets = options.assets,
|
|
@@ -9991,7 +9993,6 @@ var getPalletInstance = function getPalletInstance(type) {
|
|
|
9991
9993
|
return new HandlerClass();
|
|
9992
9994
|
};
|
|
9993
9995
|
|
|
9994
|
-
var MINT_AMOUNT = 1000n; // Mint 1000 units of asset
|
|
9995
9996
|
var getCurrencySelection = function getCurrencySelection(asset) {
|
|
9996
9997
|
if (asset.location) return {
|
|
9997
9998
|
location: asset.location
|
|
@@ -10024,7 +10025,7 @@ var createMintTxs = function createMintTxs(chain, asset, balance, address, api)
|
|
|
10024
10025
|
return palletInstance.mint(address, asset, balance, chain, api);
|
|
10025
10026
|
};
|
|
10026
10027
|
var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountHuman, balance, address, api) {
|
|
10027
|
-
var amount = parseUnits(amountHuman
|
|
10028
|
+
var amount = parseUnits(amountHuman, asset.decimals);
|
|
10028
10029
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
10029
10030
|
amount: amount
|
|
10030
10031
|
}), balance, address, api);
|
|
@@ -10032,7 +10033,7 @@ var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountH
|
|
|
10032
10033
|
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
10033
10034
|
var asset = findAssetInfo(chain, currency, null);
|
|
10034
10035
|
if (!asset) return null;
|
|
10035
|
-
var amount = parseUnits(amountHuman
|
|
10036
|
+
var amount = parseUnits(amountHuman, asset.decimals);
|
|
10036
10037
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
10037
10038
|
amount: amount
|
|
10038
10039
|
}), balance, address, api);
|
|
@@ -10073,7 +10074,7 @@ var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeA
|
|
|
10073
10074
|
});
|
|
10074
10075
|
return preminted.some(function (a) {
|
|
10075
10076
|
return isAssetXcEqual(a, sent);
|
|
10076
|
-
}) ? parseUnits(
|
|
10077
|
+
}) ? parseUnits(BYPASS_MINT_AMOUNT, sent.decimals) : 0n;
|
|
10077
10078
|
};
|
|
10078
10079
|
var wrapTxBypass = /*#__PURE__*/function () {
|
|
10079
10080
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(dryRunOptions) {
|
|
@@ -10129,7 +10130,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10129
10130
|
break;
|
|
10130
10131
|
}
|
|
10131
10132
|
_context.n = 1;
|
|
10132
|
-
return createRequiredMintTxs(chain, findNativeAssetInfoOrThrow(chain),
|
|
10133
|
+
return createRequiredMintTxs(chain, findNativeAssetInfoOrThrow(chain), BYPASS_MINT_AMOUNT, 0n, address, api);
|
|
10133
10134
|
case 1:
|
|
10134
10135
|
_t = _context.v;
|
|
10135
10136
|
_context.n = 3;
|
|
@@ -10143,7 +10144,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10143
10144
|
break;
|
|
10144
10145
|
}
|
|
10145
10146
|
_context.n = 4;
|
|
10146
|
-
return createOptionalMintTxs(chain, relayCurrency,
|
|
10147
|
+
return createOptionalMintTxs(chain, relayCurrency, BYPASS_MINT_AMOUNT, 0n, address, api);
|
|
10147
10148
|
case 4:
|
|
10148
10149
|
_t2 = _context.v;
|
|
10149
10150
|
_context.n = 6;
|
|
@@ -10156,7 +10157,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10156
10157
|
_context.n = 8;
|
|
10157
10158
|
break;
|
|
10158
10159
|
}
|
|
10159
|
-
amount = parseUnits(
|
|
10160
|
+
amount = parseUnits(BYPASS_MINT_AMOUNT, feeAsset.decimals);
|
|
10160
10161
|
_context.n = 7;
|
|
10161
10162
|
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, feeAsset), {}, {
|
|
10162
10163
|
amount: amount
|
|
@@ -10175,7 +10176,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10175
10176
|
balance = _context.v;
|
|
10176
10177
|
bonus = mintBonusForSent(chain, asset, feeAsset, !!mintFeeAssets);
|
|
10177
10178
|
if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
|
|
10178
|
-
mintAmount = parseUnits(
|
|
10179
|
+
mintAmount = parseUnits(BYPASS_MINT_AMOUNT, asset.decimals) + asset.amount;
|
|
10179
10180
|
} else {
|
|
10180
10181
|
missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, asset.amount)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
|
|
10181
10182
|
total = missing + bonus;
|
|
@@ -10616,7 +10617,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10616
10617
|
tx: tx,
|
|
10617
10618
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10618
10619
|
senderAddress: senderAddress,
|
|
10619
|
-
disableFallback: disableFallback
|
|
10620
|
+
disableFallback: disableFallback,
|
|
10621
|
+
swapConfig: swapConfig
|
|
10620
10622
|
});
|
|
10621
10623
|
case 4:
|
|
10622
10624
|
destFeeRes = _context2.v;
|
|
@@ -11692,7 +11694,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11692
11694
|
_context.n = 6;
|
|
11693
11695
|
break;
|
|
11694
11696
|
}
|
|
11695
|
-
|
|
11697
|
+
return _context.a(2, 0n);
|
|
11696
11698
|
case 6:
|
|
11697
11699
|
return _context.a(2, minAmount);
|
|
11698
11700
|
}
|
|
@@ -12689,6 +12691,31 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12689
12691
|
}
|
|
12690
12692
|
return build;
|
|
12691
12693
|
}())
|
|
12694
|
+
}, {
|
|
12695
|
+
key: "computeOverridenAmount",
|
|
12696
|
+
value: function computeOverridenAmount() {
|
|
12697
|
+
var _this$_options2 = this._options,
|
|
12698
|
+
from = _this$_options2.from,
|
|
12699
|
+
to = _this$_options2.to,
|
|
12700
|
+
currency = _this$_options2.currency;
|
|
12701
|
+
var config = this.api.getConfig();
|
|
12702
|
+
if (isConfig(config) && config.abstractDecimals) {
|
|
12703
|
+
return BYPASS_CURRENCY_AMOUNT;
|
|
12704
|
+
} else {
|
|
12705
|
+
assertToIsString(to);
|
|
12706
|
+
var asset = findAssetInfoOrThrow(from, currency, to);
|
|
12707
|
+
return parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
|
|
12708
|
+
}
|
|
12709
|
+
}
|
|
12710
|
+
}, {
|
|
12711
|
+
key: "overrideTxAmount",
|
|
12712
|
+
value: function overrideTxAmount() {
|
|
12713
|
+
var currency = this._options.currency;
|
|
12714
|
+
var modifiedBuilder = this.currency(_objectSpread2(_objectSpread2({}, currency), {}, {
|
|
12715
|
+
amount: this.computeOverridenAmount()
|
|
12716
|
+
}));
|
|
12717
|
+
return modifiedBuilder.build();
|
|
12718
|
+
}
|
|
12692
12719
|
}, {
|
|
12693
12720
|
key: "dryRun",
|
|
12694
12721
|
value: function () {
|
|
@@ -12744,15 +12771,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12744
12771
|
value: (function () {
|
|
12745
12772
|
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(options) {
|
|
12746
12773
|
var _options$disableFallb;
|
|
12747
|
-
var _this$
|
|
12774
|
+
var _this$_options3, from, to, address, senderAddress, feeAsset, currency, tx, disableFallback;
|
|
12748
12775
|
return _regenerator().w(function (_context5) {
|
|
12749
12776
|
while (1) switch (_context5.p = _context5.n) {
|
|
12750
12777
|
case 0:
|
|
12751
|
-
_this$
|
|
12778
|
+
_this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, address = _this$_options3.address, senderAddress = _this$_options3.senderAddress, feeAsset = _this$_options3.feeAsset, currency = _this$_options3.currency;
|
|
12752
12779
|
assertToIsString(to);
|
|
12753
12780
|
assertAddressIsString(address);
|
|
12754
12781
|
_context5.n = 1;
|
|
12755
|
-
return this.
|
|
12782
|
+
return this.overrideTxAmount();
|
|
12756
12783
|
case 1:
|
|
12757
12784
|
tx = _context5.v;
|
|
12758
12785
|
disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
|
|
@@ -12799,7 +12826,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12799
12826
|
var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
12800
12827
|
var _ref,
|
|
12801
12828
|
disableFallback,
|
|
12802
|
-
_this$
|
|
12829
|
+
_this$_options4,
|
|
12803
12830
|
from,
|
|
12804
12831
|
to,
|
|
12805
12832
|
senderAddress,
|
|
@@ -12813,10 +12840,10 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12813
12840
|
_ref = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {
|
|
12814
12841
|
disableFallback: false
|
|
12815
12842
|
}, disableFallback = _ref.disableFallback;
|
|
12816
|
-
_this$
|
|
12843
|
+
_this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency, feeAsset = _this$_options4.feeAsset;
|
|
12817
12844
|
assertToIsString(to);
|
|
12818
12845
|
_context6.n = 1;
|
|
12819
|
-
return this.
|
|
12846
|
+
return this.overrideTxAmount();
|
|
12820
12847
|
case 1:
|
|
12821
12848
|
tx = _context6.v;
|
|
12822
12849
|
_context6.p = 2;
|
|
@@ -12859,11 +12886,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12859
12886
|
key: "getXcmFeeEstimate",
|
|
12860
12887
|
value: (function () {
|
|
12861
12888
|
var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
12862
|
-
var _this$
|
|
12889
|
+
var _this$_options5, from, to, address, senderAddress, currency, tx;
|
|
12863
12890
|
return _regenerator().w(function (_context7) {
|
|
12864
12891
|
while (1) switch (_context7.p = _context7.n) {
|
|
12865
12892
|
case 0:
|
|
12866
|
-
_this$
|
|
12893
|
+
_this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, address = _this$_options5.address, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
|
|
12867
12894
|
assertToIsString(to);
|
|
12868
12895
|
assertAddressIsString(address);
|
|
12869
12896
|
_context7.n = 1;
|
|
@@ -12909,11 +12936,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12909
12936
|
key: "getOriginXcmFeeEstimate",
|
|
12910
12937
|
value: (function () {
|
|
12911
12938
|
var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
12912
|
-
var _this$
|
|
12939
|
+
var _this$_options6, from, to, senderAddress, currency, tx;
|
|
12913
12940
|
return _regenerator().w(function (_context8) {
|
|
12914
12941
|
while (1) switch (_context8.p = _context8.n) {
|
|
12915
12942
|
case 0:
|
|
12916
|
-
_this$
|
|
12943
|
+
_this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency;
|
|
12917
12944
|
assertToIsString(to);
|
|
12918
12945
|
_context8.n = 1;
|
|
12919
12946
|
return this.build();
|
|
@@ -12957,14 +12984,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12957
12984
|
key: "getTransferableAmount",
|
|
12958
12985
|
value: (function () {
|
|
12959
12986
|
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
12960
|
-
var _this$
|
|
12987
|
+
var _this$_options7, from, to, senderAddress, currency, feeAsset, tx;
|
|
12961
12988
|
return _regenerator().w(function (_context9) {
|
|
12962
12989
|
while (1) switch (_context9.n) {
|
|
12963
12990
|
case 0:
|
|
12964
|
-
_this$
|
|
12991
|
+
_this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
|
|
12965
12992
|
assertToIsString(to);
|
|
12966
12993
|
_context9.n = 1;
|
|
12967
|
-
return this.
|
|
12994
|
+
return this.overrideTxAmount();
|
|
12968
12995
|
case 1:
|
|
12969
12996
|
tx = _context9.v;
|
|
12970
12997
|
return _context9.a(2, getTransferableAmount({
|
|
@@ -12994,15 +13021,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12994
13021
|
key: "getMinTransferableAmount",
|
|
12995
13022
|
value: (function () {
|
|
12996
13023
|
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
12997
|
-
var _this$
|
|
13024
|
+
var _this$_options8, from, to, senderAddress, address, currency, feeAsset, tx;
|
|
12998
13025
|
return _regenerator().w(function (_context0) {
|
|
12999
13026
|
while (1) switch (_context0.n) {
|
|
13000
13027
|
case 0:
|
|
13001
|
-
_this$
|
|
13028
|
+
_this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, senderAddress = _this$_options8.senderAddress, address = _this$_options8.address, currency = _this$_options8.currency, feeAsset = _this$_options8.feeAsset;
|
|
13002
13029
|
assertToIsString(to);
|
|
13003
13030
|
assertAddressIsString(address);
|
|
13004
13031
|
_context0.n = 1;
|
|
13005
|
-
return this.
|
|
13032
|
+
return this.overrideTxAmount();
|
|
13006
13033
|
case 1:
|
|
13007
13034
|
tx = _context0.v;
|
|
13008
13035
|
return _context0.a(2, getMinTransferableAmount({
|
|
@@ -13034,15 +13061,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13034
13061
|
key: "verifyEdOnDestination",
|
|
13035
13062
|
value: (function () {
|
|
13036
13063
|
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
13037
|
-
var _this$
|
|
13064
|
+
var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
|
|
13038
13065
|
return _regenerator().w(function (_context1) {
|
|
13039
13066
|
while (1) switch (_context1.n) {
|
|
13040
13067
|
case 0:
|
|
13041
|
-
_this$
|
|
13068
|
+
_this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
|
|
13042
13069
|
assertToIsString(to);
|
|
13043
13070
|
assertAddressIsString(address);
|
|
13044
13071
|
_context1.n = 1;
|
|
13045
|
-
return this.
|
|
13072
|
+
return this.overrideTxAmount();
|
|
13046
13073
|
case 1:
|
|
13047
13074
|
tx = _context1.v;
|
|
13048
13075
|
return _context1.a(2, verifyEdOnDestination({
|
|
@@ -13073,15 +13100,15 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13073
13100
|
key: "getTransferInfo",
|
|
13074
13101
|
value: (function () {
|
|
13075
13102
|
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
13076
|
-
var _this$
|
|
13103
|
+
var _this$_options0, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
|
|
13077
13104
|
return _regenerator().w(function (_context10) {
|
|
13078
13105
|
while (1) switch (_context10.n) {
|
|
13079
13106
|
case 0:
|
|
13080
|
-
_this$
|
|
13107
|
+
_this$_options0 = this._options, from = _this$_options0.from, to = _this$_options0.to, address = _this$_options0.address, currency = _this$_options0.currency, ahAddress = _this$_options0.ahAddress, senderAddress = _this$_options0.senderAddress, feeAsset = _this$_options0.feeAsset;
|
|
13081
13108
|
assertToIsString(to);
|
|
13082
13109
|
assertAddressIsString(address);
|
|
13083
13110
|
_context10.n = 1;
|
|
13084
|
-
return this.
|
|
13111
|
+
return this.overrideTxAmount();
|
|
13085
13112
|
case 1:
|
|
13086
13113
|
tx = _context10.v;
|
|
13087
13114
|
return _context10.a(2, getTransferInfo({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.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.6.
|
|
30
|
-
"@paraspell/sdk-common": "11.6.
|
|
31
|
-
"@paraspell/pallets": "11.6.
|
|
29
|
+
"@paraspell/assets": "11.6.1",
|
|
30
|
+
"@paraspell/sdk-common": "11.6.1",
|
|
31
|
+
"@paraspell/pallets": "11.6.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|