url()

Generate the referral url for the user in a given campaign or program via ChainVine.

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

const config = {
   apiKey: 'S3CR37C0D3Z',
   testMode: true,
   logToConsole: true,
}

const userWalletAddress = '0x393849393430'

const client = new ChainvineClient(config);
const userClient = await client.syncUser(userWalletAddress);

const campaign = {
   id: 'siojdp2no'
}

const referralUrlResponse = await userClient.referral({ campaign }).url();
console.log(referralUrlResponse.url); //<-- https://app.chainvine.xyz/community/siojdp2no?r=ABC123

Params

ParamRequiredTypeDescription

campaign.id

required

string

the id of the program/campaign requirement belongs to

Response

ReferralUrlResponse

FieldTypeDescription

url

String

the referral URL for the given wallet address

wallet_address

String

the wallet address linked to the referral URL

Examples

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

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

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

const userClient = await client.syncUser(userWalletAddress);
const referralUrlResponse = await userClient.referral({ campaign }).url();

Last updated