@cordystackx/cordy_minikit 1.2.4 → 1.3.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.
package/README.md CHANGED
@@ -1,93 +1,64 @@
1
1
  ---
2
- © 2025 Cordy StackX (@cordystackx)
2
+ © 2025 Cordy StackX (@cordystackx)
3
3
  Licensed under the MIT License.
4
4
  Unauthorized removal of this notice violates the license terms.
5
5
  ---
6
6
 
7
- # Github Official Repo
8
- ```bash
9
- https://github.com/cordyStackX/cordy_minikit_official.git
10
- ```
7
+ # 🧩 Cordy MiniKit — Web3 Toolkit by CordyStackX
11
8
 
12
- # 🧩 cordy_minikit — Web3 Mini Kit by cordyStackX
9
+ [![npm version](https://img.shields.io/npm/v/@cordystackx/cordy_minikit.svg)](https://www.npmjs.com/package/@cordystackx/cordy_minikit)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
13
11
 
14
- A lightweight Web3 toolkit for building wallet UIs, controllers, and provider wrappers — designed for modern frameworks like **Next.js** and **Vite**
15
- Built with **Wagmi**, **Viem**, **Ethers** and **TypeScript** (compiled to JS for runtime).
12
+ A lightweight, production-ready Web3 toolkit for building wallet UIs, controllers, and provider wrappers — designed for modern frameworks like **Next.js** and **Vite**.
13
+ Built with **Wagmi**, **Viem**, **Ethers**, and **TypeScript**.
16
14
 
17
- ---
18
-
19
- ## 🚀 Features
20
-
21
- - 🔗 **Wallet Connect / Disconnect**
22
- Simple connect button and hooks for EVM-based wallets.
23
- - 🧰 **Prebuilt UI Components**
24
- Reusable components like `ConnectWalletBT`, `CordyStackTrans`.
25
- - ⚙️ **Controllers**
26
- Manage wallet actions, balances, and transactions.
27
- - 🎨 **CSS Modules + CSS Variables**
28
- Easy theming support for dark/light mode.
29
- - 📦 **Tree-shakable, Typed, and Lightweight**
30
- - 🧩 **Framework-Agnostic**
31
- Works with Next.js or Vite.
15
+ **📦 [NPM Package](https://www.npmjs.com/package/@cordystackx/cordy_minikit)** | **📂 [GitHub Repository](https://github.com/cordyStackX/cordy_minikit_official)**
32
16
 
33
17
  ---
34
18
 
35
- ## 🧭 SOA — System Overview & Architecture
36
-
37
- > A concise overview of the library’s structure, purpose, and build/publish process.
38
-
39
- ### 1. Purpose
40
-
41
- `@cordystackx/cordy_minikit` provides modular Web3 utilities and UI components for dApp builders.
42
- It’s designed to be embedded in frontend frameworks where you want instant Web3 wallet connectivity and a clean UI layer.
19
+ ## 🚀 Features
43
20
 
44
- **Main Goals:**
45
- - Simplify wallet integrations.
46
- - Provide clean, framework-ready UI + controllers.
47
- - Maintain portability for fullstack and extension apps.
48
- - Keep theming customizable with CSS variables.
21
+ - 🔗 **Wallet Connect/Disconnect** — Simple hooks and buttons for EVM-based wallets
22
+ - 🧰 **Prebuilt UI Components** — Ready-to-use `ConnectWalletBT`, `UI_Comp`, and more
23
+ - ⚙️ **Smart Controllers** — Manage wallet actions, balances, and transactions effortlessly
24
+ - 💸 **Transaction Helpers** — Built-in ERC20 and native token transfer functions
25
+ - 🎨 **Themeable CSS** — CSS Modules with variables for easy dark/light mode support
26
+ - 📦 **Tree-shakable & Typed** — Optimized bundle size with full TypeScript definitions
27
+ - 🧩 **Framework-Agnostic** — Works seamlessly with Next.js, Vite, and more
28
+ - 🌐 **Multi-Chain Support** — Custom chain configuration support
49
29
 
50
30
  ---
51
31
 
52
- ### 2. High-level Architecture
32
+ ## 📦 Installation
53
33
 
54
34
  ```bash
55
- root
56
- ├── chains/ # chain definitions and helpers
57
- ├── client__provider.tsx # provider client wrapper (wagmi/viem context)
58
- ├── components/ # UI components (Connect_wallet_bt, UI_Comp)
59
- ├── controllers/ # imperative components & logic (wallet ops)
60
- ├── config/ # ABIs and static configuration
61
- ├── css/ # CSS Modules and styles
62
- ├── dist/ # compiled JS + .d.ts for publishing
63
- ├── index.ts # main export aggregator
64
- └── package.json
35
+ npm install @cordystackx/cordy_minikit@latest
36
+ # or
37
+ pnpm add @cordystackx/cordy_minikit@latest
38
+ # or
39
+ yarn add @cordystackx/cordy_minikit@latest
65
40
  ```
66
41
 
42
+ ---
67
43
 
44
+ ## 🛠️ Quick Start
68
45
 
69
- # Get Started
70
-
71
- ## Setup
46
+ ### 1. Environment Setup
72
47
 
73
- 1. Install the NPM Packages
74
- ```bash
75
- npm i @cordystackx/cordy_minikit@latest
76
- ```
48
+ Create a `.env.local` file in your project root:
77
49
 
78
- 2. Create env file
79
50
  ```bash
80
- NEXT_PUBLIC_RPC_ENDPOINT=
81
- NEXT_PUBLIC_TOKENADDRESS=
82
- NEXT_PUBLIC_PLATFORM_ADDRESS=
83
- NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=
51
+ NEXT_PUBLIC_RPC_ENDPOINT=https://your-rpc-endpoint.com
52
+ NEXT_PUBLIC_TOKENADDRESS=0x...
53
+ NEXT_PUBLIC_PLATFORM_ADDRESS=0x...
54
+ NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
84
55
  ```
85
56
 
86
- 3. Create folder of /services/minikit/providers.ts
57
+ ### 2. Provider Setup
87
58
 
88
- > Note: Make sure you install @tanstack/react-query for QueryClient and QueryClientProviders
59
+ Create a providers file at `/app/providers.tsx` or `/services/minikit/providers.tsx`:
89
60
 
90
- ```ts
61
+ ```tsx
91
62
  "use client";
92
63
  import { ReactNode } from "react";
93
64
  import { ProvidersClientWrapper } from "@cordystackx/cordy_minikit";
@@ -96,116 +67,340 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
96
67
  const queryClient = new QueryClient();
97
68
 
98
69
  export default function Providers({ children }: { children: ReactNode }) {
99
-
100
- return(
101
- <QueryClientProvider client={queryClient}>
102
- <ProvidersClientWrapper>
103
- {children}
104
- </ProvidersClientWrapper>
105
- </QueryClientProvider>
106
- );
107
-
70
+ return (
71
+ <QueryClientProvider client={queryClient}>
72
+ <ProvidersClientWrapper>
73
+ {children}
74
+ </ProvidersClientWrapper>
75
+ </QueryClientProvider>
76
+ );
108
77
  }
109
78
  ```
110
79
 
111
- 4. then import it both CSS Module into the /app/layout.tsx
112
- ```ts
80
+ > **Note:** Install `@tanstack/react-query` as a peer dependency:
81
+ > ```bash
82
+ > npm install @tanstack/react-query
83
+ > ```
84
+
85
+ ### 3. Layout Integration
86
+
87
+ Import the providers and CSS in your `/app/layout.tsx`:
113
88
 
114
- import {
115
- Providers
116
- } from "@/app/services/minikit/providers";
117
- import '@cordystackx/cordy_minikit/dist/css/UI_Comp/styles.module.css';
89
+ ```tsx
90
+ import Providers from "@/app/providers";
91
+ import "@cordystackx/cordy_minikit/dist/css/UI_Comp/styles.module.css";
118
92
 
119
93
  export default function RootLayout({
120
94
  children,
121
- }: Readonly<{
95
+ }: {
122
96
  children: React.ReactNode;
123
- }>) {
97
+ }) {
124
98
  return (
125
99
  <html lang="en">
126
- <body className={`${geistSans.variable} ${geistMono.variable}`}>
127
- <Providers>
128
- {children}
129
- </Providers>
100
+ <body>
101
+ <Providers>
102
+ {children}
103
+ </Providers>
130
104
  </body>
131
105
  </html>
132
106
  );
133
107
  }
134
108
  ```
135
109
 
136
- ## Usage
110
+ ---
111
+
112
+ ## 📚 Usage Examples
137
113
 
138
- 1. Connect Buttons — ConnectWalletBT
114
+ ### 1. Connect Wallet Button
139
115
 
140
- The ConnectWalletBT component provides a plug-and-play wallet connection button for any Web3 application.
141
- It automatically handles connecting, disconnecting, and managing wallet sessions using Wagmi and Viem under the hood.
116
+ The `ConnectWalletBT` component provides a plug-and-play wallet connection button.
142
117
 
143
- ```ts
144
- import {
145
- ConnectWalletBT
146
- } from "@cordystackx/cordy_minikit";
118
+ ```tsx
119
+ import { ConnectWalletBT } from "@cordystackx/cordy_minikit";
147
120
 
148
- <ConnectWalletBT />
121
+ export default function Header() {
122
+ return (
123
+ <nav>
124
+ <ConnectWalletBT className="your-custom-class" />
125
+ </nav>
126
+ );
127
+ }
149
128
  ```
150
129
 
151
- 2. Button Transactions - CordyStackTrans
130
+ **Features:**
131
+ - Automatically shows "Connect Wallet" when disconnected
132
+ - Displays wallet address when connected
133
+ - Fully customizable with `className` prop
134
+
135
+ ---
152
136
 
153
- The CordyStackTrans function provides a simple and reusable transaction handler for EVM-based networks.
154
- It allows developers to trigger ERC20 or native token transfers directly from UI components with minimal setup.
137
+ ### 2. Wallet Modal Hook
155
138
 
156
- ```ts
139
+ Use the `useWalletModal` hook to trigger the wallet modal programmatically:
140
+
141
+ ```tsx
142
+ import { useWalletModal } from "@cordystackx/cordy_minikit";
143
+
144
+ function CustomButton() {
145
+ const { openModal, closeModal } = useWalletModal();
146
+
147
+ return (
148
+ <button onClick={openModal}>
149
+ Open Wallet
150
+ </button>
151
+ );
152
+ }
153
+ ```
154
+
155
+ ---
156
+
157
+ ### 3. Transaction Handler
158
+
159
+ The `CordyStackTrans` function handles ERC20 and native token transfers:
160
+
161
+ ```tsx
157
162
  import { CordyStackTrans } from "@cordystackx/cordy_minikit";
158
163
 
159
- // Example Usage
160
- CordyStackTrans(address: string, cost: number);
164
+ async function handlePayment() {
165
+ const recipientAddress = "0x...";
166
+ const amount = 10; // Token amount
161
167
 
162
- const trans = CordyStackTrans();
168
+ const success = await CordyStackTrans(recipientAddress, amount);
163
169
 
164
- if (trans) {
165
- return true; // Transaction successfull
166
- } else {
167
- return false; // Transaction failed or rejected
170
+ if (success) {
171
+ console.log("Transaction successful!");
172
+ } else {
173
+ console.log("Transaction failed or rejected");
174
+ }
175
+ }
176
+ ```
177
+
178
+ ---
179
+
180
+ ### 4. Custom Chain Support
181
+
182
+ Configure custom chains for your dApp:
183
+
184
+ ```tsx
185
+ import { getConfig, ProvidersClientWrapper } from "@cordystackx/cordy_minikit";
186
+ import { defineChain } from "viem";
187
+
188
+ // Define your custom chain
189
+ const myCustomChain = defineChain({
190
+ id: 1114,
191
+ name: "Core Blockchain Testnet",
192
+ network: "core-testnet",
193
+ nativeCurrency: { name: "tCORE", symbol: "tCORE", decimals: 18 },
194
+ rpcUrls: {
195
+ default: { http: ["https://rpc.test.btcs.network"] },
196
+ public: { http: ["https://rpc.test.btcs.network"] },
197
+ },
198
+ blockExplorers: {
199
+ default: { name: "Core Scan", url: "https://scan.test.btcs.network" },
200
+ },
201
+ });
202
+
203
+ // Get config with custom chain
204
+ const customConfig = getConfig({ myCustomChain });
205
+
206
+ // Use in provider
207
+ export default function Providers({ children }: { children: ReactNode }) {
208
+ return (
209
+ <ProvidersClientWrapper config={customConfig}>
210
+ {children}
211
+ </ProvidersClientWrapper>
212
+ );
168
213
  }
169
214
  ```
170
215
 
216
+ ---
217
+
218
+ ## 🏗️ Architecture Overview
219
+
220
+ ### Project Structure
221
+
222
+ ```
223
+ cordy_minikit/
224
+ ├── assets/ # Image Sources for logo
225
+ ├── components/ # UI components (ConnectWalletBT, UI_Comp)
226
+ ├── controllers/ # Transaction logic and wallet operations
227
+ ├── config/ # ABIs and static configurations
228
+ ├── css/ # CSS Modules and theming
229
+ ├── dist/ # Compiled output (published to npm)
230
+ ├── index.ts # Main export entry point
231
+ └── package.json
232
+ ```
233
+
234
+ ### Key Files
171
235
 
172
- **Runtime contract:**
173
- - Imports resolve to `dist/index.js`
174
- - `.d.ts` shipped for TS projects
175
- - Pure ESM/JS compatible with Next.js and Vite
236
+ | File/Folder | Description |
237
+ |-------------|-------------|
238
+ | `assets/` | Image Sources for logo |
239
+ | `client__provider.tsx` | React provider wrapper for Wagmi/Viem |
240
+ | `components/` | Reusable UI components for wallet interactions |
241
+ | `controllers/` | Business logic for Web3 operations |
242
+ | `config/` | ERC20 ABI and configuration files |
243
+ | `css/` | Scoped CSS Modules with theming support |
244
+ | `dist/` | Compiled JavaScript + TypeScript declarations |
176
245
 
177
246
  ---
178
247
 
179
- ### 3. File Responsibilities
248
+ ## 🧭 System Architecture — Cordy Minikit
249
+
250
+ @cordystackx/cordy_minikit is built as a modular Web3 toolkit that sits on top of Wagmi, Viem, Ethers, and Coinbase Wallet SDK, providing developers with prebuilt UI components, controllers, and configuration files for seamless wallet and transaction management.
251
+
252
+
253
+ ```mermaid
254
+ flowchart TD
255
+ %% Layer 1 - External Dependencies
256
+ subgraph External_Libraries["🔌 External Libraries"]
257
+ A1["wagmi (Wallet & Hooks)"]
258
+ A2["viem (RPC / EVM Utils)"]
259
+ A3["ethers.js (Tx + ABI Handling)"]
260
+ A4["Coinbase Wallet SDK (Wallet Provider)"]
261
+ end
262
+
263
+ %% Layer 2 - Core Logic
264
+ subgraph Core["⚙️ Core Logic Layer"]
265
+ B1["client__provider.tsx (Wagmi & Viem Client Context)"]
266
+ B2["controllers/ (Balance, Tx, WagmiButton)"]
267
+ B3["config/ (ERC20_ABI, walletConfig, links.json)"]
268
+ end
269
+
270
+ %% Layer 3 - UI Components
271
+ subgraph UI["🧩 UI Components"]
272
+ C1["Connect_wallet_bt.tsx (Connect/Disconnect Button)"]
273
+ C2["UI_Comp.tsx (Visual/Interactive UI Elements)"]
274
+ C3["CSS Modules (Dark/Light Theme Styles)"]
275
+ end
276
+
277
+ %% Layer 4 - Assets & Static Files
278
+ subgraph Assets["🖼️ Assets"]
279
+ D1["Wallet Logos (Coinbase, Metamask, WalletConnect)"]
280
+ D2["Static Config Files (Image.json, etc.)"]
281
+ end
282
+
283
+ %% Layer 5 - Output
284
+ subgraph Output["📦 Build & Distribution"]
285
+ E1["dist/ (Compiled JS + .d.ts Types)"]
286
+ E2["index.ts (Library Entry Point)"]
287
+ E3["NPM Registry (Public Package)"]
288
+ end
289
+
290
+ %% Connections
291
+ A1 & A2 & A3 & A4 --> B1
292
+ B1 --> B2
293
+ B2 --> B3
294
+ B2 --> C1
295
+ C1 --> C2
296
+ C2 --> C3
297
+ B3 --> C1
298
+ C3 --> D1
299
+ D1 --> E1
300
+ E1 --> E2
301
+ E2 --> E3
302
+
303
+ ```
304
+
305
+ ## 🔧 API Reference
306
+
307
+ ### Components
308
+
309
+ #### `ConnectWalletBT`
310
+ ```tsx
311
+ <ConnectWalletBT className?: string />
312
+ ```
313
+ - Props: `className` (optional) - Custom CSS class
314
+
315
+
316
+ ### Hooks
317
+
318
+ #### `useWalletModal()`
319
+ ```tsx
320
+ const { openModal, closeModal } = useWalletModal();
321
+ ```
322
+ - Returns: `{ openModal: () => void, closeModal: () => void }`
323
+
324
+ ### Functions
325
+
326
+ #### `CordyStackTrans(address, amount)`
327
+ ```tsx
328
+ const success = await CordyStackTrans(recipientAddress: string, amount: number);
329
+ ```
330
+ - Returns: `Promise<boolean>` - Transaction success status
180
331
 
181
- | Folder/File | Description |
182
- |--------------|-------------|
183
- | `chains/*` | Chain configuration and utilities (Sepolia, Base, etc.) |
184
- | `client__provider.tsx` | React provider wrapper for Wagmi/Viem clients |
185
- | `components/*` | Connect wallet, UI components |
186
- | `controllers/*` | Logic-based hooks and components for Web3 ops |
187
- | `config/*` | ABIs, static configs |
188
- | `css/*` | Scoped CSS Modules and base theme |
189
- | `dist/*` | Compiled JS & type declarations (published bundle) |
332
+ #### `getConfig(customChains?)`
333
+ ```tsx
334
+ const config = getConfig({ myChain: customChainDefinition });
335
+ ```
336
+ - Returns: Wagmi configuration with custom chains
190
337
 
191
338
  ---
192
339
 
193
- ### 4. Build & Publish (npm)
340
+ ## 🎨 Customization
194
341
 
195
- #### ✅ Setup `package.json`
196
- ```json
197
- {
198
- "main": "dist/index.js",
199
- "types": "dist/index.d.ts",
200
- "files": ["dist"],
201
- "scripts": {
202
- "clean": "rm -rf dist",
203
- "build": "tsc",
204
- "prepublishOnly": "pnpm run build"
205
- },
206
- "publishConfig": {
207
- "access": "public",
208
- "registry": "https://registry.npmjs.org/"
209
- }
342
+ ### Custom Styling
343
+
344
+ ```tsx
345
+ <ConnectWalletBT className="my-custom-button" />
346
+ ```
347
+
348
+ ```css
349
+ .my-custom-button {
350
+ background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
351
+ border-radius: 8px;
352
+ padding: 12px 24px;
353
+ font-weight: 600;
210
354
  }
211
- ```
355
+ ```
356
+
357
+ ---
358
+
359
+ ## 📋 Requirements
360
+
361
+ - **React**: ^18.3.1
362
+ - **Next.js**: ^14.2.33 (for Next.js projects)
363
+ - **@tanstack/react-query**: ^5.90.3
364
+ - **wagmi**: ^2.18.1
365
+ - **viem**: Latest version
366
+ - **ethers**: ^6.15.0
367
+
368
+ ---
369
+
370
+ ## 🤝 Contributing
371
+
372
+ Contributions are welcome! Please feel free to submit a Pull Request.
373
+
374
+ 1. Fork the repository
375
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
376
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
377
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
378
+ 5. Open a Pull Request
379
+
380
+ ---
381
+
382
+ ## 📄 License
383
+
384
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
385
+
386
+ ---
387
+
388
+ ## 🔗 Links
389
+
390
+ - **NPM Package**: https://www.npmjs.com/package/@cordystackx/cordy_minikit
391
+ - **GitHub Repository**: https://github.com/cordyStackX/cordy_minikit_official
392
+ - **Official Website**: https://cordy-stack-x.vercel.app/
393
+
394
+ ---
395
+
396
+ ## 💬 Support
397
+
398
+ For issues, questions, or feature requests:
399
+ - Open an issue on [GitHub](https://github.com/cordyStackX/cordy_minikit_official/issues)
400
+ - Visit our [website](https://cordy-stack-x.vercel.app/)
401
+
402
+ ---
403
+
404
+ **Built with ❤️ by [CordyStackX](https://cordy-stack-x.vercel.app/)**
405
+
406
+ ---
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordystackx/cordy_minikit",
3
- "version": "1.2.4",
3
+ "version": "1.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"