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
  • How this method claims earnings for your user
  • Examples
  1. Developers
  2. SDK
  3. Classes and Functions
  4. ChainvineUser

claimEligibleEarnings([payload,])

Claim eligible cryptocurrency earnings for a user of your campaign

This method allows you request a user's earnings to be paid out from your Gnosis Safe.

Note - this endpoint is asynchronous of the actual payouts from your Gnosis Safe, which occur on-chain. ChainVine handles reconciling earnings owed with those that are transferred successfully on-chain via this SDK method.

const campaignId = 'aSlug123';

const campaign = {
  id: campaignId
}

const claim = await userClient.claimEligibleEarnings({campaign});

Params

Param
Required
Type
Description

campaign.id

required

string

Response

Field
Type
Description

message

String

Ok status message on success

How this method claims earnings for your user

  • All unpaid earnings are flagged for pay-out

  • Pay-outs are reflected on ChainVine asynchronously of the request

  • Earnings that are paid out successfully on chain are marked as paid out ChainVine side

  • Earnings that fail on-chain are not marked as failed on ChainVine and can be re-attempted

  • Earnings that are being paid out will not be retried while on-chain transfer confirmation is pending

Examples

In this approach, we claim a user's earnings on their behalf.

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

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

// Generate your ChainvineClient instance
const client = new ChainvineClient(); //Make sure to whitelist your domain

const userClient = await client.syncUser(userWalletAddress);

const campaign = {
  id: campaignId
}

const claim = await userClient.claimEligibleEarnings({campaign});

In this approach, we claim a user's earnings on their behalf. Since we are in a server-side environment, we pass in the API Key to the ChainvineClient instance.

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 campaign = {
  id: campaignId
}

const claim = await userClient.claimEligibleEarnings({campaign});
PreviouscompleteRequirement([payload,])NexttransferEvent([payload,])

Last updated 1 year ago

the requirement belongs to Note: this campaign/program must belong to your account

⚙️
🧰
id of the program/campaign