From 46a636f91287d0377813d44bcf10f44fbc4f6000 Mon Sep 17 00:00:00 2001 From: smypmsa Date: Wed, 5 Mar 2025 17:04:25 +0000 Subject: [PATCH] fixed transaction import --- config.py | 11 +++-------- src/core/client.py | 2 +- src/trading/base.py | 8 ++++---- src/trading/buyer.py | 2 +- src/trading/seller.py | 2 +- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/config.py b/config.py index 677a551..2ce3ba1 100644 --- a/config.py +++ b/config.py @@ -4,13 +4,8 @@ Configuration for the pump.fun trading bot. from typing import Final -import os - -from dotenv import load_dotenv from solders.pubkey import Pubkey -load_dotenv() - # System & pump.fun addresses PUMP_PROGRAM: Final[Pubkey] = Pubkey.from_string( "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P" @@ -45,9 +40,9 @@ BUY_AMOUNT = 0.0001 # Amount of SOL to spend when buying BUY_SLIPPAGE = 0.2 # 20% slippage tolerance for buying SELL_SLIPPAGE = 0.2 # 20% slippage tolerance for selling ENABLE_DYNAMIC_PRIORITY_FEE = ( - True # getRecentPriorityFee is used to get current priority fee + True # TODO: getRecentPriorityFee is used to get current priority fee ) -EXTRA_PRIORITY_FEE = 0.1 # 10% increase in dynamic priority fee +EXTRA_PRIORITY_FEE = 0.1 # TODO: 10% increase in dynamic priority fee TOKEN_DECIMALS: Final[int] = 6 MAX_RETRIES: int = 5 @@ -55,6 +50,6 @@ WAIT_TIME_AFTER_BUY: int = 20 WAIT_TIME_BEFORE_NEW_TOKEN: int = 5 WAIT_TIME_AFTER_CREATION: int = 15 -# RPS of your node to avoid rate limit errors +# TODO: RPS of your node to avoid rate limit errors # You can also get a trader node https://docs.chainstack.com/docs/solana-trader-nodes MAX_RPS = 25 diff --git a/src/core/client.py b/src/core/client.py index 4f0335e..9a7b51c 100644 --- a/src/core/client.py +++ b/src/core/client.py @@ -8,10 +8,10 @@ from typing import Any, Dict, List, Optional, Tuple, Union from solana.rpc.async_api import AsyncClient from solana.rpc.commitment import Confirmed from solana.rpc.types import TxOpts -from solana.transaction import Transaction from solders.instruction import Instruction from solders.keypair import Keypair from solders.pubkey import Pubkey +from solders.transaction import Transaction from src.utils.logger import get_logger diff --git a/src/trading/base.py b/src/trading/base.py index e6fd6b5..c4cb7f1 100644 --- a/src/trading/base.py +++ b/src/trading/base.py @@ -64,10 +64,10 @@ class TradeResult: """Result of a trading operation.""" success: bool - tx_signature: Optional[str] = None - error_message: Optional[str] = None - amount: Optional[float] = None - price: Optional[float] = None + tx_signature: str | None = None + error_message: str | None = None + amount: float | None = None + price: float | None = None class Trader(ABC): diff --git a/src/trading/buyer.py b/src/trading/buyer.py index 52dd329..d85aa89 100644 --- a/src/trading/buyer.py +++ b/src/trading/buyer.py @@ -10,11 +10,11 @@ import spl.token.instructions as spl_token from solana.rpc.async_api import AsyncClient from solana.rpc.commitment import Confirmed from solana.rpc.types import TxOpts -from solana.transaction import Transaction from solders.instruction import AccountMeta, Instruction from solders.keypair import Keypair from solders.pubkey import Pubkey from solders.system_program import TransferParams, transfer +from solders.transaction import Transaction from spl.token.instructions import get_associated_token_address from src.core.client import SolanaClient diff --git a/src/trading/seller.py b/src/trading/seller.py index 74585c9..9724b33 100644 --- a/src/trading/seller.py +++ b/src/trading/seller.py @@ -6,9 +6,9 @@ import asyncio import struct from typing import Optional -from solana.transaction import Transaction from solders.instruction import AccountMeta, Instruction from solders.pubkey import Pubkey +from solders.transaction import Transaction from src.core.client import SolanaClient from src.core.curve import BondingCurveManager