@getpara/cosmos-wallet-connectors 2.0.0-dev.3 → 2.0.0-dev.4

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.
@@ -15,7 +15,8 @@ import {
15
15
  useDisconnect,
16
16
  useSuggestChainAndConnect,
17
17
  getChainInfo,
18
- getWallet as grazGetWallet
18
+ getWallet as grazGetWallet,
19
+ WALLET_TYPES
19
20
  } from "@getpara/graz";
20
21
  import { useExternalWalletStore } from "../stores/useStore.js";
21
22
  import { rawSecp256k1PubkeyToRawAddress } from "@getpara/web-sdk";
@@ -94,6 +95,7 @@ function CosmosExternalWalletProvider({
94
95
  const storedExternalWallet = para.externalWallets[(_a2 = changeResp.ethAddress) != null ? _a2 : ""];
95
96
  const { provider, providerId } = getProvider(walletType);
96
97
  para.setExternalWallet({
98
+ partnerId: para.partnerId,
97
99
  address: changeResp.ethAddress,
98
100
  type: "COSMOS",
99
101
  provider,
@@ -116,6 +118,7 @@ function CosmosExternalWalletProvider({
116
118
  try {
117
119
  return yield para.loginExternalWallet({
118
120
  externalWallet: {
121
+ partnerId: para.partnerId,
119
122
  address: address2,
120
123
  type: "COSMOS",
121
124
  provider,
@@ -157,7 +160,7 @@ function CosmosExternalWalletProvider({
157
160
  const signMessage = (_0) => __async(this, [_0], function* ({ message, externalWallet }) {
158
161
  let wallet, signAddress, signEthAddress;
159
162
  if (externalWallet) {
160
- const commonWallet = wallets.find((w) => w.internalId === externalWallet.providerId);
163
+ const commonWallet = wallets.find((w) => w.id === externalWallet.providerId);
161
164
  wallet = grazGetWallet(commonWallet == null ? void 0 : commonWallet.grazType);
162
165
  signAddress = externalWallet.addressBech32;
163
166
  signEthAddress = externalWallet.address;
@@ -229,6 +232,7 @@ function CosmosExternalWalletProvider({
229
232
  const address2 = formatEthHexAddress(rawAddress);
230
233
  const { provider, providerId } = getProvider(walletType2);
231
234
  return {
235
+ partnerId: para.partnerId,
232
236
  type: "COSMOS",
233
237
  address: address2,
234
238
  addressBech32,
@@ -268,21 +272,38 @@ function CosmosExternalWalletProvider({
268
272
  updateExternalWalletState({ isConnecting: false });
269
273
  }
270
274
  });
271
- const getWallet = (walletType2) => incompleteWallets.find((w) => w.grazType === walletType2 || w.grazMobileType === walletType2);
275
+ const injectedWallets = WALLET_TYPES.filter((w) => !incompleteWallets.some((iw) => iw.grazType === w) && checkWallet(w)).map((w) => {
276
+ const wallet = grazGetWallet(w);
277
+ if (!wallet.eip6963ProviderInfo) {
278
+ return void 0;
279
+ }
280
+ const eipInfo = wallet.eip6963ProviderInfo;
281
+ return __spreadValues({
282
+ grazType: w,
283
+ // Using name here for the injected connector since that's the only common id across the networks
284
+ id: eipInfo.name,
285
+ internalId: eipInfo.name,
286
+ iconUrl: eipInfo.icon
287
+ }, eipInfo);
288
+ }).filter((w) => !!w);
289
+ const allWallets = [...incompleteWallets, ...injectedWallets];
290
+ const getWallet = (walletType2) => allWallets.find((w) => w.grazType === walletType2 || w.grazMobileType === walletType2);
272
291
  const getProvider = (walletType2) => {
273
292
  const wallet = getWallet(walletType2);
274
293
  return {
275
294
  provider: wallet == null ? void 0 : wallet.name,
276
- providerId: wallet == null ? void 0 : wallet.internalId
295
+ providerId: wallet == null ? void 0 : wallet.id
277
296
  };
278
297
  };
279
- const wallets = incompleteWallets.map((wallet) => {
298
+ const wallets = allWallets.map((wallet) => {
280
299
  return __spreadProps(__spreadValues({
281
300
  connect: () => connect(wallet.grazType),
282
301
  connectMobile: () => connect(wallet.grazType),
283
302
  getQrUri: () => "",
284
303
  type: "COSMOS"
285
304
  }, wallet), {
305
+ // Using name here since that's the only common id across the networks
306
+ id: wallet.name,
286
307
  installed: checkWallet(wallet.grazType)
287
308
  });
288
309
  }).filter((w) => !!w);
@@ -307,7 +328,7 @@ function CosmosExternalWalletProvider({
307
328
  }), [para, multiChain, chains, selectedChainId]);
308
329
  const requestInfo = (providerId) => __async(this, null, function* () {
309
330
  var _a2;
310
- const wallet = wallets.find((w) => w.internalId === providerId);
331
+ const wallet = wallets.find((w) => w.id === providerId);
311
332
  if (!wallet) {
312
333
  throw new Error(`Wallet for provider ${providerId} not found`);
313
334
  }
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@getpara/cosmos-wallet-connectors",
3
- "version": "2.0.0-dev.3",
3
+ "version": "2.0.0-dev.4",
4
4
  "dependencies": {
5
- "@getpara/graz": "2.0.0-alpha.3",
6
- "@getpara/react-common": "2.0.0-dev.3",
7
- "@getpara/web-sdk": "2.0.0-dev.3",
5
+ "@getpara/react-common": "2.0.0-alpha.37",
6
+ "@getpara/web-sdk": "2.0.0-alpha.37",
8
7
  "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.41",
9
8
  "starknet": "^6.11.0",
10
9
  "zustand": "^4.5.2",
11
10
  "zustand-sync-tabs": "^0.2.2"
12
11
  },
13
12
  "devDependencies": {
14
- "@getpara/graz": "2.0.0-alpha.3",
13
+ "@getpara/graz": "2.0.0-alpha.5",
15
14
  "@types/react": "^18.0.31",
16
15
  "@types/react-dom": "^18.2.7",
17
16
  "typescript": "^5.8.3"
@@ -24,10 +23,10 @@
24
23
  "dist",
25
24
  "package.json"
26
25
  ],
27
- "gitHead": "ffe34f7d8df2dd3c2327ca1f35bcc9764e0a68a2",
26
+ "gitHead": "10ecce9873131e6a1b114fb0642a94bb02040bef",
28
27
  "main": "dist/index.js",
29
28
  "peerDependencies": {
30
- "@getpara/graz": "2.0.0-alpha.3",
29
+ "@getpara/graz": ">=2.0.0-alpha.5",
31
30
  "react": ">=18",
32
31
  "react-dom": ">=18"
33
32
  },