Options
All
  • Public
  • Public/Protected
  • All
Menu

This class supports using text-to-art ai.
Do not create it directly; Get it from AinftJs instance.

Hierarchy

Index

Constructors

  • new TextToArt(baseUrl: string, route: null | string, ain: default, ainize?: default): TextToArt

Properties

ain: default

The Ain object for sign and send transaction to AIN blockchain.

ainize?: default

The Ainize object for send request to AIN blockchain.

baseUrl: string = ''

The base url of api server of AINFT Factory.

route: string

The subpath of api server request url.

Methods

  • Posts a request to generate an image.

    Parameters

    • appId: string

      The ID of the app where the text-to-art task will be used.

    • discord: DiscordMessageInfo

      The Discord object that contains the IDs of the user, guild, channel, and message.

    • params: TextToArtParams

      The request parameters used for the text-to-art task.

    Returns Promise<any>

    A promise that resolves with the task id for the task or null.

  • getTextToArtParams(appId: string, taskId: string): Promise<null | TextToArtParams>
  • Gets the request parameters used for a text-to-art task.

    Parameters

    • appId: string

      The ID of the app where the text-to-art task will be used.

    • taskId: string

      The ID of the text-to-art task.

    Returns Promise<null | TextToArtParams>

    • A promise that resolves with the request parameters used for the text-to-art task or null.
  • getTextToArtResults(appId: string, taskId: string): Promise<null | TextToArtResponse>
  • Gets the result of a text-to-art task.

    Parameters

    • appId: string

      The ID of the app where the text-to-art task will be used.

    • taskId: string

      The ID of the text-to-art task.

    Returns Promise<null | TextToArtResponse>

    • A promise that resolves with the text-to-art results or null.
  • getTextToArtTxHash(appId: string, taskId: string): Promise<null | TextToArtTxHash>
  • Gets the transaction hash for a text-to-art task.

    Parameters

    • appId: string

      The ID of the app where the text-to-art task will be used.

    • taskId: string

      The ID of the text-to-art task.

    Returns Promise<null | TextToArtTxHash>

    • A promise that resolves with the transaction hash for the task or null.
  • sendFormRequest(method: POST | PUT, trailingUrl: string, stringFields: {}, fileFields: {}): Promise<any>
  • Sends request that include form to api server of AINFT Factory. Used to upload asset data.

    Parameters

    • method: POST | PUT

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • stringFields: {}

      The string fields of form.

      • [key: string]: string
    • fileFields: {}

      The file fields of form.

      • [key: string]: { buffer: Buffer; filename: string }
        • buffer: Buffer
        • filename: string

    Returns Promise<any>

    Returns response of api request.

  • sendRequest(method: HttpMethod, trailingUrl: string, data?: Record<string, any>): Promise<any>
  • Sends request to api server of AINFT Factory. Authenticate by signing data.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    Returns Promise<any>

    Returns response of api request.

  • sendRequestWithoutSign(method: HttpMethod, trailingUrl: string, data?: Record<string, any>, headers?: AxiosRequestHeaders): Promise<any>
  • Sends request to api server of AINFT Factory. Used when authentication is not required.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    • Optional headers: AxiosRequestHeaders

      The headers of Http api request.

    Returns Promise<any>

    Returns response of api request.

  • setBaseUrl(baseUrl: string): void
  • signData(data: any): string | Promise<string>
  • Sign the data with the private key that the user has registered.

    Parameters

    • data: any

      The data to sign.

    Returns string | Promise<string>

    Returns signature string.

Generated using TypeDoc