transferEvent([payload,])

const campaignId = 'aSlud3293';

const amount = 100; // required, this is the amount of token you want us to convert
const usd_value = 100; //required, 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 chain_id = '1'; // optional
const fee = 20; // optional
const transaction_hash = '0x1234567890'; //optional
const token_address = '0x1234567890'; //optional
const requirement_id = 'abc123def'; //optional

const completion = await userClient.transferEvent({
    requirement_id,
    campaign: {
        id: campaignId
    },
    transaction_hash,
    chain_id,
    network,
    token_address,
    amount,
    usd_value
    external_identifier
    fee,
});

Params

Param
Required
Type
Description

amount

required

number

an amount to associate with the completion

campaign.id

required

string

the id of the program/campaign requirement belongs to

usd_value

optional

string

the value of the amount field in USD

fee

optional

number

an optional fee to pass into the SDK

transaction_hash

optional

string

The hash of the transaction that this completion should be linked to

token_address

optional

string

a token address (token, NFT, smart contract) that should be associated with this completion

external_identifier

optional

string

a user identifier known to your system, if passed in, ChainVine will associate this with the wallet address if none has been associated yet, this value will be returned to you if present

requirement_id

optional

string

The requirement to track the transfer against, this is only required if you have a program with multiple transfer objectives

Response

Field
Type
Description

message

String

Ok status message on success

Examples

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

const userWalletAddress = '0x293kdo0ij0';

const campaignId = 'aSlug123';

// Generate your ChainvineClient instance
const client = new ChainvineClient(); //Make sure to whitelist your domain
const userClient = await client.syncUser(userWalletAddress);

const amount = 100; // required, this is the amount of token you want us to convert
const usd_value = 100; //required, 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 chain_id = '1'; // optional
const fee = 20; // optional
const transaction_hash = '0x1234567890'; //optional
const token_address = '0x1234567890'; //optional
const requirement_id = 'abc123def'; //optional

const completion = await userClient.transferEvent({
    requirement_id,
    campaign: {
        id: campaignId
    },
    transaction_hash,
    chain_id,
    network,
    token_address,
    amount,
    usd_value
    external_identifier
    fee,
});

Last updated