@getpara/evm-wallet-connectors 2.12.0 → 2.13.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.
@@ -6,7 +6,8 @@ export type EvmExternalWalletContextType = ExternalWalletContextType & ChainMana
6
6
  avatar?: string;
7
7
  } & FarcasterMiniAppManagement & {
8
8
  verificationStage: 'verifying' | 'switchingChain';
9
+ switchConnection: (connectorName: string) => Promise<void>;
9
10
  };
10
11
  export declare const EvmExternalWalletContext: import("react").Context<EvmExternalWalletContextType>;
11
12
  export type EvmExternalWalletProviderConfig = ExternalWalletProviderConfigBase;
12
- export declare function EvmExternalWalletProvider({ children, onSwitchWallet, para, walletsWithFullAuth, connectedWallet: connectedWalletProp, includeWalletVerification, connectionOnly, }: EvmExternalWalletProviderConfig & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
13
+ export declare function EvmExternalWalletProvider({ children, para, walletsWithFullAuth, includeWalletVerification, connectionOnly, }: EvmExternalWalletProviderConfig & PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -16,7 +16,8 @@ import {
16
16
  useSignMessage,
17
17
  useSwitchAccount,
18
18
  useConnections,
19
- useBalance
19
+ useBalance,
20
+ useConfig
20
21
  } from "wagmi";
21
22
  import { isEIP6963Connector } from "../utils/isEIP6963Connector.js";
22
23
  import { emitWalletConnectUri } from "../utils/getWalletConnectUri.js";
@@ -29,87 +30,129 @@ import {
29
30
  import { isMobile } from "@getpara/web-sdk";
30
31
  import { etherUnits, formatUnits } from "viem";
31
32
  import { externalHooks } from "./externalHooks.js";
33
+ import {
34
+ connect as wagmiConnect,
35
+ disconnect,
36
+ getConnections,
37
+ getConnectors,
38
+ watchAccount,
39
+ watchConnections
40
+ } from "wagmi/actions";
32
41
  const EvmExternalWalletContext = createContext(__spreadProps(__spreadValues({}, defaultEvmExternalWallet), {
33
42
  farcasterStatus: void 0,
34
43
  verificationStage: void 0
35
44
  }));
36
45
  function EvmExternalWalletProvider({
37
46
  children,
38
- onSwitchWallet,
39
47
  para,
40
48
  walletsWithFullAuth,
41
- connectedWallet: connectedWalletProp,
42
49
  includeWalletVerification,
43
50
  connectionOnly
44
51
  }) {
45
52
  const { connectAsync, connectors: untypedConnectors } = useConnect();
46
53
  const connections = useConnections();
47
- const {
48
- address: wagmiAddress,
49
- isConnecting,
50
- isReconnecting,
51
- chainId,
52
- connector: connectedConnector,
53
- isConnected
54
- } = useAccount();
55
- const { switchAccount: wagmiSwitchAccount } = useSwitchAccount();
54
+ const config = useConfig();
55
+ const { address: wagmiAddress, chainId, connector: connectedConnector } = useAccount();
56
+ const { switchAccountAsync: wagmiSwitchAccount } = useSwitchAccount();
56
57
  const { chains, switchChainAsync } = useSwitchChain();
57
58
  const { disconnectAsync, status: disconnectStatus } = useDisconnect();
58
59
  const { data: ensName, refetch: refetchEnsName } = useEnsName({ address: wagmiAddress });
59
60
  const { data: ensAvatar, refetch: refetchEnsAvatar } = useEnsAvatar({
60
- name: normalize(ensName)
61
+ name: ensName ? normalize(ensName) : void 0
61
62
  });
62
63
  const { signMessageAsync } = useSignMessage();
63
- const connectedWallet = connectedWalletProp ? para.findWallet(connectedWalletProp.id, connectedWalletProp.type) : null;
64
64
  const disconnectTypeRef = useRef();
65
- const verificationMessage = useRef();
66
65
  const { refetch: getBalance } = useBalance({ address: wagmiAddress });
67
66
  const connectors = untypedConnectors;
68
67
  const connectionsRef = useRef(connections);
69
68
  const connectorsRef = useRef(connectors);
70
69
  const [verificationStage, setVerificationStage] = useState("verifying");
71
- const isLocalConnecting = useExternalWalletStore((state) => state.isConnecting);
70
+ useEffect(() => {
71
+ const initializeConfig = () => __async(this, null, function* () {
72
+ yield para.initExternalWalletProvider({
73
+ type: "EVM",
74
+ interface: {
75
+ disconnect: () => __async(this, null, function* () {
76
+ yield disconnect(config);
77
+ }),
78
+ getAddress: () => __async(this, null, function* () {
79
+ var _a, _b;
80
+ const connections2 = getConnections(config);
81
+ const nonParaConnection = connections2.find((c) => c.connector.name !== "Para");
82
+ const address = (_b = (_a = nonParaConnection == null ? void 0 : nonParaConnection.accounts) == null ? void 0 : _a[0]) != null ? _b : null;
83
+ return address;
84
+ }),
85
+ signMessage: (_0) => __async(this, [_0], function* ({ message, address }) {
86
+ try {
87
+ const resp = yield signMessageBase({ message, address });
88
+ return { signature: resp.signature };
89
+ } catch (e) {
90
+ throw e;
91
+ }
92
+ }),
93
+ watchDisconnection: (callback) => {
94
+ return watchConnections(config, {
95
+ onChange: (connections2) => __async(this, null, function* () {
96
+ const nonParaConnections = connections2.filter((c) => c.connector.name !== "Para");
97
+ if (nonParaConnections.length === 0) {
98
+ yield callback();
99
+ }
100
+ })
101
+ });
102
+ },
103
+ watchWalletChange: (callback) => {
104
+ return watchAccount(config, {
105
+ onChange: (account) => {
106
+ var _a, _b;
107
+ const connections2 = getConnections(config);
108
+ const nonParaConnection = connections2.find((c) => c.connector.name !== "Para");
109
+ const address = (_b = (_a = nonParaConnection == null ? void 0 : nonParaConnection.accounts) == null ? void 0 : _a[0]) != null ? _b : null;
110
+ const connector = nonParaConnection == null ? void 0 : nonParaConnection.connector;
111
+ if (account.isConnected && account.address === address) {
112
+ callback({
113
+ externalWallet: {
114
+ providerId: connector.name,
115
+ provider: connector.name,
116
+ address,
117
+ type: "EVM"
118
+ }
119
+ });
120
+ }
121
+ }
122
+ });
123
+ },
124
+ connectParaConnector: () => __async(this, null, function* () {
125
+ const connectors2 = getConnectors(config);
126
+ const paraConnector = connectors2.find((c) => {
127
+ return c.name === "Para";
128
+ });
129
+ if (!paraConnector) {
130
+ throw new Error("Para connector not found");
131
+ }
132
+ yield wagmiConnect(config, { connector: paraConnector });
133
+ })
134
+ }
135
+ });
136
+ });
137
+ initializeConfig();
138
+ }, []);
72
139
  const updateExternalWalletState = useExternalWalletStore((state) => state.updateState);
73
- const hasStoredExternalWallets = () => {
74
- var _a;
75
- const storedExternalWalletsString = localStorage.getItem("@CAPSULE/externalWallets");
76
- let storedExternalWallets = {};
77
- if (storedExternalWalletsString) {
78
- storedExternalWallets = JSON.parse(storedExternalWalletsString);
79
- }
80
- return ((_a = Object.values(storedExternalWallets)) == null ? void 0 : _a.length) > 0;
81
- };
82
140
  const switchAccount = useCallback(
83
- (connectorName) => {
141
+ (connectorName) => __async(this, null, function* () {
84
142
  var _a;
85
143
  const connector = (_a = connectionsRef.current.find((c) => {
86
144
  var _a2;
87
145
  const paraDetails = (_a2 = c.connector) == null ? void 0 : _a2.paraDetails;
88
- return [paraDetails == null ? void 0 : paraDetails.name, paraDetails == null ? void 0 : paraDetails.id, paraDetails == null ? void 0 : paraDetails.internalId].includes(connectorName);
146
+ return [paraDetails == null ? void 0 : paraDetails.name, c.connector.name].includes(connectorName);
89
147
  })) == null ? void 0 : _a.connector;
90
148
  if (!connector) {
91
149
  console.warn(`connector not found: ${connectorName}`);
92
150
  return;
93
151
  }
94
- wagmiSwitchAccount({ connector });
95
- },
152
+ yield wagmiSwitchAccount({ connector });
153
+ }),
96
154
  [wagmiSwitchAccount]
97
155
  );
98
- const findConnectorAndAccount = (externalWallet) => {
99
- var _a;
100
- let connector;
101
- switch (true) {
102
- case !!externalWallet.providerId:
103
- {
104
- connector = (_a = connectionsRef.current.find((c) => {
105
- var _a2;
106
- return ((_a2 = c.connector) == null ? void 0 : _a2.name) === externalWallet.providerId;
107
- })) == null ? void 0 : _a.connector;
108
- }
109
- break;
110
- }
111
- return { connector, account: externalWallet.address };
112
- };
113
156
  const getWalletBalance = useCallback(
114
157
  // Format from wei to eth
115
158
  () => __async(this, null, function* () {
@@ -118,43 +161,6 @@ function EvmExternalWalletProvider({
118
161
  }),
119
162
  [chainId, wagmiAddress, getBalance]
120
163
  );
121
- useEffect(() => {
122
- if ((connectedConnector == null ? void 0 : connectedConnector.id) === "para") {
123
- return;
124
- }
125
- if (!isConnecting && !isReconnecting && !isLocalConnecting && !!wagmiAddress && // If the user has no stored wallets we want to reset, if they do we should assuming this is being triggered from a wagmi account switch
126
- !hasStoredExternalWallets() && !disconnectTypeRef.current && para.isReady && !para.isFarcasterMiniApp) {
127
- reset();
128
- }
129
- }, [isConnected, isLocalConnecting, wagmiAddress, connectedConnector, para.isReady, para.isFarcasterMiniApp]);
130
- useEffect(() => {
131
- const storedExternalWallet = Object.values(para.externalWallets || {})[0];
132
- if (!isLocalConnecting && isConnected && (storedExternalWallet == null ? void 0 : storedExternalWallet.type) === "EVM" && (storedExternalWallet == null ? void 0 : storedExternalWallet.address) !== wagmiAddress && (connectedConnector == null ? void 0 : connectedConnector.id) !== "para" && !disconnectTypeRef.current) {
133
- switchWallet(wagmiAddress);
134
- }
135
- }, [isLocalConnecting, wagmiAddress, isConnected]);
136
- useEffect(() => {
137
- var _a;
138
- const connectedConnectorName = (connectedConnector == null ? void 0 : connectedConnector.name) === "WalletConnect" ? (_a = connectedConnector == null ? void 0 : connectedConnector.paraDetails) == null ? void 0 : _a.name : connectedConnector == null ? void 0 : connectedConnector.name;
139
- if (!isLocalConnecting && !isConnecting && !isReconnecting && connectedWallet && connectedConnector && connectedWallet.type === "EVM" && connectedConnectorName !== connectedWallet.name) {
140
- switchAccount(connectedWallet.isExternal ? connectedWallet.name : "Para");
141
- }
142
- }, [isLocalConnecting, isConnecting, isReconnecting, connectedWallet, wagmiSwitchAccount]);
143
- useEffect(() => {
144
- const connectPara = () => __async(this, null, function* () {
145
- if (!isLocalConnecting && !isConnecting && !isReconnecting && !isConnected && !connectedConnector) {
146
- if (Object.values(para.wallets).length === 0 || !(yield para.isFullyLoggedIn())) {
147
- return;
148
- }
149
- connectParaEmbedded();
150
- }
151
- });
152
- connectPara();
153
- }, [isLocalConnecting, isConnecting, isReconnecting, isConnected, connectedConnector]);
154
- const reset = () => __async(this, null, function* () {
155
- yield disconnectAsync();
156
- yield para.logout();
157
- });
158
164
  const getChainParams = (chainId2) => {
159
165
  var _a;
160
166
  const chain = chains.find((c) => c.id === chainId2);
@@ -171,12 +177,10 @@ function EvmExternalWalletProvider({
171
177
  blockExplorerUrls: ((_a = chain.blockExplorers) == null ? void 0 : _a.default) ? [chain.blockExplorers.default.url] : void 0
172
178
  };
173
179
  };
174
- const signMessage = (_0) => __async(this, [_0], function* ({ message, externalWallet }) {
175
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
176
- let signOpts = {};
177
- const connector = findConnector(
178
- externalWallet ? externalWallet.providerId : getConnectorInfo(connectedConnector).providerId
179
- );
180
+ const signMessageBase = (_0) => __async(this, [_0], function* ({ message, address }) {
181
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
182
+ const connection = connectionsRef.current.find((c) => c.accounts.includes(address));
183
+ const connector = connection == null ? void 0 : connection.connector;
180
184
  const signUri = isMobile() && connector.type === "walletConnect" ? (_a = connector.paraDetails) == null ? void 0 : _a.deeplinkUri : void 0;
181
185
  const openApp = () => {
182
186
  if (signUri) {
@@ -184,16 +188,12 @@ function EvmExternalWalletProvider({
184
188
  }
185
189
  };
186
190
  openApp();
187
- if (externalWallet) {
188
- signOpts = findConnectorAndAccount(externalWallet);
189
- switchAccount((_b = externalWallet.providerId) != null ? _b : "");
190
- }
191
- const address = signOpts.account ? typeof signOpts.account === "string" ? signOpts.account : signOpts.account.getAddress() : wagmiAddress;
192
191
  try {
193
- const signature = yield signMessageAsync(__spreadValues({
192
+ const signature = yield signMessageAsync({
194
193
  message,
195
- account: address
196
- }, signOpts));
194
+ account: address,
195
+ connector: connection.connector
196
+ });
197
197
  return {
198
198
  address,
199
199
  signature
@@ -201,54 +201,60 @@ function EvmExternalWalletProvider({
201
201
  } catch (e) {
202
202
  console.error("Error signing message:", e);
203
203
  console.error("Error signing message:", e.message, e.details);
204
- if (e.message.includes("Chain not configured") || e.details.includes("Chain not configured")) {
204
+ if (((_b = e.message) == null ? void 0 : _b.includes("Chain not configured")) || ((_c = e.details) == null ? void 0 : _c.includes("Chain not configured"))) {
205
205
  setVerificationStage("switchingChain");
206
- const currentChainParams = getChainParams((_d = (_c = chains[0]) == null ? void 0 : _c.id) != null ? _d : chainId);
206
+ const currentChainParams = getChainParams((_e = (_d = chains[0]) == null ? void 0 : _d.id) != null ? _e : chainId);
207
207
  if (!currentChainParams) {
208
- return {
209
- error: `Chain ${chainId} not found in configuration`
210
- };
208
+ throw new Error(`Chain ${chainId} not found in configuration`);
211
209
  }
212
210
  try {
213
211
  yield switchChainAsync({
214
212
  addEthereumChainParameter: currentChainParams,
215
- chainId: (_f = (_e = chains[0]) == null ? void 0 : _e.id) != null ? _f : chainId
213
+ chainId: (_g = (_f = chains[0]) == null ? void 0 : _f.id) != null ? _g : chainId
216
214
  });
217
215
  setVerificationStage("verifying");
218
- return yield signMessage({ message, externalWallet });
216
+ return yield signMessageBase({ message, address });
219
217
  } catch (error) {
220
218
  console.error("Error adding chain:", error);
221
- return {
222
- error: `Error adding chain. You may need to add ${currentChainParams == null ? void 0 : currentChainParams.chainName} support to ${(_i = (_h = (_g = connectedConnector == null ? void 0 : connectedConnector.paraDetails) == null ? void 0 : _g.name) != null ? _h : connectedConnector == null ? void 0 : connectedConnector.name) != null ? _i : "the wallet"} manually.`
223
- };
219
+ throw new Error(
220
+ `Error adding chain. You may need to add ${currentChainParams == null ? void 0 : currentChainParams.chainName} support to ${(_j = (_i = (_h = connectedConnector == null ? void 0 : connectedConnector.paraDetails) == null ? void 0 : _h.name) != null ? _i : connectedConnector == null ? void 0 : connectedConnector.name) != null ? _j : "the wallet"} manually.`
221
+ );
224
222
  }
225
223
  }
226
224
  switch (e.name) {
227
225
  case "UserRejectedRequestError": {
228
- return { error: "Signature request rejected" };
226
+ throw new Error("Signature request rejected");
229
227
  }
230
228
  default: {
231
- return { error: "An unknown error occurred" };
229
+ throw new Error("An unknown error occurred");
232
230
  }
233
231
  }
234
232
  }
235
233
  });
236
- const signVerificationMessage = () => __async(this, null, function* () {
237
- setVerificationStage("verifying");
238
- const signature = yield signMessage({ message: verificationMessage.current });
239
- return signature;
234
+ const signMessage = (_0) => __async(this, [_0], function* ({ message, externalWallet }) {
235
+ var _a;
236
+ let address = wagmiAddress;
237
+ if (externalWallet) {
238
+ address = externalWallet.address;
239
+ yield switchAccount((_a = externalWallet.providerId) != null ? _a : "");
240
+ }
241
+ try {
242
+ return yield signMessageBase({ message, address });
243
+ } catch (e) {
244
+ return { error: e.message };
245
+ }
240
246
  });
241
247
  const switchChain = (chainId2) => __async(this, null, function* () {
242
- var _a, _b, _c;
248
+ var _a, _b, _c, _d;
243
249
  let error;
244
250
  try {
245
251
  yield switchChainAsync({ chainId: chainId2 });
246
252
  } catch (e) {
247
- if (e.details.includes("Missing or invalid.")) {
253
+ if ((_a = e.details) == null ? void 0 : _a.includes("Missing or invalid.")) {
248
254
  const chain = chains.find((c) => c.id === chainId2);
249
255
  error = [
250
256
  "Network not supported.",
251
- `You may need to add ${chain == null ? void 0 : chain.name} support to ${(_c = (_b = (_a = connectedConnector == null ? void 0 : connectedConnector.paraDetails) == null ? void 0 : _a.name) != null ? _b : connectedConnector == null ? void 0 : connectedConnector.name) != null ? _c : "the wallet"} manually.`
257
+ `You may need to add ${chain == null ? void 0 : chain.name} support to ${(_d = (_c = (_b = connectedConnector == null ? void 0 : connectedConnector.paraDetails) == null ? void 0 : _b.name) != null ? _c : connectedConnector == null ? void 0 : connectedConnector.name) != null ? _d : "the wallet"} manually.`
252
258
  ];
253
259
  } else {
254
260
  switch (e.name) {
@@ -265,55 +271,6 @@ function EvmExternalWalletProvider({
265
271
  }
266
272
  return { error };
267
273
  });
268
- const login = (_0) => __async(this, [_0], function* ({ address, withFullParaAuth = false, providerId, provider }) {
269
- var _a, _b, _c;
270
- try {
271
- refetchEnsName();
272
- refetchEnsAvatar();
273
- return yield para.loginExternalWallet({
274
- externalWallet: {
275
- partnerId: para.partnerId,
276
- address,
277
- type: "EVM",
278
- provider,
279
- providerId,
280
- withFullParaAuth,
281
- ensName,
282
- ensAvatar,
283
- isConnectionOnly: connectionOnly,
284
- withVerification: includeWalletVerification
285
- },
286
- uri: window == null ? void 0 : window.location.origin,
287
- chainId: (_c = (_b = (_a = chains[0]) == null ? void 0 : _a.id) != null ? _b : chainId) == null ? void 0 : _c.toString()
288
- });
289
- } catch (e) {
290
- yield disconnectAsync();
291
- yield para.logout();
292
- throw "Error logging you in. Please try again.";
293
- }
294
- });
295
- const switchWallet = (address) => __async(this, null, function* () {
296
- updateExternalWalletState({ isConnecting: true });
297
- let error;
298
- if (!address) {
299
- yield para.logout();
300
- } else {
301
- if (para.isExternalWalletAuth || para.isExternalWalletWithVerification) {
302
- yield reset();
303
- } else {
304
- try {
305
- const loginInfo = getConnectorInfo(connectedConnector);
306
- yield login(__spreadValues({
307
- address
308
- }, loginInfo));
309
- } catch (err) {
310
- error = err;
311
- }
312
- }
313
- }
314
- onSwitchWallet == null ? void 0 : onSwitchWallet({ address, error });
315
- updateExternalWalletState({ isConnecting: false });
316
- });
317
274
  const connectBase = (connector) => __async(this, null, function* () {
318
275
  var _a, _b, _c, _d, _e, _f;
319
276
  if (connector.type === "walletConnect" || ((_a = connector.paraDetails) == null ? void 0 : _a.internalId) === "WALLETCONNECT" || ((_b = connector.paraDetails) == null ? void 0 : _b.showQrModal)) {
@@ -330,43 +287,60 @@ function EvmExternalWalletProvider({
330
287
  });
331
288
  return (_f = data.accounts) == null ? void 0 : _f[0];
332
289
  });
333
- const connect = (connector) => __async(this, null, function* () {
334
- updateExternalWalletState({ isConnecting: true });
335
- yield disconnectAsync();
336
- let authState;
337
- let address;
338
- let error;
290
+ const connectCallback = (connector) => () => __async(this, null, function* () {
291
+ var _a, _b, _c, _d, _e, _f;
292
+ if (connector.type === "walletConnect" || ((_a = connector.paraDetails) == null ? void 0 : _a.internalId) === "WALLETCONNECT" || ((_b = connector.paraDetails) == null ? void 0 : _b.showQrModal)) {
293
+ yield emitWalletConnectUri(connector, connector.getUri);
294
+ }
295
+ const walletChainId = yield connector.getChainId();
296
+ const chainId2 = (_e = (_c = chains.find(({ id }) => id === walletChainId)) == null ? void 0 : _c.id) != null ? _e : (
297
+ // Fall back to the first chain provided.
298
+ (_d = chains[0]) == null ? void 0 : _d.id
299
+ );
339
300
  try {
340
- address = yield connectBase(connector);
341
- if (address) {
342
- try {
343
- const loginInfo = getConnectorInfo(connector);
344
- authState = yield login(__spreadValues({
345
- address
346
- }, loginInfo));
347
- verificationMessage.current = authState.signatureVerificationMessage;
348
- } catch (err) {
349
- address = void 0;
350
- error = err;
351
- }
352
- }
301
+ const data = yield connectAsync({
302
+ // If the wallet is already on a supported chain, use that to avoid a chain switch prompt.
303
+ chainId: chainId2,
304
+ connector
305
+ });
306
+ const loginInfo = getConnectorInfo(connector);
307
+ return {
308
+ externalWallet: __spreadProps(__spreadValues({}, loginInfo), {
309
+ address: (_f = data.accounts) == null ? void 0 : _f[0],
310
+ type: "EVM"
311
+ }),
312
+ chainId: chainId2 == null ? void 0 : chainId2.toString()
313
+ };
353
314
  } catch (e) {
354
315
  switch (e.name) {
355
316
  case "UserRejectedRequestError": {
356
- error = "Connection request rejected";
357
- break;
317
+ throw new Error("Connection request rejected");
358
318
  }
359
319
  case "ResourceUnavailableRpcError": {
360
- error = `${connector.name} not detected`;
361
- break;
320
+ throw new Error(`${connector.name} not detected`);
362
321
  }
363
322
  default: {
364
323
  console.error("Wagmi connection error:", e.message);
365
- error = "An unknown error occurred";
366
- break;
324
+ throw new Error("An unknown error occurred");
367
325
  }
368
326
  }
369
327
  }
328
+ });
329
+ const connect = (connector) => __async(this, null, function* () {
330
+ var _a;
331
+ updateExternalWalletState({ isConnecting: true });
332
+ yield disconnectAsync();
333
+ let authState;
334
+ let address;
335
+ let error;
336
+ try {
337
+ authState = yield para.connectExternalWallet({ connect: connectCallback(connector) });
338
+ refetchEnsName();
339
+ refetchEnsAvatar();
340
+ address = (_a = authState.externalWallet) == null ? void 0 : _a.address;
341
+ } catch (e) {
342
+ error = e.message;
343
+ }
370
344
  updateExternalWalletState({ isConnecting: false });
371
345
  return { address, authState, error };
372
346
  });
@@ -490,7 +464,10 @@ function EvmExternalWalletProvider({
490
464
  type: "EVM",
491
465
  providerId: connector.name,
492
466
  provider: connector.name,
493
- withFullParaAuth
467
+ withFullParaAuth,
468
+ isConnectionOnly: connectionOnly,
469
+ withVerification: includeWalletVerification,
470
+ partnerId: para.partnerId
494
471
  };
495
472
  };
496
473
  const formattedChains = chains.map((c) => {
@@ -547,10 +524,10 @@ function EvmExternalWalletProvider({
547
524
  switchChain,
548
525
  connectParaEmbedded,
549
526
  signMessage,
550
- signVerificationMessage,
551
527
  getWalletBalance,
552
528
  requestInfo,
553
529
  disconnectBase,
530
+ switchConnection: switchAccount,
554
531
  farcasterStatus,
555
532
  verificationStage
556
533
  }, externalHooks),
@@ -95,24 +95,26 @@ function ParaEvmProvider({
95
95
  };
96
96
  const [config, setConfig] = useState(null);
97
97
  useEffect(() => {
98
- if (!para.isReady) {
98
+ if (!para.isSetup) {
99
99
  return;
100
100
  }
101
101
  const initializeConfig = () => __async(this, null, function* () {
102
102
  var _a2;
103
+ let config2;
103
104
  if (para.isFarcasterMiniApp) {
104
105
  let createFarcasterConnector = null;
105
106
  try {
106
107
  createFarcasterConnector = (_a2 = (yield import("@farcaster/miniapp-wagmi-connector")).farcasterMiniApp) != null ? _a2 : void 0;
107
108
  } catch (e) {
108
109
  }
109
- setConfig(createConfig([...propsWalletList, farcasterWallet], createFarcasterConnector));
110
+ config2 = createConfig([...propsWalletList, farcasterWallet], createFarcasterConnector);
110
111
  } else {
111
- setConfig(createConfig([...propsWalletList]));
112
+ config2 = createConfig([...propsWalletList]);
112
113
  }
114
+ setConfig(config2);
113
115
  });
114
116
  initializeConfig();
115
- }, [para.isFarcasterMiniApp, para.isReady, propsWalletList]);
117
+ }, [para.isFarcasterMiniApp, para.isSetup, propsWalletList]);
116
118
  if (!config) {
117
119
  return null;
118
120
  }
@@ -13,8 +13,13 @@ const getOrCreateWalletConnectInstance = ({
13
13
  }) => {
14
14
  let config = __spreadProps(__spreadValues({}, walletConnectParameters ? walletConnectParameters : {}), {
15
15
  projectId,
16
- showQrModal: false
16
+ showQrModal: false,
17
17
  // Required. Otherwise WalletConnect modal (Web3Modal) will popup during time of connection for a wallet
18
+ qrModalOptions: {
19
+ themeVariables: {
20
+ "--wcm-z-index": "100000"
21
+ }
22
+ }
18
23
  });
19
24
  if (paraDetailsShowQrModal) {
20
25
  config = __spreadProps(__spreadValues({}, config), { showQrModal: true });
@@ -11,7 +11,7 @@ const farcasterWallet = ({ para, createFarcasterConnector }) => {
11
11
  name: "Farcaster",
12
12
  rdns: "xyz.farcaster.MiniAppWallet",
13
13
  iconUrl: icon,
14
- installed: (para == null ? void 0 : para.isReady) && (para == null ? void 0 : para.isFarcasterMiniApp),
14
+ installed: (para == null ? void 0 : para.isSetup) && (para == null ? void 0 : para.isFarcasterMiniApp),
15
15
  isExtension: true,
16
16
  downloadUrl: "https://farcaster.xyz/",
17
17
  createConnector: (walletDetails) => createConnector((config) => __spreadValues(__spreadValues({}, createFarcasterConnector()(config)), walletDetails))
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@getpara/evm-wallet-connectors",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "dependencies": {
5
5
  "@coinbase/wallet-sdk": "4.3.0",
6
- "@getpara/wagmi-v2-connector": "2.12.0",
7
- "@getpara/web-sdk": "2.12.0",
6
+ "@getpara/wagmi-v2-connector": "2.13.0",
7
+ "@getpara/web-sdk": "2.13.0",
8
8
  "@walletconnect/ethereum-provider": "2.23.0",
9
9
  "zustand": "^4.5.2",
10
10
  "zustand-sync-tabs": "^0.2.2"
11
11
  },
12
12
  "devDependencies": {
13
- "@getpara/react-common": "2.12.0",
13
+ "@getpara/react-common": "2.13.0",
14
14
  "@tanstack/react-query": "^5.74.0",
15
15
  "@types/react": "^18.0.31",
16
16
  "@types/react-dom": "^18.2.7",
@@ -26,7 +26,7 @@
26
26
  "dist",
27
27
  "package.json"
28
28
  ],
29
- "gitHead": "09c114d148f7a0c2ad250d6346a76aa3b332b2d4",
29
+ "gitHead": "75ac5d1ebe87366c23bb4e485481deb1b593e299",
30
30
  "main": "dist/index.js",
31
31
  "peerDependencies": {
32
32
  "@farcaster/miniapp-wagmi-connector": "^1.0.0",