ChainVine API Docs
  • Chainvine
    • Product and Features
    • Technical Overview
  • ⚙️Developers
    • 🔨Use Cases
      • Leverage cookies
      • Link Claimer/Referrer
      • Record Link Click
      • Generate a Referrer Link
      • Record a Transfer Event
      • Complete a Requirement
    • 🖼️Embedded Widget
      • Implementation
      • FAQ
    • 🧰SDK
      • Implementation
      • Configuring the Client
      • Classes and Functions
        • Utility Methods
        • ChainvineClient
          • getReferralUrl(walletAddress)
          • recordClick(referrer)
          • linkReferrer([payload,])
          • referralConversion([payload,])
          • syncUser(walletAddress)
          • getCampaignReferralStats([payload,])
        • ChainvineUser
          • Initializing the client
          • joinCampaign([campaignParams,])
          • getRequirement([payload,])
          • getUserStats([payload,])
          • verifyRequirement([payload,])
          • completeRequirement([payload,])
          • claimEligibleEarnings([payload,])
          • transferEvent([payload,])
          • referral([campaignParams,])
            • linkToReferrer(referrer)
            • url()
          • setRewardTiersOverride([payload,])
        • Errors
        • Authentication
          • Getting your API Key
          • Allow-listing a domain
      • FAQ
    • 🪝Webhooks
    • 📔Open API Specification
  • Rewards
    • Claiming For Users
      • On ChainVine
Powered by GitBook
On this page
  • Params
  • Response
  • Examples
  1. Developers
  2. SDK
  3. Classes and Functions
  4. ChainvineUser

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

Param
Required
Type
Description

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

Field
Type
Description

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
    },
});
import { ChainvineClient } from '@chainvine/sdk';

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

// Generate your ChainvineClient instance
const client = new ChainvineClient({
    apiKey: '0dj03j000d'  // Your API Key
});

const userClient = await client.syncUser(userWalletAddress);

const stats = await userClient.getUserStats({
    campaign: {
        id: campaignId
    },
});
PreviousgetRequirement([payload,])NextverifyRequirement([payload,])

Last updated 1 year ago

⚙️
🧰