Skip to content

Commit cfe7cdd

Browse files
committed
Some typos, improvements
1 parent 11bc90a commit cfe7cdd

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

standards/application/waku-api.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ contributors:
2929
* [Function definitions](#function-definitions)
3030
* [Predefined values](#predefined-values)
3131
* [Extended definitions](#extended-definitions)
32+
* [Send messages](#send-messages)
33+
* [Type definitions](#type-definitions-1)
34+
* [Function definitions](#function-definitions-1)
35+
* [Extended definitions](#extended-definitions-1)
36+
* [Event source](#event-source)
37+
* [Type definitions](#type-definitions-2)
3238
* [The Validation API](#the-validation-api)
3339
* [Security/Privacy Considerations](#securityprivacy-considerations)
3440
* [Copyright](#copyright)
@@ -39,10 +45,10 @@ contributors:
3945
This document specifies an Application Programming Interface (API) that is RECOMMENDED for developers of the [WAKU2](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/10/waku2.md) clients to implement,
4046
and for consumers to use as a single entry point to its functionalities.
4147

42-
This API defines the RECOMMENDED interface for leveraging Waku protocols to send and receive messages.
48+
This API defines the RECOMMENDED interface for leveraging Waku protocols to send and receive messages.
4349
Application developers SHOULD use it to access capabilities for peer discovery, message routing, and peer-to-peer reliability.
4450

45-
TODO: This spec must be further extended to include connection health inspection, message sending, subscription and store hash queries.
51+
TODO: This spec must be further extended to include connection health inspection, subscription, and store hash queries.
4652

4753
## Motivation
4854

@@ -72,9 +78,10 @@ An alternative would be to choose a programming language. However, such choice m
7278
- Primitive types are `string`, `int`, `bool`, `byte`, `enum` and `uint`
7379
- Complex pre-defined types are:
7480
- `object`: object and other nested types.
75-
- `array`: iterable object containing values of all the same type.
81+
- `array`: iterable object containing values of all the same type. Syntax: `array<T>` where `T` is the element type (e.g., `array<string>`, `array<byte>`).
7682
- `result`: an enum type that either contains a value or void (success), or an error (failure); The error is left to the implementor.
7783
- `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language.
84+
- `event_emitter`: an object that emits events with specific event names and associated event data types.
7885
- Usage of `result` is RECOMMENDED, usage of exceptions is NOT RECOMMENDED, no matter the language.
7986

8087
TODO: Review whether to specify categories of errors.
@@ -90,11 +97,13 @@ language_mappings:
9097
- functions: "camelCase"
9198
- variables: "camelCase"
9299
- types: "PascalCase"
100+
event_emitter: "Use EventEmitter object with `emit`, `addListener`, etc; with event name the string specified in IDL. For example. eventEmitter.emit('message:sent',...)"
93101
nim:
94102
naming_convention:
95103
- functions: "camelCase"
96104
- variables: "camelCase"
97105
- types: "PascalCase"
106+
event_emitter: TBD
98107
```
99108
100109
### Application
@@ -118,6 +127,10 @@ types:
118127
WakuNode:
119128
type: object
120129
description: "A Waku node instance."
130+
fields:
131+
message_events:
132+
type: MessageEvents
133+
description: "Message related events."
121134
122135
NodeConfig:
123136
type: object
@@ -151,6 +164,7 @@ types:
151164
description: "The passed nodes are prioritised for store queries."
152165
cluster_id:
153166
type: uint
167+
description: "The cluster ID for the Waku network. Cluster IDs are defined in [RELAY-SHARDING](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/51/relay-sharding.md) and allocated in [RELAY-STATIC-SHARD-ALLOC](https://github.com/waku-org/specs/blob/master/informational/relay-static-shard-alloc.md)."
154168
auto_sharding_config:
155169
type: AutoShardingConfig
156170
default: DefaultAutoShardingConfig
@@ -201,10 +215,10 @@ types:
201215
fields:
202216
contract_address:
203217
type: string
204-
description: "The address of the RLN contract exposes `root` and `getMerkleRoot` ABIs"
218+
description: "The address of the RLN contract that exposes `root` and `getMerkleRoot` ABIs"
205219
chain_id:
206220
type: uint
207-
description: "The chain id on which the RLN contract is deployed"
221+
description: "The chain ID on which the RLN contract is deployed"
208222
epoch_size_sec:
209223
type: uint
210224
description: "The epoch size to use for RLN, in seconds"
@@ -224,15 +238,6 @@ functions:
224238
type: result<WakuNode, error>
225239
```
226240
227-
#### Property definitions
228-
229-
```yaml
230-
properties:
231-
events:
232-
type: EventEmitter
233-
description: "Event source for message-related events"
234-
```
235-
236241
#### Predefined values
237242
238243
```yaml
@@ -253,6 +258,7 @@ values:
253258
static_store_nodes: []
254259
cluster_id: 1
255260
auto_sharding_config:
261+
type: AutoShardingConfig
256262
fields:
257263
num_shards_in_cluster: 8
258264
message_validation: TheWakuNetworkMessageValidation
@@ -262,6 +268,7 @@ values:
262268
fields:
263269
max_message_size: "150 KiB"
264270
rln_config:
271+
type: RlnConfig
265272
fields:
266273
contract_address: "0xB9cd878C90E49F797B4431fBF4fb333108CB90e6"
267274
chain_id: 59141
@@ -300,7 +307,6 @@ If the `mode` set is `core`, the initialised `WakuNode` SHOULD use:
300307
- [RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/11/relay.md)
301308
- [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as service node
302309
- [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) as service node
303-
- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) as service node
304310
- [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client
305311
- [METADATA](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/66/metadata.md) as client and service node
306312
- [P2P-RELIABILITY](/standards/application/p2p-reliability.md)
@@ -390,7 +396,7 @@ types:
390396
391397
MessagePropagatedEvent:
392398
type: object
393-
description: "Confirmation that a message has been correctly delivered to the network"
399+
description: "Confirmation that a message has been correctly delivered to some neighbouring nodes."
394400
fields:
395401
request_id:
396402
type: RequestId
@@ -399,7 +405,7 @@ types:
399405
type: string
400406
description: "Hash of the message that got propagated within the network"
401407
402-
EventEventEmitter:
408+
MessageEvents:
403409
type: event_emitter
404410
description: "Event source for message-related events"
405411
events:

0 commit comments

Comments
 (0)