-
Notifications
You must be signed in to change notification settings - Fork 339
Open
Labels
soldersIssue that should be transferred to https://github.com/kevinheavey/solders/issuesIssue that should be transferred to https://github.com/kevinheavey/solders/issues
Description
Problem Description:
I'm encountering a persistent TypeError: str object cannot be interpreted as an integer when using solders.pubkey.Pubkey.from_string (or Pubkey.from_bytes after base58.b58decode fallback) to convert Base58 public key strings to Pubkey objects. This happens consistently for every single transaction I attempt to parse from Solana's jsonParsed RPC output, causing the bot to repeatedly skip transactions.
The error occurs at a low level within solders's internal routines for interpreting pubkey_bytes.
Environment Details:
- Operating System (primary): macOS Sequoia 15.5]
- CPU Architecture (macOS): Apple M3 Pro
- Operating System (tested secondary): Windows 11 x64 (tested on a different machine with Docker, same error observed)
- Python Version (inside Docker container):
Python 3.10.12(base imagepython:3.10-slim-buster) solana-pyversion:solana==0.30.0soldersversion:solders==0.15.0- Other relevant libraries:
websockets,python-dotenv,base58(installed for fallback) - RPC/WS Provider: Tested with both Helius and QuickNode (same error observed with both).
Steps to Reproduce:
- Set up a Python environment (either local
venvor Docker). - Install
solana==0.30.0,solders==0.15.0,websockets,python-dotenv,base58. - Connect to a Solana Mainnet RPC/WS endpoint (e.g., Helius, QuickNode).
- Subscribe to transaction logs (e.g.,
logsSubscribeforall). - For each received transaction signature, fetch full transaction details (
get_transaction(signature, 'jsonParsed')). - Attempt to parse
sourceanddestinationfields fromcompiled_instruction.parsed.info(for native SOL transfers) intoPubkeyobjects usingPubkey.from_string().
Code Snippet (simplified relevant part where the error is caught):
from solders.pubkey import Pubkey
import base58 # Assuming installed
# 'from_wallet_str' and 'to_wallet_str' are strings obtained from RPC 'jsonParsed' output
# e.g., from_wallet_str = "D1WfNqfPdy24tL3ZfW2u929jV937y373Y37J7B373Y3" (example valid Base58 pubkey)
try:
from_pubkey = Pubkey.from_string(from_wallet_str)
to_pubkey = Pubkey.from_string(to_wallet_str)
except Exception as e_direct:
try:
# Debug prints confirmed type <class 'str'>
# print(f"DEBUG: FROM_VALUE: '{from_wallet_str}' (Type: {type(from_wallet_str)})")
from_bytes = base58.b58decode(from_wallet_str)
to_bytes = base58.b58decode(to_wallet_str)
from_pubkey = Pubkey.from_bytes(from_bytes)
to_pubkey = Pubkey.from_bytes(to_bytes)
except Exception as e_manual:
# This is the point where the primary error message is generated.
print(f"Errore nel recuperare o processare i dettagli della transazione [signature]: argument 'pubkey_bytes': 'str' object cannot be interpreted as an integer")
# The bot continues execution after printing this message, skipping the transaction.Metadata
Metadata
Assignees
Labels
soldersIssue that should be transferred to https://github.com/kevinheavey/solders/issuesIssue that should be transferred to https://github.com/kevinheavey/solders/issues