I am trying to buy a token through solana.ру, but in the process of writing the code, I get an error
from solana.rpc.api import Client, Keypair, Pubkey
from spl.token.constants import TOKEN_PROGRAM_ID
from spl.token.client import Token
wallet_secret_key = Keypair.from_bytes([227,...,52])
wallet_public_key = Pubkey.from_string("6vp...Kyu")
target_spl_mint = Pubkey.from_string('3Pd...br9')
amount_to_buy = 1000
program_id = TOKEN_PROGRAM_ID
client = Client('https://api.mainnet-beta.solana.com')
token = Token(conn=client, pubkey=target_spl_mint,program_id=program_id,payer=wallet_secret_key)
blockhash = client.get_latest_blockhash().value.blockhash
#The error is here
transaction = token.mint_to(recent_blockhash=blockhash,dest=wallet_public_key,mint_authority=target_spl_mint,amount=amount_to_buy)
tx_id = client.send_transaction(transaction, wallet_secret_key)
print(f"Транзакция отправлена. ID: {tx_id}")
Error
self._solders.sign(signers, self._solders.message.recent_blockhash)
solders.SignerError: not enough signers
I'm just at the beginning of learning solana and spl.token. If I have chosen the wrong method to purchase tokens for sol, please let me know.
Thank You