Skip to content

Commit b214cc0

Browse files
committed
nostr/nips: NIP47 nostr wallet connect
1 parent 19f5fc8 commit b214cc0

File tree

7 files changed

+427
-3
lines changed

7 files changed

+427
-3
lines changed

crates/nostr-sdk/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ keywords = ["nostr", "sdk", "rust"]
1515
default = ["all-nips"]
1616
blocking = ["dep:once_cell", "nostr/blocking"]
1717
vanity = ["nostr/vanity"]
18-
all-nips = ["nip04", "nip05", "nip06", "nip11", "nip19", "nip46"]
18+
all-nips = ["nip04", "nip05", "nip06", "nip11", "nip19", "nip46", "nip47"]
1919
nip03 = ["nostr/nip03"]
2020
nip04 = ["nostr/nip04"]
2121
nip05 = ["nostr/nip05"]
2222
nip06 = ["nostr/nip06"]
2323
nip11 = ["nostr/nip11"]
2424
nip19 = ["nostr/nip19"]
2525
nip46 = ["nostr/nip46"]
26+
nip47 = ["nostr/nip47"]
2627

2728
[dependencies]
2829
log = "0.4"

crates/nostr-sdk/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ The following crate feature flags are available:
131131
| `nip11` | Yes | Enable NIP-11: Relay Information Document |
132132
| `nip19` | Yes | Enable NIP-19: bech32-encoded entities |
133133
| `nip46` | Yes | Enable NIP-46: Nostr Connect |
134+
| `nip47` | Yes | Enable NIP-47: Nostr Wallet Connect |
134135

135136
## Supported NIPs
136137

crates/nostr/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ keywords = ["nostr", "protocol", "sdk"]
1515
default = ["all-nips"]
1616
blocking = ["reqwest?/blocking"]
1717
vanity = ["nip19"]
18-
all-nips = ["nip04", "nip05", "nip06", "nip11", "nip19", "nip21", "nip46"]
18+
all-nips = ["nip04", "nip05", "nip06", "nip11", "nip19", "nip21", "nip46", "nip47"]
1919
nip03 = ["dep:nostr-ots"]
2020
nip04 = ["dep:aes", "dep:base64", "dep:cbc"]
2121
nip05 = ["dep:reqwest"]
@@ -24,6 +24,7 @@ nip11 = ["dep:reqwest"]
2424
nip19 = ["dep:bech32"]
2525
nip21 = ["nip19"]
2626
nip46 = ["nip04"]
27+
nip47 = ["nip04"]
2728

2829
[dependencies]
2930
aes = { version = "0.8", optional = true }

crates/nostr/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ The following crate feature flags are available:
9999
| `nip11` | Yes | Enable NIP-11: Relay Information Document |
100100
| `nip19` | Yes | Enable NIP-19: bech32-encoded entities |
101101
| `nip21` | Yes | Enable NIP-21: `nostr` URI scheme |
102+
| `nip47` | Yes | Enable NIP-47: Nostr Wallet Connect
102103
| `nip46` | Yes | Enable NIP-46: Nostr Connect |
103104

104105
## Supported NIPs
@@ -135,7 +136,7 @@ The following crate feature flags are available:
135136
|| [42 - Authentication of clients to relays](https://github.com/nostr-protocol/nips/blob/master/42.md) |
136137
|| [45 - Event Counts](https://github.com/nostr-protocol/nips/blob/master/45.md) |
137138
|| [46 - Nostr Connect](https://github.com/nostr-protocol/nips/blob/master/46.md) |
138-
| | [47 - Wallet Connect](https://github.com/nostr-protocol/nips/blob/master/47.md) |
139+
| | [47 - Wallet Connect](https://github.com/nostr-protocol/nips/blob/master/47.md) |
139140
|| [50 - Keywords filter](https://github.com/nostr-protocol/nips/blob/master/50.md) |
140141
|| [51 - Lists](https://github.com/nostr-protocol/nips/blob/master/51.md) |
141142
|| [56 - Reporting](https://github.com/nostr-protocol/nips/blob/master/56.md) |

crates/nostr/src/event/kind.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ pub enum Kind {
5252
PublicChatReserved48,
5353
/// Public Chat Reserved (NIP28)
5454
PublicChatReserved49,
55+
/// Wallet Service Info (NIP47)
56+
WalletConnectInfo,
5557
/// Reporting (NIP56)
5658
Reporting,
5759
/// Zap Request (NIP57)
@@ -66,6 +68,10 @@ pub enum Kind {
6668
RelayList,
6769
/// Client Authentication (NIP42)
6870
Authentication,
71+
/// Wallet Connect Request (NIP47)
72+
WalletConnectRequest,
73+
/// Wallet Connect Response (NIP47)
74+
WalletConnectResponse,
6975
/// Nostr Connect (NIP46)
7076
NostrConnect,
7177
/// Categorized People List (NIP51)
@@ -126,13 +132,16 @@ impl From<u64> for Kind {
126132
47 => Self::PublicChatReserved47,
127133
48 => Self::PublicChatReserved48,
128134
49 => Self::PublicChatReserved49,
135+
13194 => Self::WalletConnectInfo,
129136
1984 => Self::Reporting,
130137
9734 => Self::ZapRequest,
131138
9735 => Self::Zap,
132139
10000 => Self::MuteList,
133140
10001 => Self::PinList,
134141
10002 => Self::RelayList,
135142
22242 => Self::Authentication,
143+
23194 => Self::WalletConnectRequest,
144+
23195 => Self::WalletConnectResponse,
136145
24133 => Self::NostrConnect,
137146
30000 => Self::CategorizedPeopleList,
138147
30001 => Self::CategorizedBookmarkList,
@@ -171,13 +180,16 @@ impl From<Kind> for u64 {
171180
Kind::PublicChatReserved47 => 47,
172181
Kind::PublicChatReserved48 => 48,
173182
Kind::PublicChatReserved49 => 49,
183+
Kind::WalletConnectInfo => 13194,
174184
Kind::Reporting => 1984,
175185
Kind::ZapRequest => 9734,
176186
Kind::Zap => 9735,
177187
Kind::MuteList => 10000,
178188
Kind::PinList => 10001,
179189
Kind::RelayList => 10002,
180190
Kind::Authentication => 22242,
191+
Kind::WalletConnectRequest => 23194,
192+
Kind::WalletConnectResponse => 23195,
181193
Kind::NostrConnect => 24133,
182194
Kind::CategorizedPeopleList => 30000,
183195
Kind::CategorizedBookmarkList => 30001,

crates/nostr/src/nips/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ pub mod nip21;
2121
pub mod nip26;
2222
#[cfg(feature = "nip46")]
2323
pub mod nip46;
24+
#[cfg(feature = "nip47")]
25+
pub mod nip47;
2426
pub mod nip58;
2527
pub mod nip65;

0 commit comments

Comments
 (0)