@cordystackx/cordy_minikit 1.5.34 → 2.0.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 +438 -58
- package/dist/components/Connect_wallet_bt.d.ts.map +1 -1
- package/dist/components/Connect_wallet_bt.js +62 -11
- package/dist/components/UI_Comp.d.ts.map +1 -1
- package/dist/components/UI_Comp.js +79 -17
- package/dist/config/Image.json +4 -3
- package/dist/controllers/DisConnect.d.ts +6 -0
- package/dist/controllers/DisConnect.d.ts.map +1 -0
- package/dist/controllers/DisConnect.js +56 -0
- package/dist/controllers/Get_Account_Info.d.ts +26 -0
- package/dist/controllers/Get_Account_Info.d.ts.map +1 -0
- package/dist/controllers/Get_Account_Info.js +158 -0
- package/dist/controllers/Get_Balance.d.ts.map +1 -1
- package/dist/controllers/Get_Balance.js +16 -3
- package/dist/controllers/StellarButton.d.ts +10 -0
- package/dist/controllers/StellarButton.d.ts.map +1 -0
- package/dist/controllers/StellarButton.js +43 -0
- package/dist/controllers/Transactions.d.ts +6 -0
- package/dist/controllers/Transactions.d.ts.map +1 -1
- package/dist/controllers/Transactions.js +87 -2
- package/dist/controllers/WagmiButton.d.ts.map +1 -1
- package/dist/controllers/WagmiButton.js +6 -2
- package/dist/controllers/index.d.ts +6 -1
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +6 -1
- package/dist/controllers/loadStellarBalance.d.ts +7 -0
- package/dist/controllers/loadStellarBalance.d.ts.map +1 -0
- package/dist/controllers/loadStellarBalance.js +23 -0
- package/dist/css/UI_Comp/styles.module.css +193 -44
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/package.json +16 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wagmi__providers.d.ts +12 -1
- package/dist/wagmi__providers.d.ts.map +1 -1
- package/dist/wagmi__providers.js +52 -3
- package/package.json +16 -4
- package/dist/controllers/Get_Sessions.d.ts +0 -2
- package/dist/controllers/Get_Sessions.d.ts.map +0 -1
- package/dist/controllers/Get_Sessions.js +0 -2
package/README.md
CHANGED
|
@@ -17,6 +17,14 @@ Built with **Wagmi**, **Viem**, **Ethers**, and **TypeScript**.
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
+
## 🖼️ Demo
|
|
21
|
+
|
|
22
|
+
| Demo 1 | Demo 2 | Demo 3 |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
|  |  |  |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
20
28
|
## 🚀 Features
|
|
21
29
|
|
|
22
30
|
- 🔗 **Wallet Connect/Disconnect** — Simple hooks and buttons for EVM-based wallets
|
|
@@ -42,6 +50,53 @@ yarn add @cordystackx/cordy_minikit@latest
|
|
|
42
50
|
|
|
43
51
|
---
|
|
44
52
|
|
|
53
|
+
## 📢 New: Non-EVM Wallet Support
|
|
54
|
+
|
|
55
|
+
Cordy MiniKit now supports **Non-EVM wallets**, starting with **Stellar / Soroban** integration.
|
|
56
|
+
|
|
57
|
+
You can now connect Stellar wallets through **Freighter**, read Stellar account balances, detect wallet context,
|
|
58
|
+
and send native Stellar payments using the built-in `CordyStackTransStellar` helper.
|
|
59
|
+
|
|
60
|
+
Supported wallet contexts now include:
|
|
61
|
+
|
|
62
|
+
- `EVM` — Wagmi / EVM wallet connected
|
|
63
|
+
- `Non-EVM` — Stellar / Non-EVM wallet connected
|
|
64
|
+
- `MULTI` — Both EVM and Non-EVM wallets connected
|
|
65
|
+
- `NONE` — No wallet connected
|
|
66
|
+
|
|
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.
|
|
99
|
+
|
|
45
100
|
## 🛠️ Quick Start
|
|
46
101
|
|
|
47
102
|
### 1. Environment Setup
|
|
@@ -49,11 +104,19 @@ yarn add @cordystackx/cordy_minikit@latest
|
|
|
49
104
|
Create a `.env.local` file in your project root:
|
|
50
105
|
|
|
51
106
|
```bash
|
|
107
|
+
# Wagmi EVM
|
|
52
108
|
NEXT_PUBLIC_RPC_ENDPOINT=https://your-rpc-endpoint.com
|
|
53
109
|
NEXT_PUBLIC_TOKENADDRESS=0x...
|
|
54
110
|
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
|
|
111
|
+
|
|
112
|
+
# Stellar / Soroban Non-EVM
|
|
113
|
+
NEXT_PUBLIC_STELLAR_HORIZON=https://horizon-testnet.stellar.org
|
|
114
|
+
NEXT_PUBLIC_STELLAR_CONTRACT_ID=CCXI.....
|
|
115
|
+
NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015 //Optional
|
|
55
116
|
```
|
|
56
117
|
|
|
118
|
+
For Stellar, `NEXT_PUBLIC_STELLAR_CONTRACT_ID` is the Soroban equivalent of an EVM token address. Use `NEXT_PUBLIC_STELLAR_HORIZON` for native account balance lookups through Horizon.
|
|
119
|
+
|
|
57
120
|
### 2. Provider Setup
|
|
58
121
|
|
|
59
122
|
Create a providers file at `/app/providers.tsx` or `/services/minikit/providers.tsx`:
|
|
@@ -156,7 +219,7 @@ function CustomButton() {
|
|
|
156
219
|
|
|
157
220
|
### 3. Transaction Handler
|
|
158
221
|
|
|
159
|
-
The `CordyStackTrans` function handles ERC20
|
|
222
|
+
The `CordyStackTrans` function handles ERC20 transfers:
|
|
160
223
|
|
|
161
224
|
```tsx
|
|
162
225
|
import { CordyStackTrans } from "@cordystackx/cordy_minikit";
|
|
@@ -174,6 +237,50 @@ async function handlePayment() {
|
|
|
174
237
|
}
|
|
175
238
|
}
|
|
176
239
|
```
|
|
240
|
+
Conditions enforced by the helper:
|
|
241
|
+
|
|
242
|
+
- Runs only in the browser
|
|
243
|
+
- Requires an active EVM wallet connection
|
|
244
|
+
- Requires a valid recipient EVM address
|
|
245
|
+
- Requires `amount > 0`
|
|
246
|
+
- Requires the configured token contract address from `NEXT_PUBLIC_TOKENADDRESS`
|
|
247
|
+
- Requires the active wallet/network to support the configured token contract
|
|
248
|
+
- Requires the user to approve/sign the transaction in their wallet
|
|
249
|
+
- Returns `true` when the transaction is submitted successfully
|
|
250
|
+
- Returns `false` when the transaction is rejected, invalid, or fails
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
Optional extra note if your helper supports native transfers too:
|
|
254
|
+
|
|
255
|
+
```md
|
|
256
|
+
> Note: `CordyStackTrans` is intended for ERC20 token transfers. For native Stellar/XLM payments, use
|
|
257
|
+
`CordyStackTransStellar`.
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 3.1 Stellar Transfer Helper
|
|
261
|
+
|
|
262
|
+
Use `CordyStackTransStellar` for native Stellar payments through Freighter.
|
|
263
|
+
|
|
264
|
+
```tsx
|
|
265
|
+
import { CordyStackTransStellar } from "@cordystackx/cordy_minikit";
|
|
266
|
+
|
|
267
|
+
async function sendXLM() {
|
|
268
|
+
const success = await CordyStackTransStellar("G...", 10, {
|
|
269
|
+
memo: "Sample payment",
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
if (success) {
|
|
273
|
+
console.log("Stellar transfer successful!");
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Conditions enforced by the helper:
|
|
279
|
+
- Runs only in the browser
|
|
280
|
+
- Requires Freighter access
|
|
281
|
+
- Requires a valid destination address
|
|
282
|
+
- Requires `amount > 0`
|
|
283
|
+
- Requires the active Freighter network to match `NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE` when that env var is set
|
|
177
284
|
|
|
178
285
|
---
|
|
179
286
|
|
|
@@ -212,6 +319,330 @@ export default function Providers({ children }: { children: ReactNode }) {
|
|
|
212
319
|
);
|
|
213
320
|
}
|
|
214
321
|
```
|
|
322
|
+
|
|
323
|
+
### 5. Disconnect Wallets
|
|
324
|
+
|
|
325
|
+
Custom hook for disconnecting EVM, Stellar, or all connected wallets.
|
|
326
|
+
|
|
327
|
+
```tsx
|
|
328
|
+
import { useDisconnectWallets } from "@cordystackx/cordy_minikit";
|
|
329
|
+
|
|
330
|
+
export default function WalletControls() {
|
|
331
|
+
const {
|
|
332
|
+
disconnectEVM,
|
|
333
|
+
disconnectStellar,
|
|
334
|
+
disconnectAll,
|
|
335
|
+
} = useDisconnectWallets();
|
|
336
|
+
|
|
337
|
+
return (
|
|
338
|
+
<div>
|
|
339
|
+
<button onClick={disconnectEVM}>
|
|
340
|
+
Disconnect EVM
|
|
341
|
+
</button>
|
|
342
|
+
|
|
343
|
+
<button onClick={disconnectStellar}>
|
|
344
|
+
Disconnect Stellar
|
|
345
|
+
</button>
|
|
346
|
+
|
|
347
|
+
<button onClick={disconnectAll}>
|
|
348
|
+
Disconnect All
|
|
349
|
+
</button>
|
|
350
|
+
</div>
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Returns:
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
{
|
|
359
|
+
disconnectEVM: () => Promise<boolean>;
|
|
360
|
+
disconnectStellar: () => Promise<boolean>;
|
|
361
|
+
disconnectAll: () => Promise<boolean>;
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
┌─────────────────────┬────────────────────────────────────────────────────┐
|
|
366
|
+
│ Function │ Description │
|
|
367
|
+
├─────────────────────┼────────────────────────────────────────────────────┤
|
|
368
|
+
│ disconnectEVM() │ Disconnects the active Wagmi/EVM wallet │
|
|
369
|
+
├─────────────────────┼────────────────────────────────────────────────────┤
|
|
370
|
+
│ disconnectStellar() │ Clears the active Stellar/Freighter wallet session │
|
|
371
|
+
├─────────────────────┼────────────────────────────────────────────────────┤
|
|
372
|
+
│ disconnectAll() │ Disconnects both EVM and Stellar wallet sessions │
|
|
373
|
+
└─────────────────────┴────────────────────────────────────────────────────┘
|
|
374
|
+
|
|
375
|
+
Each function returns:
|
|
376
|
+
|
|
377
|
+
```ts
|
|
378
|
+
Promise<boolean>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
- true — disconnect succeeded
|
|
382
|
+
- false — disconnect failed
|
|
383
|
+
|
|
384
|
+
Example with success handling:
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
const { disconnectAll } = useDisconnectWallets();
|
|
388
|
+
|
|
389
|
+
async function handleDisconnect() {
|
|
390
|
+
const success = await disconnectAll();
|
|
391
|
+
|
|
392
|
+
if (success) {
|
|
393
|
+
console.log("Wallets disconnected");
|
|
394
|
+
} else {
|
|
395
|
+
console.log("Failed to disconnect wallets");
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
│ Note: useDisconnectWallets() is a React hook. Call it only at the top level of a client component or another hook.
|
|
401
|
+
│ Do not call it inside onClick, loops, conditions, or normal functions.
|
|
402
|
+
|
|
403
|
+
### 6. WalletStatus
|
|
404
|
+
|
|
405
|
+
Custom hook for reading wallet status, balances, wallet context, refresh helpers, and disconnect functions for both
|
|
406
|
+
EVM and Non-EVM wallets.
|
|
407
|
+
|
|
408
|
+
```tsx
|
|
409
|
+
import { useWalletStatus } from "@cordystackx/cordy_minikit";
|
|
410
|
+
|
|
411
|
+
export default function WalletInfo() {
|
|
412
|
+
const {
|
|
413
|
+
context,
|
|
414
|
+
evm,
|
|
415
|
+
stellar,
|
|
416
|
+
refreshBalances,
|
|
417
|
+
refreshEvmBalance,
|
|
418
|
+
refreshStellarBalance,
|
|
419
|
+
disconnectEVM,
|
|
420
|
+
disconnectStellar,
|
|
421
|
+
disconnectAll,
|
|
422
|
+
} = useWalletStatus();
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<div>
|
|
426
|
+
<p>Wallet Context: {context}</p>
|
|
427
|
+
|
|
428
|
+
{context === "EVM" && (
|
|
429
|
+
<p>EVM Address: {evm.address}</p>
|
|
430
|
+
)}
|
|
431
|
+
|
|
432
|
+
{context === "Non_EVM" && (
|
|
433
|
+
<p>Stellar Address: {stellar.address}</p>
|
|
434
|
+
)}
|
|
435
|
+
|
|
436
|
+
{context === "MULTI" && (
|
|
437
|
+
<>
|
|
438
|
+
<p>EVM Address: {evm.address}</p>
|
|
439
|
+
<p>Stellar Address: {stellar.address}</p>
|
|
440
|
+
</>
|
|
441
|
+
)}
|
|
442
|
+
|
|
443
|
+
<button onClick={refreshBalances}>
|
|
444
|
+
Refresh Balances
|
|
445
|
+
</button>
|
|
446
|
+
|
|
447
|
+
<button onClick={disconnectAll}>
|
|
448
|
+
Disconnect All
|
|
449
|
+
</button>
|
|
450
|
+
</div>
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
Returns:
|
|
456
|
+
|
|
457
|
+
```ts
|
|
458
|
+
{
|
|
459
|
+
context: "EVM" | "Non_EVM" | "MULTI" | "NONE";
|
|
460
|
+
|
|
461
|
+
evm: {
|
|
462
|
+
isConnected: boolean;
|
|
463
|
+
address?: string;
|
|
464
|
+
chain?: unknown;
|
|
465
|
+
balance: string;
|
|
466
|
+
symbol: string;
|
|
467
|
+
error?: string;
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
stellar: {
|
|
471
|
+
isConnected: boolean;
|
|
472
|
+
address?: string;
|
|
473
|
+
network?: string;
|
|
474
|
+
balance?: string;
|
|
475
|
+
error?: string;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
refreshEvmBalance: () => Promise<boolean>;
|
|
479
|
+
refreshStellarBalance: (accountId?: string) => Promise<boolean>;
|
|
480
|
+
refreshBalances: () => Promise<boolean>;
|
|
481
|
+
|
|
482
|
+
disconnectEVM: () => Promise<boolean>;
|
|
483
|
+
disconnectStellar: () => Promise<boolean>;
|
|
484
|
+
disconnectAll: () => Promise<boolean>;
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
Wallet context values:
|
|
489
|
+
|
|
490
|
+
┌─────────┬────────────────────────────────────────┐
|
|
491
|
+
│ Context │ Description │
|
|
492
|
+
├─────────┼────────────────────────────────────────┤
|
|
493
|
+
│ EVM │ Wagmi / EVM wallet connected │
|
|
494
|
+
├─────────┼────────────────────────────────────────┤
|
|
495
|
+
│ Non-EVM │ Stellar / Freighter wallet connected │
|
|
496
|
+
├─────────┼────────────────────────────────────────┤
|
|
497
|
+
│ MULTI │ Both EVM and Stellar wallets connected │
|
|
498
|
+
├─────────┼────────────────────────────────────────┤
|
|
499
|
+
│ NONE │ No wallet connected │
|
|
500
|
+
└─────────┴────────────────────────────────────────┘
|
|
501
|
+
|
|
502
|
+
Example: close wallet modal after successful connection:
|
|
503
|
+
|
|
504
|
+
```tsx
|
|
505
|
+
"use client";
|
|
506
|
+
|
|
507
|
+
import { useEffect } from "react";
|
|
508
|
+
import {
|
|
509
|
+
useWalletStatus,
|
|
510
|
+
useWalletModal,
|
|
511
|
+
} from "@cordystackx/cordy_minikit";
|
|
512
|
+
|
|
513
|
+
export default function AutoCloseWalletModal() {
|
|
514
|
+
const { context } = useWalletStatus();
|
|
515
|
+
const { closeModal } = useWalletModal();
|
|
516
|
+
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
if (context !== "NONE") {
|
|
519
|
+
closeModal();
|
|
520
|
+
}
|
|
521
|
+
}, [context, closeModal]);
|
|
522
|
+
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
│ Note: useWalletStatus() is a React hook. Call it only at the top level of a client component or another hook.
|
|
528
|
+
|
|
529
|
+
### 7. Wallet Connection Components
|
|
530
|
+
|
|
531
|
+
#### `WalletButton`
|
|
532
|
+
|
|
533
|
+
Low-level EVM wallet connector button list powered by Wagmi.
|
|
534
|
+
|
|
535
|
+
`WalletButton` renders all configured Wagmi connectors and handles EVM wallet connection state internally.
|
|
536
|
+
|
|
537
|
+
```tsx
|
|
538
|
+
import { WalletButton } from "@cordystackx/cordy_minikit";
|
|
539
|
+
|
|
540
|
+
export default function EVMConnect() {
|
|
541
|
+
return (
|
|
542
|
+
<WalletButton
|
|
543
|
+
onStatusChange={({ isPending, error }) => {
|
|
544
|
+
console.log("Connecting:", isPending);
|
|
545
|
+
console.log("Error:", error);
|
|
546
|
+
}}
|
|
547
|
+
/>
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
Props:
|
|
553
|
+
|
|
554
|
+
```ts
|
|
555
|
+
{
|
|
556
|
+
onStatusChange?: (status: {
|
|
557
|
+
isPending: boolean;
|
|
558
|
+
error?: string;
|
|
559
|
+
}) => void;
|
|
560
|
+
}
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
Behavior:
|
|
564
|
+
|
|
565
|
+
- Lists available Wagmi connectors
|
|
566
|
+
- Detects whether injected wallets are installed
|
|
567
|
+
- Supports WalletConnect and Trust Wallet display handling
|
|
568
|
+
- Shows Connecting... while connection is pending
|
|
569
|
+
- Stores the active wallet session as evm
|
|
570
|
+
- Reports pending/error state through onStatusChange
|
|
571
|
+
|
|
572
|
+
│ Note: WalletButton is usually used internally by UI_Comp, but it can also be imported directly for custom wallet
|
|
573
|
+
│ UIs.
|
|
574
|
+
|
|
575
|
+
────────────────────────────────────────────────────────────────────────────────
|
|
576
|
+
|
|
577
|
+
#### StellarWalletButton
|
|
578
|
+
|
|
579
|
+
Low-level Stellar / Freighter wallet connector button.
|
|
580
|
+
|
|
581
|
+
StellarWalletButton connects to Freighter, returns the Stellar public key, and reports the active Stellar network.
|
|
582
|
+
|
|
583
|
+
```tsx
|
|
584
|
+
import { StellarWalletButton } from "@cordystackx/cordy_minikit";
|
|
585
|
+
|
|
586
|
+
export default function StellarConnect() {
|
|
587
|
+
return (
|
|
588
|
+
<StellarWalletButton
|
|
589
|
+
onConnect={(address) => {
|
|
590
|
+
console.log("Connected Stellar address:", address);
|
|
591
|
+
}}
|
|
592
|
+
onStatusChange={({ isPending, error, address, network }) => {
|
|
593
|
+
console.log("Connecting:", isPending);
|
|
594
|
+
console.log("Error:", error);
|
|
595
|
+
console.log("Address:", address);
|
|
596
|
+
console.log("Network:", network);
|
|
597
|
+
}}
|
|
598
|
+
/>
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
Props:
|
|
604
|
+
|
|
605
|
+
```ts
|
|
606
|
+
{
|
|
607
|
+
onConnect?: (address: string) => void;
|
|
608
|
+
|
|
609
|
+
onStatusChange?: (status: {
|
|
610
|
+
isPending: boolean;
|
|
611
|
+
error?: string;
|
|
612
|
+
address?: string;
|
|
613
|
+
network?: string;
|
|
614
|
+
}) => void;
|
|
615
|
+
}
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
Behavior:
|
|
619
|
+
|
|
620
|
+
- Requests Freighter wallet access
|
|
621
|
+
- Returns the connected Stellar public key
|
|
622
|
+
- Reads active Freighter network details
|
|
623
|
+
- Shows connected address preview
|
|
624
|
+
- Reports pending/error/address/network through onStatusChange
|
|
625
|
+
|
|
626
|
+
Conditions:
|
|
627
|
+
|
|
628
|
+
- Runs only in the browser
|
|
629
|
+
- Requires Freighter wallet extension/app access
|
|
630
|
+
- Requires user approval in Freighter
|
|
631
|
+
- For testnet apps, Freighter should be set to the matching testnet network
|
|
632
|
+
|
|
633
|
+
Small improvement for `WalletButton`: after successful connect, you may want to notify parent explicitly:
|
|
634
|
+
|
|
635
|
+
```ts
|
|
636
|
+
onStatusChange?.({ isPending: false });
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
right after:
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
await connectAsync({ connector });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
`Not required, but cleaner.`
|
|
215
646
|
|
|
216
647
|
---
|
|
217
648
|
|
|
@@ -245,63 +676,6 @@ cordy_minikit/
|
|
|
245
676
|
|
|
246
677
|
---
|
|
247
678
|
|
|
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
679
|
## 🔧 API Reference
|
|
306
680
|
|
|
307
681
|
### Components
|
|
@@ -329,6 +703,12 @@ const success = await CordyStackTrans(recipientAddress: string, amount: number);
|
|
|
329
703
|
```
|
|
330
704
|
- Returns: `Promise<boolean>` - Transaction success status
|
|
331
705
|
|
|
706
|
+
#### `CordyStackTransStellar(address, amount, options?)`
|
|
707
|
+
```tsx
|
|
708
|
+
const success = await CordyStackTransStellar(recipientAddress: string, amount: number, options?: { memo?: string; source?: string });
|
|
709
|
+
```
|
|
710
|
+
- Returns: `Promise<boolean>` - Stellar transaction success status
|
|
711
|
+
|
|
332
712
|
#### `getConfig(customChains?)`
|
|
333
713
|
```tsx
|
|
334
714
|
const config = getConfig({ myChain: customChainDefinition });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Connect_wallet_bt.d.ts","sourceRoot":"","sources":["../../components/Connect_wallet_bt.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Connect_wallet_bt.d.ts","sourceRoot":"","sources":["../../components/Connect_wallet_bt.tsx"],"names":[],"mappings":"AAUE,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,SAAS,GACV,EAAE,oBAAoB,+BA2EtB"}
|