@paraspell/sdk 8.5.1 → 8.5.3

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
@@ -336,6 +336,9 @@ await getTransferInfo({from, to, address, destinationAddress, currency /*- {id:
336
336
 
337
337
  //Get bridge and execution fee for transfer from Parachain to Ethereum. Returns as an object of 2 values - [bridgeFee, executionFee]
338
338
  await getParaEthTransferFees(/*api - optional (Can also be WS port string or array o WS ports. Must be AssetHubPolkadot WS!)*/)
339
+
340
+ //Verify whether XCM message you wish to send will reach above existential deposit on destination chain.
341
+ await verifyEdOnDestination(node, currency: {symbol: || id: || multilocation: .. ,amount: 100000n}, address)
339
342
  ```
340
343
 
341
344
  ## 💻 Tests
package/dist/index.cjs CHANGED
@@ -3,6 +3,8 @@
3
3
  var sdkCore = require('@paraspell/sdk-core');
4
4
  var polkadotSdkCompat = require('polkadot-api/polkadot-sdk-compat');
5
5
  var polkadotApi = require('polkadot-api');
6
+ var blake2b = require('@noble/hashes/blake2b');
7
+ var utils = require('@noble/hashes/utils');
6
8
 
7
9
  function _arrayLikeToArray(r, a) {
8
10
  (null == a || a > r.length) && (a = r.length);
@@ -545,6 +547,11 @@ var _transform = function transform(obj) {
545
547
  key: polkadotApi.FixedSizeBinary.fromHex(value.key)
546
548
  }
547
549
  };
550
+ } else if (key === 'SetTopic') {
551
+ return {
552
+ type: key,
553
+ value: polkadotApi.FixedSizeBinary.fromHex(value)
554
+ };
548
555
  } else if (key === 'X1' && Array.isArray(value)) {
549
556
  return {
550
557
  type: key,
@@ -632,6 +639,9 @@ var _transform = function transform(obj) {
632
639
  };
633
640
 
634
641
  var unsupportedNodes = ['ComposableFinance', 'Interlay', 'Parallel', 'CrustShadow', 'Kintsugi', 'ParallelHeiko', 'Picasso', 'RobonomicsKusama', 'Turing', 'Pendulum', 'Subsocial'];
642
+ var isHex = function isHex(str) {
643
+ return typeof str === 'string' && /^0x[0-9a-fA-F]+$/.test(str);
644
+ };
635
645
  var PapiApi = /*#__PURE__*/function () {
636
646
  function PapiApi() {
637
647
  _classCallCheck(this, PapiApi);
@@ -749,16 +759,12 @@ var PapiApi = /*#__PURE__*/function () {
749
759
  }
750
760
  return createApiInstance;
751
761
  }()
752
- }, {
753
- key: "createAccountId",
754
- value: function createAccountId(address) {
755
- return polkadotApi.FixedSizeBinary.fromAccountId32(address).asHex();
756
- }
757
762
  }, {
758
763
  key: "accountToHex",
759
764
  value: function accountToHex(address) {
760
765
  var isPrefixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
761
- var hex = this.createAccountId(address);
766
+ if (isHex(address)) return address;
767
+ var hex = polkadotApi.FixedSizeBinary.fromAccountId32(address).asHex();
762
768
  return isPrefixed ? hex : hex.slice(2);
763
769
  }
764
770
  }, {
@@ -781,92 +787,149 @@ var PapiApi = /*#__PURE__*/function () {
781
787
  });
782
788
  }
783
789
  }, {
784
- key: "calculateTransactionFee",
790
+ key: "objectToHex",
785
791
  value: function () {
786
- var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(tx, address) {
792
+ var _objectToHex = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(obj) {
793
+ var transformedObj, tx, removeFirst5Bytes, encodedData;
787
794
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
788
795
  while (1) switch (_context3.prev = _context3.next) {
789
796
  case 0:
790
- return _context3.abrupt("return", tx.getEstimatedFees(address));
791
- case 1:
797
+ transformedObj = _transform(obj);
798
+ tx = this.api.getUnsafeApi().tx.PolkadotXcm.send({
799
+ dest: {
800
+ type: sdkCore.Version.V4,
801
+ value: {
802
+ parents: sdkCore.Parents.ZERO,
803
+ interior: {
804
+ type: 'Here'
805
+ }
806
+ }
807
+ },
808
+ message: transformedObj
809
+ });
810
+ removeFirst5Bytes = function removeFirst5Bytes(hexString) {
811
+ return '0x' + hexString.slice(12);
812
+ };
813
+ _context3.next = 5;
814
+ return tx.getEncodedData();
815
+ case 5:
816
+ encodedData = _context3.sent;
817
+ return _context3.abrupt("return", removeFirst5Bytes(encodedData.asHex()));
818
+ case 7:
792
819
  case "end":
793
820
  return _context3.stop();
794
821
  }
795
- }, _callee3);
822
+ }, _callee3, this);
796
823
  }));
797
- function calculateTransactionFee(_x3, _x4) {
798
- return _calculateTransactionFee.apply(this, arguments);
824
+ function objectToHex(_x3) {
825
+ return _objectToHex.apply(this, arguments);
799
826
  }
800
- return calculateTransactionFee;
827
+ return objectToHex;
801
828
  }()
802
829
  }, {
803
- key: "getBalanceNative",
830
+ key: "hexToUint8a",
831
+ value: function hexToUint8a(hex) {
832
+ return polkadotApi.Binary.fromHex(hex).asBytes();
833
+ }
834
+ }, {
835
+ key: "stringToUint8a",
836
+ value: function stringToUint8a(str) {
837
+ return polkadotApi.Binary.fromText(str).asBytes();
838
+ }
839
+ }, {
840
+ key: "blake2AsHex",
841
+ value: function blake2AsHex(data) {
842
+ return "0x".concat(utils.bytesToHex(blake2b.blake2b(data, {
843
+ dkLen: 32
844
+ })));
845
+ }
846
+ }, {
847
+ key: "calculateTransactionFee",
804
848
  value: function () {
805
- var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(address) {
806
- var res;
849
+ var _calculateTransactionFee = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(tx, address) {
807
850
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
808
851
  while (1) switch (_context4.prev = _context4.next) {
809
852
  case 0:
810
- _context4.next = 2;
811
- return this.api.getUnsafeApi().query.System.Account.getValue(address);
812
- case 2:
813
- res = _context4.sent;
814
- return _context4.abrupt("return", res.data.free);
815
- case 4:
853
+ return _context4.abrupt("return", tx.getEstimatedFees(address));
854
+ case 1:
816
855
  case "end":
817
856
  return _context4.stop();
818
857
  }
819
- }, _callee4, this);
858
+ }, _callee4);
820
859
  }));
821
- function getBalanceNative(_x5) {
822
- return _getBalanceNative.apply(this, arguments);
860
+ function calculateTransactionFee(_x4, _x5) {
861
+ return _calculateTransactionFee.apply(this, arguments);
823
862
  }
824
- return getBalanceNative;
863
+ return calculateTransactionFee;
825
864
  }()
826
865
  }, {
827
- key: "getBalanceForeignPolkadotXcm",
866
+ key: "getBalanceNative",
828
867
  value: function () {
829
- var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(address, id) {
868
+ var _getBalanceNative = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(address) {
830
869
  var res;
831
870
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
832
871
  while (1) switch (_context5.prev = _context5.next) {
833
872
  case 0:
834
873
  _context5.next = 2;
835
- return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
874
+ return this.api.getUnsafeApi().query.System.Account.getValue(address);
836
875
  case 2:
837
876
  res = _context5.sent;
838
- return _context5.abrupt("return", res && res.balance ? BigInt(res.balance) : 0n);
877
+ return _context5.abrupt("return", res.data.free);
839
878
  case 4:
840
879
  case "end":
841
880
  return _context5.stop();
842
881
  }
843
882
  }, _callee5, this);
844
883
  }));
845
- function getBalanceForeignPolkadotXcm(_x6, _x7) {
846
- return _getBalanceForeignPolkadotXcm.apply(this, arguments);
884
+ function getBalanceNative(_x6) {
885
+ return _getBalanceNative.apply(this, arguments);
847
886
  }
848
- return getBalanceForeignPolkadotXcm;
887
+ return getBalanceNative;
849
888
  }()
850
889
  }, {
851
- key: "getMythosForeignBalance",
890
+ key: "getBalanceForeignPolkadotXcm",
852
891
  value: function () {
853
- var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address) {
892
+ var _getBalanceForeignPolkadotXcm = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(address, id) {
854
893
  var res;
855
894
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
856
895
  while (1) switch (_context6.prev = _context6.next) {
857
896
  case 0:
858
897
  _context6.next = 2;
859
- return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
898
+ return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
860
899
  case 2:
861
900
  res = _context6.sent;
862
- return _context6.abrupt("return", res && res.free ? BigInt(res.free) : 0n);
901
+ return _context6.abrupt("return", res && res.balance ? BigInt(res.balance) : 0n);
863
902
  case 4:
864
903
  case "end":
865
904
  return _context6.stop();
866
905
  }
867
906
  }, _callee6, this);
868
907
  }));
869
- function getMythosForeignBalance(_x8) {
908
+ function getBalanceForeignPolkadotXcm(_x7, _x8) {
909
+ return _getBalanceForeignPolkadotXcm.apply(this, arguments);
910
+ }
911
+ return getBalanceForeignPolkadotXcm;
912
+ }()
913
+ }, {
914
+ key: "getMythosForeignBalance",
915
+ value: function () {
916
+ var _getMythosForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address) {
917
+ var res;
918
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
919
+ while (1) switch (_context7.prev = _context7.next) {
920
+ case 0:
921
+ _context7.next = 2;
922
+ return this.api.getUnsafeApi().query.Balances.Account.getValue(address);
923
+ case 2:
924
+ res = _context7.sent;
925
+ return _context7.abrupt("return", res && res.free ? BigInt(res.free) : 0n);
926
+ case 4:
927
+ case "end":
928
+ return _context7.stop();
929
+ }
930
+ }, _callee7, this);
931
+ }));
932
+ function getMythosForeignBalance(_x9) {
870
933
  return _getMythosForeignBalance.apply(this, arguments);
871
934
  }
872
935
  return getMythosForeignBalance;
@@ -874,24 +937,24 @@ var PapiApi = /*#__PURE__*/function () {
874
937
  }, {
875
938
  key: "getAssetHubForeignBalance",
876
939
  value: function () {
877
- var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(address, multiLocation) {
940
+ var _getAssetHubForeignBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address, multiLocation) {
878
941
  var transformedMultiLocation, res;
879
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
880
- while (1) switch (_context7.prev = _context7.next) {
942
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
943
+ while (1) switch (_context8.prev = _context8.next) {
881
944
  case 0:
882
945
  transformedMultiLocation = _transform(multiLocation);
883
- _context7.next = 3;
946
+ _context8.next = 3;
884
947
  return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(transformedMultiLocation, address);
885
948
  case 3:
886
- res = _context7.sent;
887
- return _context7.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
949
+ res = _context8.sent;
950
+ return _context8.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
888
951
  case 5:
889
952
  case "end":
890
- return _context7.stop();
953
+ return _context8.stop();
891
954
  }
892
- }, _callee7, this);
955
+ }, _callee8, this);
893
956
  }));
894
- function getAssetHubForeignBalance(_x9, _x10) {
957
+ function getAssetHubForeignBalance(_x10, _x11) {
895
958
  return _getAssetHubForeignBalance.apply(this, arguments);
896
959
  }
897
960
  return getAssetHubForeignBalance;
@@ -899,23 +962,23 @@ var PapiApi = /*#__PURE__*/function () {
899
962
  }, {
900
963
  key: "getForeignAssetsByIdBalance",
901
964
  value: function () {
902
- var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(address, assetId) {
965
+ var _getForeignAssetsByIdBalance = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, assetId) {
903
966
  var res;
904
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
905
- while (1) switch (_context8.prev = _context8.next) {
967
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
968
+ while (1) switch (_context9.prev = _context9.next) {
906
969
  case 0:
907
- _context8.next = 2;
970
+ _context9.next = 2;
908
971
  return this.api.getUnsafeApi().query.ForeignAssets.Account.getValue(assetId, address);
909
972
  case 2:
910
- res = _context8.sent;
911
- return _context8.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
973
+ res = _context9.sent;
974
+ return _context9.abrupt("return", BigInt(res === undefined ? 0 : res.balance));
912
975
  case 4:
913
976
  case "end":
914
- return _context8.stop();
977
+ return _context9.stop();
915
978
  }
916
- }, _callee8, this);
979
+ }, _callee9, this);
917
980
  }));
918
- function getForeignAssetsByIdBalance(_x11, _x12) {
981
+ function getForeignAssetsByIdBalance(_x12, _x13) {
919
982
  return _getForeignAssetsByIdBalance.apply(this, arguments);
920
983
  }
921
984
  return getForeignAssetsByIdBalance;
@@ -923,26 +986,26 @@ var PapiApi = /*#__PURE__*/function () {
923
986
  }, {
924
987
  key: "getBalanceForeignBifrost",
925
988
  value: function () {
926
- var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(address, asset) {
989
+ var _getBalanceForeignBifrost = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, asset) {
927
990
  var currencySelection, transformedParameters, response, accountData;
928
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
929
- while (1) switch (_context9.prev = _context9.next) {
991
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
992
+ while (1) switch (_context10.prev = _context10.next) {
930
993
  case 0:
931
994
  currencySelection = sdkCore.getNode('BifrostPolkadot').getCurrencySelection(asset);
932
995
  transformedParameters = _transform(currencySelection);
933
- _context9.next = 4;
996
+ _context10.next = 4;
934
997
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
935
998
  case 4:
936
- response = _context9.sent;
999
+ response = _context10.sent;
937
1000
  accountData = response ? response : null;
938
- return _context9.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1001
+ return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
939
1002
  case 7:
940
1003
  case "end":
941
- return _context9.stop();
1004
+ return _context10.stop();
942
1005
  }
943
- }, _callee9, this);
1006
+ }, _callee10, this);
944
1007
  }));
945
- function getBalanceForeignBifrost(_x13, _x14) {
1008
+ function getBalanceForeignBifrost(_x14, _x15) {
946
1009
  return _getBalanceForeignBifrost.apply(this, arguments);
947
1010
  }
948
1011
  return getBalanceForeignBifrost;
@@ -950,27 +1013,27 @@ var PapiApi = /*#__PURE__*/function () {
950
1013
  }, {
951
1014
  key: "getBalanceNativeAcala",
952
1015
  value: function () {
953
- var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(address, symbol) {
1016
+ var _getBalanceNativeAcala = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(address, symbol) {
954
1017
  var transformedParameters, response, accountData;
955
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
956
- while (1) switch (_context10.prev = _context10.next) {
1018
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1019
+ while (1) switch (_context11.prev = _context11.next) {
957
1020
  case 0:
958
1021
  transformedParameters = _transform({
959
1022
  Token: symbol
960
1023
  });
961
- _context10.next = 3;
1024
+ _context11.next = 3;
962
1025
  return this.api.getUnsafeApi().query.Tokens.Accounts.getValue(address, transformedParameters);
963
1026
  case 3:
964
- response = _context10.sent;
1027
+ response = _context11.sent;
965
1028
  accountData = response ? response : null;
966
- return _context10.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
1029
+ return _context11.abrupt("return", accountData ? BigInt(accountData.free.toString()) : 0n);
967
1030
  case 6:
968
1031
  case "end":
969
- return _context10.stop();
1032
+ return _context11.stop();
970
1033
  }
971
- }, _callee10, this);
1034
+ }, _callee11, this);
972
1035
  }));
973
- function getBalanceNativeAcala(_x15, _x16) {
1036
+ function getBalanceNativeAcala(_x16, _x17) {
974
1037
  return _getBalanceNativeAcala.apply(this, arguments);
975
1038
  }
976
1039
  return getBalanceNativeAcala;
@@ -978,19 +1041,19 @@ var PapiApi = /*#__PURE__*/function () {
978
1041
  }, {
979
1042
  key: "getBalanceForeignXTokens",
980
1043
  value: function () {
981
- var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(node, address, asset) {
1044
+ var _getBalanceForeignXTokens = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(node, address, asset) {
982
1045
  var pallet, response, entry;
983
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
984
- while (1) switch (_context11.prev = _context11.next) {
1046
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1047
+ while (1) switch (_context12.prev = _context12.next) {
985
1048
  case 0:
986
1049
  pallet = 'Tokens';
987
1050
  if (node === 'Centrifuge' || node === 'Altair') {
988
1051
  pallet = 'OrmlTokens';
989
1052
  }
990
- _context11.next = 4;
1053
+ _context12.next = 4;
991
1054
  return this.api.getUnsafeApi().query[pallet].Accounts.getEntries(address);
992
1055
  case 4:
993
- response = _context11.sent;
1056
+ response = _context12.sent;
994
1057
  entry = response.find(function (_ref2) {
995
1058
  var _asset$symbol, _asset$assetId, _asset$symbol2, _asset$assetId2;
996
1059
  var keyArgs = _ref2.keyArgs;
@@ -999,14 +1062,14 @@ var PapiApi = /*#__PURE__*/function () {
999
1062
  var assetItem = _keyArgs[1];
1000
1063
  return assetItem.toString().toLowerCase() === ((_asset$symbol = asset.symbol) === null || _asset$symbol === undefined ? undefined : _asset$symbol.toLowerCase()) || sdkCore.isForeignAsset(asset) && assetItem.toString().toLowerCase() === ((_asset$assetId = asset.assetId) === null || _asset$assetId === undefined ? undefined : _asset$assetId.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && assetItem.value.toString().toLowerCase() === ((_asset$symbol2 = asset.symbol) === null || _asset$symbol2 === undefined ? undefined : _asset$symbol2.toLowerCase()) || _typeof(assetItem) === 'object' && 'value' in assetItem && sdkCore.isForeignAsset(asset) && assetItem.value.toString().toLowerCase() === ((_asset$assetId2 = asset.assetId) === null || _asset$assetId2 === undefined ? undefined : _asset$assetId2.toLowerCase());
1001
1064
  });
1002
- return _context11.abrupt("return", entry !== null && entry !== undefined && entry.value ? BigInt(entry.value.free.toString()) : 0n);
1065
+ return _context12.abrupt("return", entry !== null && entry !== undefined && entry.value ? BigInt(entry.value.free.toString()) : 0n);
1003
1066
  case 7:
1004
1067
  case "end":
1005
- return _context11.stop();
1068
+ return _context12.stop();
1006
1069
  }
1007
- }, _callee11, this);
1070
+ }, _callee12, this);
1008
1071
  }));
1009
- function getBalanceForeignXTokens(_x17, _x18, _x19) {
1072
+ function getBalanceForeignXTokens(_x18, _x19, _x20) {
1010
1073
  return _getBalanceForeignXTokens.apply(this, arguments);
1011
1074
  }
1012
1075
  return getBalanceForeignXTokens;
@@ -1014,45 +1077,51 @@ var PapiApi = /*#__PURE__*/function () {
1014
1077
  }, {
1015
1078
  key: "getBalanceForeignAssetsAccount",
1016
1079
  value: function () {
1017
- var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(address, assetId) {
1080
+ var _getBalanceForeignAssetsAccount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(address, assetId) {
1018
1081
  var response;
1019
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1020
- while (1) switch (_context12.prev = _context12.next) {
1082
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1083
+ while (1) switch (_context13.prev = _context13.next) {
1021
1084
  case 0:
1022
- _context12.next = 2;
1085
+ _context13.next = 2;
1023
1086
  return this.api.getUnsafeApi().query.Assets.Account.getValue(assetId, address);
1024
1087
  case 2:
1025
- response = _context12.sent;
1026
- return _context12.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
1088
+ response = _context13.sent;
1089
+ return _context13.abrupt("return", BigInt(response === undefined ? 0 : response.balance));
1027
1090
  case 4:
1028
1091
  case "end":
1029
- return _context12.stop();
1092
+ return _context13.stop();
1030
1093
  }
1031
- }, _callee12, this);
1094
+ }, _callee13, this);
1032
1095
  }));
1033
- function getBalanceForeignAssetsAccount(_x20, _x21) {
1096
+ function getBalanceForeignAssetsAccount(_x21, _x22) {
1034
1097
  return _getBalanceForeignAssetsAccount.apply(this, arguments);
1035
1098
  }
1036
1099
  return getBalanceForeignAssetsAccount;
1037
1100
  }()
1038
1101
  }, {
1039
- key: "getFromStorage",
1102
+ key: "getFromRpc",
1040
1103
  value: function () {
1041
- var _getFromStorage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(key) {
1042
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1043
- while (1) switch (_context13.prev = _context13.next) {
1104
+ var _getFromRpc = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(module, method, key) {
1105
+ var toSS58, value;
1106
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1107
+ while (1) switch (_context14.prev = _context14.next) {
1044
1108
  case 0:
1045
- return _context13.abrupt("return", this.api._request('state_getStorage', [key]));
1046
- case 1:
1109
+ toSS58 = polkadotApi.AccountId().dec;
1110
+ _context14.next = 3;
1111
+ return this.api._request("".concat(module, "_").concat(method), [module === 'system' && isHex(key) ? toSS58(key) : key]);
1112
+ case 3:
1113
+ value = _context14.sent;
1114
+ return _context14.abrupt("return", isHex(value) ? value : '0x' + value.toString(16).padStart(8, '0'));
1115
+ case 5:
1047
1116
  case "end":
1048
- return _context13.stop();
1117
+ return _context14.stop();
1049
1118
  }
1050
- }, _callee13, this);
1119
+ }, _callee14, this);
1051
1120
  }));
1052
- function getFromStorage(_x22) {
1053
- return _getFromStorage.apply(this, arguments);
1121
+ function getFromRpc(_x23, _x24, _x25) {
1122
+ return _getFromRpc.apply(this, arguments);
1054
1123
  }
1055
- return getFromStorage;
1124
+ return getFromRpc;
1056
1125
  }()
1057
1126
  }, {
1058
1127
  key: "clone",
@@ -1062,23 +1131,23 @@ var PapiApi = /*#__PURE__*/function () {
1062
1131
  }, {
1063
1132
  key: "createApiForNode",
1064
1133
  value: function () {
1065
- var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(node) {
1134
+ var _createApiForNode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(node) {
1066
1135
  var api;
1067
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1068
- while (1) switch (_context14.prev = _context14.next) {
1136
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1137
+ while (1) switch (_context15.prev = _context15.next) {
1069
1138
  case 0:
1070
1139
  api = new PapiApi();
1071
- _context14.next = 3;
1140
+ _context15.next = 3;
1072
1141
  return api.init(node);
1073
1142
  case 3:
1074
- return _context14.abrupt("return", api);
1143
+ return _context15.abrupt("return", api);
1075
1144
  case 4:
1076
1145
  case "end":
1077
- return _context14.stop();
1146
+ return _context15.stop();
1078
1147
  }
1079
- }, _callee14);
1148
+ }, _callee15);
1080
1149
  }));
1081
- function createApiForNode(_x23) {
1150
+ function createApiForNode(_x26) {
1082
1151
  return _createApiForNode.apply(this, arguments);
1083
1152
  }
1084
1153
  return createApiForNode;
@@ -1086,20 +1155,20 @@ var PapiApi = /*#__PURE__*/function () {
1086
1155
  }, {
1087
1156
  key: "getDryRun",
1088
1157
  value: function () {
1089
- var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref3) {
1158
+ var _getDryRun = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref3) {
1090
1159
  var tx, address, node, supportsDryRunApi, result, isSuccess, failureReason, executionFee, fee;
1091
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
1092
- while (1) switch (_context15.prev = _context15.next) {
1160
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
1161
+ while (1) switch (_context16.prev = _context16.next) {
1093
1162
  case 0:
1094
1163
  tx = _ref3.tx, address = _ref3.address, node = _ref3.node;
1095
1164
  supportsDryRunApi = sdkCore.getAssetsObject(node).supportsDryRunApi;
1096
1165
  if (supportsDryRunApi) {
1097
- _context15.next = 4;
1166
+ _context16.next = 4;
1098
1167
  break;
1099
1168
  }
1100
1169
  throw new Error("DryRunApi is not available on node ".concat(node));
1101
1170
  case 4:
1102
- _context15.next = 6;
1171
+ _context16.next = 6;
1103
1172
  return this.api.getUnsafeApi().apis.DryRunApi.dry_run_call({
1104
1173
  type: 'system',
1105
1174
  value: {
@@ -1108,34 +1177,34 @@ var PapiApi = /*#__PURE__*/function () {
1108
1177
  }
1109
1178
  }, tx.decodedCall);
1110
1179
  case 6:
1111
- result = _context15.sent;
1180
+ result = _context16.sent;
1112
1181
  isSuccess = result.success && result.value.execution_result.success;
1113
1182
  if (isSuccess) {
1114
- _context15.next = 11;
1183
+ _context16.next = 11;
1115
1184
  break;
1116
1185
  }
1117
1186
  failureReason = result.value.execution_result.value.error.value.value.type;
1118
- return _context15.abrupt("return", Promise.resolve({
1187
+ return _context16.abrupt("return", Promise.resolve({
1119
1188
  success: false,
1120
1189
  failureReason: failureReason
1121
1190
  }));
1122
1191
  case 11:
1123
- _context15.next = 13;
1192
+ _context16.next = 13;
1124
1193
  return this.calculateTransactionFee(tx, address);
1125
1194
  case 13:
1126
- executionFee = _context15.sent;
1195
+ executionFee = _context16.sent;
1127
1196
  fee = sdkCore.computeFeeFromDryRun(result, node, executionFee);
1128
- return _context15.abrupt("return", Promise.resolve({
1197
+ return _context16.abrupt("return", Promise.resolve({
1129
1198
  success: true,
1130
1199
  fee: fee
1131
1200
  }));
1132
1201
  case 16:
1133
1202
  case "end":
1134
- return _context15.stop();
1203
+ return _context16.stop();
1135
1204
  }
1136
- }, _callee15, this);
1205
+ }, _callee16, this);
1137
1206
  }));
1138
- function getDryRun(_x24) {
1207
+ function getDryRun(_x27) {
1139
1208
  return _getDryRun.apply(this, arguments);
1140
1209
  }
1141
1210
  return getDryRun;
@@ -1265,6 +1334,7 @@ var getOriginFeeDetails = createPapiApiCall(sdkCore.getOriginFeeDetails);
1265
1334
  var getMaxNativeTransferableAmount = createPapiApiCall(sdkCore.getMaxNativeTransferableAmount);
1266
1335
  var getMaxForeignTransferableAmount = createPapiApiCall(sdkCore.getMaxForeignTransferableAmount);
1267
1336
  var getTransferableAmount = createPapiApiCall(sdkCore.getTransferableAmount);
1337
+ var verifyEdOnDestination = createPapiApiCall(sdkCore.verifyEdOnDestination);
1268
1338
 
1269
1339
  var assets = /*#__PURE__*/Object.freeze({
1270
1340
  __proto__: null,
@@ -1295,7 +1365,8 @@ var assets = /*#__PURE__*/Object.freeze({
1295
1365
  getTransferInfo: getTransferInfo,
1296
1366
  getTransferableAmount: getTransferableAmount,
1297
1367
  hasSupportForAsset: sdkCore.hasSupportForAsset,
1298
- isNodeEvm: sdkCore.isNodeEvm
1368
+ isNodeEvm: sdkCore.isNodeEvm,
1369
+ verifyEdOnDestination: verifyEdOnDestination
1299
1370
  });
1300
1371
 
1301
1372
  /**
@@ -1345,8 +1416,9 @@ var EvmBuilderClass = /*#__PURE__*/function () {
1345
1416
  */
1346
1417
  }, {
1347
1418
  key: "address",
1348
- value: function address(_address) {
1419
+ value: function address(_address, ahAddress) {
1349
1420
  this._options.address = _address;
1421
+ this._options.ahAddress = ahAddress;
1350
1422
  return this;
1351
1423
  }
1352
1424
  /**
@@ -1392,11 +1464,18 @@ var EvmBuilderClass = /*#__PURE__*/function () {
1392
1464
  _context.next = 2;
1393
1465
  break;
1394
1466
  case 9:
1395
- _context.next = 11;
1467
+ sdkCore.validateAddress(this._options.address, this._options.to);
1468
+ if (!(this._options.from === 'Moonbeam' && this._options.to === 'Ethereum')) {
1469
+ _context.next = 12;
1470
+ break;
1471
+ }
1472
+ return _context.abrupt("return", sdkCore.transferMoonbeamToEth(this._options));
1473
+ case 12:
1474
+ _context.next = 14;
1396
1475
  return sdkCore.transferMoonbeamEvm(this._options);
1397
- case 11:
1476
+ case 14:
1398
1477
  return _context.abrupt("return", _context.sent);
1399
- case 12:
1478
+ case 15:
1400
1479
  case "end":
1401
1480
  return _context.stop();
1402
1481
  }
@@ -1453,6 +1532,7 @@ exports.getParaEthTransferFees = getParaEthTransferFees;
1453
1532
  exports.getTransferInfo = getTransferInfo;
1454
1533
  exports.getTransferableAmount = getTransferableAmount;
1455
1534
  exports.send = send;
1535
+ exports.verifyEdOnDestination = verifyEdOnDestination;
1456
1536
  exports.xcmPallet = transfer;
1457
1537
  Object.keys(sdkCore).forEach(function (k) {
1458
1538
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {