По сути, когда я моделирую транзакцию, она не работает, но когда я создаю подпись транзакции и подтверждаю ее, монета покупается без каких-либо проблем. p>
main.py:
Код: Выделить всё
from solders.pubkey import Pubkey
from pumpfun.pumpfun import buy
buy(Pubkey.from_string('token_mint_string'), 0.05)
Код: Выделить всё
def buy(token_mint_address: Pubkey, sol_buy_amount: float):
# ... (some code that is not that important)
compiled_message: MessageV0 = MessageV0.try_compile(
payer=owner_pubkey,
instructions=instructions,
address_lookup_table_accounts=[],
recent_blockhash=client.get_latest_blockhash().value.blockhash,
)
transaction: VersionedTransaction = VersionedTransaction(compiled_message, [payer_keypair])
print(client.simulate_transaction(transaction))
Код: Выделить всё
OUTPUT:
Код: Выделить всё
SimulateTransactionResp { context: RpcResponseContext { slot: 277011621, api_version: Some("1.18.15") }, value: RpcSimulateTransactionResult(RpcSimulateTransactionResult { err: Some(AccountNotFound), logs: Some([]), accounts: None, units_consumed: Some(0), return_data: None, inner_instructions: None }) }
Я знаю, что это правильный контактный адрес (мята).
Нужно ли мне иметь средства на счету для имитации транзакций?
Подробнее здесь: https://stackoverflow.com/questions/787 ... -on-solana