Integration Workflow Example

To help you integrate with the Unified Staking API effectively, we've provided a public repository showcasing a practical implementation. This repository is designed to streamline the staking process, offering a modular and extensible framework that supports multiple blockchain networks, including Solana, Polkadot, and Avail.

Here’s how it works and how you can get started:

Why This Repository Matters

This integration example is crafted to give you a head start. Instead of reinventing the wheel, you can focus on building value for your users while relying on a tried-and-tested foundation. The code is modular, easy to navigate, and designed with real-world scenarios in mind.

Key Features

  • Network Flexibility: Supports staking and unstaking across various networks with minimal effort.
  • Modular Architecture: Each blockchain interaction is encapsulated in its own module, making the code easy to extend and maintain.
  • Dynamic Configurations: A centralized config.json file ensures that you can quickly adapt the integration for new environments or networks.
  • Practical Logging: Robust logging mechanisms simplify debugging and help you monitor the staking flow.

How to Get Started

Step 1: Clone the Repository:

git clone [email protected]:alessandromaci/unified-api.git unified-api-integration-example
cd unified-api-integration-example

Step 2: Install Dependencies:

npm install

Step 3: Set Up Your Environment:

  • Rename .env.example to .env and provide your API keys and network configurations.
  • Fill in the config.json file with your project-specific details, such as chain settings, network parameters, and any other required data.

Step 4: Run the Example:

node stake.js --network=solana

How It’s Organized

  • Core Scripts:
    • stake.js — handles the entire staking workflow from creating the transaction to broadcasting it.
    • unstake.js — manages unstaking operations with network-specific logic.
  • Blockchain services:
    • stake.js — handles the entire staking workflow from creating the transaction to broadcasting it.
    • unstake.js — manages unstaking operations with network-specific logic.
  • Helper Utilities:
    • Common utilities like logging are in the utils directory, ensuring clean and reusable code.