UNPKG

@faktoryfun/styx-sdk

Version:

Bitcoin deposit SDK for Stacks applications, enabling trustless Bitcoin-to-sBTC deposits

139 lines (138 loc) 5.19 kB
// src/constants.ts - Simplified without auto-detection // =========================================== // Network and pool configurations // =========================================== // Network configurations export const NETWORK_CONFIGS = { mainnet: { name: "Mainnet", apiUrl: "https://styx-be.vercel.app", stacksNetwork: "mainnet", bitcoinNetwork: "mainnet", }, testnet: { name: "Testnet", apiUrl: "https://backend-styx-testnet.vercel.app", stacksNetwork: "testnet", bitcoinNetwork: "testnet", }, regtest: { name: "Regtest", apiUrl: "https://backend-styx-testnet.vercel.app", stacksNetwork: "regtest", bitcoinNetwork: "regtest", // Bitcoin APIs use Hiro's regtest endpoints bitcoinApiUrl: "https://mempool.bitcoin.regtest.hiro.so/api/v1", }, }; // Pool configurations per network export const MAINNET_POOLS = { main: { id: "main", type: "legacy", contractAddress: "SP6SA6BTPNN5WDAWQ7GWJF1T5E2KWY01K9SZDBJQ.styx-v1", btcAddress: "bc1qlh3zk77pc4mlyqz0dqhjvn6p2g5tfqj8qvqxfy", // Your existing mainnet address name: "Legacy Styx Pool", description: "Original sBTC bridge with USDA/PEPE swaps", supportedSwapTypes: ["sbtc", "usda", "pepe"], minDepositSats: 10000, maxDepositSats: 400000, isActive: true, }, aibtc: { id: "aibtc", type: "aibtc", contractAddress: "SPV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RCJDC22.btc2sbtc", btcAddress: "bc1qex5rfzcytljulw0k69rnh2n89vp3fwh0kes79s", // You'll need to provide mainnet AI BTC pool address name: "AI BTC Pool", description: "AI-powered BTC to sBTC bridge with AI token swaps", supportedSwapTypes: ["sbtc", "aibtc"], minDepositSats: 10000, maxDepositSats: 1000000, isActive: true, }, }; export const TESTNET_POOLS = { main: { id: "main", type: "legacy", contractAddress: "ST6SA6BTPNN5WDAWQ7GWJF1T5E2KWY01KBRYYSZN.styx-v1", btcAddress: "tb1qmed265dnezfrrptfsgzsxuxwsrpff0eeqn29ph", // Testnet BTC address for legacy pool name: "Legacy Styx Pool (Testnet)", description: "Original sBTC bridge with USDA/PEPE swaps (Testnet)", supportedSwapTypes: ["sbtc", "usda", "pepe"], minDepositSats: 10000, maxDepositSats: 400000, isActive: true, }, aibtc: { id: "aibtc", type: "aibtc", contractAddress: "STV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RJ5XDY2.btc2sbtc", btcAddress: "tb1q8pm9ud5rpc8cy802s37mwqey83h6jzkkarayp2", // Testnet BTC address for AI BTC pool name: "AI BTC Pool (Testnet)", description: "AI-powered BTC to sBTC bridge with AI token swaps (Testnet)", supportedSwapTypes: ["sbtc", "aibtc"], minDepositSats: 10000, maxDepositSats: 1000000, isActive: true, }, }; // NEW: Regtest pools configuration export const REGTEST_POOLS = { main: { id: "main", type: "legacy", contractAddress: "ST6SA6BTPNN5WDAWQ7GWJF1T5E2KWY01KBRYYSZN.styx-v1", // Update with your regtest contracts btcAddress: "bcrt1qmed265dnezfrrptfsgzsxuxwsrpff0eeqn29ph", // Update with your regtest BTC address name: "Legacy Styx Pool (Regtest)", description: "Original sBTC bridge with USDA/PEPE swaps (Regtest)", supportedSwapTypes: ["sbtc", "usda", "pepe"], minDepositSats: 10000, maxDepositSats: 400000, isActive: true, }, aibtc: { id: "aibtc", type: "aibtc", contractAddress: "STV9K21TBFAK4KNRJXF5DFP8N7W46G4V9RJ5XDY2.btc2sbtc", // Update with your regtest contracts btcAddress: "bcrt1q8pm9ud5rpc8cy802s37mwqey83h6jzkkarayp2", // Update with your regtest BTC address name: "AI BTC Pool (Regtest)", description: "AI-powered BTC to sBTC bridge with AI token swaps (Regtest)", supportedSwapTypes: ["sbtc", "aibtc"], minDepositSats: 10000, maxDepositSats: 1000000, isActive: true, }, }; // Combined pool registry export const POOL_CONFIGS = { mainnet: MAINNET_POOLS, testnet: TESTNET_POOLS, regtest: REGTEST_POOLS, }; // Keep your existing constants for backward compatibility export const DEPOSIT_BTC_ADDRESS = MAINNET_POOLS.main.btcAddress; // Points to legacy mainnet pool export const MIN_DEPOSIT_SATS = 10000; export const MAX_DEPOSIT_SATS = 400000; // =========================================== // Simple helper functions (no auto-detection) // =========================================== export function getNetworkConfig(network) { return NETWORK_CONFIGS[network]; } export function getPoolConfig(network, poolId) { return POOL_CONFIGS[network][poolId]; } export function getPoolBtcAddress(network, poolId) { return POOL_CONFIGS[network][poolId].btcAddress; } export function getApiUrl(network) { return NETWORK_CONFIGS[network].apiUrl; } export function getDefaultPoolForSwapType(swapType) { if (swapType === "aibtc") { return "aibtc"; } return "main"; // Default to legacy pool }