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
  1. Developers
  2. Use Cases

Generate a Referrer Link

If you would like to bypass ChainVine and supply referrers with a referral URL directly on your webpage, you can generate a referral URL for a given wallet address using the "url" endpoint.

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

const userWalletAddress = '0x293kdo0ij0';

const campaign = {
   id: 'aSlug123'
}

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

const userClient = await client.syncUser(userWalletAddress);
const userReferral = userClientReferrals.referral({campaign})

const res = await userReferral.url();

console.log(res.url); // > https://yourdomain.xyz/refer?r=99dj2ikmdo2
import { ChainvineClient } from '@chainvine/sdk';

const userWalletAddress = '0x293kdo0ij0';

const campaign = {
   id: 'aSlug123'
}

const client = new ChainvineClient({
    apiKey: '9dj022didj', //your api key
});

const userClient = await client.syncUser(userWalletAddress);

const userReferral = userClientReferrals.referral({campaign})

const res = await userReferral.url();

console.log(res.url); // > https://yourdomain.xyz/refer?r=99dj2ikmdo2
PreviousRecord Link ClickNextRecord a Transfer Event

Last updated 1 year ago

⚙️
🔨