@cicero-zcash/react 0.1.0 → 0.2.0
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 +116 -159
- package/dist/index.d.mts +30 -140
- package/dist/index.d.ts +30 -140
- package/dist/index.js +234 -837
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +234 -855
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
# 🛡️ Cicero
|
|
4
4
|
|
|
5
|
-
### The
|
|
5
|
+
### The RainbowKit for Shielded Zcash
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Universal wallet connection, bi-directional network synchronization, and multi-wallet state management for React and Next.js applications.**
|
|
8
8
|
|
|
9
9
|
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
[](https://www.npmjs.com/package/@cicero-zcash/react)
|
|
10
11
|
[](https://z.cash)
|
|
11
|
-
[](https://zips.z.cash/zip-0321)
|
|
12
12
|
[](./DESIGN.md)
|
|
13
13
|
|
|
14
|
-
[
|
|
14
|
+
[Quickstart](#-quickstart) • [React Hooks](#-react-hooks) • [Wallets Supported](#-supported-wallets) • [Components](#-components)
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
@@ -19,45 +19,60 @@
|
|
|
19
19
|
|
|
20
20
|
## 📖 What is Cicero?
|
|
21
21
|
|
|
22
|
-
**Cicero**
|
|
22
|
+
**Cicero** is the **"RainbowKit of Zcash"**. It provides a drop-in, zero-knowledge native wallet connection suite:
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
- 🥒 **Zucchini Chrome Extension:** 1-click in-browser connection and shielded account detection.
|
|
25
|
+
- 📱 **Mobile & Desktop Wallets:** Zashi (Electric Coin Co.) and Ywallet QR handoff.
|
|
26
|
+
- 🔑 **Viewing Key Mode:** Audit and read-only treasury dashboard connection.
|
|
27
|
+
- 🔄 **Bi-Directional Network Sync:** Automatically detects Mainnet vs Testnet from wallet address prefixes and listens to extension network change events.
|
|
28
|
+
- 💰 **Per-Network Balance Segregation:** Independent balance caching for Mainnet and Testnet with live USD conversion.
|
|
27
29
|
|
|
28
30
|
```tsx
|
|
29
|
-
import { CiceroProvider, CiceroConnectButton } from '@cicero-zcash/react';
|
|
31
|
+
import { CiceroProvider, CiceroConnectButton, useAccount, useBalance } from '@cicero-zcash/react';
|
|
30
32
|
|
|
31
33
|
export default function App() {
|
|
32
34
|
return (
|
|
33
35
|
<CiceroProvider initialNetwork="mainnet">
|
|
34
|
-
<nav>
|
|
35
|
-
<
|
|
36
|
+
<nav className="flex justify-between p-4 border-b">
|
|
37
|
+
<span>My Zcash dApp</span>
|
|
38
|
+
<CiceroConnectButton variant="primary" size="md" />
|
|
36
39
|
</nav>
|
|
37
|
-
<
|
|
40
|
+
<Dashboard />
|
|
38
41
|
</CiceroProvider>
|
|
39
42
|
);
|
|
40
43
|
}
|
|
44
|
+
|
|
45
|
+
function Dashboard() {
|
|
46
|
+
const { address, isConnected, wallet } = useAccount();
|
|
47
|
+
const { zec, usd } = useBalance();
|
|
48
|
+
|
|
49
|
+
if (!isConnected) return <p>Please connect your Zcash wallet.</p>;
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div>
|
|
53
|
+
<p>Connected to {wallet?.name}</p>
|
|
54
|
+
<p>Address: {address}</p>
|
|
55
|
+
<p>Balance: {zec} ZEC (~${usd} USD)</p>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
41
59
|
```
|
|
42
60
|
|
|
43
61
|
---
|
|
44
62
|
|
|
45
|
-
## ⚡
|
|
63
|
+
## ⚡ Features
|
|
46
64
|
|
|
47
|
-
- **🛡️
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
- **📱 Mobile & Desktop Handoff:** Pre-configured deep links and dynamic QR codes compatible with **Zashi** (Electric Coin Co.) and **Ywallet**.
|
|
53
|
-
- **🎨 Supabase Design Language:** Clean, technical aesthetic styled strictly with Supabase tokens (emerald `#3ecf8e` primary CTAs, `#171717` ink typography, 6px button radii, and `#1c1c1c` code blocks).
|
|
54
|
-
- **⏱️ Lifecycle State Watcher:** Manages countdowns (15-min invoices), mempool transaction detection, confirmed states, and developer simulation controls for rapid hackathon testing.
|
|
65
|
+
- **🛡️ Shielded-First Architecture:** Built specifically for Zcash's Unified Address standard (ZIP-316), Sapling (`zs1`), and Transparent (`t1`) pools.
|
|
66
|
+
- **🔄 Live Network & Chain Synchronization:** Listens to wallet extension events (`networkChanged`, `accountsChanged`). Switching between Mainnet and Testnet inside Zucchini immediately updates Cicero and queries the new balance.
|
|
67
|
+
- **💼 RainbowKit-Style Connected Pill:** Displays active network indicator (green/amber dot), current ZEC balance, and truncated address. Clicking opens an account drawer with address copying, QR code receive view, and network switch assistance.
|
|
68
|
+
- **🎨 Supabase Design Language:** Styled with Supabase tokens (`#3ecf8e` emerald accents, `#171717` ink typography, 6px button radii, clean border tokens).
|
|
69
|
+
- **🪙 Live Fiat Conversions:** `useZcashPrice()` hook provides cached, rate-limited ZEC/USD pricing with automatic fallback.
|
|
55
70
|
|
|
56
71
|
---
|
|
57
72
|
|
|
58
73
|
## 🚀 Quickstart
|
|
59
74
|
|
|
60
|
-
### 1. Install
|
|
75
|
+
### 1. Install
|
|
61
76
|
|
|
62
77
|
```bash
|
|
63
78
|
pnpm add @cicero-zcash/react
|
|
@@ -67,176 +82,118 @@ npm install @cicero-zcash/react
|
|
|
67
82
|
yarn add @cicero-zcash/react
|
|
68
83
|
```
|
|
69
84
|
|
|
70
|
-
### 2.
|
|
85
|
+
### 2. Wrap your app in `<CiceroProvider>`
|
|
71
86
|
|
|
72
87
|
```tsx
|
|
73
|
-
import {
|
|
88
|
+
import { CiceroProvider } from '@cicero-zcash/react';
|
|
74
89
|
|
|
75
|
-
export
|
|
90
|
+
export function RootLayout({ children }: { children: React.ReactNode }) {
|
|
76
91
|
return (
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<CiceroPayButton
|
|
82
|
-
recipient="u1qwe829xkps9482mzsll049281kz8471..."
|
|
83
|
-
amount={0.05}
|
|
84
|
-
memo="Unlock Paper #42"
|
|
85
|
-
variant="primary"
|
|
86
|
-
size="md"
|
|
87
|
-
onSuccess={({ txId, amount }) => {
|
|
88
|
-
alert(`Settled on-chain! Tx: ${txId}`);
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
+
<CiceroProvider initialNetwork="mainnet" appName="My Zcash dApp">
|
|
93
|
+
{children}
|
|
94
|
+
</CiceroProvider>
|
|
92
95
|
);
|
|
93
96
|
}
|
|
94
97
|
```
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
## 🧩 Component Options
|
|
99
|
-
|
|
100
|
-
### Modal Button: `<CiceroPayButton />`
|
|
101
|
-
A button that triggers the modal dialog containing the ZIP-321 QR code, deep links, address copy tools, and live settlement watcher.
|
|
102
|
-
|
|
103
|
-
### Inline Card: `<CiceroInvoice />`
|
|
104
|
-
An embeddable payment card that renders directly on page—ideal for checkout flows, POS tablets, or invoice dashboards.
|
|
105
|
-
|
|
106
|
-
### Headless Hook: `useCiceroPayment()`
|
|
107
|
-
Full programmatic control over the Zcash payment state machine:
|
|
99
|
+
### 3. Add the `<CiceroConnectButton />`
|
|
108
100
|
|
|
109
101
|
```tsx
|
|
110
|
-
import {
|
|
111
|
-
|
|
112
|
-
function CustomPaymentUI() {
|
|
113
|
-
const {
|
|
114
|
-
status,
|
|
115
|
-
zip321Uri,
|
|
116
|
-
secondsRemaining,
|
|
117
|
-
addressType,
|
|
118
|
-
isShielded,
|
|
119
|
-
simulateDetection,
|
|
120
|
-
} = useCiceroPayment({
|
|
121
|
-
recipient: 'u1...',
|
|
122
|
-
amount: 0.25,
|
|
123
|
-
memo: 'Invoice #1092',
|
|
124
|
-
});
|
|
102
|
+
import { CiceroConnectButton } from '@cicero-zcash/react';
|
|
125
103
|
|
|
104
|
+
export function Header() {
|
|
126
105
|
return (
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
<p>Remaining: {secondsRemaining}s</p>
|
|
132
|
-
</div>
|
|
106
|
+
<header className="flex justify-between items-center p-4">
|
|
107
|
+
<h1>Zcash Portal</h1>
|
|
108
|
+
<CiceroConnectButton variant="primary" size="md" />
|
|
109
|
+
</header>
|
|
133
110
|
);
|
|
134
111
|
}
|
|
135
112
|
```
|
|
136
113
|
|
|
137
|
-
|
|
138
|
-
Directly prompt the **Zucchini Wallet** Chrome extension side-panel for in-browser payments:
|
|
114
|
+
---
|
|
139
115
|
|
|
140
|
-
|
|
141
|
-
import { useZucchiniWallet } from '@cicero-zcash/react';
|
|
116
|
+
## 🪝 React Hooks
|
|
142
117
|
|
|
143
|
-
|
|
144
|
-
const { isAvailable, connect, requestPayment } = useZucchiniWallet();
|
|
118
|
+
Cicero exports familiar, ergonomic hooks modeled after RainbowKit and wagmi:
|
|
145
119
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
120
|
+
### `useAccount()`
|
|
121
|
+
```tsx
|
|
122
|
+
const {
|
|
123
|
+
address, // string | null - Active shielded or transparent address
|
|
124
|
+
isConnected, // boolean - Whether a wallet is connected
|
|
125
|
+
isConnecting, // boolean - True during connection handshake
|
|
126
|
+
wallet, // ZcashWallet | null - Active wallet adapter metadata
|
|
127
|
+
disconnect, // () => Promise<void> - Disconnect handler
|
|
128
|
+
} = useAccount();
|
|
129
|
+
```
|
|
155
130
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
131
|
+
### `useBalance()`
|
|
132
|
+
```tsx
|
|
133
|
+
const {
|
|
134
|
+
zec, // number - Shielded balance in ZEC
|
|
135
|
+
usd, // string | null - Estimated USD equivalent
|
|
136
|
+
isLoading, // boolean - True when querying balance
|
|
137
|
+
refetch, // () => Promise<void> - Re-queries balance from wallet/RPC
|
|
138
|
+
} = useBalance();
|
|
162
139
|
```
|
|
163
140
|
|
|
164
|
-
|
|
141
|
+
### `useCicero()`
|
|
142
|
+
Full context access including network state, modal controls, and raw wallet methods:
|
|
143
|
+
```tsx
|
|
144
|
+
const {
|
|
145
|
+
account,
|
|
146
|
+
network, // 'mainnet' | 'testnet'
|
|
147
|
+
switchNetwork, // (net: 'mainnet' | 'testnet') => Promise<SwitchResult>
|
|
148
|
+
openConnectModal,
|
|
149
|
+
closeConnectModal,
|
|
150
|
+
openAccountModal,
|
|
151
|
+
closeAccountModal,
|
|
152
|
+
} = useCicero();
|
|
153
|
+
```
|
|
165
154
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
| `showUsd` | `boolean` | No | Displays live estimated USD conversion (defaults to `true`) |
|
|
179
|
-
| `invoiceId` | `string` | No | Custom merchant invoice identifier |
|
|
180
|
-
| `onSuccess` | `(tx) => void` | No | Callback fired upon on-chain payment confirmation |
|
|
181
|
-
| `onStatusChange` | `(status) => void` | No | Callback fired on status transitions (`pending`, `detected`, `confirmed`, `expired`) |
|
|
155
|
+
### `useZucchiniWallet()`
|
|
156
|
+
Direct low-level hook for interacting with the Zucchini browser extension:
|
|
157
|
+
```tsx
|
|
158
|
+
const {
|
|
159
|
+
isAvailable, // boolean - True if Zucchini Chrome extension is installed
|
|
160
|
+
isConnected, // boolean
|
|
161
|
+
connect, // () => Promise<WalletSession>
|
|
162
|
+
address, // string | null
|
|
163
|
+
network, // 'mainnet' | 'testnet'
|
|
164
|
+
getBalance, // () => Promise<number | null>
|
|
165
|
+
} = useZucchiniWallet();
|
|
166
|
+
```
|
|
182
167
|
|
|
183
168
|
---
|
|
184
169
|
|
|
185
|
-
##
|
|
170
|
+
## 🔌 Supported Wallets
|
|
186
171
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
172
|
+
| Wallet | Type | Support | Features |
|
|
173
|
+
|---|---|---|---|
|
|
174
|
+
| **Zucchini** | Chrome Extension | Direct in-browser | 1-click connect, live network sync, shielded balance |
|
|
175
|
+
| **Zashi** | Mobile (iOS/Android) | QR Handoff | Electric Coin Co. official wallet |
|
|
176
|
+
| **Ywallet** | Desktop & Mobile | QR Handoff | Multi-platform shielded wallet |
|
|
177
|
+
| **Viewing Key** | Read-Only | Manual Input | Auditor compliance, treasury dashboards |
|
|
178
|
+
| **Burner Wallet**| Dev / Sandbox | Ephemeral | Instant testing in development |
|
|
193
179
|
|
|
194
180
|
---
|
|
195
181
|
|
|
196
|
-
##
|
|
197
|
-
|
|
198
|
-
```text
|
|
199
|
-
cicero/
|
|
200
|
-
├── packages/
|
|
201
|
-
│ └── cicero/ # @cicero-zcash/react component library
|
|
202
|
-
│ ├── src/
|
|
203
|
-
│ │ ├── components/ # CiceroPayButton, CiceroModal, CiceroQRCode, CiceroInvoice
|
|
204
|
-
│ │ ├── hooks/ # useCiceroPayment, useZcashPrice
|
|
205
|
-
│ │ ├── utils/ # ZIP-321 builder, address validator, deep links
|
|
206
|
-
│ │ └── index.ts
|
|
207
|
-
│ └── tsup.config.ts
|
|
208
|
-
├── apps/
|
|
209
|
-
│ └── web/ # Next.js 15 interactive studio & docs
|
|
210
|
-
│ ├── src/
|
|
211
|
-
│ │ ├── app/ # App router pages
|
|
212
|
-
│ │ └── components/ # PlaygroundStudio, HeroSection, Navbar, DocsSection
|
|
213
|
-
│ └── tailwind.config.ts
|
|
214
|
-
├── DESIGN.md # Supabase design system token specification
|
|
215
|
-
├── pnpm-workspace.yaml
|
|
216
|
-
└── README.md
|
|
217
|
-
```
|
|
182
|
+
## 🧩 Components
|
|
218
183
|
|
|
219
|
-
|
|
184
|
+
### `<CiceroConnectButton />`
|
|
220
185
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
pnpm install
|
|
230
|
-
|
|
231
|
-
# Run the live studio and docs
|
|
232
|
-
pnpm dev
|
|
233
|
-
|
|
234
|
-
# Build both package and web app
|
|
235
|
-
pnpm build
|
|
236
|
-
```
|
|
186
|
+
| Prop | Type | Default | Description |
|
|
187
|
+
|---|---|---|---|
|
|
188
|
+
| `variant` | `'primary' \| 'outline' \| 'dark'` | `'primary'` | Visual style token |
|
|
189
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button dimensions |
|
|
190
|
+
| `showBalance` | `boolean` | `true` | Show balance in connected pill |
|
|
191
|
+
| `showNetwork` | `boolean` | `true` | Show network indicator dot |
|
|
192
|
+
| `label` | `string` | `'Connect Zcash Wallet'` | Custom disconnect trigger text |
|
|
193
|
+
| `className` | `string` | `''` | Custom CSS class names |
|
|
237
194
|
|
|
238
195
|
---
|
|
239
196
|
|
|
240
|
-
##
|
|
197
|
+
## 📄 License
|
|
241
198
|
|
|
242
|
-
MIT
|
|
199
|
+
MIT © [Kaycee276](https://github.com/Kaycee276)
|
package/dist/index.d.mts
CHANGED
|
@@ -2,16 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
type ZcashAddressType = 'unified' | 'sapling' | 'transparent' | 'unknown';
|
|
4
4
|
type ZcashNetwork = 'mainnet' | 'testnet';
|
|
5
|
-
type PaymentStatus = 'idle' | 'pending' | 'detected' | 'confirmed' | 'expired' | 'failed';
|
|
6
5
|
type CiceroTheme = 'supabase' | 'emerald' | 'dark' | 'light';
|
|
7
|
-
interface PaymentDetails {
|
|
8
|
-
recipient: string;
|
|
9
|
-
amount: number | string;
|
|
10
|
-
memo?: string;
|
|
11
|
-
message?: string;
|
|
12
|
-
network?: ZcashNetwork;
|
|
13
|
-
invoiceId?: string;
|
|
14
|
-
}
|
|
15
6
|
interface Zip321PaymentRequest {
|
|
16
7
|
address: string;
|
|
17
8
|
amount?: string;
|
|
@@ -19,52 +10,6 @@ interface Zip321PaymentRequest {
|
|
|
19
10
|
message?: string;
|
|
20
11
|
rawUri: string;
|
|
21
12
|
}
|
|
22
|
-
interface CiceroPayProps {
|
|
23
|
-
/** Zcash recipient address (Unified, Sapling, or Transparent) */
|
|
24
|
-
recipient: string;
|
|
25
|
-
/** Amount in ZEC */
|
|
26
|
-
amount: number | string;
|
|
27
|
-
/** Optional encrypted memo (up to 512 bytes, supported on shielded addresses) */
|
|
28
|
-
memo?: string;
|
|
29
|
-
/** Optional human-readable message */
|
|
30
|
-
message?: string;
|
|
31
|
-
/** Button label text */
|
|
32
|
-
label?: string;
|
|
33
|
-
/** Zcash network (defaults to 'mainnet') */
|
|
34
|
-
network?: ZcashNetwork;
|
|
35
|
-
/** Visual theme */
|
|
36
|
-
theme?: CiceroTheme;
|
|
37
|
-
/** Button variant */
|
|
38
|
-
variant?: 'primary' | 'outline' | 'dark';
|
|
39
|
-
/** Button size */
|
|
40
|
-
size?: 'sm' | 'md' | 'lg';
|
|
41
|
-
/** Whether to show estimated USD value alongside ZEC */
|
|
42
|
-
showUsd?: boolean;
|
|
43
|
-
/** Custom modal title */
|
|
44
|
-
modalTitle?: string;
|
|
45
|
-
/** Custom modal subtitle */
|
|
46
|
-
modalSubtitle?: string;
|
|
47
|
-
/** Invoice expiration time in seconds (defaults to 900 = 15 mins) */
|
|
48
|
-
expiresInSeconds?: number;
|
|
49
|
-
/** Optional custom lightwalletd or indexer URL */
|
|
50
|
-
customRpcUrl?: string;
|
|
51
|
-
/** Optional unique invoice or order reference */
|
|
52
|
-
invoiceId?: string;
|
|
53
|
-
/** Callback fired when transaction confirmation is detected */
|
|
54
|
-
onSuccess?: (tx: {
|
|
55
|
-
txId: string;
|
|
56
|
-
amount: number;
|
|
57
|
-
memo?: string;
|
|
58
|
-
}) => void;
|
|
59
|
-
/** Callback fired on payment error */
|
|
60
|
-
onError?: (error: Error) => void;
|
|
61
|
-
/** Callback fired whenever the payment status transitions */
|
|
62
|
-
onStatusChange?: (status: PaymentStatus) => void;
|
|
63
|
-
/** Custom CSS classes for the trigger button */
|
|
64
|
-
className?: string;
|
|
65
|
-
/** Disable the button */
|
|
66
|
-
disabled?: boolean;
|
|
67
|
-
}
|
|
68
13
|
|
|
69
14
|
type WalletCategory = 'extension' | 'mobile' | 'desktop' | 'read-only' | 'developer';
|
|
70
15
|
interface WalletSession$1 {
|
|
@@ -102,6 +47,12 @@ interface ZcashWallet {
|
|
|
102
47
|
address?: string;
|
|
103
48
|
network?: ZcashNetwork;
|
|
104
49
|
}) => Promise<number | null>;
|
|
50
|
+
getNetwork?: () => Promise<ZcashNetwork>;
|
|
51
|
+
switchNetwork?: (network: ZcashNetwork) => Promise<{
|
|
52
|
+
success: boolean;
|
|
53
|
+
requiresManualSwitch?: boolean;
|
|
54
|
+
currentNetwork?: ZcashNetwork;
|
|
55
|
+
}>;
|
|
105
56
|
sendPayment?: (params: SendPaymentParams) => Promise<SendPaymentResult>;
|
|
106
57
|
}
|
|
107
58
|
|
|
@@ -142,7 +93,11 @@ interface CiceroContextType {
|
|
|
142
93
|
isConnecting: boolean;
|
|
143
94
|
wallet: ZcashWallet | null;
|
|
144
95
|
network: ZcashNetwork;
|
|
145
|
-
switchNetwork: (net: ZcashNetwork) =>
|
|
96
|
+
switchNetwork: (net: ZcashNetwork) => Promise<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
requiresManualSwitch?: boolean;
|
|
99
|
+
currentNetwork?: ZcashNetwork;
|
|
100
|
+
}>;
|
|
146
101
|
balance: BalanceState;
|
|
147
102
|
refetchBalance: () => Promise<void>;
|
|
148
103
|
connect: (walletId: string, customAddressOrKey?: string) => Promise<void>;
|
|
@@ -217,39 +172,6 @@ interface CiceroAccountModalProps {
|
|
|
217
172
|
}
|
|
218
173
|
declare const CiceroAccountModal: React.FC<CiceroAccountModalProps>;
|
|
219
174
|
|
|
220
|
-
declare const CiceroPayButton: React.FC<CiceroPayProps>;
|
|
221
|
-
|
|
222
|
-
interface CiceroModalProps {
|
|
223
|
-
isOpen: boolean;
|
|
224
|
-
onClose: () => void;
|
|
225
|
-
recipient: string;
|
|
226
|
-
amount: number | string;
|
|
227
|
-
memo?: string;
|
|
228
|
-
message?: string;
|
|
229
|
-
network?: ZcashNetwork;
|
|
230
|
-
status: PaymentStatus;
|
|
231
|
-
txId: string | null;
|
|
232
|
-
secondsRemaining: number;
|
|
233
|
-
zip321Uri: string;
|
|
234
|
-
addressType: string;
|
|
235
|
-
isShielded: boolean;
|
|
236
|
-
memoValidation: {
|
|
237
|
-
valid: boolean;
|
|
238
|
-
warning?: string;
|
|
239
|
-
byteLength: number;
|
|
240
|
-
};
|
|
241
|
-
onSimulateDetection?: () => void;
|
|
242
|
-
onResetPayment?: () => void;
|
|
243
|
-
title?: string;
|
|
244
|
-
subtitle?: string;
|
|
245
|
-
showUsd?: boolean;
|
|
246
|
-
/** Zucchini Wallet integration */
|
|
247
|
-
zucchiniAvailable?: boolean;
|
|
248
|
-
zucchiniPaying?: boolean;
|
|
249
|
-
onPayWithZucchini?: () => void;
|
|
250
|
-
}
|
|
251
|
-
declare const CiceroModal: React.FC<CiceroModalProps>;
|
|
252
|
-
|
|
253
175
|
interface CiceroQRCodeProps {
|
|
254
176
|
value: string;
|
|
255
177
|
size?: number;
|
|
@@ -259,56 +181,6 @@ interface CiceroQRCodeProps {
|
|
|
259
181
|
}
|
|
260
182
|
declare const CiceroQRCode: React.FC<CiceroQRCodeProps>;
|
|
261
183
|
|
|
262
|
-
declare const CiceroInvoice: React.FC<CiceroPayProps>;
|
|
263
|
-
|
|
264
|
-
interface UseCiceroPaymentOptions {
|
|
265
|
-
recipient: string;
|
|
266
|
-
amount: number | string;
|
|
267
|
-
memo?: string;
|
|
268
|
-
message?: string;
|
|
269
|
-
network?: ZcashNetwork;
|
|
270
|
-
expiresInSeconds?: number;
|
|
271
|
-
invoiceId?: string;
|
|
272
|
-
customRpcUrl?: string;
|
|
273
|
-
onSuccess?: (tx: {
|
|
274
|
-
txId: string;
|
|
275
|
-
amount: number;
|
|
276
|
-
memo?: string;
|
|
277
|
-
}) => void;
|
|
278
|
-
onError?: (error: Error) => void;
|
|
279
|
-
onStatusChange?: (status: PaymentStatus) => void;
|
|
280
|
-
}
|
|
281
|
-
declare function useCiceroPayment({ recipient, amount, memo, message, network, expiresInSeconds, // 15 mins
|
|
282
|
-
invoiceId, customRpcUrl, onSuccess, onError, onStatusChange, }: UseCiceroPaymentOptions): {
|
|
283
|
-
status: PaymentStatus;
|
|
284
|
-
txId: string | null;
|
|
285
|
-
secondsRemaining: number;
|
|
286
|
-
isModalOpen: boolean;
|
|
287
|
-
openModal: () => void;
|
|
288
|
-
closeModal: () => void;
|
|
289
|
-
resetPayment: () => void;
|
|
290
|
-
zip321Uri: string;
|
|
291
|
-
deepLinks: {
|
|
292
|
-
generic: string;
|
|
293
|
-
zashi: string;
|
|
294
|
-
ywallet: string;
|
|
295
|
-
};
|
|
296
|
-
addressType: ZcashAddressType;
|
|
297
|
-
isShielded: boolean;
|
|
298
|
-
memoValidation: {
|
|
299
|
-
valid: boolean;
|
|
300
|
-
warning?: string;
|
|
301
|
-
byteLength: number;
|
|
302
|
-
};
|
|
303
|
-
simulateDetection: () => void;
|
|
304
|
-
invoiceId: string | undefined;
|
|
305
|
-
network: ZcashNetwork;
|
|
306
|
-
customRpcUrl: string | undefined;
|
|
307
|
-
zucchiniAvailable: boolean;
|
|
308
|
-
zucchiniPaying: boolean;
|
|
309
|
-
payWithZucchini: () => Promise<void>;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
184
|
declare function useZcashPrice(enabled?: boolean): {
|
|
313
185
|
convertZecToUsd: (zecAmount: number | string) => string | null;
|
|
314
186
|
usdPrice: number | null;
|
|
@@ -322,6 +194,7 @@ type WalletPaymentStatus = 'idle' | 'requesting' | 'submitted' | 'error';
|
|
|
322
194
|
interface WalletSession {
|
|
323
195
|
address?: string;
|
|
324
196
|
connected: boolean;
|
|
197
|
+
network?: ZcashNetwork;
|
|
325
198
|
balance?: number;
|
|
326
199
|
}
|
|
327
200
|
interface WalletPaymentResult {
|
|
@@ -360,6 +233,23 @@ declare class ZucchiniWalletAdapter {
|
|
|
360
233
|
* Resolves the user's active Shielded Unified Address.
|
|
361
234
|
*/
|
|
362
235
|
connect(): Promise<WalletSession>;
|
|
236
|
+
/**
|
|
237
|
+
* Queries the active network of the Zucchini Wallet ('mainnet' | 'testnet').
|
|
238
|
+
*/
|
|
239
|
+
getNetwork(): Promise<ZcashNetwork>;
|
|
240
|
+
/**
|
|
241
|
+
* Requests a network change. If the extension does not support programmatic
|
|
242
|
+
* switching, informs the application that manual user toggle is needed.
|
|
243
|
+
*/
|
|
244
|
+
switchNetwork(targetNetwork: ZcashNetwork): Promise<{
|
|
245
|
+
success: boolean;
|
|
246
|
+
requiresManualSwitch?: boolean;
|
|
247
|
+
currentNetwork: ZcashNetwork;
|
|
248
|
+
}>;
|
|
249
|
+
/**
|
|
250
|
+
* Subscribes to network change events from the wallet extension.
|
|
251
|
+
*/
|
|
252
|
+
onNetworkChanged(listener: (network: ZcashNetwork) => void): () => void;
|
|
363
253
|
/**
|
|
364
254
|
* Helper to normalize raw balance formats (e.g. number, string, zatoshis, or pool totals).
|
|
365
255
|
*/
|
|
@@ -481,4 +371,4 @@ declare function getWalletDeepLinks(zip321Uri: string): {
|
|
|
481
371
|
ywallet: string;
|
|
482
372
|
};
|
|
483
373
|
|
|
484
|
-
export { type AccountState, type BalanceState, type BuildZip321Params, CiceroAccountModal, type CiceroAccountModalProps, CiceroConnectButton, type CiceroConnectButtonProps, CiceroConnectModal, type CiceroConnectModalProps, type CiceroContextType,
|
|
374
|
+
export { type AccountState, type BalanceState, type BuildZip321Params, CiceroAccountModal, type CiceroAccountModalProps, CiceroConnectButton, type CiceroConnectButtonProps, CiceroConnectModal, type CiceroConnectModalProps, type CiceroContextType, CiceroProvider, type CiceroProviderProps, CiceroQRCode, type CiceroTheme, type SendPaymentParams, type SendPaymentResult, type UseZucchiniWalletOptions, type WalletCategory, type WalletSession$1 as WalletSession, type ZcashAddressType, type ZcashNetwork, type ZcashWallet, ZucchiniWalletAdapter, burnerWallet, decodeBase64Url, encodeBase64Url, generateZip321Uri, getAddressType, getDefaultWallets, getWalletDeepLinks, isShieldedAddress, parseZip321Uri, truncateAddress, useAccount, useAccountModal, useBalance, useCicero, useConnectModal, useZcashPrice, useZucchiniWallet, validateMemoSupport, viewingKeyWallet, ywallet, zashiWallet, zucchiniWallet };
|