Skip to content

Repository files navigation

TinkerBots

Stellar Token Management API Documentation

Overview

This application provides a RESTful API for managing tokens on the Stellar blockchain, built with Node.js, Express, and TypeScript.

Table of Contents

API Endpoints

1. Token Creation

Create and issue a new token on the Stellar network.

Endpoint: POST /api/stellar/create-token

Request Body:

{
  "tokenCode": "MYTOKEN",
  "amount": "1000",
  "destinationAccount": "GABCD..."
}

Response:

{
  "success": true,
  "message": "Successfully issued 1000 MYTOKEN to GABCD...",
  "transactionHash": "abc123...",
  "tokenDetails": {
    "code": "MYTOKEN",
    "issuer": "GXYZ...",
    "asset": "MYTOKEN:GXYZ...",
    "amount_issued": "1000",
    "distributed_to": "GABCD..."
  }
}

2. Get Balance

Check the balance of a specific token for an account.

Endpoint: GET /api/stellar/balance?account=GABCD...&asset=MYTOKEN:GXYZ...

Response:

{
  "account": "GABCD...",
  "balances": [
    {
      "asset_type": "credit_alphanum4",
      "asset_code": "MYTOKEN",
      "asset_issuer": "GXYZ...",
      "balance": "1000.0000000"
    }
  ]
}

Authentication

API endpoints require authentication using a Stellar secret key stored in environment variables.

Environment Variables

Create a .env file in the project root with the following variables:

STELLAR_SECRET_KEY=your_secret_key_here
STELLAR_NETWORK=TESTNET  # or PUBLIC for mainnet
PORT=3000
NODE_ENV=development

Error Handling

Errors follow this format:

{
  "success": false,
  "error": "Error message",
  "details": "Additional error details (if available)"
}

Development

  1. Install dependencies:

    npm install
  2. Start development server:

    npm run dev
  3. Run tests:

    npm test

Production Deployment

  1. Build the application:

    npm run build
  2. Start the server:

    npm start

License

[Specify your license here]

About

Tokenization

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages