
SDK
Use SDK to integrate ⚡️claimr into your web application, customize its behavior, and create a more engaging and rewarding user experience.
SDK (Software Development Kit) is a powerful tool that integrates claimr's functionalities into your web application. It provides a set of methods and events that enable you to interact with the claimr widget, customize its behavior, and enhance the user experience.
Methods
complete_task(task_id)
complete_task(task_id)This method allows you to mark a task as complete directly from your web application's front-end. This is useful for tasks that are completed outside of the claimr widget, such as watching a video or visiting a specific page on your website.
The
task_idparameter should be the unique identifier of the task you want to complete, which can be found in your claimr admin panel.
connect_wallet(address, signature, message)
connect_wallet(address, signature, message)This method enables users to sign in to your claimr campaign using their web3 wallet credentials.
The
addressparameter should be the user's wallet address.The
signatureparameter should be the cryptographic signature generated by the user's wallet.The
messageparameter should be the message that was signed by the user's wallet.
destroy()
destroy()This method removes the claimr widget instance from your web page.
get_user_info(campaign_id, public_key, account, platform)
get_user_info(campaign_id, public_key, account, platform)This method retrieves information about a specific user from your claimr campaign using the public API.
The
campaign_idparameter should be the unique identifier of your campaign.The
public_keyparameter should be the public key generated in your campaign's general settings.The
accountparameter should be the user's account identifier. For web3 wallet addresses, use the address in lowercase.The
platformparameter should be the platform identifier. For web3 wallets, use "web3".
login()
login()This method triggers the login dialog within the claimr widget, allowing users to sign in to their claimr account.
logout()
logout()This method logs the user out of their claimr account within the widget.
open_quest(quest_id)
open_quest(quest_id)This method opens a specific quest within the claimr widget.
The
quest_idparameter should be the unique identifier of the quest you want to open, which can be found in your claimr admin panel.
set_theme(theme)
set_theme(theme)This method allows you to set the theme of the claimr widget if supported by your CSS.
The
themeparameter should be a string representing the desired theme.
set_user_token(token)
set_user_token(token)This method sets the user token generated by the claimr API. This token is used to associate a user's actions within the claimr widget with their account on your platform.
The
tokenparameter should be the user token generated by the API. Refer to the claimr API documentation for details on generating user tokens.
Events
on_contest_open
on_contest_openThis event is fired when a user opens any quest within the claimr widget.
on_custom_login
on_custom_loginThis event is fired when a user logs in using the "custom" sign-in option.
on_logout
on_logoutThis event is fired when a user logs out of their claimr account within the widget.
Parameters
user
userThis parameter contains information about the currently logged-in user, such as their user ID, name, and email address.
Last updated
Was this helpful?