Options
All
  • Public
  • Public/Protected
  • All
Menu

Client class initiates connection to the XMTP network. Should be created with await Client.create(options)

Hierarchy

  • Client

Index

Constructors

Properties

address: string
apiClient: default
contacts: Set<string>
keystore: Keystore
publicKeyBundle: PublicKeyBundle

Accessors

  • get backupType(): BackupType

Methods

  • canMessage(peerAddress: string): Promise<boolean>
  • canMessage(peerAddress: string[]): Promise<boolean[]>
  • Check if @peerAddress can be messaged, specifically it checks that a PublicKeyBundle can be found for the given address

    Parameters

    • peerAddress: string

    Returns Promise<boolean>

  • Check if @peerAddress can be messaged, specifically it checks that a PublicKeyBundle can be found for the given address

    Parameters

    • peerAddress: string[]

    Returns Promise<boolean[]>

  • close(): Promise<void>
  • encodeContent(content: any, options?: SendOptions): Promise<Uint8Array>
  • Convert arbitrary content into a serialized EncodedContent instance with the given options

    Parameters

    Returns Promise<Uint8Array>

  • forgetContact(peerAddress: string): void
  • Used to force getUserContact fetch contact from the network.

    Parameters

    • peerAddress: string

    Returns void

  • Returns the cached PublicKeyBundle if one is known for the given address or fetches one from the network

    This throws if either the address is invalid or the contact is not published. See also [#canMessage].

    Parameters

    • peerAddress: string

    Returns Promise<undefined | PublicKeyBundle | SignedPublicKeyBundle>

  • listEnvelopes<Out>(topic: string, mapper: EnvelopeMapper<Out>, opts?: ListMessagesOptions): Promise<Out[]>
  • List stored messages from the specified topic.

    A specified mapper function will be applied to each envelope. If the mapper function throws an error during processing, the envelope will be discarded.

    Type parameters

    • Out

    Parameters

    Returns Promise<Out[]>

  • listEnvelopesPaginated<Out>(contentTopic: string, mapper: EnvelopeMapper<Out>, opts?: ListMessagesPaginatedOptions): AsyncGenerator<Out[], any, unknown>
  • List messages on a given set of content topics, yielding one page at a time

    Type parameters

    • Out

    Parameters

    Returns AsyncGenerator<Out[], any, unknown>

  • publishEnvelopes(envelopes: PublishParams[]): Promise<void>
  • Low level method for publishing envelopes to the XMTP network with no pre-processing or encryption applied.

    Primarily used internally

    Parameters

    • envelopes: PublishParams[]

      PublishParams[]

    Returns Promise<void>

  • publishUserContact(legacy?: boolean): Promise<void>
  • Parameters

    • legacy: boolean = false

    Returns Promise<void>

  • Register a codec to be automatically used for encoding/decoding messages of the given Content Type

    Parameters

    Returns void

  • canMessage(peerAddress: string, opts?: Partial<NetworkOptions>): Promise<boolean>
  • canMessage(peerAddress: string[], opts?: Partial<NetworkOptions>): Promise<boolean[]>
  • Export the XMTP PrivateKeyBundle from the SDK as a Uint8Array.

    This bundle can then be provided as privateKeyOverride in a subsequent call to Client.create(...)

    Be very careful with these keys, as they can be used to impersonate a user on the XMTP network and read the user's messages.

    Parameters

    Returns Promise<Uint8Array>

Generated using TypeDoc