@aleph-sdk/monorepo
    Preparing search index...

    Class AlephHttpClient

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    aggregateClient: AggregateMessageClient
    forgetClient: ForgetMessageClient
    instanceClient: InstanceMessageClient
    messageClient: BaseMessageClient
    postClient: PostMessageClient
    programClient: ProgramMessageClient
    storeClient: StoreMessageClient

    Methods

    • Downloads a file from the Aleph network.

      Parameters

      • file_hash: string

        The hash of the STORE message of the file to retrieve.

      Returns Promise<ArrayBuffer>

    • Fetches an aggregate value from the Aleph network. Aggregates are a key-value store on the Aleph network. Aggregates are bound by address and each address can have multiple keys. By default, only the address that signs the aggregate can modify it.

      Type Parameters

      • T

      Parameters

      • address: string

        The address of the aggregate's owner

      • key: string

        The key of the aggregate to fetch

      Returns Promise<T>

    • Fetches multiple aggregates from the Aleph network. Aggregates are a key-value store on the Aleph network. Aggregates are bound by address and each address can have multiple keys. By default, only the address that signs the aggregate can modify it.

      Parameters

      • address: string

        The address of the aggregate's owner

      • Optionalkeys: string[]

        The keys of the aggregates to fetch

      Returns Promise<Record<string, any>>

    • Tries to fetch a specific message from the Aleph network. Throws an error if the message is not found or forgotten.

      Type Parameters

      • T extends MessageType | "any" = "any"
      • Content = any

      Parameters

      • itemHash: string

        The hash of the message to fetch.

      Returns Promise<PublishedMessage<MessageTypeMap<Content>[T]>>

    • Fetches the reason why a message has been rejected from the network. If the message has no error, returns null.

      Parameters

      • itemHash: string

        The hash of the message to fetch the error from.

      Returns Promise<null | MessageError>

    • Retrieves raw messages from the Aleph network. Similar to getPosts, but with more options.

      Parameters

      • config: GetMessagesConfiguration

        The configuration used to fetch messages.

      Returns Promise<MessagesQueryResponse>

    • Retrieves messages using cursor-based pagination. More efficient than page-based pagination for large result sets.

      Parameters

      • config: GetMessagesCursorConfiguration

        The configuration used to fetch messages (same filters as getMessages, minus page).

      Returns Promise<CursorMessagesResponse>

    • Returns an async iterator over all messages matching the given filters. Handles cursor-based pagination automatically, yielding individual messages.

      Parameters

      • config: Omit<GetMessagesCursorConfiguration, "cursor">

        The filters used to query messages (same as getMessages, minus page).

      Returns AsyncGenerator<PublishedMessage<MessageContent>>

    • Fetches a POST message on the Aleph network. POST messages are used to store arbitrary JSON data on the Aleph network. They can be queried by type, channel, reference, address, tag, or hash. POSTs can be modified by amend messages. This endpoint returns the latest version of the POST.

      Type Parameters

      • T = any

      Parameters

      • config: PostGetConfiguration

        The configuration used to fetch a post message.

      Returns Promise<PostResponse<T>>

    • Fetches multiple POST messages on the Aleph network. POST messages are used to store arbitrary JSON data on the Aleph network.

      Type Parameters

      • T = any

      Parameters

      • config: PostGetConfiguration

        The configuration used to fetch a post message.

      Returns Promise<PostQueryResponse<T>>

    • Retrieves posts using cursor-based pagination. More efficient than page-based pagination for large result sets.

      Type Parameters

      • T = any

      Parameters

      • config: PostGetCursorConfiguration

        The configuration used to fetch posts (same filters as getPosts, minus page).

      Returns Promise<CursorPostsResponse<T>>

    • Returns an async iterator over all posts matching the given filters. Handles cursor-based pagination automatically, yielding individual posts.

      Type Parameters

      • T = any

      Parameters

      • config: Omit<PostGetCursorConfiguration, "cursor">

        The filters used to query posts (same as getPosts, minus page).

      Returns AsyncGenerator<PostResponse<T>>

    • Watches for new messages on the Aleph network. This method returns a socket that can be used to listen for new messages.

      Parameters

      • config: Omit<GetMessagesConfiguration, "page" | "pagination">

        The filters used to watch for new messages, similar to getMessages.

      Returns Promise<AlephSocket>