Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Event

This class supports event functionality for activating tokenomics in the community.
Do not create it directly; Get it from AinftJs instance.

Hierarchy

Index

Constructors

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

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

  • Adds an activity that matches the event.

    Parameters

    Returns Promise<string>

    Returns activity ID.

  • Creates a new event. Sets the tasks to be performed and the rewards to receive.

    Parameters

    Returns Promise<void>

  • delete(appId: string, eventId: string): Promise<void>
  • Deletes an event.

    Parameters

    • appId: string

      The ID of app.

    • eventId: string

      The ID of event.

    Returns Promise<void>

  • Gets event.

    Parameters

    • appId: string

      The ID of app.

    • eventId: string

      The ID of event.

    Returns Promise<TokenomicsEvent>

    Returns event information.

  • getActivityHistory(appId: string, userId: string, eventId: string): Promise<Activity[]>
  • Returns list of user's activity.

    Parameters

    • appId: string

      The ID of app.

    • userId: string

      The ID of the user who wants to check the activity history.

    • eventId: string

      The ID of the event you want to check activity history.

    Returns Promise<Activity[]>

  • getPendingRewards(appId: string, userId: string, eventId: string): Promise<PendingRewards>
  • Return user's pending reward from event.

    Parameters

    • appId: string

      The ID of app.

    • userId: string

      The ID of the user who wants to check pending rewards.

    • eventId: string

      The ID of event to check pending rewards.

    Returns Promise<PendingRewards>

  • getRewardHistory(appId: string, userId: string, eventId: string): Promise<RewardInfo[]>
  • Returns list of user's reward history.

    Parameters

    • appId: string

      The ID of app.

    • userId: string

      The ID of the user who wants to check reward history.

    • eventId: string

      The ID of event to check reward history.

    Returns Promise<RewardInfo[]>

  • getRewardTypeList(appId: string): Promise<RewardType[]>
  • Returns a list of RewardTypes to use for events.

    Parameters

    • appId: string

      The ID of app.

    Returns Promise<RewardType[]>

  • getTaskTypeList(appId: string): Promise<TaskType[]>
  • Returns a list of TaskTypes to use for events.

    Parameters

    • appId: string

      The ID of app.

    Returns Promise<TaskType[]>

  • reward(appId: string, userId: string, eventId: string, options?: RewardOptions): Promise<{ amount: number }>
  • Provides event rewards to users.

    Parameters

    • appId: string

      The ID of app.

    • userId: string

      The ID of user to be rewarded.

    • eventId: string

      The ID of the event that the user participated in.

    • Optional options: RewardOptions

      The options of reward.

    Returns Promise<{ amount: number }>

  • 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.

  • Updates the activity's status. Activity status includes CREATED, REWARDED, and FAILED.

    Parameters

    Returns Promise<void>

Generated using TypeDoc