Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 78 additions & 1 deletion backend/src/api/liquid/liquid.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class LiquidRoutes {
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/featured', this.$getAllFeaturedLiquidAssets)
.get(config.MEMPOOL.API_URL_PREFIX + 'asset/:assetId/icon', this.getLiquidIcon)
.get(config.MEMPOOL.API_URL_PREFIX + 'assets/group/:id', this.$getAssetGroup)
// ADD ANGOR ROUTES FOR LIQUID
.get(config.MEMPOOL.API_URL_PREFIX + 'angor/projects', this.$getAngorProjects)
.get(config.MEMPOOL.API_URL_PREFIX + 'angor/project/:id', this.$getAngorProject)
.get(config.MEMPOOL.API_URL_PREFIX + 'angor/stats', this.$getAngorStats)
;

if (config.DATABASE.ENABLED) {
Expand All @@ -35,6 +39,80 @@ class LiquidRoutes {
}
}

// ADD ANGOR METHODS
private async $getAngorProjects(req: Request, res: Response) {
try {
// Added some mock data, will get replaced by original ones when actual projects are present on op of liquid
const projects = [
{
id: '1',
name: 'Liquid DeFi Platform',
description: 'Building a decentralized finance platform on Liquid Network',
fundingGoal: 100000000,
currentFunding: 45000000,
status: 'active',
createdAt: Date.now() - 30 * 24 * 60 * 60 * 1000,
endDate: Date.now() + 60 * 24 * 60 * 60 * 1000,
},
{
id: '2',
name: 'Liquid NFT Marketplace',
description: 'A marketplace for NFTs on the Liquid sidechain',
fundingGoal: 50000000,
currentFunding: 50000000,
status: 'completed',
createdAt: Date.now() - 90 * 24 * 60 * 60 * 1000,
endDate: Date.now() - 10 * 24 * 60 * 60 * 1000,
}
];

res.header('Pragma', 'public');
res.header('Cache-control', 'public');
res.setHeader('Expires', new Date(Date.now() + 1000 * 60 * 5).toUTCString());
res.json(projects);
} catch (e) {
handleError(req, res, 500, e instanceof Error ? e.message : e);
}
}

private async $getAngorProject(req: Request, res: Response) {
try {
const project = {
id: req.params.id,
name: 'Sample Project',
description: 'Sample project description',
fundingGoal: 100000000,
currentFunding: 45000000,
status: 'active',
createdAt: Date.now() - 30 * 24 * 60 * 60 * 1000,
endDate: Date.now() + 60 * 24 * 60 * 60 * 1000,
};

res.header('Pragma', 'public');
res.header('Cache-control', 'public');
res.setHeader('Expires', new Date(Date.now() + 1000 * 60 * 5).toUTCString());
res.json(project);
} catch (e) {
handleError(req, res, 500, e instanceof Error ? e.message : e);
}
}

private async $getAngorStats(req: Request, res: Response) {
try {
const stats = {
totalProjects: 2,
totalFunding: 95000000,
activeProjects: 1
};

res.header('Pragma', 'public');
res.header('Cache-control', 'public');
res.setHeader('Expires', new Date(Date.now() + 1000 * 60 * 5).toUTCString());
res.json(stats);
} catch (e) {
handleError(req, res, 500, e instanceof Error ? e.message : e);
}
}

private getLiquidIcon(req: Request, res: Response) {
const result = icons.getIconByAssetId(req.params.assetId);
Expand Down Expand Up @@ -254,7 +332,6 @@ class LiquidRoutes {
handleError(req, res, 500, e instanceof Error ? e.message : e);
}
}

}

export default new LiquidRoutes();
122 changes: 122 additions & 0 deletions docker-liquid/docker-compose-mainnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
version: "3.7"

services:
# MariaDB for mempool backend - run as root to fix permission issues
db:
container_name: liquid-mainnet-mempool-db
image: mariadb:10.5.21
restart: on-failure
stop_grace_period: 1m
environment:
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"
volumes:
- ./mysql/mainnet-data:/var/lib/mysql
network_mode: host

# Mempool backend API - connects to your local Elements daemon and Electrs
api:
container_name: liquid-mainnet-mempool-api
image: blockcore/mempool-backend:latest
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
depends_on:
- db
environment:
# Network configuration
MEMPOOL_NETWORK: "liquid"
MEMPOOL_BACKEND: "esplora"
MEMPOOL_ENABLED: "true"

# CRITICAL: Angor configuration
ANGOR_ENABLED: "true"

# Esplora configuration (connecting to your LOCAL electrs)
ESPLORA_REST_API_URL: "http://127.0.0.1:3000"
ESPLORA_REQUEST_TIMEOUT: "10000"
ESPLORA_FALLBACK_TIMEOUT: "10000"

# Elements Core RPC configuration (connecting to your LOCAL elements daemon)
CORE_RPC_HOST: "127.0.0.1"
CORE_RPC_PORT: "7041"
CORE_RPC_USERNAME: "ritankar"
CORE_RPC_PASSWORD: "ritankar-liquid"
CORE_RPC_TIMEOUT: "60000"

# Database configuration
DATABASE_ENABLED: "true"
DATABASE_HOST: "127.0.0.1"
DATABASE_PORT: "3306"
DATABASE_DATABASE: "mempool"
DATABASE_USERNAME: "mempool"
DATABASE_PASSWORD: "mempool"

# Statistics and logging
STATISTICS_ENABLED: "true"
MEMPOOL_STDOUT_LOG_MIN_PRIORITY: "debug"
MEMPOOL_INDEXING_BLOCKS_AMOUNT: "8640"
MEMPOOL_BLOCKS_SUMMARIES_INDEXING: "true"

# Mempool specific settings
MEMPOOL_CACHE_ENABLED: "true"
MEMPOOL_CACHE_DIR: "/backend/cache"
MEMPOOL_CLEAR_PROTECTION_MINUTES: "20"
MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "50"
MEMPOOL_BLOCK_WEIGHT_UNITS: "4000000"
MEMPOOL_INITIAL_BLOCKS_AMOUNT: "8"
MEMPOOL_MEMPOOL_BLOCKS_AMOUNT: "8"
volumes:
- ./data-mainnet:/backend/cache
network_mode: host
command: "./wait-for-it.sh 127.0.0.1:3306 --timeout=720 --strict -- ./start.sh"

# Mempool frontend - using your local image with Angor changes
web:
container_name: liquid-mainnet-mempool-web
image: mempool-frontend
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
depends_on:
- api
- db
environment:
# Frontend configuration
FRONTEND_HTTP_PORT: "8081"
BACKEND_MAINNET_HTTP_HOST: "127.0.0.1"
BACKEND_MAINNET_HTTP_PORT: "8999"

# Network configuration
MAINNET_ENABLED: "false"
LIQUID_ENABLED: "true"
LIQUID_TESTNET_ENABLED: "false"
ROOT_NETWORK: "liquid"
BASE_MODULE: "liquid"

# URLs
LIQUID_WEBSITE_URL: "http://localhost:8081"
MEMPOOL_WEBSITE_URL: "https://mempool.space"

# CRITICAL: Angor configuration
ANGOR_ENABLED: "true"

# Features
LIGHTNING: "false"
MINING_DASHBOARD: "false"
AUDIT: "false"
ACCELERATOR: "false"
ACCELERATOR_BUTTON: "false"
PUBLIC_ACCELERATIONS: "false"
HISTORICAL_PRICE: "true"
ADDITIONAL_CURRENCIES: "false"

# Display settings
ITEMS_PER_PAGE: "10"
KEEP_BLOCKS_AMOUNT: "8"
MEMPOOL_BLOCKS_AMOUNT: "8"
BLOCK_WEIGHT_UNITS: "4000000"
network_mode: host
command: "./wait-for 127.0.0.1:3306 --timeout=720 -- nginx -g 'daemon off;'"
122 changes: 122 additions & 0 deletions docker-liquid/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
version: "3.7"

services:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous one is for mainnet so this is for angornet?

# MariaDB for mempool backend - run as root to fix permission issues
db:
container_name: liquid-mempool-db
image: mariadb:10.5.21
restart: on-failure
stop_grace_period: 1m
environment:
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"
volumes:
- ./mysql/data:/var/lib/mysql
network_mode: host

# Mempool backend API - connects to your local Elements daemon and Electrs
api:
container_name: liquid-mempool-api
image: blockcore/mempool-backend:latest
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
depends_on:
- db
environment:
# Network configuration
MEMPOOL_NETWORK: "liquidtestnet"
MEMPOOL_BACKEND: "esplora"
MEMPOOL_ENABLED: "true"

# CRITICAL: Angor configuration
ANGOR_ENABLED: "true"

# Esplora configuration (connecting to your LOCAL electrs)
ESPLORA_REST_API_URL: "http://127.0.0.1:3001"
ESPLORA_REQUEST_TIMEOUT: "10000"
ESPLORA_FALLBACK_TIMEOUT: "10000"

# Elements Core RPC configuration (connecting to your LOCAL elements daemon)
CORE_RPC_HOST: "127.0.0.1"
CORE_RPC_PORT: "18891"
CORE_RPC_USERNAME: "user"
CORE_RPC_PASSWORD: "password"
CORE_RPC_TIMEOUT: "60000"

# Database configuration
DATABASE_ENABLED: "true"
DATABASE_HOST: "127.0.0.1"
DATABASE_PORT: "3306"
DATABASE_DATABASE: "mempool"
DATABASE_USERNAME: "mempool"
DATABASE_PASSWORD: "mempool"

# Statistics and logging
STATISTICS_ENABLED: "true"
MEMPOOL_STDOUT_LOG_MIN_PRIORITY: "debug"
MEMPOOL_INDEXING_BLOCKS_AMOUNT: "8640"
MEMPOOL_BLOCKS_SUMMARIES_INDEXING: "true"

# Mempool specific settings
MEMPOOL_CACHE_ENABLED: "true"
MEMPOOL_CACHE_DIR: "/backend/cache"
MEMPOOL_CLEAR_PROTECTION_MINUTES: "20"
MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "50"
MEMPOOL_BLOCK_WEIGHT_UNITS: "4000000"
MEMPOOL_INITIAL_BLOCKS_AMOUNT: "8"
MEMPOOL_MEMPOOL_BLOCKS_AMOUNT: "8"
volumes:
- ./data:/backend/cache
network_mode: host
command: "./wait-for-it.sh 127.0.0.1:3306 --timeout=720 --strict -- ./start.sh"

# Mempool frontend - using your local image with Angor changes
web:
container_name: liquid-mempool-web
image: mempool-frontend
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
depends_on:
- api
- db
environment:
# Frontend configuration
FRONTEND_HTTP_PORT: "8080"
BACKEND_MAINNET_HTTP_HOST: "127.0.0.1"
BACKEND_MAINNET_HTTP_PORT: "8999"

# Network configuration
MAINNET_ENABLED: "false"
LIQUID_ENABLED: "true"
LIQUID_TESTNET_ENABLED: "true"
ROOT_NETWORK: "liquidtestnet"
BASE_MODULE: "liquid"

# URLs
LIQUID_WEBSITE_URL: "http://localhost:8080"
MEMPOOL_WEBSITE_URL: "https://mempool.space"

# CRITICAL: Angor configuration
ANGOR_ENABLED: "true"

# Features
LIGHTNING: "false"
MINING_DASHBOARD: "false"
AUDIT: "false"
ACCELERATOR: "false"
ACCELERATOR_BUTTON: "false"
PUBLIC_ACCELERATIONS: "false"
HISTORICAL_PRICE: "true"
ADDITIONAL_CURRENCIES: "false"

# Display settings
ITEMS_PER_PAGE: "10"
KEEP_BLOCKS_AMOUNT: "8"
MEMPOOL_BLOCKS_AMOUNT: "8"
BLOCK_WEIGHT_UNITS: "4000000"
network_mode: host
command: "./wait-for 127.0.0.1:3306 --timeout=720 -- nginx -g 'daemon off;'"
1 change: 0 additions & 1 deletion frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
server.run.js

# docker
Dockerfile
entrypoint.sh
nginx-mempool.conf
nginx.conf
Expand Down
Loading