@getpara/cosmos-wallet-connectors 2.0.0-alpha.5 → 2.0.0-alpha.50

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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { CosmosExternalWalletContext } from './providers/CosmosExternalWalletContext.js';
2
- export type { CosmosExternalWalletContextType } from './providers/CosmosExternalWalletContext.js';
2
+ export { type CosmosExternalWalletContextType, type CosmosSignResult } from './providers/CosmosExternalWalletContext.js';
3
3
  export { ParaCosmosProvider } from './providers/ParaCosmosContext.js';
4
4
  export type { ParaCosmosProviderProps, ParaGrazProviderProps, ParaCosmosProviderConfig, } from './providers/ParaCosmosContext.js';
5
5
  export * from './wallets/connectors/index.js';
6
6
  export type { WalletList } from './types/Wallet.js';
7
+ export type * from './types/ExternalHooks.js';
@@ -1,43 +1,15 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ParaCosmosProviderConfig } from './ParaCosmosContext.js';
3
3
  import { WalletWithType } from '../types/Wallet.js';
4
- import ParaWeb, { Wallet } from '@getpara/web-sdk';
5
- import type { CommonChain, CommonWallet, TExternalWallet } from '@getpara/react-common';
6
- export type CosmosExternalWalletContextType = {
7
- wallets: CommonWallet[];
8
- chains: CommonChain[];
9
- chainId?: string;
10
- disconnect: () => Promise<void>;
11
- switchChain: (chainId: string) => Promise<{
12
- error?: string[];
13
- }>;
14
- connectParaEmbedded: () => Promise<{
15
- result?: unknown;
16
- error?: string;
17
- }>;
18
- signMessage: (message: string) => Promise<{
19
- signature?: string;
20
- error?: string;
21
- }>;
22
- signVerificationMessage: () => Promise<{
23
- address?: string;
24
- signature?: string;
25
- cosmosPublicKeyHex?: string;
26
- cosmosSigner?: string;
27
- error?: string;
28
- }>;
4
+ import { type ChainManagement, type ConnectParaEmbedded, type ExternalWalletContextType, type ExternalWalletProviderConfig, type ExternalWalletProviderConfigBase, type SignResult } from '@getpara/react-common';
5
+ import { TExternalHooks } from './externalHooks.js';
6
+ export type CosmosSignResult = SignResult & {
7
+ cosmosPublicKeyHex?: string;
8
+ cosmosSigner?: string;
9
+ addressBech32?: string;
29
10
  };
30
- export type CosmosExternalWalletProviderConfig = {
31
- onSwitchWallet?: (args: {
32
- address?: string;
33
- error?: string;
34
- }) => void;
35
- para: ParaWeb;
36
- walletsWithFullAuth: TExternalWallet[];
37
- connectedWallet?: Omit<Wallet, 'signer'> | null;
38
- };
39
- export type CosmosExternalWalletProviderConfigFull = {
40
- wallets: WalletWithType[];
41
- } & Omit<ParaCosmosProviderConfig, 'wallets'> & CosmosExternalWalletProviderConfig;
11
+ export type CosmosExternalWalletContextType = ExternalWalletContextType<CosmosSignResult> & ChainManagement<string> & TExternalHooks & ConnectParaEmbedded;
12
+ export type CosmosExternalWalletProviderConfig = ExternalWalletProviderConfigBase;
13
+ export type CosmosExternalWalletProviderConfigFull = ExternalWalletProviderConfig<WalletWithType, Omit<ParaCosmosProviderConfig, 'wallets'>>;
42
14
  export declare const CosmosExternalWalletContext: import("react").Context<CosmosExternalWalletContextType>;
43
- export declare function CosmosExternalWalletProvider({ children, onSwitchWallet, selectedChainId, wallets: incompleteWallets, chains, multiChain, shouldUseSuggestChainAndConnect, onSwitchChain, para, walletsWithFullAuth, connectedWallet, }: 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, includeWalletVerification, connectionOnly, }: CosmosExternalWalletProviderConfigFull & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -15,19 +15,16 @@ 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
- const defaultCosmosExternalWallet = {
22
- wallets: [],
23
- chains: [],
24
- chainId: void 0,
25
- disconnect: () => Promise.resolve(),
26
- switchChain: () => Promise.resolve({}),
27
- connectParaEmbedded: () => Promise.resolve({}),
28
- signMessage: () => Promise.resolve({}),
29
- signVerificationMessage: () => Promise.resolve({})
30
- };
22
+ import { rawSecp256k1PubkeyToRawAddress } from "@getpara/web-sdk";
23
+ import {
24
+ defaultCosmosExternalWallet
25
+ } from "@getpara/react-common";
26
+ import { formatEthHexAddress } from "../utils/formatEthHexAddress.js";
27
+ import { externalHooks } from "./externalHooks.js";
31
28
  const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
32
29
  function CosmosExternalWalletProvider({
33
30
  children,
@@ -40,9 +37,11 @@ function CosmosExternalWalletProvider({
40
37
  onSwitchChain,
41
38
  para,
42
39
  walletsWithFullAuth,
43
- connectedWallet
40
+ connectedWallet,
41
+ includeWalletVerification,
42
+ connectionOnly
44
43
  }) {
45
- var _a, _b;
44
+ var _a, _b, _c, _d;
46
45
  const { suggestAndConnectAsync } = useSuggestChainAndConnect();
47
46
  const {
48
47
  data: account,
@@ -50,7 +49,7 @@ function CosmosExternalWalletProvider({
50
49
  isReconnecting,
51
50
  isConnected
52
51
  } = useAccount({
53
- chainId: multiChain ? chains.map((c) => c.chainId) : selectedChainId,
52
+ chainId: multiChain ? chains.map((c) => c.chainId) : selectedChainId != null ? selectedChainId : "",
54
53
  multiChain
55
54
  });
56
55
  const { connectAsync } = useConnect();
@@ -58,8 +57,9 @@ function CosmosExternalWalletProvider({
58
57
  const { walletType } = useActiveWalletType();
59
58
  const isLocalConnecting = useExternalWalletStore((state) => state.isConnecting);
60
59
  const updateExternalWalletState = useExternalWalletStore((state) => state.updateState);
61
- const bufferAddress = multiChain ? (_a = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _a.address.toString() : account == null ? void 0 : account.address.toString();
62
- const address = multiChain ? (_b = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _b.bech32Address : account == null ? void 0 : account.bech32Address;
60
+ 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
+ const address = multiChain ? (_d = account == null ? void 0 : account[selectedChainId]) == null ? void 0 : _d.bech32Address : account == null ? void 0 : account.bech32Address;
62
+ const isLinkingAccount = useRef(false);
63
63
  const verificationMessage = useRef();
64
64
  const reset = () => __async(this, null, function* () {
65
65
  yield disconnectAsync();
@@ -80,7 +80,7 @@ function CosmosExternalWalletProvider({
80
80
  }
81
81
  const connectedWallet2 = yield shouldUseSuggestChainAndConnect ? suggestAndConnectAsync({ walletType, chainInfo }) : connectAsync({ walletType, chainId });
82
82
  changeResp.address = connectedWallet2.accounts[chainId].bech32Address;
83
- changeResp.bufferAddress = connectedWallet2.accounts[chainId].address.toString();
83
+ changeResp.ethAddress = formatEthHexAddress(connectedWallet2.accounts[chainId].address);
84
84
  } catch (err) {
85
85
  if (err.message === "No wallet exists") {
86
86
  changeResp.error = err.message;
@@ -92,26 +92,41 @@ function CosmosExternalWalletProvider({
92
92
  onSwitchWallet(changeResp);
93
93
  if (!changeResp.error) {
94
94
  onSwitchChain(chainId);
95
- const storedExternalWallet = para.externalWallets[(_a2 = changeResp.bufferAddress) != null ? _a2 : ""];
95
+ const storedExternalWallet = para.externalWallets[(_a2 = changeResp.ethAddress) != null ? _a2 : ""];
96
+ const { provider, providerId } = getProvider(walletType);
96
97
  para.setExternalWallet({
97
- address: changeResp.bufferAddress,
98
+ partnerId: para.partnerId,
99
+ address: changeResp.ethAddress,
98
100
  type: "COSMOS",
99
- provider: getProviderName(walletType),
101
+ provider,
102
+ providerId,
100
103
  addressBech32: changeResp.address,
101
- withFullParaAuth: storedExternalWallet.isExternalWithParaAuth
104
+ withFullParaAuth: storedExternalWallet.isExternalWithParaAuth,
105
+ withVerification: includeWalletVerification,
106
+ isConnectionOnly: connectionOnly
102
107
  });
103
108
  }
104
109
  return { error };
105
110
  });
106
- const login = (bufferAddress2, address2, isFullAuthWallet, providerName) => __async(this, null, function* () {
111
+ const login = (_0) => __async(this, [_0], function* ({
112
+ address: address2,
113
+ addressBech32,
114
+ withFullParaAuth,
115
+ providerId,
116
+ provider
117
+ }) {
107
118
  try {
108
119
  return yield para.loginExternalWallet({
109
120
  externalWallet: {
110
- address: bufferAddress2,
121
+ partnerId: para.partnerId,
122
+ address: address2,
111
123
  type: "COSMOS",
112
- provider: providerName,
113
- addressBech32: address2,
114
- withFullParaAuth: isFullAuthWallet
124
+ provider,
125
+ providerId,
126
+ addressBech32,
127
+ withFullParaAuth,
128
+ withVerification: includeWalletVerification,
129
+ isConnectionOnly: connectionOnly
115
130
  }
116
131
  });
117
132
  } catch (err) {
@@ -120,15 +135,15 @@ function CosmosExternalWalletProvider({
120
135
  }
121
136
  });
122
137
  useEffect(() => {
123
- const storedExternalWallet = para.externalWallets[bufferAddress != null ? bufferAddress : ""];
124
- if (isConnected && !isConnecting && !isReconnecting && !isLocalConnecting && !!bufferAddress && !storedExternalWallet && walletType !== GrazWalletType.PARA) {
138
+ const storedExternalWallet = para.externalWallets[ethAddress != null ? ethAddress : ""];
139
+ if (isConnected && !isConnecting && !isReconnecting && !isLocalConnecting && !!ethAddress && !storedExternalWallet && walletType !== GrazWalletType.PARA && !isLinkingAccount.current) {
125
140
  reset();
126
141
  }
127
142
  }, [isConnecting, isLocalConnecting, isReconnecting, isConnected]);
128
143
  useEffect(() => {
129
144
  const connect2 = () => __async(this, null, function* () {
130
145
  var _a2;
131
- if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedWallet.type === "COSMOS" && (connectedWallet.isExternal ? walletType !== ((_a2 = connectedWallet.name) == null ? void 0 : _a2.toLowerCase()) : walletType !== "para")) {
146
+ if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedWallet.type === "COSMOS" && (connectedWallet.isExternal ? walletType !== ((_a2 = connectedWallet.name) == null ? void 0 : _a2.toLowerCase()) : walletType !== "para") && !isLinkingAccount.current) {
132
147
  const isLoggedIn = yield para.isFullyLoggedIn();
133
148
  if (!isLoggedIn) {
134
149
  return;
@@ -142,19 +157,30 @@ function CosmosExternalWalletProvider({
142
157
  });
143
158
  connect2();
144
159
  }, [isLocalConnecting, isConnecting, isReconnecting, walletType, connectedWallet]);
145
- const signMessage = (message) => __async(this, null, function* () {
146
- const wallet = grazGetWallet(walletType);
160
+ const signMessage = (_0) => __async(this, [_0], function* ({ message, externalWallet }) {
161
+ let wallet, signAddress, signEthAddress;
162
+ if (externalWallet) {
163
+ const commonWallet = wallets.find((w) => w.id === externalWallet.providerId);
164
+ wallet = grazGetWallet(commonWallet == null ? void 0 : commonWallet.grazType);
165
+ signAddress = externalWallet.addressBech32;
166
+ signEthAddress = externalWallet.address;
167
+ } else {
168
+ wallet = grazGetWallet(walletType);
169
+ signAddress = address;
170
+ signEthAddress = ethAddress;
171
+ }
147
172
  if (!wallet) {
148
173
  return { error: "Connected wallet not found" };
149
174
  }
150
175
  try {
151
176
  const publicKey = (yield wallet.getKey(selectedChainId)).pubKey;
152
- const signature = yield wallet.signArbitrary(selectedChainId, address, message);
177
+ const signature = yield wallet.signArbitrary(selectedChainId, signAddress, message);
153
178
  return {
154
- address: bufferAddress,
179
+ address: signEthAddress,
180
+ addressBech32: signAddress,
155
181
  signature: signature.signature,
156
182
  cosmosPublicKeyHex: Buffer.from(publicKey).toString("hex"),
157
- cosmosSigner: address
183
+ cosmosSigner: signAddress
158
184
  };
159
185
  } catch (e) {
160
186
  if (e.message.includes("Request rejected")) {
@@ -164,82 +190,120 @@ function CosmosExternalWalletProvider({
164
190
  }
165
191
  });
166
192
  const signVerificationMessage = () => __async(this, null, function* () {
167
- const signature = yield signMessage(verificationMessage.current);
193
+ const signature = yield signMessage({ message: verificationMessage.current });
168
194
  return signature;
169
195
  });
170
- const connect = (walletType2, chainId) => __async(this, null, function* () {
196
+ const connectBase = (walletType2, chainId) => __async(this, null, function* () {
171
197
  var _a2;
172
- updateExternalWalletState({ isConnecting: true });
173
- const walletId = (_a2 = getWallet(walletType2)) == null ? void 0 : _a2.id;
174
- const isFullAuthWallet = walletsWithFullAuth.includes(walletId.toUpperCase());
175
198
  if (!chainId) {
176
199
  yield disconnectAsync();
177
200
  }
178
201
  const _chainId = chainId != null ? chainId : multiChain ? chains.map((c) => c.chainId) : selectedChainId;
179
202
  if (!_chainId) {
180
- console.error("Chain id not provided.");
181
- return;
203
+ throw new Error("Chain id not provided.");
182
204
  }
183
- let address2;
184
- let bufferAddress2;
185
- let error;
186
- let authState;
187
205
  if (!walletType2) {
188
- console.error("Graz wallet type not provided.");
189
- return;
190
- } else {
191
- try {
192
- let chainInfo;
193
- if (shouldUseSuggestChainAndConnect) {
194
- if (typeof _chainId !== "string") {
195
- console.error("multiChain is not compatible with shouldUseSuggestChainAndConnect.");
196
- return;
197
- }
198
- chainInfo = getChainInfo({ chainId: _chainId });
199
- if (!chainInfo) {
200
- console.error("Chain not found.");
201
- return;
202
- }
203
- }
204
- const connectedWallet2 = yield shouldUseSuggestChainAndConnect ? suggestAndConnectAsync({ walletType: walletType2, chainInfo }) : connectAsync({ walletType: walletType2, chainId: _chainId });
205
- const firstChain = !chainId ? selectedChainId : typeof _chainId === "string" ? _chainId : _chainId[0];
206
- address2 = connectedWallet2.accounts[firstChain].bech32Address;
207
- bufferAddress2 = connectedWallet2.accounts[firstChain].address.toString();
208
- if (connectedWallet2.accounts[firstChain]) {
209
- try {
210
- authState = yield login(bufferAddress2, address2, isFullAuthWallet, getProviderName(walletType2));
211
- verificationMessage.current = authState.stage === "verify" ? authState.signatureVerificationMessage : void 0;
212
- } catch (err) {
213
- authState = void 0;
214
- bufferAddress2 = void 0;
215
- address2 = void 0;
216
- error = err;
217
- }
206
+ throw new Error("Graz wallet type not provided.");
207
+ }
208
+ try {
209
+ let chainInfo;
210
+ if (shouldUseSuggestChainAndConnect) {
211
+ if (typeof _chainId !== "string") {
212
+ console.error("multiChain is not compatible with shouldUseSuggestChainAndConnect.");
213
+ return;
218
214
  }
219
- } catch (err) {
220
- if (err.message === "No wallet exists") {
221
- error = err.message;
222
- } else {
223
- console.error("Graz connection error:", err);
224
- error = "An unknown error occurred.";
215
+ chainInfo = getChainInfo({ chainId: _chainId });
216
+ if (!chainInfo) {
217
+ console.error("Chain not found.");
218
+ return;
225
219
  }
226
220
  }
221
+ const connectedWallet2 = yield shouldUseSuggestChainAndConnect ? suggestAndConnectAsync({ walletType: walletType2, chainInfo }) : connectAsync({ walletType: walletType2, chainId: _chainId });
222
+ const firstChain = !chainId ? selectedChainId : typeof _chainId === "string" ? _chainId : _chainId[0];
223
+ const addressBech32 = connectedWallet2.accounts[firstChain].bech32Address;
224
+ let rawAddress;
225
+ const accountAddress = connectedWallet2.accounts[firstChain].address;
226
+ if (!accountAddress || accountAddress.length === 0 || accountAddress.byteLength === 0) {
227
+ const pubKey = connectedWallet2.accounts[firstChain].pubKey;
228
+ rawAddress = rawSecp256k1PubkeyToRawAddress(pubKey);
229
+ } else {
230
+ rawAddress = accountAddress;
231
+ }
232
+ const address2 = formatEthHexAddress(rawAddress);
233
+ const { provider, providerId } = getProvider(walletType2);
234
+ return {
235
+ partnerId: para.partnerId,
236
+ type: "COSMOS",
237
+ address: address2,
238
+ addressBech32,
239
+ provider,
240
+ providerId
241
+ };
242
+ } catch (e) {
243
+ let error;
244
+ if (e.message === "No wallet exists") {
245
+ error = e.message;
246
+ } else {
247
+ error = `Graz connection error: ${(_a2 = e == null ? void 0 : e.message) != null ? _a2 : e}`;
248
+ }
249
+ throw error;
227
250
  }
228
- updateExternalWalletState({ isConnecting: false });
229
- return { authState, address: address2, bufferAddress: bufferAddress2, error };
230
251
  });
231
- const getWallet = (walletType2) => incompleteWallets.find((w) => w.grazType === walletType2 || w.grazMobileType === walletType2);
232
- const getProviderName = (walletType2) => {
233
- var _a2;
234
- return (_a2 = getWallet(walletType2)) == null ? void 0 : _a2.name;
252
+ const connect = (walletType2, chainId) => __async(this, null, function* () {
253
+ var _a2, _b2;
254
+ updateExternalWalletState({ isConnecting: true });
255
+ const walletId = (_a2 = getWallet(walletType2)) == null ? void 0 : _a2.id;
256
+ const isFullAuthWallet = walletsWithFullAuth.includes(walletId.toUpperCase());
257
+ try {
258
+ const externalWallet = yield connectBase(walletType2, chainId);
259
+ const authState = yield login(__spreadProps(__spreadValues({}, externalWallet), {
260
+ withFullParaAuth: isFullAuthWallet
261
+ }));
262
+ verificationMessage.current = authState.stage === "verify" ? authState.signatureVerificationMessage : void 0;
263
+ return {
264
+ address: externalWallet.address,
265
+ authState
266
+ };
267
+ } catch (e) {
268
+ return {
269
+ error: (_b2 = e == null ? void 0 : e.message) != null ? _b2 : e
270
+ };
271
+ } finally {
272
+ updateExternalWalletState({ isConnecting: false });
273
+ }
274
+ });
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);
291
+ const getProvider = (walletType2) => {
292
+ const wallet = getWallet(walletType2);
293
+ return {
294
+ provider: wallet == null ? void 0 : wallet.name,
295
+ providerId: wallet == null ? void 0 : wallet.id
296
+ };
235
297
  };
236
- const wallets = incompleteWallets.map((wallet) => {
298
+ const wallets = allWallets.map((wallet) => {
237
299
  return __spreadProps(__spreadValues({
238
300
  connect: () => connect(wallet.grazType),
239
301
  connectMobile: () => connect(wallet.grazType),
240
302
  getQrUri: () => "",
241
303
  type: "COSMOS"
242
304
  }, wallet), {
305
+ // Using name here since that's the only common id across the networks
306
+ id: wallet.name,
243
307
  installed: checkWallet(wallet.grazType)
244
308
  });
245
309
  }).filter((w) => !!w);
@@ -262,11 +326,39 @@ function CosmosExternalWalletProvider({
262
326
  return { error };
263
327
  }
264
328
  }), [para, multiChain, chains, selectedChainId]);
329
+ const requestInfo = (providerId) => __async(this, null, function* () {
330
+ var _a2;
331
+ const wallet = wallets.find((w) => w.id === providerId);
332
+ if (!wallet) {
333
+ throw new Error(`Wallet for provider ${providerId} not found`);
334
+ }
335
+ isLinkingAccount.current = true;
336
+ try {
337
+ const externalWallet = yield connectBase(
338
+ wallet.grazType,
339
+ multiChain ? chains.map((c) => c.chainId) : selectedChainId
340
+ );
341
+ return externalWallet;
342
+ } catch (e) {
343
+ console.error("Error linking account:", e);
344
+ throw new Error((_a2 = e == null ? void 0 : e.message) != null ? _a2 : e);
345
+ }
346
+ });
347
+ const disconnectBase = () => __async(this, null, function* () {
348
+ var _a2;
349
+ isLinkingAccount.current = true;
350
+ try {
351
+ yield disconnectAsync();
352
+ } catch (e) {
353
+ console.error("Error linking account:", e);
354
+ throw new Error((_a2 = e == null ? void 0 : e.message) != null ? _a2 : e);
355
+ }
356
+ });
265
357
  return /* @__PURE__ */ jsx(
266
358
  CosmosExternalWalletContext.Provider,
267
359
  {
268
360
  value: useMemo(
269
- () => ({
361
+ () => __spreadValues({
270
362
  wallets,
271
363
  chains: formattedChains,
272
364
  chainId: selectedChainId,
@@ -274,8 +366,10 @@ function CosmosExternalWalletProvider({
274
366
  switchChain,
275
367
  connectParaEmbedded,
276
368
  signMessage,
277
- signVerificationMessage
278
- }),
369
+ signVerificationMessage,
370
+ requestInfo,
371
+ disconnectBase
372
+ }, externalHooks),
279
373
  [
280
374
  wallets,
281
375
  formattedChains,
@@ -284,7 +378,9 @@ function CosmosExternalWalletProvider({
284
378
  switchChain,
285
379
  connectParaEmbedded,
286
380
  signMessage,
287
- signVerificationMessage
381
+ signVerificationMessage,
382
+ requestInfo,
383
+ disconnectBase
288
384
  ]
289
385
  ),
290
386
  children
@@ -0,0 +1,8 @@
1
+ import { useAccount } from '@getpara/graz';
2
+ import { MultiChainHookArgs } from '../types/ExternalHooks.js';
3
+ export type TExternalHooks = {
4
+ useAccount: typeof useAccount<MultiChainHookArgs>;
5
+ };
6
+ export declare const externalHooks: {
7
+ useAccount: typeof useAccount;
8
+ };
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import "../chunk-IV3L3JVM.js";
3
+ import { useAccount } from "@getpara/graz";
4
+ const externalHooks = { useAccount };
5
+ export {
6
+ externalHooks
7
+ };
@@ -0,0 +1,8 @@
1
+ import { UseAccountArgs } from '@getpara/graz';
2
+ type ChainId$1 = string | string[];
3
+ export interface MultiChainHookArgs {
4
+ chainId?: ChainId$1;
5
+ multiChain?: boolean;
6
+ }
7
+ export type UseAccountParameters = UseAccountArgs & MultiChainHookArgs;
8
+ export {};
@@ -0,0 +1 @@
1
+ "use client";
@@ -0,0 +1 @@
1
+ export declare function formatEthHexAddress(address: Uint8Array): string;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import "../chunk-IV3L3JVM.js";
3
+ function formatEthHexAddress(address) {
4
+ return `0x${Buffer.from(address).toString("hex")}`.toLowerCase();
5
+ }
6
+ export {
7
+ formatEthHexAddress
8
+ };
@@ -0,0 +1,2 @@
1
+ import { WalletWithType } from '../../../types/Wallet.js';
2
+ export declare const cosmostationWallet: () => WalletWithType;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import "../../../chunk-IV3L3JVM.js";
3
+ import { icon } from "./cosmostationIcon.js";
4
+ import { WalletType } from "@getpara/graz";
5
+ import { isMobile } from "@getpara/web-sdk";
6
+ const cosmostationWallet = () => {
7
+ return {
8
+ id: "cosmostation",
9
+ internalId: "COSMOSTATION",
10
+ name: "Cosmostation",
11
+ iconUrl: icon,
12
+ isExtension: true,
13
+ isMobile: isMobile() && true,
14
+ downloadUrl: "https://www.cosmostation.io/products/cosmostation_extension",
15
+ grazType: WalletType.COSMOSTATION,
16
+ grazMobileType: WalletType.WC_COSMOSTATION_MOBILE
17
+ };
18
+ };
19
+ export {
20
+ cosmostationWallet
21
+ };
@@ -0,0 +1 @@
1
+ export declare const icon = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzMwNV8yKSI+CjxwYXRoIGQ9Ik0xNy4zNDI5IDIuNzE1ODJIOS42NDc3QzkuNDU1OTggMi43MTYgOS4yNjc2NyAyLjc2NjU0IDkuMTAxNjIgMi44NjIzOEM4LjkzNTU2IDIuOTU4MjIgOC43OTc2IDMuMDk1OTkgOC43MDE1MyAzLjI2MTkxTDQuODUzODkgOS45MjU2NkM0Ljc1NzY5IDEwLjA5MTYgNC43MDcwMyAxMC4yOCA0LjcwNzAzIDEwLjQ3MThDNC43MDcwMyAxMC42NjM1IDQuNzU3NjkgMTAuODUxOSA0Ljg1Mzg5IDExLjAxNzlMOC43MDE1MyAxNy42ODE2TDEwLjU5MzYgMTYuNTg5NUw3LjA2MzE4IDEwLjQ3MThMMTAuMjc5MiA0LjkwMDJIMTYuNzE0MUwyMC4yNDczIDExLjAxNzhMMjIuMTM5NCA5LjkyNTYyTDE4LjI4ODkgMy4yNjE5MUMxOC4xOTMxIDMuMDk1NzkgMTguMDU1MiAyLjk1Nzg1IDE3Ljg4OTIgMi44NjE5OEMxNy43MjMxIDIuNzY2MTEgMTcuNTM0NyAyLjcxNTcgMTcuMzQyOSAyLjcxNTgyWiIgZmlsbD0iIzlDNkNGRiIvPgo8cGF0aCBkPS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5MjlDMTkuMjE4NyAxMy45MjcgMTkuMjY5NCAxMy43Mzg2IDE5LjI2OTQgMTMuNTQ2OEMxOS4yNjk0IDEzLjM1NSAxOS4yMTg3IDEzLjE2NjYgMTkuMTIyNSAxMy4wMDA3TDE1LjI3NDkgNi4zMzY5MVoiIGZpbGw9IiMwNUQyREQiLz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8zMDVfMiI+CjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K";
4
+ export {
5
+ icon
6
+ };
@@ -1,4 +1,5 @@
1
1
  import { keplrWallet } from './keplr/keplr.js';
2
2
  import { leapWallet } from './leap/leap.js';
3
- export { keplrWallet, leapWallet };
3
+ import { cosmostationWallet } from './cosmostation/cosmostation.js';
4
+ export { keplrWallet, leapWallet, cosmostationWallet };
4
5
  export declare const allWallets: (() => import("../../types/Wallet.js").WalletWithType)[];
@@ -2,9 +2,11 @@
2
2
  import "../../chunk-IV3L3JVM.js";
3
3
  import { keplrWallet } from "./keplr/keplr.js";
4
4
  import { leapWallet } from "./leap/leap.js";
5
- const allWallets = [keplrWallet, leapWallet];
5
+ import { cosmostationWallet } from "./cosmostation/cosmostation.js";
6
+ const allWallets = [keplrWallet, leapWallet, cosmostationWallet];
6
7
  export {
7
8
  allWallets,
9
+ cosmostationWallet,
8
10
  keplrWallet,
9
11
  leapWallet
10
12
  };
@@ -6,6 +6,7 @@ import { isMobile } from "@getpara/web-sdk";
6
6
  const keplrWallet = () => {
7
7
  return {
8
8
  id: "keplr",
9
+ internalId: "KEPLR",
9
10
  name: "Keplr",
10
11
  iconUrl: icon,
11
12
  isExtension: true,
@@ -6,6 +6,7 @@ import { isMobile } from "@getpara/web-sdk";
6
6
  const leapWallet = () => {
7
7
  return {
8
8
  id: "leap",
9
+ internalId: "LEAP",
9
10
  name: "Leap",
10
11
  iconUrl: icon,
11
12
  isExtension: true,
package/package.json CHANGED
@@ -1,43 +1,40 @@
1
1
  {
2
2
  "name": "@getpara/cosmos-wallet-connectors",
3
- "version": "2.0.0-alpha.5",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "exports": {
8
- ".": "./dist/index.js",
9
- "./connectors": "./dist/wallets/connectors/index.js"
10
- },
11
- "scripts": {
12
- "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
13
- "typegen": "tsc --emitDeclarationOnly",
14
- "test": "vitest run --coverage"
15
- },
3
+ "version": "2.0.0-alpha.50",
16
4
  "dependencies": {
17
- "@cosmjs/cosmwasm-stargate": "<=0.31.3",
18
- "@cosmjs/launchpad": "*",
19
- "@cosmjs/proto-signing": "<=0.31.3",
20
- "@cosmjs/stargate": "<=0.33.1",
21
- "@cosmjs/tendermint-rpc": "<=0.31.3",
22
- "@getpara/graz": "^1.0.0-dev.2",
23
- "@getpara/web-sdk": "2.0.0-alpha.5",
5
+ "@getpara/react-common": "2.0.0-alpha.50",
6
+ "@getpara/web-sdk": "2.0.0-alpha.50",
24
7
  "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.41",
8
+ "starknet": "^6.11.0",
25
9
  "zustand": "^4.5.2",
26
10
  "zustand-sync-tabs": "^0.2.2"
27
11
  },
28
12
  "devDependencies": {
29
- "@getpara/react-common": "2.0.0-alpha.5",
13
+ "@getpara/graz": "2.0.0-alpha.5",
30
14
  "@types/react": "^18.0.31",
31
15
  "@types/react-dom": "^18.2.7",
32
- "typescript": "^5.4.3"
16
+ "typescript": "^5.8.3"
33
17
  },
34
- "peerDependencies": {
35
- "react": ">=18",
36
- "react-dom": ">=18"
18
+ "exports": {
19
+ ".": "./dist/index.js",
20
+ "./connectors": "./dist/wallets/connectors/index.js"
37
21
  },
38
22
  "files": [
39
23
  "dist",
40
24
  "package.json"
41
25
  ],
42
- "gitHead": "3ecfca088f24489f2e8fa5493d0f4459b08880e1"
26
+ "gitHead": "688b92a7ca207593a4a3be09cb5cc580092614fc",
27
+ "main": "dist/index.js",
28
+ "peerDependencies": {
29
+ "@getpara/graz": ">=2.0.0-alpha.5",
30
+ "react": ">=18",
31
+ "react-dom": ">=18"
32
+ },
33
+ "scripts": {
34
+ "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
35
+ "test": "vitest run --coverage",
36
+ "typegen": "tsc --emitDeclarationOnly"
37
+ },
38
+ "type": "module",
39
+ "types": "dist/index.d.ts"
43
40
  }