Interface Conversation<ContentTypes>

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

interface Conversation<ContentTypes> {
    clientAddress: string;
    consentProof?: ConsentProofPayload;
    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

Properties

clientAddress: string

The wallet address connected to the client

consentProof?: ConsentProofPayload

Proof of consent for the conversation, used when a user has pre-consented to a conversation

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

Methods