mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2025-08-27 13:09:22 +00:00
zap in context.md
This commit is contained in:
parent
14eccbcb6f
commit
11ac73776c
21
CONTEXT.md
21
CONTEXT.md
@ -651,6 +651,27 @@ export function Post(/* ...props */) {
|
||||
}
|
||||
```
|
||||
|
||||
### Lightning Zaps (NIP-57)
|
||||
|
||||
Implement zaps with a payment method fallback chain: **NWC → WebLN → Manual**. Always validate recipient lightning addresses (`lud16`/`lud06`) before creating zap requests.
|
||||
|
||||
```tsx
|
||||
// Use unified wallet detection
|
||||
const { webln, activeNWC, preferredMethod } = useWallet();
|
||||
const { zap } = useZaps(target, webln, activeNWC, onSuccess);
|
||||
|
||||
// Validate recipient can receive zaps
|
||||
if (!author.metadata?.lud16 && !author.metadata?.lud06) {
|
||||
return null; // Hide zap button
|
||||
}
|
||||
```
|
||||
|
||||
**Critical patterns:**
|
||||
- Detect WebLN only when needed (dialog open)
|
||||
- Show payment method indicator to users
|
||||
- Handle errors gracefully with specific messaging
|
||||
- Use `useZaps` hook for payment logic
|
||||
|
||||
## App Configuration
|
||||
|
||||
The project includes an `AppProvider` that manages global application state including theme and relay configuration. The default configuration includes:
|
||||
|
Loading…
x
Reference in New Issue
Block a user