Interface Conversation<ContentTypes>

Conversation represents either a V1 or V2 conversation with a common set of methods.

interface Conversation<ContentTypes> {
    clientAddress: string;
    consentState: ConsentState;
    context?: InvitationContext;
    conversationVersion: "v1" | "v2";
    createdAt: Date;
    ephemeralTopic: string;
    isAllowed: boolean;
    isDenied: boolean;
    peerAddress: string;
    topic: string;
    allow(): Promise<void>;
    decodeMessage(env): Promise<DecodedMessage<ContentTypes>>;
    deny(): Promise<void>;
    messages(opts?): Promise<DecodedMessage<ContentTypes>[]>;
    messagesPaginated(opts?): AsyncGenerator<DecodedMessage<ContentTypes>[], any, unknown>;
    prepareMessage(content, options?): Promise<PreparedMessage>;
    send(content, options?): Promise<DecodedMessage<ContentTypes>>;
    streamEphemeral(): Promise<Stream<DecodedMessage<ContentTypes>, ContentTypes>>;
    streamMessages(): Promise<Stream<DecodedMessage<ContentTypes>, ContentTypes>>;

Type Parameters

  • ContentTypes = any

Implemented by


clientAddress: string

The wallet address connected to the client

consentState: ConsentState

Returns the consent state of the conversation peer address

Optional field containing the conversationId and metadata for V2 conversations. Will always be undefined on V1 conversations

conversationVersion: "v1" | "v2"
createdAt: Date

Timestamp the conversation was created at

ephemeralTopic: string

A unique identifier for ephemeral envelopes for a conversation.

isAllowed: boolean

Returns true if conversation peer address is on the allow list

isDenied: boolean

Returns true if conversation peer address is on the deny list

peerAddress: string

The wallet address of the other party in the conversation

topic: string

A unique identifier for a conversation. Each conversation is stored on the network on one topic


  • Return a PreparedMessage that has contains the message ID of the message that will be sent.


    Returns Promise<PreparedMessage>

Generated using TypeDoc