error payloads

This commit is contained in:
shocknet-justin 2024-09-08 11:09:06 -04:00
parent cc4b6650e7
commit 7b15e7dfed

55
69.md
View File

@ -226,19 +226,6 @@ To ensure consistent error handling across implementations, this NIP defines the
4. **Unsupported Feature**: When the receiver doesn't support a feature requested by the payer.
5. **Invalid Amount**: When the amount specified is too big or too small, providing the acceptable range.
Error responses should be sent as kind 21001 events with the following structure in the encrypted content:
```json
{
"error": "<error_message>",
"code": "<error_code>",
"range": { //sats
"min": 10,
"max": 10000000
}
}
```
Error codes:
- 1: Invalid Offer
@ -249,6 +236,44 @@ Error codes:
Clients MUST handle these error responses gracefully and display appropriate messages to users.
### Error Response Payloads
Error responses should be sent as kind 21001 events with the following structure in the encrypted content:
```json
{
"error": "<error_message>",
"code": "<error_code>"
// Additional fields optionally included depending on the error type
}
```
### Expected Payloads
3. **Expired Offer**
- **Code**: 3
- **Payload**:
```json
{
"error": "Expired Offer",
"code": 3,
"latest": "<noffer1..>"
}
```
5. **Invalid Amount**
- **Code**: 5
- **Payload**:
```json
{
"error": "Invalid Amount",
"code": 5,
"range": { //sats
"min": 10,
"max": 10000000
}
}
```
## Transition from LNURL
LNURL services wishing to signal the upgrade should add `nip69: <noffer>` to the inital GET response described in [LUD-06](https://github.com/lnurl/luds/blob/luds/06.md). Clients seeing this new value on a LNURL server should automatically upgrade the payment flow that was instantiated by the user for that address.
@ -264,5 +289,5 @@ Future versions of this NIP may consider standardizing additional features such
## Reference Implementations
[Lightning.Pub](https://github.com/shocknet/Lightning.Pub/pull/727) / [ShockWallet](https://github.com/shocknet/wallet2/pull/268)
[demo.nip69.dev](https://demo.nip69.dev)
- [Lightning.Pub](https://github.com/shocknet/Lightning.Pub/pull/727) / [ShockWallet](https://github.com/shocknet/wallet2/pull/268)
- [demo.nip69.dev](https://demo.nip69.dev)