Follow the instructions below to set up and use the example client.
- Clone the repository to your local machine:
git clone https://github.com/roll-network/tryrolljs.git
- Navigate to the root directory of the repository:
cd tryrolljs
- Install the dependencies by running the following command:
yarn install
- Build the project:
yarn build
- Navigate to to Node Api Client:
cd examples/example-node-api-client
- Create a
.env
file in examples/example-node-api-client. - Copy the environment variables from
env.example
into the.env
file.
Replace the placeholder values in the .env
file with your actual credentials and configuration.
If you are a Mac or Linux user, you need to import the .env
file into your terminal session. Follow these steps:
- Navigate to the example-node-api-client directory:
cd examples/example-node-api-client
- Run the following command to import the environment variables:
source .env
Make sure your environment variables are set correctly by running the following command:
echo $CLIENT_SECRET
If the command outputs your CLIENT_SECRET value, it means the environment variables are set correctly.
To start the command line prompt, run the following command:
yarn start
The command line prompt will display a list of operations you can perform with the API.
- Get Token List: Retrieves a list of tokens from the API.
- Get Token Creator: Retrieves the creator of a specific token.
- Get User: Retrieves information about a specific user.
- Get User Balances: Retrieves the balances of a specific user.
- Get User Token Balance: Retrieves the balance of a specific user for a specific token.
- Check If User Has Token Balance: Checks if a specific user has a balance for a specific token.
- Create Platform User: Creates a new user on the platform.
- Login Platform User: Logs in an existing user on the platform.
- Get Client: Retrieves information about a specific client.
- Send From Platform User: Sends tokens from a platform user to another address.
- Send Batch From Platform User: Sends multiple token transfers from a platform user to different addresses.
- Get Platform User Deposit Address: Retrieves the deposit address for a platform user.
- Get Platform User Balances: Retrieves the balances of a platform user.
- Get Platform User Balance: Retrieves the balance of a platform user for a specific token.
- Get Clients: Retrieves a list of clients.
- Generate Client Secret: Generates a new client secret.
If you encounter an "Unauthorized 403" error while performing an operation, follow the steps below.
- Choose the option "Generate Client Secret" from the command prompt.
- You will be redirected to your browser to sign into your account.
- After signing in, the new
CLIENT_SECRET
will be displayed in your terminal. - Replace the
CLIENT_SECRET