@getpara/cosmos-wallet-connectors 2.0.0-alpha.19 → 2.0.0-alpha.20

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.
@@ -18,6 +18,7 @@ import {
18
18
  getWallet as grazGetWallet
19
19
  } from "@getpara/graz";
20
20
  import { useExternalWalletStore } from "../stores/useStore.js";
21
+ import { rawSecp256k1PubkeyToRawAddress } from "@getpara/web-sdk";
21
22
  import { formatEthHexAddress } from "../utils/formatEthHexAddress.js";
22
23
  const defaultCosmosExternalWallet = {
23
24
  wallets: [],
@@ -212,7 +213,15 @@ function CosmosExternalWalletProvider({
212
213
  const connectedWallet2 = yield shouldUseSuggestChainAndConnect ? suggestAndConnectAsync({ walletType: walletType2, chainInfo }) : connectAsync({ walletType: walletType2, chainId: _chainId });
213
214
  const firstChain = !chainId ? selectedChainId : typeof _chainId === "string" ? _chainId : _chainId[0];
214
215
  address2 = connectedWallet2.accounts[firstChain].bech32Address;
215
- ethAddress2 = formatEthHexAddress(connectedWallet2.accounts[firstChain].address);
216
+ let rawAddress;
217
+ const accountAddress = connectedWallet2.accounts[firstChain].address;
218
+ if (!accountAddress || accountAddress.length === 0 || accountAddress.byteLength === 0) {
219
+ const pubKey = connectedWallet2.accounts[firstChain].pubKey;
220
+ rawAddress = rawSecp256k1PubkeyToRawAddress(pubKey);
221
+ } else {
222
+ rawAddress = accountAddress;
223
+ }
224
+ ethAddress2 = formatEthHexAddress(rawAddress);
216
225
  if (connectedWallet2.accounts[firstChain]) {
217
226
  try {
218
227
  authState = yield login(ethAddress2, address2, isFullAuthWallet, getProviderName(walletType2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/cosmos-wallet-connectors",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.20",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,13 +20,13 @@
20
20
  "@cosmjs/stargate": "<=0.33.1",
21
21
  "@cosmjs/tendermint-rpc": "<=0.31.3",
22
22
  "@getpara/graz": "^1.0.0-dev.2",
23
- "@getpara/web-sdk": "2.0.0-alpha.19",
23
+ "@getpara/web-sdk": "2.0.0-alpha.20",
24
24
  "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.41",
25
25
  "zustand": "^4.5.2",
26
26
  "zustand-sync-tabs": "^0.2.2"
27
27
  },
28
28
  "devDependencies": {
29
- "@getpara/react-common": "2.0.0-alpha.19",
29
+ "@getpara/react-common": "2.0.0-alpha.20",
30
30
  "@types/react": "^18.0.31",
31
31
  "@types/react-dom": "^18.2.7",
32
32
  "typescript": "^5.4.3"
@@ -39,5 +39,5 @@
39
39
  "dist",
40
40
  "package.json"
41
41
  ],
42
- "gitHead": "80d2c5d7e1203fb12378aa29bfd4d7003c7d7075"
42
+ "gitHead": "4c8d918b9fc387476968bfc08524fe1a8b6ec83b"
43
43
  }