Class Client<ContentTypes>

Type Parameters

  • ContentTypes extends DefaultContentTypes = DefaultContentTypes

Constructors

Properties

address: string
codecRegistry: {
    [key: string]: ContentCodec<unknown>;
}

Type declaration

conversations: default<ContentTypes>
dbPath: string
inboxId: string
installationId: InstallationId
preferences: default

Methods

  • Add this account to the current inboxId.

    Parameters

    • newAccount: Signer | {}

      The signer of the new account to be added.

    Returns Promise<void>

  • Determines whether the current user can send messages to the specified peers.

    This method checks if the specified peers are using clients that are on the network.

    Parameters

    • addresses: string[]

      The addresses of the peers to check for messaging eligibility.

    Returns Promise<{
        [key: Address]: boolean;
    }>

    A Promise resolving to a hash of addresses and booleans if they can message on the network.

  • Decrypts an encrypted local attachment.

    This asynchronous method takes an encrypted local attachment and decrypts it.

    Parameters

    Returns Promise<DecryptedLocalAttachment>

    A Promise that resolves to the decrypted local attachment.

    Throws

    Throws an error if the attachment is not a local file URI (must start with "file://").

  • Deletes the local database. This cannot be undone and these stored messages will not be refetched from the network.

    Returns Promise<any>

  • Drop the local database connection. This function is delicate and should be used with caution. App will error if database not properly reconnected. See: reconnectLocalDatabase()

    Returns Promise<any>

  • Encrypts a local attachment for secure transmission.

    This asynchronous method takes a file, checks if it's a local file URI, and encrypts the attachment for secure transmission.

    Parameters

    Returns Promise<EncryptedLocalAttachment>

    A Promise that resolves to the encrypted local attachment.

    Throws

    Throws an error if the attachment is not a local file URI (must start with "file://").

  • Find the Address associated with this address

    Parameters

    • peerAddress: string

      The address of the peer to check for inboxId.

    Returns Promise<undefined | string>

    A Promise resolving to the InboxId.

  • Make a request for your inbox state.

    Parameters

    • refreshFromNetwork: boolean

      If you want to refresh the current state of in the inbox from the network or not.

    Returns Promise<InboxState>

    A Promise resolving to a InboxState.

  • Make a request for a list of inbox states.

    Parameters

    • refreshFromNetwork: boolean

      If you want to refresh the current state the inbox from the network or not.

    • inboxIds: string[]

      The inboxIds to get the associate inbox states for.

    Returns Promise<InboxState[]>

    A Promise resolving to a list of InboxState.

  • Reconnects the local database after being dropped.

    Returns Promise<any>

  • Remove this account from the current inboxId.

    Parameters

    • wallet: Signer | {}

      The signer object used for authenticate the removal.

    • addressToRemove: string

      The address of the wallet you'd like to remove from the account.

    Returns Promise<void>

  • Make a request for a message history sync.

    Returns Promise<any>

  • Revoke all other installations but the current one.

    Parameters

    Returns Promise<void>

  • Sign this message with the current installation key.

    Parameters

    • message: string

      The message to sign.

    Returns Promise<Uint8Array>

    A Promise resolving to the signature bytes.

  • Verify the signature was signed with this clients installation key.

    Parameters

    • message: string

      The message that was signed.

    • signature: Uint8Array

      The signature.

    Returns Promise<boolean>

    A Promise resolving to a boolean if the signature verified or not.

  • Builds a instance of the Client class using the provided address and chainId if SCW.

    Type Parameters

    • ContentCodecs extends DefaultContentTypes = DefaultContentTypes

    Parameters

    • address: string

      The address of the account to build

    • options: ClientOptions & {
          codecs?: ContentCodecs;
      }
    • Optional inboxId: string

    Returns Promise<Client<ContentCodecs>>

    A Promise that resolves to a new Client instance.

    See XMTP Docs for more information.

  • Determines whether the current user can send messages to the specified peers.

    This method checks if the specified peers are using clients that are on the network.

    Parameters

    • env: XMTPEnvironment

      Environment to see if the address is on the network for

    • addresses: string[]

      The addresses of the peers to check for messaging eligibility.

    Returns Promise<{
        [key: Address]: boolean;
    }>

    A Promise resolving to a hash of addresses and booleans if they can message on the network.

  • Creates a new instance of the XMTP Client with a randomly generated address.

    Type Parameters

    • ContentTypes extends DefaultContentTypes

    Parameters

    Returns Promise<Client<ContentTypes>>

    A Promise that resolves to a new Client instance with a random address.

  • Drop the client from memory. Use when you want to remove the client from memory and are done with it.

    Parameters

    • installationId: InstallationId

    Returns Promise<any>

  • Static method to determine the inboxId for the address.

    Parameters

    Returns Promise<string>

Generated using TypeDoc