Class Dm<ContentTypes>

Type Parameters

  • ContentTypes extends DefaultContentTypes = DefaultContentTypes

Implements

Constructors

Properties

commitLogForkStatus?: CommitLogForkStatus
createdAt: number
version: DM = ...

Methods

  • Clears the disappearing message settings for this group. Will throw if the user does not have the required permissions.

    Returns Promise<void>

    A Promise that resolves when the settings are cleared.

  • Returns the disappearing message settings. To get the latest settings from the network, call sync() first.

    Returns Promise<undefined | DisappearingMessageSettings>

    A Promise that resolves to the disappearing message settings.

  • Returns Promise<GetConversationHmacKeysResponse>

    A Promise that resolves to a list of hmac keys for this conversation that can be used to filter out self push notifications.

  • Returns Promise<ConversationTopic[]>

    A Promise that resolves to a list of conversation topics that can be used to subscribe to push notifications.

  • Returns whether the dm is active. To get the latest active status from the network, call sync() first

    Returns Promise<boolean>

    A Promise that resolves if the group is active or not

  • Checks if disappearing messages are enabled.

    Returns Promise<boolean>

    A Promise that resolves to a boolean indicating whether disappearing messages are enabled.

  • Returns Promise<Member[]>

    A Promise that resolves to an array of Member objects. To get the latest member list from the network, call sync() first.

  • This method returns an array of messages associated with the dm. To get the latest messages from the network, call sync() first.

    Parameters

    • Optional opts: MessagesOptions

    Returns Promise<DecodedMessageUnion<ContentTypes>[]>

    A Promise that resolves to an array of DecodedMessage objects.

  • This method returns an array of messages associated with the dm. To get the latest messages from the network, call sync() first.

    Parameters

    • Optional opts: MessagesOptions

    Returns Promise<DecodedMessageUnion<ContentTypes>[]>

    A Promise that resolves to an array of DecodedMessage objects, each of which will contain any related reactions under the childMessages property.

  • Returns Promise<string>

    A Promise that resolves to null unless the dm is paused because of a minimum libxmtp version for the dm. If the dm is paused, the Promise resolves to the version string of the libxmtp that is required to join the dm.

  • This method return the peer inbox id associated with the dm.

    Returns Promise<string>

    A Promise that resolves to a InboxId.

  • Prepare a dm message to be sent.

    Type Parameters

    Parameters

    • content: ConversationSendPayload<SendContentTypes>

      The content of the message. It can be either a string or a structured MessageContent object.

    • Optional opts: SendOptions

    Returns Promise<MessageId>

    A Promise that resolves to a string identifier for the prepared message to be sent.

    Throws

    Throws an error if there is an issue with sending the message.

  • Publish all prepared messages.

    Returns Promise<any>

    Throws

    Throws an error if there is an issue finding the unpublished message

  • Sends a message to the current dm.

    Type Parameters

    Parameters

    • content: ConversationSendPayload<SendContentTypes>

      The content of the message. It can be either a string or a structured MessageContent object.

    • Optional opts: SendOptions

    Returns Promise<MessageId>

    A Promise that resolves to a string identifier for the sent message.

    Throws

    Throws an error if there is an issue with sending the message.

  • Sets up a real-time message stream for the current dm.

    This method subscribes to incoming messages in real-time and listens for new message events. When a new message is detected, the provided callback function is invoked with the details of the message. Additionally, this method returns a function that can be called to unsubscribe and end the message stream.

    Parameters

    • callback: ((message) => Promise<void>)

      A callback function that will be invoked with the new DecodedMessage when a message is received.

    • Optional onClose: (() => void)

      Optional callback to invoke when the stream is closed.

        • (): void
        • Returns void

    Returns Promise<(() => void)>

    A function that, when called, unsubscribes from the message stream and ends real-time updates.

  • Executes a network request to fetch the latest messages and membership changes associated with the dm and saves them to the local state.

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Updates the disappearing message settings. Will throw if the user does not have the required permissions.

    Parameters

    Returns Promise<void>

    A Promise that resolves when the settings are updated.