Complete a Requirement

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';

const userWalletAddress = '0x293kdo0ij0';
const campaignId = 'aSlug123';

const client = new ChainvineClient(); //Make sure to whitelist your domain
const requirementId = 'Hiodn2oD2dkmo2';
const userClient = await client.syncUser(userWalletAddress);

const completion = await userClient.completeRequirement({
    campaign: {
        id: campaignId
    },
    id: requirementId
});

Last updated