@beans-app/beans-sdk
v0.0.4
Published
Beans API Library
Downloads
315
Readme
Beans SDK
This project demonstrates how to use the Beans SDK to interact with the Beans API. The SDK allows users to perform tasks such as:
• Sending direct payments
• Sending strict send payments
• Sending strict receive payments
• Fetching payment history
• Getting the latest payment
• Requesting exchange rates between assets
Prerequisites
• Node.js (version 14 or higher) should be installed on your machine.
• npm (Node Package Manager) is required to install dependencies.
Running the example
1. Clone the Repository
First, install the package to your local machine:
npm i @beans-app/beans-sdk
2. Navigate to SDK
cd /node_modules/@beans-app/beans-sdk
2. Install Dependencies
Run the following command to install all necessary dependencies:
npm install
3. Create an .env File
In the root directory of your project, create a .env file with the following variables. Make sure to replace the placeholder values with your own:
API_BASE_URL=https://your-api-url-here/
BEANS_JWT=your-beans-jwt-token
CLIENT_SIGNER_SECRET_SEED=signer-stellar-secret-seed
CLIENT_STELLAR_ACCOUNT_ID=client-stellar-account-id
DEFAULT_DESTINATION_STELLAR_ACCOUNT_ID=destination-stellar-account-id
STELLAR_URL=stellar-url
NETWORK_PASSPHRASE=network-passphrase
• API_BASE_URL: The URL of your Beans API endpoint (only needed for DEV env)
• BEANS_JWT: The JWT token used for authentication with the Beans API.
• CLIENT_SIGNER_SECRET_SEED: The signer Stellar account's secret seed
• CLIENT_STELLAR_ACCOUNT_ID: The Stellar account ID
• DEFAULT_DESTINATION_STELLAR_ACCOUNT_ID: The Stellar account ID to send funds
• STELLAR_URL: The Stellar url for accessing the network
• NETWORK_PASSPHRASE: The Stellar url for accessing the network
4. Run the Example Script
To run the example script, navigate to the root of the project and run the following command:
node example/example.js
This will start the interactive CLI, allowing you to perform different operations with the Beans SDK.