@sip-protocol/react 0.1.0 → 0.1.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 +54 -14
- package/dist/index.d.mts +1224 -6
- package/dist/index.d.ts +1224 -6
- package/dist/index.js +5783 -10
- package/dist/index.mjs +5777 -9
- package/package.json +9 -8
- package/src/components/ethereum/index.ts +55 -0
- package/src/components/ethereum/privacy-toggle.tsx +822 -0
- package/src/components/ethereum/stealth-address-display.tsx +1050 -0
- package/src/components/ethereum/transaction-history.tsx +1187 -0
- package/src/components/ethereum/transaction-tracker.tsx +302 -0
- package/src/components/ethereum/viewing-key-manager.tsx +228 -0
- package/src/components/index.ts +107 -0
- package/src/components/privacy-toggle.tsx +548 -0
- package/src/components/stealth-address-display.tsx +770 -0
- package/src/components/transaction-history.tsx +651 -0
- package/src/components/transaction-tracker.tsx +1079 -0
- package/src/components/viewing-key-manager.tsx +1576 -0
- package/src/hooks/index.ts +61 -0
- package/src/hooks/use-privacy-advisor.ts +371 -0
- package/src/hooks/use-private-swap.ts +5 -5
- package/src/hooks/use-proof-composition.ts +654 -0
- package/src/hooks/use-scan-payments.ts +504 -0
- package/src/hooks/use-stealth-address.ts +23 -7
- package/src/hooks/use-stealth-transfer.ts +284 -0
- package/src/hooks/use-transaction-history.ts +435 -0
- package/src/index.ts +75 -0
package/README.md
CHANGED
|
@@ -56,28 +56,68 @@ Access the SIP client instance directly.
|
|
|
56
56
|
const sip = useSIP()
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
### `useStealthAddress()`
|
|
59
|
+
### `useStealthAddress(chain)`
|
|
60
60
|
|
|
61
|
-
Generate and manage stealth addresses
|
|
61
|
+
Generate and manage stealth addresses for privacy-preserving transactions.
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
const {
|
|
64
|
+
const {
|
|
65
|
+
metaAddress,
|
|
66
|
+
stealthAddress,
|
|
67
|
+
isGenerating,
|
|
68
|
+
regenerate,
|
|
69
|
+
copyToClipboard,
|
|
70
|
+
} = useStealthAddress('ethereum')
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<div>
|
|
74
|
+
<p>Share this: {metaAddress}</p>
|
|
75
|
+
<p>One-time address: {stealthAddress}</p>
|
|
76
|
+
<button onClick={regenerate}>Generate New</button>
|
|
77
|
+
<button onClick={copyToClipboard}>Copy</button>
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
65
80
|
```
|
|
66
81
|
|
|
67
|
-
### `usePrivateSwap()`
|
|
82
|
+
### `usePrivateSwap()`
|
|
68
83
|
|
|
69
|
-
Execute private swaps with shielded intents.
|
|
84
|
+
Execute private swaps with shielded intents.
|
|
70
85
|
|
|
71
86
|
```tsx
|
|
72
|
-
const {
|
|
87
|
+
const { quote, fetchQuote, swap, status, isLoading, error, reset } = usePrivateSwap()
|
|
88
|
+
|
|
89
|
+
// Fetch a quote
|
|
90
|
+
await fetchQuote({
|
|
91
|
+
inputChain: 'solana',
|
|
92
|
+
outputChain: 'ethereum',
|
|
93
|
+
inputToken: 'SOL',
|
|
94
|
+
outputToken: 'ETH',
|
|
95
|
+
inputAmount: '1000000000',
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Execute swap
|
|
99
|
+
const result = await swap({
|
|
100
|
+
input: { chain: 'solana', token: 'SOL', amount: 1000000000n },
|
|
101
|
+
output: { chain: 'ethereum', token: 'ETH', minAmount: 0n },
|
|
102
|
+
privacyLevel: PrivacyLevel.SHIELDED,
|
|
103
|
+
})
|
|
73
104
|
```
|
|
74
105
|
|
|
75
|
-
### `useViewingKey()`
|
|
106
|
+
### `useViewingKey()`
|
|
76
107
|
|
|
77
|
-
Generate and manage viewing keys for compliance.
|
|
108
|
+
Generate and manage viewing keys for compliance.
|
|
78
109
|
|
|
79
110
|
```tsx
|
|
80
|
-
const { generate, decrypt, share } = useViewingKey()
|
|
111
|
+
const { viewingKey, sharedWith, generate, decrypt, share } = useViewingKey()
|
|
112
|
+
|
|
113
|
+
// Generate a viewing key
|
|
114
|
+
const key = generate()
|
|
115
|
+
|
|
116
|
+
// Share with auditor
|
|
117
|
+
await share('auditor-123')
|
|
118
|
+
|
|
119
|
+
// Decrypt transaction for auditing
|
|
120
|
+
const decrypted = await decrypt(encryptedTransaction)
|
|
81
121
|
```
|
|
82
122
|
|
|
83
123
|
## Configuration
|
|
@@ -104,14 +144,14 @@ See [@sip-protocol/sdk](https://github.com/sip-protocol/sip-protocol/tree/main/p
|
|
|
104
144
|
|
|
105
145
|
## Development Status
|
|
106
146
|
|
|
107
|
-
This package is
|
|
147
|
+
This package is production-ready with full hook implementations:
|
|
108
148
|
|
|
109
149
|
- [x] Provider setup
|
|
110
150
|
- [x] `useSIP()` hook
|
|
111
|
-
- [
|
|
112
|
-
- [
|
|
113
|
-
- [
|
|
114
|
-
- [
|
|
151
|
+
- [x] `useStealthAddress()` hook (secp256k1 & ed25519 support)
|
|
152
|
+
- [x] `usePrivateSwap()` hook (full swap lifecycle)
|
|
153
|
+
- [x] `useViewingKey()` hook (compliance-ready)
|
|
154
|
+
- [x] Comprehensive test suite (57 tests)
|
|
115
155
|
|
|
116
156
|
## Documentation
|
|
117
157
|
|