In python, you can use the SPL token client included in the solana-py repo at https://github.com/michaelhly/solana-py/tree/master/src/spl/token
To do the transfer, based on the example transaction that you linked, you use:
- token id / mint:
Crh6XxeJoKGVbCKaCXzD57pkUv5vYwgW3acnKWP91bWV
- source account:
AqCV7nMqWY8TnN9VqNrdvGNcchHjkbZfjSoLXSTeE9Fb
- destination account:
vLswbP3WbNRyE4FBaj7GdQj3hG5CKgJGw9fEGaA165z
- source account owner / authority:
5j22en4YDzDNzmGm7WWVxxYGDQ3Y873p7joVbKncZ1Ke
- amount: 1
This gives you:
from spl.token.constants import TOKEN_PROGRAM_ID
from spl.token.instructions import transfer_checked, TransferCheckedParams
from solana.rpc.commitment import Confirmed
from solana.rpc.api import Client
from solana.rpc.types import TxOpts
from solana.keypair import Keypair
from solana.publickey import PublicKey
from solana.transaction import Transaction
transaction = Transaction()
transaction.add(
transfer_checked(
TransferCheckedParams(
program_id=TOKEN_PROGRAM_ID,
source=new PublicKey("AqCV7nMqWY8TnN9VqNrdvGNcchHjkbZfjSoLXSTeE9Fb"),
mint=new PublicKey("Crh6XxeJoKGVbCKaCXzD57pkUv5vYwgW3acnKWP91bWV"),
dest=new PublicKey("vLswbP3WbNRyE4FBaj7GdQj3hG5CKgJGw9fEGaA165z"),
owner=new PublicKey("5j22en4YDzDNzmGm7WWVxxYGDQ3Y873p7joVbKncZ1Ke"),
amount=1,
decimals=0,
signers=[]
)
)
)
client = Client(endpoint="https://api.mainnet-beta.solana.com", commitment=Confirmed)
owner = Keypair() # <-- need the keypair for the token owner here! 5j22en4YDzDNzmGm7WWVxxYGDQ3Y873p7joVbKncZ1Ke
client.send_transaction(
transaction, owner, opts=TxOpts(skip_confirmation=False, preflight_commitment=Confirmed))
Here's an integration test using transfer_checked, same as the SolScan transaction that you linked: https://github.com/michaelhly/solana-py/blob/f41f020938d1fb257142f18608bcb884adb54479/tests/integration/test_token_client.py#L231