This method is deprecated, and will be sunset in upcoming versions of the SDK.
Before implementing this approach, be sure to have whitelisted your domain.
import { ChainvineClient } from '@chainvine/sdk';
const client = new ChainvineClient({
apiKey: '9dj022didj', //your api key
});
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 campaign = {
id: 'aSlug123'
}
const result = await client.referralConversion({
campaign,
wallet_address,
amount,
transaction_hash,
token_address,
usd_value,
external_identifier,
});
import { ChainvineClient } from '@chainvine/sdk';
const client = new ChainvineClient({
apiKey: '9dj022didj', //your api key
});
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 campaign = {
id: 'aSlug123'
}
const result = await client.referralConversion({
campaign,
wallet_address,
amount,
transaction_hash,
token_address,
usd_value,
external_identifier,
});
Payload
Param
Required
Type
Description
wallet_address
required
String
the wallet of the user being referred
chain_prefix
optional
String
a wallet address prefix - provide this if you are passing in a wallet address
amount
required
Number
an amount to pass in
campaign_id
required
String
usd_value
optional
number
The USD Value of the token(s) or value being transferred, please supply this if available
transaction_hash
optional
String
a transaction hash to associate with the conversion
token_address
optional (defaults to Ethereum if not provided)
String
the token address of the token that was transfered
fee
optional
String
the usd value of the fee earned from the transaction
external_identifier
optional
String
An external identifier associated to the wallet_address in your system