@cordystackx/cordy_minikit 0.3.4 → 0.3.5

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.
@@ -5,7 +5,7 @@ type WalletContextType = {
5
5
  };
6
6
  export default function WalletProviders({ children }: {
7
7
  children: ReactNode;
8
- }): import("react").JSX.Element;
8
+ }): import("react/jsx-runtime").JSX.Element;
9
9
  export declare function useWalletModal(): WalletContextType;
10
10
  export {};
11
11
  //# sourceMappingURL=wagmi__providers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wagmi__providers.d.ts","sourceRoot":"","sources":["../wagmi__providers.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuC,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvE,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAMF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAkB5E;AAED,wBAAgB,cAAc,sBAI7B"}
1
+ {"version":3,"file":"wagmi__providers.d.ts","sourceRoot":"","sources":["../wagmi__providers.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuC,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvE,KAAK,iBAAiB,GAAG;IACvB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAMF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,2CAkB5E;AAED,wBAAgB,cAAc,sBAI7B"}
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import { createContext, useContext, useState } from "react";
3
4
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
5
  import { WagmiProvider } from "wagmi";
@@ -8,17 +9,10 @@ const WalletContext = createContext(null);
8
9
  const queryClient = new QueryClient();
9
10
  export default function WalletProviders({ children }) {
10
11
  const [open, setOpen] = useState(false);
11
- return (<WagmiProvider config={config}>
12
- <QueryClientProvider client={queryClient}>
13
- <WalletContext.Provider value={{
14
- openModal: () => setOpen(true),
15
- closeModal: () => setOpen(false),
16
- }}>
17
- {children}
18
- {open && <UI_Comp />} {/* show modal only when open */}
19
- </WalletContext.Provider>
20
- </QueryClientProvider>
21
- </WagmiProvider>);
12
+ return (_jsx(WagmiProvider, { config: config, children: _jsx(QueryClientProvider, { client: queryClient, children: _jsxs(WalletContext.Provider, { value: {
13
+ openModal: () => setOpen(true),
14
+ closeModal: () => setOpen(false),
15
+ }, children: [children, open && _jsx(UI_Comp, {}), " "] }) }) }));
22
16
  }
23
17
  export function useWalletModal() {
24
18
  const ctx = useContext(WalletContext);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordystackx/cordy_minikit",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,7 +41,8 @@
41
41
  "@types/react-dom": "^18.3.7"
42
42
  },
43
43
  "scripts": {
44
- "build": "tsc",
44
+ "build": "tsc && pnpm run copy-css",
45
+ "copy-css": "mkdir -p dist/css/Buttons dist/css/UI_Comp && cp css/Buttons/styles.module.css dist/css/Buttons/ && cp css/UI_Comp/styles.module.css dist/css/UI_Comp/",
45
46
  "release": "pnpm publish --access public"
46
47
  }
47
48
  }
@@ -1,69 +0,0 @@
1
- "use client";
2
- import Image__src from "../config/Image.json";
3
- import { UI_Comp__css } from "../css";
4
- import { WalletButton, Disconnect, getTokenBalance } from "../controllers";
5
- import { useWalletModal } from "../wagmi__providers";
6
- import { useAccount } from "wagmi";
7
- import { FaUser } from 'react-icons/fa';
8
- import { useState, useEffect } from "react";
9
- export default function UI_Comp() {
10
- const { closeModal } = useWalletModal();
11
- const { isConnected, address } = useAccount();
12
- const [loading, setLoading] = useState(false);
13
- const [errorMsg, setErrorMsg] = useState();
14
- const [balance, setBalance] = useState("");
15
- useEffect(() => {
16
- Get_Balance();
17
- }, [balance]);
18
- const Get_Balance = async () => {
19
- if (!address || !process.env.NEXT_PUBLIC_TOKENADDRESS)
20
- return;
21
- const balance = await getTokenBalance(address, process.env.NEXT_PUBLIC_TOKENADDRESS);
22
- setBalance(balance);
23
- return;
24
- };
25
- if (isConnected) {
26
- if (balance === "") {
27
- Get_Balance();
28
- }
29
- return (<div className={UI_Comp__css.container}>
30
- <div className={UI_Comp__css.connector}>
31
- <p className={UI_Comp__css.closed} onClick={closeModal}>✕</p>
32
- {isConnected && (<div className={UI_Comp__css.info}>
33
- {balance ? (<span>
34
- <FaUser size={70}/>
35
- <p style={{ color: "#0f0" }}>Connected</p>
36
- <p style={{ color: "#0ff" }}>Balance: {Number(balance).toFixed(2)} {process.env.NEXT_PUBLIC_SYMBOL}</p>
37
- <p style={{ color: "#ff0" }}>{address}</p>
38
- </span>) : (<p style={{ color: "var(--foreground_wagmi)" }}>Loading balance...</p>)}
39
-
40
- </div>)}
41
-
42
- <Disconnect />
43
- <a href="https://cordy-stack-x.vercel.app/">
44
- Powered By CordyStackX
45
- </a>
46
-
47
- </div>
48
- </div>);
49
- }
50
- return (<div className={UI_Comp__css.container}>
51
- <div className={UI_Comp__css.connector}>
52
- <p className={UI_Comp__css.closed} onClick={closeModal}>✕</p>
53
- <img src={Image__src.logo} width={50} height={50}/>
54
- <h2>Cordy MiniKit</h2>
55
-
56
- <div>
57
- <h3>{loading ? "Loading..." : ""}</h3>
58
- <WalletButton onStatusChange={({ isPending, error }) => {
59
- setLoading(isPending);
60
- setErrorMsg(error);
61
- }}/>
62
- <p>{errorMsg}</p>
63
- </div>
64
- <a href="https://cordy-stack-x.vercel.app/">
65
- Powered By CordyStackX
66
- </a>
67
- </div>
68
- </div>);
69
- }
@@ -1,5 +0,0 @@
1
- import { useDisconnect } from 'wagmi';
2
- export default function Disconnect() {
3
- const { disconnect } = useDisconnect();
4
- return (<button onClick={() => disconnect()}>Disconnect</button>);
5
- }