Skip to main content

Conversations

Class: Conversations

Conversations allows you to view ongoing 1:1 messaging sessions with another wallet

Constructors​

constructor​

new Conversations(client)

Parameters​

NameType
clientClient

Defined in​

conversations/Conversations.ts:21

Properties​

client​

Private client: Client

Defined in​

conversations/Conversations.ts:20

Methods​

getIntroductionPeers​

Private getIntroductionPeers(): Promise<Map<string, Date>>

Returns​

Promise<Map<string, Date>>

Defined in​

conversations/Conversations.ts:233


getPeerAddress​

Private getPeerAddress(message): string

Parameters​

NameType
messageMessageV1

Returns​

string

Defined in​

conversations/Conversations.ts:365


list​

list(): Promise<Conversation[]>

List all conversations with the current wallet found in the network, deduped by peer address

Returns​

Promise<Conversation[]>

Defined in​

conversations/Conversations.ts:28


newConversation​

newConversation(peerAddress, context?): Promise<Conversation>

Creates a new conversation for the given address. Will throw an error if the peer is not found in the XMTP network

Parameters​

NameType
peerAddressstring
context?InvitationContext

Returns​

Promise<Conversation>

Defined in​

conversations/Conversations.ts:270


sendInvitation​

Private sendInvitation(recipient, invitation, created): Promise<SealedInvitation>

Parameters​

NameType
recipientSignedPublicKeyBundle
invitationInvitationV1
createdDate

Returns​

Promise<SealedInvitation>

Defined in​

conversations/Conversations.ts:335


stream​

stream(): Promise<Stream<Conversation>>

Returns a stream of any newly created conversations. Will dedupe to not return the same conversation twice in the same stream. Does not dedupe any other previously seen conversations

Returns​

Promise<Stream<Conversation>>

Defined in​

conversations/Conversations.ts:59


streamAllMessages​

streamAllMessages(): Promise<AsyncGenerator<DecodedMessage, any, unknown>>

Streams messages from all conversations.

When a new conversation is initiated with the client's address, this function will automatically register it and add it to the list of conversations to watch. Callers should be aware the first messages in a newly created conversation are picked up on a best effort basis and there are other potential race conditions which may cause some newly created conversations to be missed.

Returns​

Promise<AsyncGenerator<DecodedMessage, any, unknown>>

Defined in​

conversations/Conversations.ts:110