@getpara/cosmos-wallet-connectors 2.0.0-alpha.59 → 2.0.0-alpha.60

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.
@@ -12,4 +12,4 @@ export type CosmosExternalWalletContextType = ExternalWalletContextType<CosmosSi
12
12
  export type CosmosExternalWalletProviderConfig = ExternalWalletProviderConfigBase;
13
13
  export type CosmosExternalWalletProviderConfigFull = ExternalWalletProviderConfig<WalletWithType, Omit<ParaCosmosProviderConfig, 'wallets'>>;
14
14
  export declare const CosmosExternalWalletContext: import("react").Context<CosmosExternalWalletContextType>;
15
- export declare function CosmosExternalWalletProvider({ children, onSwitchWallet, selectedChainId, wallets: incompleteWallets, chains, multiChain, shouldUseSuggestChainAndConnect, onSwitchChain, para, walletsWithFullAuth, connectedWallet, includeWalletVerification, connectionOnly, }: CosmosExternalWalletProviderConfigFull & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
15
+ export declare function CosmosExternalWalletProvider({ children, onSwitchWallet, selectedChainId, wallets: incompleteWallets, chains, multiChain, shouldUseSuggestChainAndConnect, onSwitchChain, para, walletsWithFullAuth, connectedWallet: connectedWalletProp, includeWalletVerification, connectionOnly, }: CosmosExternalWalletProviderConfigFull & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -37,7 +37,7 @@ function CosmosExternalWalletProvider({
37
37
  onSwitchChain,
38
38
  para,
39
39
  walletsWithFullAuth,
40
- connectedWallet,
40
+ connectedWallet: connectedWalletProp,
41
41
  includeWalletVerification,
42
42
  connectionOnly
43
43
  }) {
@@ -57,6 +57,8 @@ function CosmosExternalWalletProvider({
57
57
  const { walletType } = useActiveWalletType();
58
58
  const isLocalConnecting = useExternalWalletStore((state) => state.isConnecting);
59
59
  const updateExternalWalletState = useExternalWalletStore((state) => state.updateState);
60
+ const isConnectError = useRef(false);
61
+ const connectedWallet = connectedWalletProp ? para.findWallet(connectedWalletProp.id, connectedWalletProp.type) : null;
60
62
  const ethAddress = multiChain ? (_b = (_a = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _a.ethereumHexAddress) == null ? void 0 : _b.toLowerCase() : (_c = account == null ? void 0 : account.ethereumHexAddress) == null ? void 0 : _c.toLowerCase();
61
63
  const address = multiChain ? (_d = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _d.bech32Address : account == null ? void 0 : account.bech32Address;
62
64
  const isLinkingAccount = useRef(false);
@@ -143,16 +145,21 @@ function CosmosExternalWalletProvider({
143
145
  useEffect(() => {
144
146
  const connect2 = () => __async(this, null, function* () {
145
147
  var _a2;
146
- if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedWallet.type === "COSMOS" && (connectedWallet.isExternal ? walletType !== ((_a2 = connectedWallet.name) == null ? void 0 : _a2.toLowerCase()) : walletType !== "para") && !isLinkingAccount.current) {
148
+ if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedWallet.type === "COSMOS" && (connectedWallet.isExternal ? walletType !== ((_a2 = connectedWallet.name) == null ? void 0 : _a2.toLowerCase()) : walletType !== "para") && !isLinkingAccount.current && !isConnectError.current) {
147
149
  const isLoggedIn = yield para.isFullyLoggedIn();
148
150
  if (!isLoggedIn) {
149
151
  return;
150
152
  }
151
153
  const chainId = multiChain ? chains.map((c) => c.chainId) : selectedChainId;
152
- yield connectAsync({
153
- walletType: connectedWallet.isExternal ? connectedWallet.name.toLowerCase() : GrazWalletType.PARA,
154
- chainId
155
- });
154
+ const targetWalletType = connectedWallet.isExternal ? connectedWallet.name.toLowerCase() : GrazWalletType.PARA;
155
+ try {
156
+ yield connectAsync({
157
+ walletType: targetWalletType,
158
+ chainId
159
+ });
160
+ } catch (e) {
161
+ isConnectError.current = true;
162
+ }
156
163
  }
157
164
  });
158
165
  connect2();
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@getpara/cosmos-wallet-connectors",
3
- "version": "2.0.0-alpha.59",
3
+ "version": "2.0.0-alpha.60",
4
4
  "dependencies": {
5
- "@getpara/react-common": "2.0.0-alpha.59",
6
- "@getpara/web-sdk": "2.0.0-alpha.59",
5
+ "@getpara/react-common": "2.0.0-alpha.60",
6
+ "@getpara/web-sdk": "2.0.0-alpha.60",
7
7
  "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.41",
8
8
  "starknet": "^6.11.0",
9
9
  "zustand": "^4.5.2",
@@ -23,7 +23,7 @@
23
23
  "dist",
24
24
  "package.json"
25
25
  ],
26
- "gitHead": "e15908ac8eafff6f3b264fffa43742870b14b275",
26
+ "gitHead": "b445d9dcf909a9bfa72d4f21b825fcf7c643be0c",
27
27
  "main": "dist/index.js",
28
28
  "peerDependencies": {
29
29
  "@getpara/graz": ">=2.0.0-alpha.5",