Skip to content
53 changes: 52 additions & 1 deletion standards/application/waku-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ An alternative would be to choose a programming language. However, such choice m
### Primitive types and general guidelines

- No `default` means that the value is mandatory, meaning a `default` value implies an optional parameter.
- Primitive types are `string`, `int`, `bool`, `enum` and `uint`
- Primitive types are `string`, `int`, `bool`, `byte`, `enum` and `uint`
- Complex pre-defined types are:
- `object`: object and other nested types.
- `array`: iterable object containing values of all the same type.
Expand Down Expand Up @@ -302,6 +302,57 @@ If the `mode` set is `core`, the initialised `WakuNode` SHOULD use:
`edge` mode SHOULD be used if node functions in resource restricted environment,
whereas `core` SHOULD be used if node has no strong hardware or bandwidth restrictions.

## Send messages

#### Type definitions

```yaml
types:
SendMessage:
type: object
fields:
contentTopic:
type: string
description: "Content-based filtering field as defined in [TOPICS](https://github.com/vacp2p/rfc-index/blob/main/waku/informational/23/topics.md#content-topics)"
payload:
type: array<byte>
description: "The message data to be sent."
ephemeral:
type: bool
default: false
description: "Whether the message is ephemeral. Read at [ATTRIBUTES](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/14/message.md#message-attributes)"
rateLimitProof:
type: array<byte>
default: none
description: "Rate limiting proof needed for [PUBLISHING](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/17/rln-relay.md#publishing)"

RequestId:
type: string
description: "A unique identifier for a request"
```

#### Function definitions

```yaml
functions:
send:
description: "Send a message through the network."
parameters:
- name: message
type: SendMessage
description: "The message to send"
returns:
type: result<RequestId, error>
```

#### Extended definitions

When `message` is sent with `contentTopic` for a first time,
the node SHOULD trigger a subscription based on `Subscribe to messages` section.

Additionally, the node SHOULD initiate recurring [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) queries
to validate if sent message was stored on the network and `static_store_nodes` SHOULD be prioritised.

## The Validation API

[WAKU2-RLN-RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/17/rln-relay.md) is currently the primary message validation mechanism in place.
Expand Down
Loading