Options
All
  • Public
  • Public/Protected
  • All
Menu

This class supports add activities.
Do not create it directly; Get it from AinftJs instance.

Hierarchy

Index

Constructors

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

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

  • Add activity.

    Parameters

    • appId: string

      The ID of app.

    • userId: string

      The ID of user.

    • data: any

      Data related to the activity.

    • activityType: TaskTypeCategory | NftActivityType

      The type of activity.

    • Optional nftInfo: ActivityNftInfo

      Information about the NFTs used in the activity.

    Returns Promise<any>

  • addNftRecord(appId: string, userId: string, nftInfo: ActivityNftInfo, label: string, data: any): Promise<any>
  • Adds a record accomplished with an NFT.

    Parameters

    • appId: string

      The ID of app.

    • userId: string

      The ID of user.

    • nftInfo: ActivityNftInfo

      Information about the NFTs used in the activity.

    • label: string

      The label of record.

    • data: any

      Data related to the activity.

    Returns Promise<any>

  • Gets transaction body to add ai history with NFT. Sending the transaction must be done manually.

    Parameters

    Returns Promise<any>

    Returns transaction body without signature.

  • 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