@cordystackx/cordy_minikit 0.3.8 → 0.4.1

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.
@@ -1,3 +1,4 @@
1
1
  import { createConfig } from 'wagmi';
2
+ export declare function getConfig(): ReturnType<typeof createConfig>;
2
3
  export declare const config: ReturnType<typeof createConfig>;
3
4
  //# sourceMappingURL=walletConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"walletConfig.d.ts","sourceRoot":"","sources":["../../config/walletConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAAE,MAAM,OAAO,CAAC;AAO3C,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAUjD,CAAC"}
1
+ {"version":3,"file":"walletConfig.d.ts","sourceRoot":"","sources":["../../config/walletConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,YAAY,EAA0B,MAAM,OAAO,CAAC;AAQnE,wBAAgB,SAAS,IAAI,UAAU,CAAC,OAAO,YAAY,CAAC,CAiB3D;AAGD,eAAO,MAAM,MAAM,EAAE,UAAU,CAAC,OAAO,YAAY,CAEV,CAAC"}
@@ -1,16 +1,28 @@
1
1
  import { http, createConfig } from 'wagmi';
2
2
  import { mainnet, base } from 'wagmi/chains';
3
- import { walletConnect } from 'wagmi/connectors';
3
+ import { walletConnect, metaMask, coinbaseWallet } from 'wagmi/connectors';
4
4
  import { BaseSepolia } from "../chains";
5
5
  const projectId = process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID;
6
- export const config = createConfig({
7
- chains: [mainnet, base, BaseSepolia()],
8
- connectors: [
9
- walletConnect({ projectId })
10
- ],
11
- transports: {
12
- [mainnet.id]: http(),
13
- [base.id]: http(),
14
- [BaseSepolia().id]: http()
15
- },
16
- });
6
+ // Function to create config - only called on client side
7
+ export function getConfig() {
8
+ return createConfig({
9
+ chains: [mainnet, base, BaseSepolia()],
10
+ connectors: [
11
+ metaMask(),
12
+ walletConnect({ projectId }),
13
+ coinbaseWallet({
14
+ appName: "cordy_minikit",
15
+ version: "3"
16
+ })
17
+ ],
18
+ transports: {
19
+ [mainnet.id]: http(),
20
+ [base.id]: http(),
21
+ [BaseSepolia().id]: http()
22
+ },
23
+ });
24
+ }
25
+ // Create config only on client side
26
+ export const config = typeof window !== 'undefined'
27
+ ? getConfig()
28
+ : {};
@@ -32,12 +32,23 @@ export default function WalletButton({ onStatusChange }) {
32
32
  }, isPending: pendingConnector?.uid === connector.uid && isPending }, connector.uid))) }));
33
33
  }
34
34
  function WalletOption({ connector, onClick, isPending }) {
35
- const [ready, setReady] = React.useState(false);
35
+ const [ready, setReady] = React.useState(true); // ✅ default to true so it still renders
36
+ const [installed, setInstalled] = React.useState(true);
36
37
  React.useEffect(() => {
37
38
  (async () => {
38
- const provider = await connector.getProvider();
39
- setReady(!!provider);
39
+ try {
40
+ const provider = await connector.getProvider();
41
+ setInstalled(!!provider); // true if wallet found
42
+ }
43
+ catch {
44
+ setInstalled(false);
45
+ }
40
46
  })();
41
47
  }, [connector]);
42
- return (_jsx("button", { disabled: !ready || isPending, onClick: onClick, children: isPending ? "Connecting..." : connector.name }));
48
+ const disabled = isPending || !installed;
49
+ return (_jsx("button", { disabled: disabled, onClick: onClick, children: isPending
50
+ ? "Connecting..."
51
+ : !installed
52
+ ? `${connector.name} (Not Installed)`
53
+ : connector.name }));
43
54
  }