Updated code just using solders
:
from solders.message import Message
from solders.keypair import Keypair
from solders.instruction import Instruction, AccountMeta
from solders.hash import Hash
from solders.transaction import Transaction
from solders.pubkey import Pubkey
TOKEN_PROGRAM_ID = Pubkey.from_string('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA')
ASSOCIATED_TOKEN_PROGRAM_ID = Pubkey.from_string('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL')
SYSVAR_RENT_PUBKEY = Pubkey.from_string('SysvarRent111111111111111111111111111111111')
ZERO_BYTES = bytes([0])
SYSTEM_PROGRAM_PROGRAM_ID = Pubkey.from_string('11111111111111111111111111111111')
owner = Keypair.from_base58_string('2an9mq3qY6e7PhGxHYRcw3JbpHLrBYgRzH5QBKgJZSxUUszYrgXQbRFZicuVWZLNiBzeUE3rgDma2EnYQKse8UpB')
fee_payer = Pubkey.from_string('MogXFseNqiFnRtk6wrDL9BDfKRZhjP5VBSiE1E35zeJ')
associated_token_address = Pubkey.from_string('3FuYhW79b3xbyixukA8pav6P9TgEwtCKPEhC1sULxBxG')
instruction = Instruction(
ASSOCIATED_TOKEN_PROGRAM_ID,
ZERO_BYTES,
[
AccountMeta(fee_payer, True, True),
AccountMeta(associated_token_address, False, True),
AccountMeta(owner.pubkey(), False, False),
AccountMeta(SYSTEM_PROGRAM_PROGRAM_ID, False, False),
AccountMeta(TOKEN_PROGRAM_ID, False, False),
AccountMeta(SYSVAR_RENT_PUBKEY, False, False),
],
)
null_signer = NullSigner(owner.pubkey())
message = Message([instruction], owner.pubkey())
blockhash = Hash.default() # replace with a real blockhash
transaction = Transaction([owner], message, blockhash)
print(transaction)
New Error:
thread '<unnamed>' panicked at 'Transaction::sign failed with error NotEnoughSigners', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/solana-sdk-1.10.25/src/transaction/mod.rs:710:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "src/__main__.py", line 88, in <module>
transaction = Transaction([owner], message, blockhash)
pyo3_runtime.PanicException: Transaction::sign failed with error NotEnoughSigners
make: *** [start] Error 1