req_add_tag takes a single integer for the tag name + other @theawiteb fixes.

This commit is contained in:
fiatjaf
2026-04-02 18:07:58 -03:00
parent 5b5f9feb01
commit 6f235c0387
+8 -8
View File
@@ -52,7 +52,7 @@ The WASM module must export a function named `run` with a single pointer paramet
### `on_event(sub_handle: i32, event_handle: i32, eosed: i32)`
If 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.
If 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.
### `on_eose(sub_handle: i32)`
@@ -168,11 +168,11 @@ Same as `req_add_id` but with a hex-encoded id string. Length is assumed to be 6
Add a kind integer to the `kinds` filter.
### `nostr.req_add_tag(req: i32, tag_ptr: i32, tag_len: i32, value_ptr: i32, value_len: i32) -> void`
### `nostr.req_add_tag(req: i32, tag: i32, value_ptr: i32, value_len: i32) -> void`
Add 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.
Add 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.
### `nostr.req_add_tag_bin32(req: i32, tag_ptr: i32, tag_len: i32, value_ptr: i32) -> void`
### `nostr.req_add_tag_bin32(req: i32, tag: i32, value_ptr: i32) -> void`
Same 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.
@@ -253,15 +253,15 @@ Returns the total number of tags on this event.
### `nostr.event_get_tag_item_count(event_handle: i32, tag_index: i32) -> i32`
Returns the number of items in the tag at `tag_index`.
Returns the number of items in the tag at `tag_index`; or `0` if such tag doesn't exist.
### `nostr.event_get_tag_item(event_handle: i32, tag_index: i32, item_index: i32) -> i32`
Returns a pointer to a buffer containing the item at `(tag_index, item_index)` (follows the String Convention above).
Returns 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.
### `nostr.event_get_tag_item_bin32(event_handle: i32, tag_index: i32, item_index: i32) -> i32`
Same 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.
Same 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.
### `nostr.event_get_tag_item_by_name(event_handle: i32, name_ptr: i32, name_len: i32, item_index: i32) -> i32`
@@ -269,7 +269,7 @@ Finds the first tag whose name (item 0) matches the string at `name_ptr/name_len
### `nostr.event_get_tag_item_by_name_bin32(event_handle: i32, name_ptr: i32, name_len: i32, item_index: i32) -> i32`
Same 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.
Same 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.
### `nostr.display(event: i32) -> void`