getUserStats([payload,])

Fetches the completion status of a program requirement for the user

const campaignId = 'aSlug123';

const stats = await userClient.getUserStats(
   {
      campaign: {
         id: campaignId
      }
   }
)

Params

ParamRequiredTypeDescription

campaign.id

required

String

the id of the program/campaign the requirement belongs to.

Note: this campaign/program must belong to your account.

Response

UserStatsResponse

FieldTypeDescription

links_clicked.total

number

Total links clicked for the user and campaign

rewards_earnings.unclaimed_earnings_sum

string

Total unclaimed earnings amount formatted to two decimal points.

rewards_earnings.display_amount

string

Total unclaimed earnings amount formatted to two decimal points with the currency

Examples

import { ChainvineClient } from '@chainvine/sdk';

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

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

const stats = await userClient.getUserStats({
    campaign: {
        id: campaignId
    },
});

Last updated