upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSemisol <45574030+Semisol@users.noreply.github.com>2023-04-03 22:18:11 +0300
committerGitHub <noreply@github.com>2023-04-03 22:18:11 +0300
commitc232c9a46a279883f7d8e07db9f2ae6a79a784c6 (patch)
treee8dc1d1a57d9aefb030ac3545f4e3d8492546d28
parent961f28285a739000277f489573f5b4c22053f27c (diff)
NIP-47: feedbacj
-rw-r--r--47.md59
1 files changed, 47 insertions, 12 deletions
diff --git a/47.md b/47.md
index 96bf906..fd85e13 100644
--- a/47.md
+++ b/47.md
@@ -8,8 +8,7 @@ Nostr Wallet Connect
8 8
9## Rationale 9## Rationale
10 10
11Paying zaps should be possible without the user needing to open a different app to only pay a Lightning invoice. 11This NIP describes a way for clients to access a remote Lightning wallet through a standardized protocol. Custodians may implement this, or the user may run a bridge that bridges their wallet/node and the Nostr Wallet Connect protocol.
12This NIP describes a way for users to control a remote Lightning node or a custodial Lightning wallet. When self-hosting, this setup does not require the user to run their own server, thereby bypassing certain hurdles that are commonly encountered when trying to connect to a Lightning node remotely.
13 12
14## Terms 13## Terms
15 14
@@ -47,7 +46,17 @@ Response:
47} 46}
48``` 47```
49 48
50The data field SHOULD contain a `message` field with a human readable error message if the status is `error`. 49The data field SHOULD contain a `message` field with a human readable error message and a `code` field with the error code if the status is `error`.
50
51### Error codes
52- `RATE_LIMITED`: The client is sending commands too fast. It should retry in a few seconds.
53- `NOT_IMPLEMENTED`: The command is not known or is intentionally not implemented.
54- `INSUFFICIENT_BALANCE`: The wallet does not have enough funds to cover a fee reserve or the payment amount.
55- `QUOTA_EXCEEDED`: The wallet has exceeded
56- `RESTRICTED`: This public key is not allowed to do this operation.
57- `UNAUTHORIZED`: This public key has no wallet connected.
58- `INTERNAL`: An internal error.
59- `OTHER`: Other error.
51 60
52## Nostr Wallet Connect URI 61## Nostr Wallet Connect URI
53**client** discovers **wallet service** by scanning a QR code, handling a deeplink or pasting in a URI. 62**client** discovers **wallet service** by scanning a QR code, handling a deeplink or pasting in a URI.
@@ -61,7 +70,7 @@ The **wallet service** generates this connection URI with protocol `nostr+wallet
61 - The key is harder to leak since it is not shown to the user and backed up. 70 - The key is harder to leak since it is not shown to the user and backed up.
62 - It improves privacy because the user's main key would not be linked to their payments. 71 - It improves privacy because the user's main key would not be linked to their payments.
63 72
64The **client** should then store this connection and use it when the user wants to perform actions like paying an invoice. Optionally it can display metadata about the connected **wallet service** from it's profile (name, image, url). 73The **client** should then store this connection and use it when the user wants to perform actions like paying an invoice. Due to this NIP using ephemeral events, it is recommended to pick relays that do not close connections on inactivity to not drop events.
65 74
66### Example connection string 75### Example connection string
67```sh 76```sh
@@ -70,34 +79,60 @@ nostr+walletconnect:b889ff5b1513b641e2a139f661a661364979c5beee91842f8f0ef42ab558
70 79
71## Commands 80## Commands
72 81
73### `pay_invoice` 82### `get_info`
74 83
75Description: Requests payment of an invoice. 84Description: Get information about the wallet and service.
85
86Request: Empty object.
87
88Response:
89```jsonc
90{
91 "balance": 100000, // balance in msat, int
92 // this should be capped at the quota allowed for this client
93 // to not report unspendable balance.
94 "implemented_commands": ["get_info", "pay_invoice"] // commands supported, string array
95 // extensions can be specified via command+extension:
96 // get_info+node_info
97}
98```
99
100### `create_invoice`
101
102Description: Requests creation of an invoice.
76 103
77Request: 104Request:
78```jsonc 105```jsonc
79{ 106{
80 "invoice": "lnbc50n1..." // BOLT11 invoice, string 107 "amount": 1000, // amount in msat, int
108 // must be a whole number of sats unless
109 // create_invoice+msat_amount is implemented.
110 "description": "memo" // a description, string, optional
81} 111}
82``` 112```
83 113
84Response: 114Response:
85```jsonc 115```jsonc
86{ 116{
87 "preimage": "0123456789abcdef..." // preimage after payment, string 117 "invoice": "lnbc50n1..." // BOLT11 invoice, string
88} 118}
89``` 119```
90 120
91### `balance` 121### `pay_invoice`
92 122
93Description: Requests the balance of the wallet. 123Description: Requests payment of an invoice.
94 124
95Request: an empty JSON object. 125Request:
126```jsonc
127{
128 "invoice": "lnbc50n1..." // BOLT11 invoice, string
129}
130```
96 131
97Response: 132Response:
98```jsonc 133```jsonc
99{ 134{
100 "balance": 100000 // balance in msat, int 135 "preimage": "0123456789abcdef..." // preimage after payment, string
101} 136}
102``` 137```
103 138