feat(extensions): add getLnurlPayInfo to ExtensionContext
Enables extensions to get LNURL-pay info for users by pubkey, supporting Lightning Address (LUD-16) and zap (NIP-57) functionality. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
92b9b2564f
commit
e3b1f7580e
2 changed files with 45 additions and 1 deletions
|
|
@ -8,7 +8,8 @@ import {
|
||||||
PaymentReceivedData,
|
PaymentReceivedData,
|
||||||
NostrEvent,
|
NostrEvent,
|
||||||
UnsignedNostrEvent,
|
UnsignedNostrEvent,
|
||||||
RpcMethodHandler
|
RpcMethodHandler,
|
||||||
|
LnurlPayInfo
|
||||||
} from './types.js'
|
} from './types.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,6 +45,15 @@ export interface MainHandlerInterface {
|
||||||
paymentHash: string
|
paymentHash: string
|
||||||
feeSats: number
|
feeSats: number
|
||||||
}>
|
}>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get LNURL-pay info for a user by their Nostr pubkey
|
||||||
|
* This enables Lightning Address (LUD-16) and zap (NIP-57) support
|
||||||
|
*/
|
||||||
|
getLnurlPayInfoByPubkey(pubkeyHex: string, options?: {
|
||||||
|
metadata?: string
|
||||||
|
description?: string
|
||||||
|
}): Promise<LnurlPayInfo>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nostr operations
|
// Nostr operations
|
||||||
|
|
@ -177,6 +187,17 @@ export class ExtensionContextImpl implements ExtensionContext {
|
||||||
return this.mainHandler.sendNostrEvent(event)
|
return this.mainHandler.sendNostrEvent(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get LNURL-pay info for a user by pubkey
|
||||||
|
* Enables Lightning Address and zap support
|
||||||
|
*/
|
||||||
|
async getLnurlPayInfo(pubkeyHex: string, options?: {
|
||||||
|
metadata?: string
|
||||||
|
description?: string
|
||||||
|
}): Promise<LnurlPayInfo> {
|
||||||
|
return this.mainHandler.paymentManager.getLnurlPayInfoByPubkey(pubkeyHex, options)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to payment received callbacks
|
* Subscribe to payment received callbacks
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,20 @@ export interface PaymentReceivedData {
|
||||||
metadata?: Record<string, any>
|
metadata?: Record<string, any>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LNURL-pay info response (LUD-06/LUD-16)
|
||||||
|
* Used for Lightning Address and zap support
|
||||||
|
*/
|
||||||
|
export interface LnurlPayInfo {
|
||||||
|
tag: 'payRequest'
|
||||||
|
callback: string // URL to call with amount
|
||||||
|
minSendable: number // Minimum msats
|
||||||
|
maxSendable: number // Maximum msats
|
||||||
|
metadata: string // JSON-encoded metadata array
|
||||||
|
allowsNostr?: boolean // Whether zaps are supported
|
||||||
|
nostrPubkey?: string // Pubkey for zap receipts (hex)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nostr event structure (minimal)
|
* Nostr event structure (minimal)
|
||||||
*/
|
*/
|
||||||
|
|
@ -142,6 +156,15 @@ export interface ExtensionContext {
|
||||||
*/
|
*/
|
||||||
publishNostrEvent(event: UnsignedNostrEvent): Promise<string | null>
|
publishNostrEvent(event: UnsignedNostrEvent): Promise<string | null>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get LNURL-pay info for a user (by pubkey)
|
||||||
|
* Used to enable Lightning Address support (LUD-16) and zaps (NIP-57)
|
||||||
|
*/
|
||||||
|
getLnurlPayInfo(pubkeyHex: string, options?: {
|
||||||
|
metadata?: string // Custom metadata JSON
|
||||||
|
description?: string // Human-readable description
|
||||||
|
}): Promise<LnurlPayInfo>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subscribe to payment received callbacks
|
* Subscribe to payment received callbacks
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue