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

Last updated