upleb.uk

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

summaryrefslogtreecommitdiff
path: root/5C.md
diff options
context:
space:
mode:
Diffstat (limited to '5C.md')
-rw-r--r--5C.md16
1 files changed, 8 insertions, 8 deletions
diff --git a/5C.md b/5C.md
index a4e655e..44a2473 100644
--- a/5C.md
+++ b/5C.md
@@ -52,7 +52,7 @@ The WASM module must export a function named `run` with a single pointer paramet
52 52
53### `on_event(sub_handle: i32, event_handle: i32, eosed: i32)` 53### `on_event(sub_handle: i32, event_handle: i32, eosed: i32)`
54 54
55If the WASM module ever calls `nostr.subscribe` it must also export a function named `on_event` that will be called with every received event from any subscription. `sub` will be the subscription handle, `event` will be the event handle, `eosed` will be 0 if the event was received before `EOSE`, 1 otherwise. 55If the WASM module ever calls `nostr.subscribe` it must also export a function named `on_event` that will be called with every received event from any subscription. `sub` will be the subscription handle, `event` will be the event handle, `eosed` will be `0` if the event was received before `EOSE`, `1` otherwise.
56 56
57### `on_eose(sub_handle: i32)` 57### `on_eose(sub_handle: i32)`
58 58
@@ -168,11 +168,11 @@ Same as `req_add_id` but with a hex-encoded id string. Length is assumed to be 6
168 168
169Add a kind integer to the `kinds` filter. 169Add a kind integer to the `kinds` filter.
170 170
171### `nostr.req_add_tag(req: i32, tag_ptr: i32, tag_len: i32, value_ptr: i32, value_len: i32) -> void` 171### `nostr.req_add_tag(req: i32, tag: i32, value_ptr: i32, value_len: i32) -> void`
172 172
173Add a value to a tag filter. `tag_ptr/tag_len` points to the tag name (e.g. `"p"` -- will be added to the filter as `"#p"`); `value_ptr/value_len` points to the tag value to match. The value is treated as a string. 173Add a value to a tag filter. `tag` is the ASCII code of the letter (e.g. `112` is `"p"` and will be added to the filter as `"#p"`); `value_ptr/value_len` points to the tag value to match. The value is treated as a string.
174 174
175### `nostr.req_add_tag_bin32(req: i32, tag_ptr: i32, tag_len: i32, value_ptr: i32) -> void` 175### `nostr.req_add_tag_bin32(req: i32, tag: i32, value_ptr: i32) -> void`
176 176
177Same as `req_add_tag` but the value is a pointer to the 32-byte binary buffer that the host will convert to hex. This is useful for `#p`, `#e`, and other tag filters that need pubkey or event ID values. 177Same as `req_add_tag` but the value is a pointer to the 32-byte binary buffer that the host will convert to hex. This is useful for `#p`, `#e`, and other tag filters that need pubkey or event ID values.
178 178
@@ -253,15 +253,15 @@ Returns the total number of tags on this event.
253 253
254### `nostr.event_get_tag_item_count(event_handle: i32, tag_index: i32) -> i32` 254### `nostr.event_get_tag_item_count(event_handle: i32, tag_index: i32) -> i32`
255 255
256Returns the number of items in the tag at `tag_index`. 256Returns the number of items in the tag at `tag_index`; or `0` if such tag doesn't exist.
257 257
258### `nostr.event_get_tag_item(event_handle: i32, tag_index: i32, item_index: i32) -> i32` 258### `nostr.event_get_tag_item(event_handle: i32, tag_index: i32, item_index: i32) -> i32`
259 259
260Returns a pointer to a buffer containing the item at `(tag_index, item_index)` (follows the String Convention above). 260Returns a pointer to a buffer containing the item at `(tag_index, item_index)` (follows the String Convention above); or `0` if such tag doesn't exist.
261 261
262### `nostr.event_get_tag_item_bin32(event_handle: i32, tag_index: i32, item_index: i32) -> i32` 262### `nostr.event_get_tag_item_bin32(event_handle: i32, tag_index: i32, item_index: i32) -> i32`
263 263
264Same as `event_get_tag_item`, but returns a pointer to a 32-byte buffer of the item if it happened to be a pubkey or an event id; 0 otherwise. 264Same as `event_get_tag_item`, but returns a pointer to a 32-byte buffer of the item if it happened to be a pubkey or an event id; `0` otherwise.
265 265
266### `nostr.event_get_tag_item_by_name(event_handle: i32, name_ptr: i32, name_len: i32, item_index: i32) -> i32` 266### `nostr.event_get_tag_item_by_name(event_handle: i32, name_ptr: i32, name_len: i32, item_index: i32) -> i32`
267 267
@@ -269,7 +269,7 @@ Finds the first tag whose name (item 0) matches the string at `name_ptr/name_len
269 269
270### `nostr.event_get_tag_item_by_name_bin32(event_handle: i32, name_ptr: i32, name_len: i32, item_index: i32) -> i32` 270### `nostr.event_get_tag_item_by_name_bin32(event_handle: i32, name_ptr: i32, name_len: i32, item_index: i32) -> i32`
271 271
272Same as `event_get_tag_item_by_name`, but returns a pointer to a 32-byte buffer of the value if it happened to be a pubkey or an event id; 0 otherwise. 272Same as `event_get_tag_item_by_name`, but returns a pointer to a 32-byte buffer of the value if it happened to be a pubkey or an event id; `0` otherwise.
273 273
274### `nostr.display(event: i32) -> void` 274### `nostr.display(event: i32) -> void`
275 275