Торговый бот — объект «solders.transaction.Transaction» не имеет атрибута «recent_blockhash» и __dict__.Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Торговый бот — объект «solders.transaction.Transaction» не имеет атрибута «recent_blockhash» и __dict__.

Сообщение Anonymous »

Я пытаюсь заставить работать этот скрипт покупки Python для торговли Solana, но получаю следующую ошибку. Будем очень признательны за любую помощь.
Ошибка:

Код: Выделить всё

Attempt 1 to create associated token account failed: 'solders.transaction.Transaction' object has no attribute 'recent_blockhash'  and no __dict__ for setting new attributes
Код:

Код: Выделить всё

                msg = Message([create_ata_ix], payer.pubkey())
tx_ata = await client.send_transaction(
Transaction([payer], msg, (await client.get_latest_blockhash()).value.blockhash),
opts=TxOpts(skip_preflight=True,
preflight_commitment=Confirmed)
)

await client.confirm_transaction(tx_ata.value, commitment="confirmed")

print("Associated token account created.")
print(f"Associated token account address: {
associated_token_account}")
break
else:
print("Associated token account already exists.")
print(f"Associated token account address: {
associated_token_account}")
break
except Exception as e:
print(f"Attempt {
ata_attempt + 1} to create associated token account failed: {str(e)}")
if ata_attempt < max_retries - 1:
wait_time = 2 ** ata_attempt
print(f"Retrying in {wait_time} seconds...")
await asyncio.sleep(wait_time)
else:
print(
"Max retries reached. Unable to create associated token account.")
return`
Вот ссылка на полный код: https://github.com/chainstacklabs/pump- ... ual_buy.py
Заранее спасибо.
Пытался добавить недавний_блокхэш к транзакции и настроить процесс создания транзакции, но получил еще одну ошибку.

Код: Выделить всё

        # Create the associated token account instruction
create_ata_ix = spl_token.create_associated_token_account(
payer=payer.pubkey(),
owner=payer.pubkey(),
mint=mint
)

# Construct the message and the transaction with the blockhash
msg = Message([create_ata_ix], payer.pubkey())
tx_ata = VersionedTransaction(
payer=payer,
message=msg,
recent_blockhash=recent_blockhash  # Add the blockhash here
)

# Send the transaction
tx_hash = await client.send_transaction(tx_ata, payer, opts=TxOpts(skip_preflight=True, preflight_commitment=Confirmed))

await client.confirm_transaction(tx_hash.value, commitment="confirmed")

print("Associated token account created.")
print(f"Associated token account address: {associated_token_account}")
break
else:
print("Associated token account already exists.")
print(f"Associated token account address: {associated_token_account}")
break
except Exception as e:
print(f"Attempt {ata_attempt + 1} to create associated token account failed: {str(e)}")
if ata_attempt < max_retries - 1:
wait_time = 2 ** ata_attempt
print(f"Retrying in {wait_time} seconds...")
await asyncio.sleep(wait_time)
else:
print("Max retries reached. Unable to create associated token account.")
return
При использовании этого решения возникла еще одна ошибка:

Код: Выделить всё

Attempt 1 to create associated token account failed: VersionedTransaction.__new__() got an unexpected keyword argument 'payer'


Подробнее здесь: https://stackoverflow.com/questions/792 ... ute-recent
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение
  • Торговый бот — объект «solders.transaction.Transaction» не имеет атрибута «recent_blockhash» и __dict__.
    Anonymous » » в форуме Python
    0 Ответы
    31 Просмотры
    Последнее сообщение Anonymous
  • Торговый бот — объект «solders.transaction.Transaction» не имеет атрибута «recent_blockhash» и __dict__.
    Anonymous » » в форуме Python
    0 Ответы
    18 Просмотры
    Последнее сообщение Anonymous
  • Почему я продолжаю получать эту ошибку - ❌ Подписание транзакции не удалось: «Solders.transaction.versionedTransaction».
    Anonymous » » в форуме Python
    0 Ответы
    31 Просмотры
    Последнее сообщение Anonymous
  • Торговый бот Pancakeswap [закрыто]
    Anonymous » » в форуме Python
    0 Ответы
    142 Просмотры
    Последнее сообщение Anonymous
  • Торговый бот Pancakeswap
    Anonymous » » в форуме Python
    0 Ответы
    19 Просмотры
    Последнее сообщение Anonymous

Вернуться в «Python»