mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-18 10:06:27 +01:00
pool's .FetchManyReplaceable() and amends to previous commit.
This commit is contained in:
15
helpers.go
15
helpers.go
@@ -155,6 +155,21 @@ func extractEventID(jsonStr string) string {
|
||||
return jsonStr[start : start+64]
|
||||
}
|
||||
|
||||
func extractEventPubKey(jsonStr string) string {
|
||||
// look for "pubkey" pattern
|
||||
start := strings.Index(jsonStr, `"pubkey"`)
|
||||
if start == -1 {
|
||||
return ""
|
||||
}
|
||||
|
||||
// move to the next quote
|
||||
offset := strings.IndexRune(jsonStr[start+8:], '"')
|
||||
start += 8 + offset + 1
|
||||
|
||||
// get 64 characters of the pubkey
|
||||
return jsonStr[start : start+64]
|
||||
}
|
||||
|
||||
func extractDTag(jsonStr string) string {
|
||||
// look for ["d", pattern
|
||||
start := strings.Index(jsonStr, `["d"`)
|
||||
|
||||
Reference in New Issue
Block a user