@cicero-zcash/react 0.0.0-stage β 0.1.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 +241 -2
- package/dist/index.d.mts +484 -0
- package/dist/index.d.ts +484 -0
- package/dist/index.js +2602 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2581 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -4
package/README.md
CHANGED
|
@@ -1,3 +1,242 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# π‘οΈ Cicero
|
|
4
|
+
|
|
5
|
+
### The Developer Payment Kit for Shielded Zcash
|
|
6
|
+
|
|
7
|
+
**Drop-in React components for zero-knowledge payments, RFC-compliant ZIP-321 request URIs, and 512-byte encrypted memos.**
|
|
8
|
+
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
[](https://z.cash)
|
|
11
|
+
[](https://zips.z.cash/zip-0321)
|
|
12
|
+
[](./DESIGN.md)
|
|
13
|
+
|
|
14
|
+
[Live Interactive Studio](#live-studio) β’ [Quickstart](#quickstart) β’ [Component Props](#component-props) β’ [Use Cases](#why-cicero)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
## π What is Cicero?
|
|
21
|
+
|
|
22
|
+
**Cicero** (named after *Marcus Tullius Cicero*, Roman defender of liberty and confidential correspondence) is the **"RainbowKit / Stripe Elements of Zcash"**.
|
|
23
|
+
|
|
24
|
+
It provides two interconnected primitives:
|
|
25
|
+
1. **Universal Wallet Connection (`<CiceroConnectButton />` & `<CiceroProvider>`):** Connect any Zcash wallet (Zucchini Chrome Extension, Zashi Mobile, Ywallet, Viewing Keys, or Dev Sessions) with custom modal UI and React hooks (`useAccount()`, `useBalance()`, `useCicero()`).
|
|
26
|
+
2. **Drop-in Shielded Checkout (`<CiceroPayButton />` & `<CiceroInvoice />`):** Accept zero-knowledge Zcash payments with automatic ZIP-321 request URIs, 512-byte encrypted memos, and live settlement detection.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { CiceroProvider, CiceroConnectButton } from '@cicero-zcash/react';
|
|
30
|
+
|
|
31
|
+
export default function App() {
|
|
32
|
+
return (
|
|
33
|
+
<CiceroProvider initialNetwork="mainnet">
|
|
34
|
+
<nav>
|
|
35
|
+
<CiceroConnectButton />
|
|
36
|
+
</nav>
|
|
37
|
+
<MainApp />
|
|
38
|
+
</CiceroProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## β‘ Core Features
|
|
46
|
+
|
|
47
|
+
- **π‘οΈ Native Zero-Knowledge Checkout:** Full support for Orchard and Sapling shielded pools with mathematical sender/recipient confidentiality.
|
|
48
|
+
- **π₯ 1-Click Zucchini Browser Wallet:** Directly prompts the **Zucchini Wallet** Chrome extension side-panel for instant in-browser signing without needing a second device.
|
|
49
|
+
- **βοΈ 512-Byte Shielded Encrypted Memos:** Safely attach order numbers, licensing tokens, or private notes directly into the transaction without leaking plaintext to the public ledger.
|
|
50
|
+
- **π RFC ZIP-321 URI Standard:** Compliant with official Zcash Payment Request URIs, featuring padding-free Base64URL memo encoding.
|
|
51
|
+
- **π Unified Address Intelligence (ZIP-316):** Auto-detects receiver types (`u1`, `zs1`, `t1`) and provides warnings if users attempt unshielded transactions.
|
|
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.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## π Quickstart
|
|
59
|
+
|
|
60
|
+
### 1. Install the package
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pnpm add @cicero-zcash/react
|
|
64
|
+
# or
|
|
65
|
+
npm install @cicero-zcash/react
|
|
66
|
+
# or
|
|
67
|
+
yarn add @cicero-zcash/react
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Drop into your React or Next.js app
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { CiceroPayButton } from '@cicero-zcash/react';
|
|
74
|
+
|
|
75
|
+
export default function StoreItem() {
|
|
76
|
+
return (
|
|
77
|
+
<div className="card">
|
|
78
|
+
<h3>Premium Research Paper</h3>
|
|
79
|
+
<p>Instant unlock via zero-knowledge settlement</p>
|
|
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
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
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:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { useCiceroPayment, CiceroQRCode } from '@cicero-zcash/react';
|
|
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
|
+
});
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div>
|
|
128
|
+
<CiceroQRCode value={zip321Uri} size={160} />
|
|
129
|
+
<p>Status: {status}</p>
|
|
130
|
+
<p>Address: {addressType} ({isShielded ? 'Shielded' : 'Transparent'})</p>
|
|
131
|
+
<p>Remaining: {secondsRemaining}s</p>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Direct Browser Wallet Hook: `useZucchiniWallet()`
|
|
138
|
+
Directly prompt the **Zucchini Wallet** Chrome extension side-panel for in-browser payments:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
import { useZucchiniWallet } from '@cicero-zcash/react';
|
|
142
|
+
|
|
143
|
+
function ZucchiniCheckout() {
|
|
144
|
+
const { isAvailable, connect, requestPayment } = useZucchiniWallet();
|
|
145
|
+
|
|
146
|
+
const handlePay = async () => {
|
|
147
|
+
await connect();
|
|
148
|
+
const { txId } = await requestPayment({
|
|
149
|
+
recipient: 'u1qwe829...',
|
|
150
|
+
amount: 0.1,
|
|
151
|
+
memo: 'Order #9821',
|
|
152
|
+
});
|
|
153
|
+
console.log('Payment submitted via Zucchini!', txId);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<button onClick={handlePay} disabled={!isAvailable}>
|
|
158
|
+
{isAvailable ? 'Pay with Zucchini Wallet' : 'Install Zucchini'}
|
|
159
|
+
</button>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## βοΈ Component Props Reference
|
|
167
|
+
|
|
168
|
+
| Prop | Type | Required | Description |
|
|
169
|
+
| :--- | :--- | :---: | :--- |
|
|
170
|
+
| `recipient` | `string` | **Yes** | Zcash recipient address (Unified `u1`, Sapling `zs1`, or Transparent `t1`) |
|
|
171
|
+
| `amount` | `number \| string` | **Yes** | Amount in ZEC (e.g. `0.05`) |
|
|
172
|
+
| `memo` | `string` | No | Zero-knowledge encrypted memo (up to 512 bytes on shielded addresses) |
|
|
173
|
+
| `message` | `string` | No | Human-readable order note per ZIP-321 |
|
|
174
|
+
| `label` | `string` | No | Button label text (defaults to `"Pay with Zcash"`) |
|
|
175
|
+
| `variant` | `'primary' \| 'outline' \| 'dark'` | No | Visual style token (defaults to signature emerald primary) |
|
|
176
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | No | Button dimension and padding tier |
|
|
177
|
+
| `network` | `'mainnet' \| 'testnet'` | No | Target Zcash network (defaults to `'mainnet'`) |
|
|
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`) |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## π‘ Real-World Use Cases
|
|
186
|
+
|
|
187
|
+
1. **Confidential Remote Payroll & Freelance:**
|
|
188
|
+
Public wallets on Ethereum or Solana leak salary and savings to coworkers and competitors. Cicero allows businesses to pay contractors in shielded ZEC with private invoice IDs in the encrypted memo.
|
|
189
|
+
2. **Sub-Cent Creator & Research Micro-Paywalls:**
|
|
190
|
+
Credit card processing ($0.30 fixed fee) makes $0.10 articles economically impossible. Cicero enables pay-per-read micro-payments with near-zero transaction fees.
|
|
191
|
+
3. **Anonymous Whistleblower & Investigative Bounties:**
|
|
192
|
+
Informants submit encrypted leak verification hashes directly inside the 512-byte memo and receive shielded bounties without leaving an IP or public wallet trail.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## ποΈ Monorepo Structure
|
|
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
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## π οΈ Development
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Clone the repository
|
|
225
|
+
git clone git@github.com:Kaycee276/cicero.git
|
|
226
|
+
cd cicero
|
|
227
|
+
|
|
228
|
+
# Install dependencies across all packages
|
|
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
|
+
```
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## π License
|
|
241
|
+
|
|
242
|
+
MIT License Β© 2026 [Kaycee276](https://github.com/Kaycee276)
|