@aptos-labs/wallet-adapter-core 5.5.1 → 5.6.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/dist/index.mjs CHANGED
@@ -294,7 +294,7 @@ function _ts_generator(thisArg, body) {
294
294
  };
295
295
  }
296
296
  }
297
- var WALLET_ADAPTER_CORE_VERSION = "5.5.1";
297
+ var WALLET_ADAPTER_CORE_VERSION = "5.6.0";
298
298
  // src/WalletCore.ts
299
299
  import EventEmitter from "eventemitter3";
300
300
  import { AccountAddress, Aptos as Aptos2, Network as Network3, NetworkToChainId } from "@aptos-labs/ts-sdk";
@@ -818,7 +818,7 @@ var aptosStandardSupportedWalletList = [
818
818
  import { AptosConnectAppleWallet, AptosConnectGoogleWallet } from "@aptos-connect/wallet-adapter-plugin";
819
819
  import { Network as Network2 } from "@aptos-labs/ts-sdk";
820
820
  import { DevTWallet, TWallet } from "@atomrigslab/aptos-wallet-adapter";
821
- import { MSafeWallet } from "@msafe/aptos-aip62-wallet";
821
+ import { inMSafeWallet, MSafeWallet } from "@msafe/aptos-aip62-wallet";
822
822
  function getSDKWallets(dappConfig) {
823
823
  var sdkWallets = [];
824
824
  if (typeof window !== "undefined") {
@@ -835,7 +835,7 @@ function getSDKWallets(dappConfig) {
835
835
  } else {
836
836
  sdkWallets.push(new DevTWallet());
837
837
  }
838
- if (dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.network) {
838
+ if ((dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.msafeWalletConfig) && dappConfig.network && inMSafeWallet()) {
839
839
  sdkWallets.push(new MSafeWallet(_object_spread_props(_object_spread({}, dappConfig === null || dappConfig === void 0 ? void 0 : dappConfig.msafeWalletConfig), {
840
840
  network: dappConfig.network
841
841
  })));
@@ -914,9 +914,6 @@ var WalletCore = /*#__PURE__*/ function(EventEmitter) {
914
914
  if (_this.excludeWallet(wallet)) {
915
915
  return;
916
916
  }
917
- _this._standard_wallets = _this._standard_wallets.filter(function(item) {
918
- return item.name !== wallet.name;
919
- });
920
917
  var isValid = isWalletWithRequiredFeatureSet(wallet);
921
918
  if (isValid) {
922
919
  var index = _this._standard_not_detected_wallets.findIndex(function(notDetctedWallet) {
@@ -925,9 +922,15 @@ var WalletCore = /*#__PURE__*/ function(EventEmitter) {
925
922
  if (index !== -1) {
926
923
  _this._standard_not_detected_wallets.splice(index, 1);
927
924
  }
928
- wallet.readyState = "Installed" /* Installed */ ;
929
- _this._standard_wallets.push(wallet);
930
- _this.emit("standardWalletsAdded", wallet);
925
+ var alreadyExists = _this._standard_wallets.some(function(w) {
926
+ return w.name === wallet.name;
927
+ });
928
+ if (!alreadyExists) {
929
+ wallet.readyState = "Installed" /* Installed */ ;
930
+ wallet.isAptosNativeWallet = _this.isAptosNativeWallet(wallet);
931
+ _this._standard_wallets.push(wallet);
932
+ _this.emit("standardWalletsAdded", wallet);
933
+ }
931
934
  }
932
935
  });
933
936
  }
@@ -945,11 +948,19 @@ var WalletCore = /*#__PURE__*/ function(EventEmitter) {
945
948
  var isValid = isWalletWithRequiredFeatureSet(wallet);
946
949
  if (isValid) {
947
950
  wallet.readyState = "Installed" /* Installed */ ;
951
+ wallet.isAptosNativeWallet = _this.isAptosNativeWallet(wallet);
948
952
  _this._standard_wallets.push(wallet);
949
953
  }
950
954
  });
951
955
  }
952
956
  },
957
+ {
958
+ // Aptos native wallets do not have an authenticationFunction property
959
+ key: "isAptosNativeWallet",
960
+ value: function isAptosNativeWallet(wallet) {
961
+ return !("authenticationFunction" in wallet);
962
+ }
963
+ },
953
964
  {
954
965
  // Since we can't discover AIP-62 wallets that are not installed on the user machine,
955
966
  // we hold a AIP-62 wallets registry to show on the wallet selector modal for the users.
@@ -969,6 +980,7 @@ var WalletCore = /*#__PURE__*/ function(EventEmitter) {
969
980
  return;
970
981
  }
971
982
  if (!existingStandardWallet) {
983
+ supportedWallet.isAptosNativeWallet = !("authenticationFunction" in supportedWallet);
972
984
  _this._standard_not_detected_wallets.push(supportedWallet);
973
985
  _this.emit("standardNotDetectedWalletAdded", supportedWallet);
974
986
  }