Using the xtoearn-near-sdk-js in your app
xtoearn-near-sdk-js reference
Last updated
xtoearn-near-sdk-js reference
Last updated
Before integrating with the SDK, you need to setup and create a Rewards Program on https://xtoearn.tech. Please visit to learn how to do this
Install dotenv npm package
Create a .env and copy contents from .env.example
Set METHOD_NAME to process_events
Set ACCOUNT_ID to your Account ID which you connected to the app
Set CONTRACT_ID to your Contract Name as shown on the xtoearn app
To send Rewards for a single Rewards Program:
Generate and download the Private Key of the Rewards Program
Store the private key in your .env
as PRIVATE_KEY
To pay out the rewards call the give_rewards
function with the necessary inputs
To send rewards for multiple Rewards Programs:
Create a directory and set credentials_dir
in the args
to the complete path of the directory
Download each program private key from xtoearn website and copy the file to the directory created above
To pay out the rewards call the give_rewards
function with the necessary inputs