For when you intend to complete a requirement for a user programmatically.
Intended uses
When you are dealing with a requirement that can only be completed by your system, and not ChainVine's, some examples can include, but are not limited to:
a user interacts with a chain that ChainVine does not support
a user replies to a message on your app
a user signs up for an off-chain feature on your app
Before implementing this approach, be sure to have whitelisted your domain.
import { ChainvineClient } from'@chainvine/sdk';constuserWalletAddress='0x293kdo0ij0';constcampaignId='aSlug123';constclient=newChainvineClient(); //Make sure to whitelist your domainconstrequirementId='Hiodn2oD2dkmo2';constuserClient=awaitclient.syncUser(userWalletAddress);constcompletion=awaituserClient.completeRequirement({ campaign: { id: campaignId }, id: requirementId});
Before implementing this approach, be sure to have gotten a copy of your API Key.
import { ChainvineClient } from'@chainvine/sdk';constuserWalletAddress='0x293kdo0ij0';constcampaignId='02jd020jkd-302jdi2d-02ij0dj';// Generate your ChainvineClient instanceconstclient=newChainvineClient({ apiKey:'0dj03j000d'// Your API Key});constrequirementId='Hiodn2oD2dkmo2';constuserClient=awaitclient.syncUser(userWalletAddress);constcompletion=awaituserClient.completeRequirement({ campaign: { id: campaignId }, id: requirementId});