For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

Last updated