Event Provider
Event Provider Callback
DappPortalSDK.getEventProvider()
Event Provider Callback for Unifi Apps Mission Completion
- The purpose of this callback method is to verify mission completion on Unifi side and automatically display a success banner when verification is successful.
const eventProvider = DappPortalSDK.getEventProvider(); // When the mission is completed const eventId: string = "eventId"; // Unique event ID provided by Unifi const subMissionIndex: string = "1"; // Sub-mission index, starting from 0 await eventProvider.callback(eventId, subMissionIndex); // If verification is successful, a banner will be displayed automatically.
Parameters
| Parameter | Type | Description |
|---|---|---|
| eventId | string | The unique identifier provided by Unifi |
| subMissionIndex | string | The index of the sub-mission provided by Unifi. Indexing starts from 0. For example:
|
Responses
- N/A
If verification is successful, a banner will be displayed.
Unifi Apps Server REST API Implementation
Unifi Apps Server REST API Implementation Guide
To enable mission completion on the Unifi charts, the Unifi Apps server must provide an API endpoint that allows the Unifi to verify whether a mission has been completed.
-
Information Required
- API URL (required)
- Custom Header (optional)
- API URL (required)
-
API Overview
- Method:
GET - Scheme:
https - Read Timeout:
1s- If the Unifi server does not receive a response within 1 second, the mission will be treated as failed.
- Method:
-
Custom Header (optional)
- You may include a custom header when the API is called.
- There are no restrictions on header key/value format.
- Only one custom header can be used, and it is optional.
- ex) x-dapp-custom-key: gq8g0Ah1MD98
- You may include a custom header when the API is called.
-
URL Format
- Base URL: Unifi Apps server URL
- The
$identifieras query parameter must be included. $identifieris a placeholder that will be replaced by the user’s wallet address (in lowercase) by the Unifi server.ex) https://example.dapp.io/api/mission/1111?param=zzzz&identifier=$identifier
-
Response Body
- Content Type: JSON
- If the Unifi server receives a successful response, the user is considered to have completed the mission.
-
Mission Complete
HTTP/1.1 200 OK{"result": true} -
Mission Fail
HTTP/1.1 200 OK{"result": false}
-