Solana Client.send_transaction() not returning response

I am trying to work with Solana in Python and I am trying to send an SPL token.

The transaction successfully sends & I can see logger logging the HTTP request, however, I can’t get the response with the signature ID.

This is my code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>transfer_spl_token:
# Initialize Solana client
client = Client(endpoint=SOLANA_ENDPOINT, commitment="processed")
# Create transaction
transaction = Transaction()
# Get the associated token account address for the destination
associated_token_address = get_associated_token_address(dest_pubkey, mint_pubkey)
# Get our associated token account address for the source
source_associated_token_address = get_associated_token_address(source_pubkey, mint_pubkey)
logger.info(f"Source Associated Token Address: {source_associated_token_address}")
logger.info(f"Destination Associated Token Address: {associated_token_address}")
# Check if the associated token account exists
response = client.get_account_info(associated_token_address)
if response.value is None:
# Create associated token account instruction if it doesn't exist
create_ata_instruction = create_associated_token_account(
payer=source_pubkey,
owner=dest_pubkey,
mint=mint_pubkey
)
transaction.add(create_ata_instruction)
# Convert amount to smallest units
transfer_amount = int(amount * (10 ** decimals))
logger.info(f"Transfer amount in smallest units: {transfer_amount}")
# Add the token transfer instruction
transaction.add(
transfer_checked(
TransferCheckedParams(
program_id=TOKEN_PROGRAM_ID,
source=source_associated_token_address,
mint=mint_pubkey,
dest=associated_token_address,
owner=source_keypair.pubkey(),
amount=transfer_amount,
decimals=decimals
)
)
)
# Send transaction
response = client.send_transaction(transaction, source_keypair, opts=TxOpts(skip_confirmation=False, preflight_commitment="processed"))
logger.info(response)
</code>
<code>transfer_spl_token: # Initialize Solana client client = Client(endpoint=SOLANA_ENDPOINT, commitment="processed") # Create transaction transaction = Transaction() # Get the associated token account address for the destination associated_token_address = get_associated_token_address(dest_pubkey, mint_pubkey) # Get our associated token account address for the source source_associated_token_address = get_associated_token_address(source_pubkey, mint_pubkey) logger.info(f"Source Associated Token Address: {source_associated_token_address}") logger.info(f"Destination Associated Token Address: {associated_token_address}") # Check if the associated token account exists response = client.get_account_info(associated_token_address) if response.value is None: # Create associated token account instruction if it doesn't exist create_ata_instruction = create_associated_token_account( payer=source_pubkey, owner=dest_pubkey, mint=mint_pubkey ) transaction.add(create_ata_instruction) # Convert amount to smallest units transfer_amount = int(amount * (10 ** decimals)) logger.info(f"Transfer amount in smallest units: {transfer_amount}") # Add the token transfer instruction transaction.add( transfer_checked( TransferCheckedParams( program_id=TOKEN_PROGRAM_ID, source=source_associated_token_address, mint=mint_pubkey, dest=associated_token_address, owner=source_keypair.pubkey(), amount=transfer_amount, decimals=decimals ) ) ) # Send transaction response = client.send_transaction(transaction, source_keypair, opts=TxOpts(skip_confirmation=False, preflight_commitment="processed")) logger.info(response) </code>
transfer_spl_token:
    # Initialize Solana client
    client = Client(endpoint=SOLANA_ENDPOINT, commitment="processed")

    # Create transaction
    transaction = Transaction()

    # Get the associated token account address for the destination
    associated_token_address = get_associated_token_address(dest_pubkey, mint_pubkey)
    
    # Get our associated token account address for the source
    source_associated_token_address = get_associated_token_address(source_pubkey, mint_pubkey)
    
    logger.info(f"Source Associated Token Address: {source_associated_token_address}")
    logger.info(f"Destination Associated Token Address: {associated_token_address}")

    # Check if the associated token account exists
    response = client.get_account_info(associated_token_address)
    if response.value is None:
        # Create associated token account instruction if it doesn't exist
        create_ata_instruction = create_associated_token_account(
            payer=source_pubkey,
            owner=dest_pubkey,
            mint=mint_pubkey
        )
        transaction.add(create_ata_instruction)

    # Convert amount to smallest units
    transfer_amount = int(amount * (10 ** decimals))
    logger.info(f"Transfer amount in smallest units: {transfer_amount}")

    # Add the token transfer instruction
    transaction.add(
        transfer_checked(
            TransferCheckedParams(
                program_id=TOKEN_PROGRAM_ID,
                source=source_associated_token_address,
                mint=mint_pubkey,
                dest=associated_token_address,
                owner=source_keypair.pubkey(),
                amount=transfer_amount,
                decimals=decimals
            )
        )
    )
    
    # Send transaction
    response = client.send_transaction(transaction, source_keypair, opts=TxOpts(skip_confirmation=False, preflight_commitment="processed"))
    logger.info(response)

I’m calling this function here:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>async def confirm_buy:
# Transfer SPL token
signature = transfer_spl_token(deposit_address, user_address, token_amount, privkey, mint_address)
logger.info(signature)
</code>
<code>async def confirm_buy: # Transfer SPL token signature = transfer_spl_token(deposit_address, user_address, token_amount, privkey, mint_address) logger.info(signature) </code>
async def confirm_buy:
    # Transfer SPL token
    signature = transfer_spl_token(deposit_address, user_address, token_amount, privkey, mint_address)
    logger.info(signature)

This is what I see in my logger:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- solanaweb3.rpc.httprpc.HTTPClient - INFO - Transaction sent to https://api.mainnet-beta.solana.com. Signature noZ2x.....AHwaX:
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 429 Too Many Requests"
</code>
<code>- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - solanaweb3.rpc.httprpc.HTTPClient - INFO - Transaction sent to https://api.mainnet-beta.solana.com. Signature noZ2x.....AHwaX: - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK" - httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 429 Too Many Requests" </code>
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- solanaweb3.rpc.httprpc.HTTPClient - INFO - Transaction sent to https://api.mainnet-beta.solana.com. Signature noZ2x.....AHwaX:
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 200 OK"
- httpx - INFO - HTTP Request: POST https://api.mainnet-beta.solana.com "HTTP/1.1 429 Too Many Requests"

I am new to Solana programming and not too sure what’s going on. Do I need to sign the transaction before sending it (so I have the txn ID already)?

I tried changing the commitment/pre-flight commitment.

I tried making the function async

I can’t get the response from send_transaction()

I was expecting to get signature

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật