Record a Transfer Event

For when you intend to complete a requirement for a user programmatically.

Intended uses

When you are dealing with a requirement that can only be completed by your system, and not ChainVine's, some examples can include, but is not limited to:

  • a user interacts with a chain that ChainVine does not support

  • a user replies to a message on your app

  • a user signs up for an off-chain feature on your app

To better understand how a reward is issued to a user when calling this method, please refer to the completeRequirement method

Before implementing this approach, be sure to have whitelisted your domain.

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

const client = new ChainvineClient();

const wallet_address = '0x1234567890' //<-- supplied by your systems

const transaction_hash = '0x1234567890'; //optional
const token_address = '0x1234567890'; //optional
const amount = 100; // this is the amount of token you want us to convert
const usd_value = 100; //optional, the USD value of the token at the time of the conversion
const external_identifier = 'ABC123'; //optional (e.g. a user ID in your system)
const fee = 390;

const campaign = {
  id: 'aSlug123'
}

const userClient = await client.syncUser(wallet_address);

const res = await userClient.transferEvent({
    campaign,
    transaction_hash,
    token_address,
    amount,
    usd_value,
    external_identifier,
    fee,
});

Last updated