@paraspell/sdk 8.6.2 → 8.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -131,8 +131,9 @@ const builder = Builder(/*node api/ws_url_string/ws_url_array - optional*/)
131
131
  .to(NODE/*,customParaId - optional*/ | Multilocation object)
132
132
  .currency({symbol: 'DOT', amount: amount})
133
133
  .address(address | Multilocation object)
134
- /*.xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
135
- .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
134
+ /*.feeAsset({symbol: 'symbol'} || {id: 'id'} || {multilocation: 'multilocation'}) // Optional parameter used when multiasset is provided or when origin is AssetHub - so user can pay in fees different than DOT
135
+ .xcmVersion(Version.V1/V2/V3/V4) //Optional parameter for manual override of XCM Version used in call
136
+ .customPallet('Pallet','pallet_function') //Optional parameter for manual override of XCM Pallet and function used in call (If they are named differently on some node but syntax stays the same). Both pallet name and function required. Pallet name must be CamelCase, function name snake_case.*/
136
137
 
137
138
  const tx = await builder.build()
138
139
 
package/dist/index.cjs CHANGED
@@ -863,73 +863,104 @@ var PapiApi = /*#__PURE__*/function () {
863
863
  return calculateTransactionFee;
864
864
  }()
865
865
  }, {
866
- key: "getBalanceNative",
866
+ key: "quoteAhPrice",
867
867
  value: function () {
868
- var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(address) {
869
- var res;
868
+ var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(fromMl, toMl, amountIn) {
869
+ var includeFee,
870
+ transformedFromMl,
871
+ transformedToMl,
872
+ response,
873
+ _args5 = arguments;
870
874
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
871
875
  while (1) switch (_context5.prev = _context5.next) {
872
876
  case 0:
873
- _context5.next = 2;
874
- return this.api.getUnsafeApi().query.System.Account.getValue(address);
875
- case 2:
876
- res = _context5.sent;
877
- return _context5.abrupt("return", res.data.free);
878
- case 4:
877
+ includeFee = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : true;
878
+ transformedFromMl = _transform(fromMl);
879
+ transformedToMl = _transform(toMl);
880
+ _context5.next = 5;
881
+ return this.api.getUnsafeApi().apis.AssetConversionApi.quote_price_exact_tokens_for_tokens(transformedFromMl, transformedToMl, amountIn, includeFee);
882
+ case 5:
883
+ response = _context5.sent;
884
+ return _context5.abrupt("return", response ? BigInt(response) : undefined);
885
+ case 7:
879
886
  case "end":
880
887
  return _context5.stop();
881
888
  }
882
889
  }, _callee5, this);
883
890
  }));
884
- function getBalanceNative(_x6) {
885
- return _getBalanceNative.apply(this, arguments);
891
+ function quoteAhPrice(_x6, _x7, _x8) {
892
+ return _quoteAhPrice.apply(this, arguments);
886
893
  }
887
- return getBalanceNative;
894
+ return quoteAhPrice;
888
895
  }()
889
896
  }, {
890
- key: "getBalanceForeignPolkadotXcm",
897
+ key: "getBalanceNative",
891
898
  value: function () {
892
- var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address, id) {
899
+ var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address) {
893
900
  var res;
894
901
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
895
902
  while (1) switch (_context6.prev = _context6.next) {
896
903
  case 0:
897
904
  _context6.next = 2;
898
- return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
905
+ return this.api.getUnsafeApi().query.System.Account.getValue(address);
899
906
  case 2:
900
907
  res = _context6.sent;
901
- return _context6.abrupt("return", res && res.balance ? BigInt(res.balance) : 0n);
908
+ return _context6.abrupt("return", res.data.free);
902
909
  case 4:
903
910
  case "end":
904
911
  return _context6.stop();
905
912
  }
906
913
  }, _callee6, this);
907
914
  }));
908
- function getBalanceForeignPolkadotXcm(_x7, _x8) {
909
- return _getBalanceForeignPolkadotXcm.apply(this, arguments);
915
+ function getBalanceNative(_x9) {
916
+ return _getBalanceNative.apply(this, arguments);
910
917
  }
911
- return getBalanceForeignPolkadotXcm;
918
+ return getBalanceNative;
912
919
  }()
913
920
  }, {
914
- key: "getMythosForeignBalance",
921
+ key: "getBalanceForeignPolkadotXcm",
915
922
  value: function () {
916
- var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address) {
923
+ var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address, id) {
917
924
  var res;
918
925
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
919
926
  while (1) switch (_context7.prev = _context7.next) {
920
927
  case 0:
921
928
  _context7.next = 2;
922
- return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
929
+ return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
923
930
  case 2:
924
931
  res = _context7.sent;
925
- return _context7.abrupt("return", res && res.free ? BigInt(res.free) : 0n);
932
+ return _context7.abrupt("return", res && res.balance ? BigInt(res.balance) : 0n);
926
933
  case 4:
927
934
  case "end":
928
935
  return _context7.stop();
929
936
  }
930
937
  }, _callee7, this);
931
938
  }));
932
- function getMythosForeignBalance(_x9) {
939
+ function getBalanceForeignPolkadotXcm(_x10, _x11) {
940
+ return _getBalanceForeignPolkadotXcm.apply(this, arguments);
941
+ }
942
+ return getBalanceForeignPolkadotXcm;
943
+ }()
944
+ }, {
945
+ key: "getMythosForeignBalance",
946
+ value: function () {
947
+ var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address) {
948
+ var res;
949
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
950
+ while (1) switch (_context8.prev = _context8.next) {
951
+ case 0:
952
+ _context8.next = 2;
953
+ return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
954
+ case 2:
955
+ res = _context8.sent;
956
+ return _context8.abrupt("return", res && res.free ? BigInt(res.free) : 0n);
957
+ case 4:
958
+ case "end":
959
+ return _context8.stop();
960
+ }
961
+ }, _callee8, this);
962
+ }));
963
+ function getMythosForeignBalance(_x12) {
933
964
  return _getMythosForeignBalance.apply(this, arguments);
934
965
  }
935
966
  return getMythosForeignBalance;
@@ -937,24 +968,24 @@ var PapiApi = /*#__PURE__*/function () {
937
968
  }, {
938
969
  key: "getAssetHubForeignBalance",
939
970
  value: function () {
940
- var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address, multiLocation) {
971
+ var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, multiLocation) {
941
972
  var transformedMultiLocation, res;
942
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
943
- while (1) switch (_context8.prev = _context8.next) {
973
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
974
+ while (1) switch (_context9.prev = _context9.next) {
944
975
  case 0:
945
976
  transformedMultiLocation = _transform(multiLocation);
946
- _context8.next = 3;
977
+ _context9.next = 3;
947
978
  return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedMultiLocation, address);
948
979
  case 3:
949
- res = _context8.sent;
950
- return _context8.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
980
+ res = _context9.sent;
981
+ return _context9.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
951
982
  case 5:
952
983
  case "end":
953
- return _context8.stop();
984
+ return _context9.stop();
954
985
  }
955
- }, _callee8, this);
986
+ }, _callee9, this);
956
987
  }));
957
- function getAssetHubForeignBalance(_x10, _x11) {
988
+ function getAssetHubForeignBalance(_x13, _x14) {
958
989
  return _getAssetHubForeignBalance.apply(this, arguments);
959
990
  }
960
991
  return getAssetHubForeignBalance;
@@ -962,23 +993,23 @@ var PapiApi = /*#__PURE__*/function () {
962
993
  }, {
963
994
  key: "getForeignAssetsByIdBalance",
964
995
  value: function () {
965
- var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, assetId) {
996
+ var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, assetId) {
966
997
  var res;
967
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
968
- while (1) switch (_context9.prev = _context9.next) {
998
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
999
+ while (1) switch (_context10.prev = _context10.next) {
969
1000
  case 0:
970
- _context9.next = 2;
1001
+ _context10.next = 2;
971
1002
  return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(assetId, address);
972
1003
  case 2:
973
- res = _context9.sent;
974
- return _context9.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
1004
+ res = _context10.sent;
1005
+ return _context10.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
975
1006
  case 4:
976
1007
  case "end":
977
- return _context9.stop();
1008
+ return _context10.stop();
978
1009
  }
979
- }, _callee9, this);
1010
+ }, _callee10, this);
980
1011
  }));
981
- function getForeignAssetsByIdBalance(_x12, _x13) {
1012
+ function getForeignAssetsByIdBalance(_x15, _x16) {
982
1013
  return _getForeignAssetsByIdBalance.apply(this, arguments);
983
1014
  }
984
1015
  return getForeignAssetsByIdBalance;
@@ -986,26 +1017,26 @@ var PapiApi = /*#__PURE__*/function () {
986
1017
  }, {
987
1018
  key: "getBalanceForeignBifrost",
988
1019
  value: function () {
989
- var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, asset) {
1020
+ var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, asset) {
990
1021
  var currencySelection, transformedParameters, response, accountData;
991
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
992
- while (1) switch (_context10.prev = _context10.next) {
1022
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1023
+ while (1) switch (_context11.prev = _context11.next) {
993
1024
  case 0:
994
1025
  currencySelection = sdkCore.getNode('BifrostPolkadot').getCurrencySelection(asset);
995
1026
  transformedParameters = _transform(currencySelection);
996
- _context10.next = 4;
1027
+ _context11.next = 4;
997
1028
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
998
1029
  case 4:
999
- response = _context10.sent;
1030
+ response = _context11.sent;
1000
1031
  accountData = response ? response : null;
1001
- return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1032
+ return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1002
1033
  case 7:
1003
1034
  case "end":
1004
- return _context10.stop();
1035
+ return _context11.stop();
1005
1036
  }
1006
- }, _callee10, this);
1037
+ }, _callee11, this);
1007
1038
  }));
1008
- function getBalanceForeignBifrost(_x14, _x15) {
1039
+ function getBalanceForeignBifrost(_x17, _x18) {
1009
1040
  return _getBalanceForeignBifrost.apply(this, arguments);
1010
1041
  }
1011
1042
  return getBalanceForeignBifrost;
@@ -1013,27 +1044,27 @@ var PapiApi = /*#__PURE__*/function () {
1013
1044
  }, {
1014
1045
  key: "getBalanceNativeAcala",
1015
1046
  value: function () {
1016
- var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, symbol) {
1047
+ var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, symbol) {
1017
1048
  var transformedParameters, response, accountData;
1018
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1019
- while (1) switch (_context11.prev = _context11.next) {
1049
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1050
+ while (1) switch (_context12.prev = _context12.next) {
1020
1051
  case 0:
1021
1052
  transformedParameters = _transform({
1022
1053
  Token: symbol
1023
1054
  });
1024
- _context11.next = 3;
1055
+ _context12.next = 3;
1025
1056
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
1026
1057
  case 3:
1027
- response = _context11.sent;
1058
+ response = _context12.sent;
1028
1059
  accountData = response ? response : null;
1029
- return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1060
+ return _context12.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1030
1061
  case 6:
1031
1062
  case "end":
1032
- return _context11.stop();
1063
+ return _context12.stop();
1033
1064
  }
1034
- }, _callee11, this);
1065
+ }, _callee12, this);
1035
1066
  }));
1036
- function getBalanceNativeAcala(_x16, _x17) {
1067
+ function getBalanceNativeAcala(_x19, _x20) {
1037
1068
  return _getBalanceNativeAcala.apply(this, arguments);
1038
1069
  }
1039
1070
  return getBalanceNativeAcala;
@@ -1041,19 +1072,19 @@ var PapiApi = /*#__PURE__*/function () {
1041
1072
  }, {
1042
1073
  key: "getBalanceForeignXTokens",
1043
1074
  value: function () {
1044
- var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(node, address, asset) {
1075
+ var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(node, address, asset) {
1045
1076
  var pallet, response, entry;
1046
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1047
- while (1) switch (_context12.prev = _context12.next) {
1077
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1078
+ while (1) switch (_context13.prev = _context13.next) {
1048
1079
  case 0:
1049
1080
  pallet = 'Tokens';
1050
1081
  if (node === 'Centrifuge' || node === 'Altair') {
1051
1082
  pallet = 'OrmlTokens';
1052
1083
  }
1053
- _context12.next = 4;
1084
+ _context13.next = 4;
1054
1085
  return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
1055
1086
  case 4:
1056
- response = _context12.sent;
1087
+ response = _context13.sent;
1057
1088
  entry = response.find(function (_ref2) {
1058
1089
  var _asset$symbol, _asset$assetId, _asset$symbol2, _asset$assetId2;
1059
1090
  var keyArgs = _ref2.keyArgs;
@@ -1062,14 +1093,14 @@ var PapiApi = /*#__PURE__*/function () {
1062
1093
  var assetItem = _keyArgs[1];
1063
1094
  return assetItem.toString().toLowerCase() === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || sdkCore.isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && sdkCore.isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
1064
1095
  });
1065
- return _context12.abrupt("return", entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
1096
+ return _context13.abrupt("return", entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
1066
1097
  case 7:
1067
1098
  case "end":
1068
- return _context12.stop();
1099
+ return _context13.stop();
1069
1100
  }
1070
- }, _callee12, this);
1101
+ }, _callee13, this);
1071
1102
  }));
1072
- function getBalanceForeignXTokens(_x18, _x19, _x20) {
1103
+ function getBalanceForeignXTokens(_x21, _x22, _x23) {
1073
1104
  return _getBalanceForeignXTokens.apply(this, arguments);
1074
1105
  }
1075
1106
  return getBalanceForeignXTokens;
@@ -1077,23 +1108,23 @@ var PapiApi = /*#__PURE__*/function () {
1077
1108
  }, {
1078
1109
  key: "getBalanceForeignAssetsAccount",
1079
1110
  value: function () {
1080
- var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(address, assetId) {
1111
+ var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, assetId) {
1081
1112
  var response;
1082
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1083
- while (1) switch (_context13.prev = _context13.next) {
1113
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1114
+ while (1) switch (_context14.prev = _context14.next) {
1084
1115
  case 0:
1085
- _context13.next = 2;
1116
+ _context14.next = 2;
1086
1117
  return this.api.getUnsafeApi().query.Assets.Account.getValue(assetId, address);
1087
1118
  case 2:
1088
- response = _context13.sent;
1089
- return _context13.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
1119
+ response = _context14.sent;
1120
+ return _context14.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
1090
1121
  case 4:
1091
1122
  case "end":
1092
- return _context13.stop();
1123
+ return _context14.stop();
1093
1124
  }
1094
- }, _callee13, this);
1125
+ }, _callee14, this);
1095
1126
  }));
1096
- function getBalanceForeignAssetsAccount(_x21, _x22) {
1127
+ function getBalanceForeignAssetsAccount(_x24, _x25) {
1097
1128
  return _getBalanceForeignAssetsAccount.apply(this, arguments);
1098
1129
  }
1099
1130
  return getBalanceForeignAssetsAccount;
@@ -1101,24 +1132,24 @@ var PapiApi = /*#__PURE__*/function () {
1101
1132
  }, {
1102
1133
  key: "getFromRpc",
1103
1134
  value: function () {
1104
- var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(module, method, key) {
1135
+ var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(module, method, key) {
1105
1136
  var toSS58, value;
1106
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1107
- while (1) switch (_context14.prev = _context14.next) {
1137
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1138
+ while (1) switch (_context15.prev = _context15.next) {
1108
1139
  case 0:
1109
1140
  toSS58 = polkadotApi.AccountId().dec;
1110
- _context14.next = 3;
1141
+ _context15.next = 3;
1111
1142
  return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) ? toSS58(key) : key]);
1112
1143
  case 3:
1113
- value = _context14.sent;
1114
- return _context14.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
1144
+ value = _context15.sent;
1145
+ return _context15.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
1115
1146
  case 5:
1116
1147
  case "end":
1117
- return _context14.stop();
1148
+ return _context15.stop();
1118
1149
  }
1119
- }, _callee14, this);
1150
+ }, _callee15, this);
1120
1151
  }));
1121
- function getFromRpc(_x23, _x24, _x25) {
1152
+ function getFromRpc(_x26, _x27, _x28) {
1122
1153
  return _getFromRpc.apply(this, arguments);
1123
1154
  }
1124
1155
  return getFromRpc;
@@ -1131,23 +1162,23 @@ var PapiApi = /*#__PURE__*/function () {
1131
1162
  }, {
1132
1163
  key: "createApiForNode",
1133
1164
  value: function () {
1134
- var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(node) {
1165
+ var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(node) {
1135
1166
  var api;
1136
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1137
- while (1) switch (_context15.prev = _context15.next) {
1167
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1168
+ while (1) switch (_context16.prev = _context16.next) {
1138
1169
  case 0:
1139
1170
  api = new PapiApi();
1140
- _context15.next = 3;
1171
+ _context16.next = 3;
1141
1172
  return api.init(node);
1142
1173
  case 3:
1143
- return _context15.abrupt("return", api);
1174
+ return _context16.abrupt("return", api);
1144
1175
  case 4:
1145
1176
  case "end":
1146
- return _context15.stop();
1177
+ return _context16.stop();
1147
1178
  }
1148
- }, _callee15);
1179
+ }, _callee16);
1149
1180
  }));
1150
- function createApiForNode(_x26) {
1181
+ function createApiForNode(_x29) {
1151
1182
  return _createApiForNode.apply(this, arguments);
1152
1183
  }
1153
1184
  return createApiForNode;
@@ -1155,20 +1186,20 @@ var PapiApi = /*#__PURE__*/function () {
1155
1186
  }, {
1156
1187
  key: "getDryRun",
1157
1188
  value: function () {
1158
- var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref3) {
1159
- var tx, address, node, supportsDryRunApi, result, isSuccess, failureReason, executionFee, fee;
1160
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1161
- while (1) switch (_context16.prev = _context16.next) {
1189
+ var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref3) {
1190
+ var tx, address, node, supportsDryRunApi, result, isSuccess, failureReason, executionFee, fee, actualWeight, weight;
1191
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1192
+ while (1) switch (_context17.prev = _context17.next) {
1162
1193
  case 0:
1163
1194
  tx = _ref3.tx, address = _ref3.address, node = _ref3.node;
1164
1195
  supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1165
1196
  if (supportsDryRunApi) {
1166
- _context16.next = 4;
1197
+ _context17.next = 4;
1167
1198
  break;
1168
1199
  }
1169
1200
  throw new Error("DryRunApi is not available on node ".concat(node));
1170
1201
  case 4:
1171
- _context16.next = 6;
1202
+ _context17.next = 6;
1172
1203
  return this.api.getUnsafeApi().apis.DryRunApi.dry_run_call({
1173
1204
  type: 'system',
1174
1205
  value: {
@@ -1177,34 +1208,40 @@ var PapiApi = /*#__PURE__*/function () {
1177
1208
  }
1178
1209
  }, tx.decodedCall);
1179
1210
  case 6:
1180
- result = _context16.sent;
1211
+ result = _context17.sent;
1181
1212
  isSuccess = result.success && result.value.execution_result.success;
1182
1213
  if (isSuccess) {
1183
- _context16.next = 11;
1214
+ _context17.next = 11;
1184
1215
  break;
1185
1216
  }
1186
1217
  failureReason = result.value.execution_result.value.error.value.value.type;
1187
- return _context16.abrupt("return", Promise.resolve({
1218
+ return _context17.abrupt("return", Promise.resolve({
1188
1219
  success: false,
1189
1220
  failureReason: failureReason
1190
1221
  }));
1191
1222
  case 11:
1192
- _context16.next = 13;
1223
+ _context17.next = 13;
1193
1224
  return this.calculateTransactionFee(tx, address);
1194
1225
  case 13:
1195
- executionFee = _context16.sent;
1226
+ executionFee = _context17.sent;
1196
1227
  fee = sdkCore.computeFeeFromDryRun(result, node, executionFee);
1197
- return _context16.abrupt("return", Promise.resolve({
1228
+ actualWeight = result.value.execution_result.value.actual_weight;
1229
+ weight = actualWeight ? {
1230
+ refTime: actualWeight.ref_time,
1231
+ proofSize: actualWeight.proof_size
1232
+ } : undefined;
1233
+ return _context17.abrupt("return", Promise.resolve({
1198
1234
  success: true,
1199
- fee: fee
1235
+ fee: fee,
1236
+ weight: weight
1200
1237
  }));
1201
- case 16:
1238
+ case 18:
1202
1239
  case "end":
1203
- return _context16.stop();
1240
+ return _context17.stop();
1204
1241
  }
1205
- }, _callee16, this);
1242
+ }, _callee17, this);
1206
1243
  }));
1207
- function getDryRun(_x27) {
1244
+ function getDryRun(_x30) {
1208
1245
  return _getDryRun.apply(this, arguments);
1209
1246
  }
1210
1247
  return getDryRun;
package/dist/index.mjs CHANGED
@@ -862,73 +862,104 @@ var PapiApi = /*#__PURE__*/function () {
862
862
  return calculateTransactionFee;
863
863
  }()
864
864
  }, {
865
- key: "getBalanceNative",
865
+ key: "quoteAhPrice",
866
866
  value: function () {
867
- var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(address) {
868
- var res;
867
+ var _quoteAhPrice = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(fromMl, toMl, amountIn) {
868
+ var includeFee,
869
+ transformedFromMl,
870
+ transformedToMl,
871
+ response,
872
+ _args5 = arguments;
869
873
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
870
874
  while (1) switch (_context5.prev = _context5.next) {
871
875
  case 0:
872
- _context5.next = 2;
873
- return this.api.getUnsafeApi().query.System.Account.getValue(address);
874
- case 2:
875
- res = _context5.sent;
876
- return _context5.abrupt("return", res.data.free);
877
- case 4:
876
+ includeFee = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : true;
877
+ transformedFromMl = _transform(fromMl);
878
+ transformedToMl = _transform(toMl);
879
+ _context5.next = 5;
880
+ return this.api.getUnsafeApi().apis.AssetConversionApi.quote_price_exact_tokens_for_tokens(transformedFromMl, transformedToMl, amountIn, includeFee);
881
+ case 5:
882
+ response = _context5.sent;
883
+ return _context5.abrupt("return", response ? BigInt(response) : undefined);
884
+ case 7:
878
885
  case "end":
879
886
  return _context5.stop();
880
887
  }
881
888
  }, _callee5, this);
882
889
  }));
883
- function getBalanceNative(_x6) {
884
- return _getBalanceNative.apply(this, arguments);
890
+ function quoteAhPrice(_x6, _x7, _x8) {
891
+ return _quoteAhPrice.apply(this, arguments);
885
892
  }
886
- return getBalanceNative;
893
+ return quoteAhPrice;
887
894
  }()
888
895
  }, {
889
- key: "getBalanceForeignPolkadotXcm",
896
+ key: "getBalanceNative",
890
897
  value: function () {
891
- var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address, id) {
898
+ var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address) {
892
899
  var res;
893
900
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
894
901
  while (1) switch (_context6.prev = _context6.next) {
895
902
  case 0:
896
903
  _context6.next = 2;
897
- return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
904
+ return this.api.getUnsafeApi().query.System.Account.getValue(address);
898
905
  case 2:
899
906
  res = _context6.sent;
900
- return _context6.abrupt("return", res && res.balance ? BigInt(res.balance) : 0n);
907
+ return _context6.abrupt("return", res.data.free);
901
908
  case 4:
902
909
  case "end":
903
910
  return _context6.stop();
904
911
  }
905
912
  }, _callee6, this);
906
913
  }));
907
- function getBalanceForeignPolkadotXcm(_x7, _x8) {
908
- return _getBalanceForeignPolkadotXcm.apply(this, arguments);
914
+ function getBalanceNative(_x9) {
915
+ return _getBalanceNative.apply(this, arguments);
909
916
  }
910
- return getBalanceForeignPolkadotXcm;
917
+ return getBalanceNative;
911
918
  }()
912
919
  }, {
913
- key: "getMythosForeignBalance",
920
+ key: "getBalanceForeignPolkadotXcm",
914
921
  value: function () {
915
- var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address) {
922
+ var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address, id) {
916
923
  var res;
917
924
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
918
925
  while (1) switch (_context7.prev = _context7.next) {
919
926
  case 0:
920
927
  _context7.next = 2;
921
- return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
928
+ return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
922
929
  case 2:
923
930
  res = _context7.sent;
924
- return _context7.abrupt("return", res && res.free ? BigInt(res.free) : 0n);
931
+ return _context7.abrupt("return", res && res.balance ? BigInt(res.balance) : 0n);
925
932
  case 4:
926
933
  case "end":
927
934
  return _context7.stop();
928
935
  }
929
936
  }, _callee7, this);
930
937
  }));
931
- function getMythosForeignBalance(_x9) {
938
+ function getBalanceForeignPolkadotXcm(_x10, _x11) {
939
+ return _getBalanceForeignPolkadotXcm.apply(this, arguments);
940
+ }
941
+ return getBalanceForeignPolkadotXcm;
942
+ }()
943
+ }, {
944
+ key: "getMythosForeignBalance",
945
+ value: function () {
946
+ var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address) {
947
+ var res;
948
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
949
+ while (1) switch (_context8.prev = _context8.next) {
950
+ case 0:
951
+ _context8.next = 2;
952
+ return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
953
+ case 2:
954
+ res = _context8.sent;
955
+ return _context8.abrupt("return", res && res.free ? BigInt(res.free) : 0n);
956
+ case 4:
957
+ case "end":
958
+ return _context8.stop();
959
+ }
960
+ }, _callee8, this);
961
+ }));
962
+ function getMythosForeignBalance(_x12) {
932
963
  return _getMythosForeignBalance.apply(this, arguments);
933
964
  }
934
965
  return getMythosForeignBalance;
@@ -936,24 +967,24 @@ var PapiApi = /*#__PURE__*/function () {
936
967
  }, {
937
968
  key: "getAssetHubForeignBalance",
938
969
  value: function () {
939
- var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address, multiLocation) {
970
+ var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, multiLocation) {
940
971
  var transformedMultiLocation, res;
941
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
942
- while (1) switch (_context8.prev = _context8.next) {
972
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
973
+ while (1) switch (_context9.prev = _context9.next) {
943
974
  case 0:
944
975
  transformedMultiLocation = _transform(multiLocation);
945
- _context8.next = 3;
976
+ _context9.next = 3;
946
977
  return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedMultiLocation, address);
947
978
  case 3:
948
- res = _context8.sent;
949
- return _context8.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
979
+ res = _context9.sent;
980
+ return _context9.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
950
981
  case 5:
951
982
  case "end":
952
- return _context8.stop();
983
+ return _context9.stop();
953
984
  }
954
- }, _callee8, this);
985
+ }, _callee9, this);
955
986
  }));
956
- function getAssetHubForeignBalance(_x10, _x11) {
987
+ function getAssetHubForeignBalance(_x13, _x14) {
957
988
  return _getAssetHubForeignBalance.apply(this, arguments);
958
989
  }
959
990
  return getAssetHubForeignBalance;
@@ -961,23 +992,23 @@ var PapiApi = /*#__PURE__*/function () {
961
992
  }, {
962
993
  key: "getForeignAssetsByIdBalance",
963
994
  value: function () {
964
- var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, assetId) {
995
+ var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, assetId) {
965
996
  var res;
966
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
967
- while (1) switch (_context9.prev = _context9.next) {
997
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
998
+ while (1) switch (_context10.prev = _context10.next) {
968
999
  case 0:
969
- _context9.next = 2;
1000
+ _context10.next = 2;
970
1001
  return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(assetId, address);
971
1002
  case 2:
972
- res = _context9.sent;
973
- return _context9.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
1003
+ res = _context10.sent;
1004
+ return _context10.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
974
1005
  case 4:
975
1006
  case "end":
976
- return _context9.stop();
1007
+ return _context10.stop();
977
1008
  }
978
- }, _callee9, this);
1009
+ }, _callee10, this);
979
1010
  }));
980
- function getForeignAssetsByIdBalance(_x12, _x13) {
1011
+ function getForeignAssetsByIdBalance(_x15, _x16) {
981
1012
  return _getForeignAssetsByIdBalance.apply(this, arguments);
982
1013
  }
983
1014
  return getForeignAssetsByIdBalance;
@@ -985,26 +1016,26 @@ var PapiApi = /*#__PURE__*/function () {
985
1016
  }, {
986
1017
  key: "getBalanceForeignBifrost",
987
1018
  value: function () {
988
- var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, asset) {
1019
+ var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, asset) {
989
1020
  var currencySelection, transformedParameters, response, accountData;
990
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
991
- while (1) switch (_context10.prev = _context10.next) {
1021
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1022
+ while (1) switch (_context11.prev = _context11.next) {
992
1023
  case 0:
993
1024
  currencySelection = getNode('BifrostPolkadot').getCurrencySelection(asset);
994
1025
  transformedParameters = _transform(currencySelection);
995
- _context10.next = 4;
1026
+ _context11.next = 4;
996
1027
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
997
1028
  case 4:
998
- response = _context10.sent;
1029
+ response = _context11.sent;
999
1030
  accountData = response ? response : null;
1000
- return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1031
+ return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1001
1032
  case 7:
1002
1033
  case "end":
1003
- return _context10.stop();
1034
+ return _context11.stop();
1004
1035
  }
1005
- }, _callee10, this);
1036
+ }, _callee11, this);
1006
1037
  }));
1007
- function getBalanceForeignBifrost(_x14, _x15) {
1038
+ function getBalanceForeignBifrost(_x17, _x18) {
1008
1039
  return _getBalanceForeignBifrost.apply(this, arguments);
1009
1040
  }
1010
1041
  return getBalanceForeignBifrost;
@@ -1012,27 +1043,27 @@ var PapiApi = /*#__PURE__*/function () {
1012
1043
  }, {
1013
1044
  key: "getBalanceNativeAcala",
1014
1045
  value: function () {
1015
- var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, symbol) {
1046
+ var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, symbol) {
1016
1047
  var transformedParameters, response, accountData;
1017
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1018
- while (1) switch (_context11.prev = _context11.next) {
1048
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1049
+ while (1) switch (_context12.prev = _context12.next) {
1019
1050
  case 0:
1020
1051
  transformedParameters = _transform({
1021
1052
  Token: symbol
1022
1053
  });
1023
- _context11.next = 3;
1054
+ _context12.next = 3;
1024
1055
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
1025
1056
  case 3:
1026
- response = _context11.sent;
1057
+ response = _context12.sent;
1027
1058
  accountData = response ? response : null;
1028
- return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1059
+ return _context12.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1029
1060
  case 6:
1030
1061
  case "end":
1031
- return _context11.stop();
1062
+ return _context12.stop();
1032
1063
  }
1033
- }, _callee11, this);
1064
+ }, _callee12, this);
1034
1065
  }));
1035
- function getBalanceNativeAcala(_x16, _x17) {
1066
+ function getBalanceNativeAcala(_x19, _x20) {
1036
1067
  return _getBalanceNativeAcala.apply(this, arguments);
1037
1068
  }
1038
1069
  return getBalanceNativeAcala;
@@ -1040,19 +1071,19 @@ var PapiApi = /*#__PURE__*/function () {
1040
1071
  }, {
1041
1072
  key: "getBalanceForeignXTokens",
1042
1073
  value: function () {
1043
- var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(node, address, asset) {
1074
+ var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(node, address, asset) {
1044
1075
  var pallet, response, entry;
1045
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1046
- while (1) switch (_context12.prev = _context12.next) {
1076
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1077
+ while (1) switch (_context13.prev = _context13.next) {
1047
1078
  case 0:
1048
1079
  pallet = 'Tokens';
1049
1080
  if (node === 'Centrifuge' || node === 'Altair') {
1050
1081
  pallet = 'OrmlTokens';
1051
1082
  }
1052
- _context12.next = 4;
1083
+ _context13.next = 4;
1053
1084
  return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
1054
1085
  case 4:
1055
- response = _context12.sent;
1086
+ response = _context13.sent;
1056
1087
  entry = response.find(function (_ref2) {
1057
1088
  var _asset$symbol, _asset$assetId, _asset$symbol2, _asset$assetId2;
1058
1089
  var keyArgs = _ref2.keyArgs;
@@ -1061,14 +1092,14 @@ var PapiApi = /*#__PURE__*/function () {
1061
1092
  var assetItem = _keyArgs[1];
1062
1093
  return assetItem.toString().toLowerCase() === ((_asset$symbol = asset.symbol) === null || _asset$symbol === void 0 ? void 0 : _asset$symbol.toLowerCase()) || isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_asset$assetId = asset.assetId) === null || _asset$assetId === void 0 ? void 0 : _asset$assetId.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === void 0 ? void 0 : _asset$symbol2.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === void 0 ? void 0 : _asset$assetId2.toLowerCase());
1063
1094
  });
1064
- return _context12.abrupt("return", entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
1095
+ return _context13.abrupt("return", entry !== null && entry !== void 0 && entry.value ? BigInt(entry.value.free.toString()) : 0n);
1065
1096
  case 7:
1066
1097
  case "end":
1067
- return _context12.stop();
1098
+ return _context13.stop();
1068
1099
  }
1069
- }, _callee12, this);
1100
+ }, _callee13, this);
1070
1101
  }));
1071
- function getBalanceForeignXTokens(_x18, _x19, _x20) {
1102
+ function getBalanceForeignXTokens(_x21, _x22, _x23) {
1072
1103
  return _getBalanceForeignXTokens.apply(this, arguments);
1073
1104
  }
1074
1105
  return getBalanceForeignXTokens;
@@ -1076,23 +1107,23 @@ var PapiApi = /*#__PURE__*/function () {
1076
1107
  }, {
1077
1108
  key: "getBalanceForeignAssetsAccount",
1078
1109
  value: function () {
1079
- var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(address, assetId) {
1110
+ var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(address, assetId) {
1080
1111
  var response;
1081
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1082
- while (1) switch (_context13.prev = _context13.next) {
1112
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1113
+ while (1) switch (_context14.prev = _context14.next) {
1083
1114
  case 0:
1084
- _context13.next = 2;
1115
+ _context14.next = 2;
1085
1116
  return this.api.getUnsafeApi().query.Assets.Account.getValue(assetId, address);
1086
1117
  case 2:
1087
- response = _context13.sent;
1088
- return _context13.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
1118
+ response = _context14.sent;
1119
+ return _context14.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
1089
1120
  case 4:
1090
1121
  case "end":
1091
- return _context13.stop();
1122
+ return _context14.stop();
1092
1123
  }
1093
- }, _callee13, this);
1124
+ }, _callee14, this);
1094
1125
  }));
1095
- function getBalanceForeignAssetsAccount(_x21, _x22) {
1126
+ function getBalanceForeignAssetsAccount(_x24, _x25) {
1096
1127
  return _getBalanceForeignAssetsAccount.apply(this, arguments);
1097
1128
  }
1098
1129
  return getBalanceForeignAssetsAccount;
@@ -1100,24 +1131,24 @@ var PapiApi = /*#__PURE__*/function () {
1100
1131
  }, {
1101
1132
  key: "getFromRpc",
1102
1133
  value: function () {
1103
- var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(module, method, key) {
1134
+ var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(module, method, key) {
1104
1135
  var toSS58, value;
1105
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1106
- while (1) switch (_context14.prev = _context14.next) {
1136
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1137
+ while (1) switch (_context15.prev = _context15.next) {
1107
1138
  case 0:
1108
1139
  toSS58 = AccountId().dec;
1109
- _context14.next = 3;
1140
+ _context15.next = 3;
1110
1141
  return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) ? toSS58(key) : key]);
1111
1142
  case 3:
1112
- value = _context14.sent;
1113
- return _context14.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
1143
+ value = _context15.sent;
1144
+ return _context15.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
1114
1145
  case 5:
1115
1146
  case "end":
1116
- return _context14.stop();
1147
+ return _context15.stop();
1117
1148
  }
1118
- }, _callee14, this);
1149
+ }, _callee15, this);
1119
1150
  }));
1120
- function getFromRpc(_x23, _x24, _x25) {
1151
+ function getFromRpc(_x26, _x27, _x28) {
1121
1152
  return _getFromRpc.apply(this, arguments);
1122
1153
  }
1123
1154
  return getFromRpc;
@@ -1130,23 +1161,23 @@ var PapiApi = /*#__PURE__*/function () {
1130
1161
  }, {
1131
1162
  key: "createApiForNode",
1132
1163
  value: function () {
1133
- var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(node) {
1164
+ var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(node) {
1134
1165
  var api;
1135
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1136
- while (1) switch (_context15.prev = _context15.next) {
1166
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1167
+ while (1) switch (_context16.prev = _context16.next) {
1137
1168
  case 0:
1138
1169
  api = new PapiApi();
1139
- _context15.next = 3;
1170
+ _context16.next = 3;
1140
1171
  return api.init(node);
1141
1172
  case 3:
1142
- return _context15.abrupt("return", api);
1173
+ return _context16.abrupt("return", api);
1143
1174
  case 4:
1144
1175
  case "end":
1145
- return _context15.stop();
1176
+ return _context16.stop();
1146
1177
  }
1147
- }, _callee15);
1178
+ }, _callee16);
1148
1179
  }));
1149
- function createApiForNode(_x26) {
1180
+ function createApiForNode(_x29) {
1150
1181
  return _createApiForNode.apply(this, arguments);
1151
1182
  }
1152
1183
  return createApiForNode;
@@ -1154,20 +1185,20 @@ var PapiApi = /*#__PURE__*/function () {
1154
1185
  }, {
1155
1186
  key: "getDryRun",
1156
1187
  value: function () {
1157
- var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref3) {
1158
- var tx, address, node, supportsDryRunApi, result, isSuccess, failureReason, executionFee, fee;
1159
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1160
- while (1) switch (_context16.prev = _context16.next) {
1188
+ var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(_ref3) {
1189
+ var tx, address, node, supportsDryRunApi, result, isSuccess, failureReason, executionFee, fee, actualWeight, weight;
1190
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
1191
+ while (1) switch (_context17.prev = _context17.next) {
1161
1192
  case 0:
1162
1193
  tx = _ref3.tx, address = _ref3.address, node = _ref3.node;
1163
1194
  supportsDryRunApi = getAssetsObject(node).supportsDryRunApi;
1164
1195
  if (supportsDryRunApi) {
1165
- _context16.next = 4;
1196
+ _context17.next = 4;
1166
1197
  break;
1167
1198
  }
1168
1199
  throw new Error("DryRunApi is not available on node ".concat(node));
1169
1200
  case 4:
1170
- _context16.next = 6;
1201
+ _context17.next = 6;
1171
1202
  return this.api.getUnsafeApi().apis.DryRunApi.dry_run_call({
1172
1203
  type: 'system',
1173
1204
  value: {
@@ -1176,34 +1207,40 @@ var PapiApi = /*#__PURE__*/function () {
1176
1207
  }
1177
1208
  }, tx.decodedCall);
1178
1209
  case 6:
1179
- result = _context16.sent;
1210
+ result = _context17.sent;
1180
1211
  isSuccess = result.success && result.value.execution_result.success;
1181
1212
  if (isSuccess) {
1182
- _context16.next = 11;
1213
+ _context17.next = 11;
1183
1214
  break;
1184
1215
  }
1185
1216
  failureReason = result.value.execution_result.value.error.value.value.type;
1186
- return _context16.abrupt("return", Promise.resolve({
1217
+ return _context17.abrupt("return", Promise.resolve({
1187
1218
  success: false,
1188
1219
  failureReason: failureReason
1189
1220
  }));
1190
1221
  case 11:
1191
- _context16.next = 13;
1222
+ _context17.next = 13;
1192
1223
  return this.calculateTransactionFee(tx, address);
1193
1224
  case 13:
1194
- executionFee = _context16.sent;
1225
+ executionFee = _context17.sent;
1195
1226
  fee = computeFeeFromDryRun(result, node, executionFee);
1196
- return _context16.abrupt("return", Promise.resolve({
1227
+ actualWeight = result.value.execution_result.value.actual_weight;
1228
+ weight = actualWeight ? {
1229
+ refTime: actualWeight.ref_time,
1230
+ proofSize: actualWeight.proof_size
1231
+ } : undefined;
1232
+ return _context17.abrupt("return", Promise.resolve({
1197
1233
  success: true,
1198
- fee: fee
1234
+ fee: fee,
1235
+ weight: weight
1199
1236
  }));
1200
- case 16:
1237
+ case 18:
1201
1238
  case "end":
1202
- return _context16.stop();
1239
+ return _context17.stop();
1203
1240
  }
1204
- }, _callee16, this);
1241
+ }, _callee17, this);
1205
1242
  }));
1206
- function getDryRun(_x27) {
1243
+ function getDryRun(_x30) {
1207
1244
  return _getDryRun.apply(this, arguments);
1208
1245
  }
1209
1246
  return getDryRun;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "8.6.2",
3
+ "version": "8.7.0",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "ethers": "^6.13.5",
27
27
  "viem": "^2.23.5",
28
28
  "@noble/hashes": "^1.7.1",
29
- "@paraspell/sdk-core": "8.6.2"
29
+ "@paraspell/sdk-core": "8.7.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "polkadot-api": ">= 1.9.3 < 2"