Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libraries compatibility to python 3.12 #467

Open
majikdev24 opened this issue Nov 21, 2024 · 2 comments
Open

libraries compatibility to python 3.12 #467

majikdev24 opened this issue Nov 21, 2024 · 2 comments

Comments

@majikdev24
Copy link

some packages are not compatible with python 3.12

@michaelhly
Copy link
Owner

can you provide a more descriptive issue?

@musayub123
Copy link

Transaction Creation Error in solana-py v0.36.1

Environment & Versions

  • solana-py version: 0.36.1
  • Python version: 3.13
  • Dependencies: solders, construct-typing, httpx
  • Running on Solana devnet
  • Using QuickNode RPC endpoint

Issue Description

When attempting to create and send transfer transactions using the solders Transaction and Message classes, I'm consistently getting type conversion errors:

Error during distribution: argument 'payer': 'Hash' object cannot be converted to 'Pubkey'

Minimal Reproduction Code

from solana.rpc.api import Client
from solders.keypair import Keypair
from solders.transaction import Transaction
from solders.pubkey import Pubkey
from solders.message import Message
from solders.system_program import TransferParams, transfer
from solders.hash import Hash

# Setup
client = Client("https://api.devnet.solana.com")
sender_keypair = Keypair.from_bytes(bytes.fromhex(sender_private_key))
recipient_pubkey = Pubkey.from_string(recipient_address)

# Get blockhash
blockhash_resp = client.get_latest_blockhash()
recent_blockhash = blockhash_resp.value.blockhash

# Create transfer instruction
transfer_instruction = transfer(
    TransferParams(
        from_pubkey=sender_keypair.pubkey(),
        to_pubkey=recipient_pubkey,
        lamports=amount
    )
)

# This is where the error occurs
message = Message([transfer_instruction], recent_blockhash)
transaction = Transaction(
    from_keypairs=[sender_keypair],
    message=message
)

Expected Behavior

The transaction should be created successfully and ready to be sent.

Actual Behavior

Getting type conversion error suggesting the Message or Transaction constructor is expecting different types than what we're providing.

Questions

  1. What's the correct way to construct Message and Transaction objects in solana-py v0.36.1?
  2. Is there a specific constructor or method we should be using for transaction creation in this version?
  3. Could you provide an example of the correct transaction construction pattern?

Additional Context

  • The error specifically occurs when trying to distribute SOL to multiple wallets in a loop
  • Each individual parameter (pubkeys, instructions, blockhash) appears to be of the correct type when printed
  • We've tried various patterns of Message and Transaction construction without success

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants