@cordystackx/cordy_minikit 2.0.5 → 2.0.7

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
@@ -35,7 +35,9 @@ Built with **Wagmi**, **Viem**, **Ethers**, and **TypeScript**.
35
35
  - 📦 **Tree-shakable & Typed** — Optimized bundle size with full TypeScript definitions
36
36
  - 🧩 **Framework-Agnostic** — Works seamlessly with Next.js, Vite, and more
37
37
  - 🌐 **Multi-Chain Support** — Custom chain configuration support
38
-
38
+ - 🌌 **Non-EVM Wallet Support** — Stellar / Soroban wallet support through Freighter
39
+ - ⭐ **Stellar Balance & Transfers** — Read XLM balances and send native Stellar payments
40
+ - 🧠 **Wallet Context Detection** — Detect `EVM`, `Non-EVM`, `MULTI`, or `NONE`
39
41
  ---
40
42
 
41
43
  ## 📦 Installation
@@ -64,38 +66,7 @@ and send native Stellar payments using the built-in `CordyStackTransStellar` hel
64
66
  - `MULTI` — Both EVM and Non-EVM wallets connected
65
67
  - `NONE` — No wallet connected
66
68
 
67
- This makes Cordy MiniKit ready for multi-chain apps that need both EVM and Stellar support.
68
-
69
-
70
- Also update your Features section with these bullets:
71
-
72
- - 🌌 **Non-EVM Wallet Support** — Stellar / Soroban wallet support through Freighter
73
- - ⭐ **Stellar Balance & Transfers** — Read XLM balances and send native Stellar payments
74
- - 🧠 **Wallet Context Detection** — Detect `EVM`, `Non_EVM`, `MULTI`, or `NONE`
75
-
76
- And add this to API Reference → Hooks:
77
-
78
- #### `useWalletStatus()`
79
-
80
- ```tsx
81
- const {
82
- context,
83
- evm,
84
- stellar,
85
- refreshBalances,
86
- disconnectEVM,
87
- disconnectStellar,
88
- disconnectAll,
89
- } = useWalletStatus();
90
- ```
91
-
92
- Returns wallet status for both EVM and Non-EVM wallets.
93
-
94
- ```ts
95
- context: "EVM" | "Non-EVM" | "MULTI" | "NONE"
96
- ```
97
-
98
- Useful for detecting whether the connected wallet is Wagmi/EVM, Stellar/Non-EVM, both, or none.
69
+ This makes Cordy MiniKit ready for multi-chain apps that need both EVM and Stellar support.
99
70
 
100
71
  ## 🛠️ Quick Start
101
72
 
@@ -429,7 +400,7 @@ EVM and Non-EVM wallets.
429
400
  <p>EVM Address: {evm.address}</p>
430
401
  )}
431
402
 
432
- {context === "Non_EVM" && (
403
+ {context === "Non-EVM" && (
433
404
  <p>Stellar Address: {stellar.address}</p>
434
405
  )}
435
406
 
@@ -456,7 +427,7 @@ Returns:
456
427
 
457
428
  ```ts
458
429
  {
459
- context: "EVM" | "Non_EVM" | "MULTI" | "NONE";
430
+ context: "EVM" | "Non-EVM" | "MULTI" | "NONE";
460
431
 
461
432
  evm: {
462
433
  isConnected: boolean;
@@ -715,6 +686,28 @@ const config = getConfig({ myChain: customChainDefinition });
715
686
  ```
716
687
  - Returns: Wagmi configuration with custom chains
717
688
 
689
+ #### `useWalletStatus()`
690
+
691
+ ```tsx
692
+ const {
693
+ context,
694
+ evm,
695
+ stellar,
696
+ refreshBalances,
697
+ disconnectEVM,
698
+ disconnectStellar,
699
+ disconnectAll,
700
+ } = useWalletStatus();
701
+ ```
702
+
703
+ Returns wallet status for both EVM and Non-EVM wallets.
704
+
705
+ ```ts
706
+ context: "EVM" | "Non-EVM" | "MULTI" | "NONE"
707
+ ```
708
+
709
+ Useful for detecting whether the connected wallet is Wagmi/EVM, Stellar/Non-EVM, both, or none.
710
+
718
711
  ---
719
712
 
720
713
  ## 🎨 Customization
@@ -1 +1 @@
1
- {"version":3,"file":"UI_Comp.d.ts","sourceRoot":"","sources":["../../components/UI_Comp.tsx"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,OAAO,gCA+N9B"}
1
+ {"version":3,"file":"UI_Comp.d.ts","sourceRoot":"","sources":["../../components/UI_Comp.tsx"],"names":[],"mappings":"AAWA,MAAM,CAAC,OAAO,UAAU,OAAO,gCA8N9B"}
@@ -73,14 +73,14 @@ export default function UI_Comp() {
73
73
  };
74
74
  // EVM
75
75
  if (isConnected) {
76
- return (_jsx("div", { className: UI_Comp__css.container, children: _jsxs("div", { className: UI_Comp__css.connector, children: [_jsx("p", { className: UI_Comp__css.closed, onClick: closeModal, children: "\u2715" }), _jsx("h2", { children: "Wallet Status" }), _jsxs("div", { className: UI_Comp__css.split_layout, children: [_jsxs("div", { className: UI_Comp__css.left_column, children: [_jsx("h3", { children: "EVM Wallet" }), _jsx("div", { className: UI_Comp__css.icon_wrap, children: _jsx(FaUser, { size: 70 }) })] }), _jsxs("div", { className: UI_Comp__css.right_column, children: [_jsx("h3", { children: "Status" }), balance ? (_jsx("div", { className: UI_Comp__css.info, children: _jsxs("div", { className: UI_Comp__css.status_stack, children: [_jsx("p", { style: { color: "#0f0" }, children: "Connected" }), _jsxs("p", { style: { color: "#2f9" }, children: ["Network: ", chain?.name || "Unknown"] }), _jsxs("p", { style: { color: "#0ff" }, children: ["Balance: ", Number(balance).toFixed(2), " ", symbol] }), _jsx("p", { className: UI_Comp__css.address, style: { color: "#ff0" }, title: address || "", children: truncateAddress(address) })] }) })) : (_jsxs("span", { className: UI_Comp__css.blockchain_loader, children: [_jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node })] }))] })] }), _jsx("button", { style: { width: "230px" }, onClick: async () => {
76
+ return (_jsx("div", { className: UI_Comp__css.container, children: _jsxs("div", { className: UI_Comp__css.connector, children: [_jsx("p", { className: UI_Comp__css.closed, onClick: closeModal, children: "\u2715" }), _jsx("h2", { children: "Wallet Status" }), _jsxs("div", { className: UI_Comp__css.split_layout, children: [_jsxs("div", { className: UI_Comp__css.left_column, children: [_jsx("h3", { children: "EVM Wallet" }), _jsx("div", { className: UI_Comp__css.icon_wrap, children: _jsx(FaUser, { size: 70 }) })] }), _jsxs("div", { className: UI_Comp__css.right_column, children: [_jsx("h3", { children: "Status" }), balance ? (_jsx("div", { className: UI_Comp__css.info, children: _jsxs("div", { className: UI_Comp__css.status_stack, children: [_jsx("p", { style: { color: "#0f0" }, children: "Connected" }), _jsxs("p", { style: { color: "#2f9" }, children: ["Network: ", chain?.name || "Unknown"] }), _jsxs("p", { style: { color: "#0ff" }, children: ["Balance: ", Number(balance).toFixed(2), " ", symbol] }), _jsx("p", { className: UI_Comp__css.address, style: { color: "#ff0" }, title: address || "", children: truncateAddress(address) })] }) })) : (_jsxs("span", { className: UI_Comp__css.blockchain_loader, children: [_jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node })] }))] })] }), _jsx("button", { onClick: async () => {
77
77
  const success = await disconnectEVM();
78
78
  console.log("EVM disconnect:", success);
79
79
  }, children: "DisConnect" }), _jsxs("a", { style: { marginTop: "2rem" }, href: links.NPM_Pack_links, children: ["Powered By CordyStackX | Version ", pkg.version] })] }) }));
80
80
  }
81
81
  //Non - EVM
82
82
  if (stellarWallet.address) {
83
- return (_jsx("div", { className: UI_Comp__css.container, children: _jsxs("div", { className: UI_Comp__css.connector, children: [_jsx("p", { className: UI_Comp__css.closed, onClick: closeModal, children: "\u2715" }), _jsx("h2", { children: "Wallet Status" }), _jsxs("div", { className: UI_Comp__css.split_layout, children: [_jsxs("div", { className: UI_Comp__css.left_column, children: [_jsx("h3", { children: "Stellar Wallet" }), _jsx("div", { className: UI_Comp__css.icon_wrap, children: _jsx(FaUser, { size: 70 }) })] }), _jsxs("div", { className: UI_Comp__css.right_column, children: [_jsx("h3", { children: "Status" }), stellarWallet.balance ? (_jsxs("div", { className: UI_Comp__css.status_stack, children: [_jsx("p", { style: { color: "#0f0" }, children: "Connected" }), _jsxs("p", { style: { color: "#2f9" }, children: ["Network: ", stellarWallet.network || "Stellar"] }), _jsxs("p", { style: { color: "#0ff" }, children: ["Balance: ", stellarWallet.balance ?? "0", " XLM"] }), _jsx("p", { className: UI_Comp__css.address, style: { color: "#ff0" }, title: stellarWallet.address || "", children: truncateAddress(stellarWallet.address) }), stellarError ? _jsx("p", { style: { color: "#f55" }, children: stellarError }) : null] })) : (_jsxs("span", { className: UI_Comp__css.blockchain_loader, children: [_jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node })] }))] })] }), _jsx("button", { style: { width: "230px" }, onClick: async () => {
83
+ return (_jsx("div", { className: UI_Comp__css.container, children: _jsxs("div", { className: UI_Comp__css.connector, children: [_jsx("p", { className: UI_Comp__css.closed, onClick: closeModal, children: "\u2715" }), _jsx("h2", { children: "Wallet Status" }), _jsxs("div", { className: UI_Comp__css.split_layout, children: [_jsxs("div", { className: UI_Comp__css.left_column, children: [_jsx("h3", { children: "Stellar Wallet" }), _jsx("div", { className: UI_Comp__css.icon_wrap, children: _jsx(FaUser, { size: 70 }) })] }), _jsxs("div", { className: UI_Comp__css.right_column, children: [_jsx("h3", { children: "Status" }), stellarWallet.balance ? (_jsxs("div", { className: UI_Comp__css.status_stack, children: [_jsx("p", { style: { color: "#0f0" }, children: "Connected" }), _jsxs("p", { style: { color: "#2f9" }, children: ["Network: ", stellarWallet.network || "Stellar"] }), _jsxs("p", { style: { color: "#0ff" }, children: ["Balance: ", stellarWallet.balance ?? "0", " XLM"] }), _jsx("p", { className: UI_Comp__css.address, style: { color: "#ff0" }, title: stellarWallet.address || "", children: truncateAddress(stellarWallet.address) }), stellarError ? _jsx("p", { style: { color: "#f55" }, children: stellarError }) : null] })) : (_jsxs("span", { className: UI_Comp__css.blockchain_loader, children: [_jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node }), _jsx("span", { className: UI_Comp__css.node })] }))] })] }), _jsx("button", { onClick: async () => {
84
84
  const success = await disconnectStellar();
85
85
  console.log("EVM disconnect:", success);
86
86
  }, children: "DisConnect" }), _jsxs("a", { style: { marginTop: "2rem" }, href: links.NPM_Pack_links, children: ["Powered By CordyStackX | Version ", pkg.version] })] }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"StellarButton.d.ts","sourceRoot":"","sources":["../../controllers/StellarButton.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,SAAS,EACT,cAAc,GACf,EAAE;IACD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QACxB,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ,+BAqDA"}
1
+ {"version":3,"file":"StellarButton.d.ts","sourceRoot":"","sources":["../../controllers/StellarButton.tsx"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,SAAS,EACT,cAAc,GACf,EAAE;IACD,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QACxB,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,KAAK,IAAI,CAAC;CACZ,+BA6EA"}
@@ -1,8 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { requestAccess, getNetworkDetails } from "@stellar/freighter-api";
4
+ import { requestAccess, getNetworkDetails, isConnected, } from "@stellar/freighter-api";
5
5
  import img_src from "../config/Image.json";
6
+ const FREIGHTER_DOWNLOAD_URL = "https://www.freighter.app/";
7
+ function isMobileDevice() {
8
+ if (typeof navigator === "undefined")
9
+ return false;
10
+ return /Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent);
11
+ }
6
12
  export default function StellarWalletButton({ onConnect, onStatusChange, }) {
7
13
  const [address, setAddress] = useState(null);
8
14
  const [isPending, setIsPending] = useState(false);
@@ -13,10 +19,28 @@ export default function StellarWalletButton({ onConnect, onStatusChange, }) {
13
19
  setErrorMsg(undefined);
14
20
  onStatusChange?.({ isPending: true });
15
21
  try {
22
+ const connection = await isConnected();
23
+ if (!connection.isConnected) {
24
+ const message = isMobileDevice()
25
+ ? "Open this page in Freighter mobile or install Freighter to connect."
26
+ : "Freighter is not installed.";
27
+ if (isMobileDevice() && typeof window !== "undefined") {
28
+ window.open(FREIGHTER_DOWNLOAD_URL, "_blank", "noopener,noreferrer");
29
+ }
30
+ setErrorMsg(message);
31
+ onStatusChange?.({ isPending: false, error: message });
32
+ return;
33
+ }
16
34
  const access = await requestAccess();
35
+ if (access.error) {
36
+ throw new Error(access.error.message);
37
+ }
17
38
  const publicKey = access.address;
18
39
  setAddress(publicKey);
19
40
  const networkDetails = await getNetworkDetails();
41
+ if (networkDetails.error) {
42
+ throw new Error(networkDetails.error.message);
43
+ }
20
44
  setNetwork(networkDetails.network || "Unknown");
21
45
  onConnect?.(publicKey);
22
46
  onStatusChange?.({
@@ -39,5 +63,5 @@ export default function StellarWalletButton({ onConnect, onStatusChange, }) {
39
63
  ? "Connecting..."
40
64
  : address
41
65
  ? `Connected: ${address.slice(0, 6)}...`
42
- : "Freighter", network ? ` • ${network}` : "", errorMsg ? ` • ${errorMsg}` : ""] }));
66
+ : "Freighter"] }));
43
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WagmiButton.d.ts","sourceRoot":"","sources":["../../controllers/WagmiButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,cAAc,EACf,EAAE;IACD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CAC1E,qBA+CA"}
1
+ {"version":3,"file":"WagmiButton.d.ts","sourceRoot":"","sources":["../../controllers/WagmiButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAazC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,cAAc,EACf,EAAE;IACD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CAC1E,qBA+CA"}
@@ -4,6 +4,12 @@ import React, { useEffect } from "react";
4
4
  import { useConnect } from "wagmi";
5
5
  import Images from "../config/Image.json";
6
6
  const ACTIVE_WALLET_SESSION_KEY = "cordy_minikit_active_wallet_session";
7
+ const ALWAYS_AVAILABLE_CONNECTOR_NAMES = new Set([
8
+ "WalletConnect",
9
+ "MetaMask",
10
+ "Coinbase Wallet",
11
+ "Trust Wallet",
12
+ ]);
7
13
  export default function WalletButton({ onStatusChange }) {
8
14
  const { connectors, connectAsync } = useConnect();
9
15
  const [pendingConnector, setPendingConnector] = React.useState(null);
@@ -45,7 +51,9 @@ function WalletOption({ connector, onClick, isPending }) {
45
51
  React.useEffect(() => {
46
52
  (async () => {
47
53
  try {
48
- if (connector.name === "WalletConnect" || isTrustWallet) {
54
+ if (connector.type !== "injected" ||
55
+ ALWAYS_AVAILABLE_CONNECTOR_NAMES.has(connector.name) ||
56
+ isTrustWallet) {
49
57
  setInstalled(true);
50
58
  return;
51
59
  }
@@ -146,7 +146,7 @@
146
146
  }
147
147
  .connector button {
148
148
  width: min(100%, 300px);
149
- padding: 0.8rem 0 0.8rem 5rem;
149
+ padding: 0.8rem 4rem;
150
150
  background: linear-gradient(180deg, var(--accent_wagmi_34535), #1fa9a4);
151
151
  color: #1a1609;
152
152
  font-weight: bold;
@@ -157,7 +157,7 @@
157
157
  margin: 0.5rem 0 0;
158
158
  box-shadow: 0 12px 28px rgba(51, 217, 211, 0.18);
159
159
  display: flex;
160
- justify-content: left;
160
+ justify-content: space-evenly;
161
161
  align-items: center;
162
162
  }
163
163
  .connector button:hover {
@@ -220,8 +220,9 @@
220
220
 
221
221
  @media (max-width: 800px) {
222
222
  .connector {
223
+ position: absolute;
223
224
  width: min(100dvw, 100%);
224
- min-height: calc(100dvh - 1rem);
225
+ height: auto;
225
226
  padding: 1rem;
226
227
  bottom: 0;
227
228
  border-bottom-right-radius: 0;
@@ -239,18 +240,29 @@
239
240
  min-height: 100px;
240
241
  }
241
242
 
243
+ .left_column {
244
+ width: 80%;
245
+ min-height: 180px;
246
+ }
247
+
248
+ .right_column {
249
+ width: 90%;
250
+ height: 230px;
251
+ }
252
+
242
253
  .left_column,
243
254
  .right_column {
244
255
  padding: 1rem;
245
256
  border-radius: 16px;
257
+ margin: 1rem auto;
246
258
  }
247
259
 
248
260
  .icon_wrap {
249
- min-height: 92px;
261
+ min-height: 32px;
250
262
  }
251
263
 
252
264
  .connector button {
253
- padding: 0.85rem 0.95rem;
265
+ /* padding: 0.85rem 0.95rem; */
254
266
  width: min(100%, 280px);
255
267
  }
256
268
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordystackx/cordy_minikit",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },