mirror of
https://github.com/chainstacklabs/pumpfun-bonkfun-bot.git
synced 2026-08-04 11:17:45 +00:00
wip(core): platform aware trading
This commit is contained in:
+39
-17
@@ -6,7 +6,7 @@ platform-specific implementations of the trading interfaces.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Dict, Optional, Type
|
||||
from typing import Any
|
||||
|
||||
from core.client import SolanaClient
|
||||
from interfaces.core import (
|
||||
@@ -17,8 +17,6 @@ from interfaces.core import (
|
||||
Platform,
|
||||
)
|
||||
|
||||
from . import letsbonk, pumpfun
|
||||
|
||||
|
||||
@dataclass
|
||||
class PlatformImplementations:
|
||||
@@ -145,21 +143,45 @@ class PlatformFactory:
|
||||
self._setup_default_platforms()
|
||||
|
||||
def _setup_default_platforms(self) -> None:
|
||||
"""Setup default platform registrations.
|
||||
"""Setup default platform registrations."""
|
||||
# Import platform implementations dynamically to avoid circular imports
|
||||
try:
|
||||
from platforms.pumpfun import (
|
||||
PumpFunAddressProvider,
|
||||
PumpFunCurveManager,
|
||||
PumpFunEventParser,
|
||||
PumpFunInstructionBuilder,
|
||||
)
|
||||
|
||||
self.registry.register_platform(
|
||||
Platform.PUMP_FUN,
|
||||
PumpFunAddressProvider,
|
||||
PumpFunInstructionBuilder,
|
||||
PumpFunCurveManager,
|
||||
PumpFunEventParser
|
||||
)
|
||||
|
||||
except ImportError as e:
|
||||
print(f"Warning: Could not register pump.fun platform: {e}")
|
||||
|
||||
This will be populated as we implement each platform.
|
||||
"""
|
||||
# Platforms will be registered here as they are implemented
|
||||
# Example:
|
||||
# from platforms.pumpfun import PumpFunAddressProvider, PumpFunInstructionBuilder, ...
|
||||
# self.registry.register_platform(
|
||||
# Platform.PUMP_FUN,
|
||||
# PumpFunAddressProvider,
|
||||
# PumpFunInstructionBuilder,
|
||||
# PumpFunCurveManager,
|
||||
# PumpFunEventParser
|
||||
# )
|
||||
pass
|
||||
try:
|
||||
from platforms.letsbonk import (
|
||||
LetsBonkAddressProvider,
|
||||
LetsBonkCurveManager,
|
||||
LetsBonkEventParser,
|
||||
LetsBonkInstructionBuilder,
|
||||
)
|
||||
|
||||
self.registry.register_platform(
|
||||
Platform.LETS_BONK,
|
||||
LetsBonkAddressProvider,
|
||||
LetsBonkInstructionBuilder,
|
||||
LetsBonkCurveManager,
|
||||
LetsBonkEventParser
|
||||
)
|
||||
|
||||
except ImportError as e:
|
||||
print(f"Warning: Could not register LetsBonk platform: {e}")
|
||||
|
||||
def create_for_platform(
|
||||
self,
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
"""
|
||||
LetsBonk platform registration and exports.
|
||||
LetsBonk platform exports.
|
||||
|
||||
This module registers all LetsBonk implementations with the platform factory
|
||||
and provides convenient imports for the LetsBonk platform.
|
||||
This module provides convenient imports for the LetsBonk platform implementations.
|
||||
Platform registration is now handled by the main platform factory.
|
||||
"""
|
||||
|
||||
from interfaces.core import Platform
|
||||
from platforms import register_platform_implementations
|
||||
|
||||
from .address_provider import LetsBonkAddressProvider
|
||||
from .curve_manager import LetsBonkCurveManager
|
||||
from .event_parser import LetsBonkEventParser
|
||||
from .instruction_builder import LetsBonkInstructionBuilder
|
||||
|
||||
# Register LetsBonk platform implementations
|
||||
register_platform_implementations(
|
||||
Platform.LETS_BONK,
|
||||
LetsBonkAddressProvider,
|
||||
LetsBonkInstructionBuilder,
|
||||
LetsBonkCurveManager,
|
||||
LetsBonkEventParser
|
||||
)
|
||||
|
||||
# Export implementations for direct use if needed
|
||||
__all__ = [
|
||||
'LetsBonkAddressProvider',
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
"""
|
||||
Pump.Fun platform registration and exports.
|
||||
Pump.Fun platform exports.
|
||||
|
||||
This module registers all pump.fun implementations with the platform factory
|
||||
and provides convenient imports for the pump.fun platform.
|
||||
This module provides convenient imports for the pump.fun platform implementations.
|
||||
Platform registration is now handled by the main platform factory.
|
||||
"""
|
||||
|
||||
from interfaces.core import Platform
|
||||
from platforms import register_platform_implementations
|
||||
|
||||
from .address_provider import PumpFunAddressProvider
|
||||
from .curve_manager import PumpFunCurveManager
|
||||
from .event_parser import PumpFunEventParser
|
||||
from .instruction_builder import PumpFunInstructionBuilder
|
||||
|
||||
# Register pump.fun platform implementations
|
||||
register_platform_implementations(
|
||||
Platform.PUMP_FUN,
|
||||
PumpFunAddressProvider,
|
||||
PumpFunInstructionBuilder,
|
||||
PumpFunCurveManager,
|
||||
PumpFunEventParser
|
||||
)
|
||||
|
||||
# Export implementations for direct use if needed
|
||||
__all__ = [
|
||||
'PumpFunAddressProvider',
|
||||
|
||||
Reference in New Issue
Block a user