@@ -237,17 +237,24 @@ def _build_tx(self, from_pubkey, accounts, program_id, instr_data, extra_account
237237 # ================================================================
238238
239239 def test_solana_sign_token_transfer (self ):
240- """SPL Token transfer — OLED shows 'Send [amount] tokens to [address]'."""
240+ """SPL Token TransferChecked — OLED shows 'Send 50.00 USDC to [address]'.
241+ Uses opcode 12 (TransferChecked) with mint account + token_info metadata."""
241242 self .requires_fullFeature ()
243+ self .requires_message ("SolanaSignTx" )
242244 self .setup_mnemonic_allallall ()
243245 from_pubkey = self ._get_from_pubkey ()
244- to_account = b'\x33 ' * 32 # destination token account
245- owner = from_pubkey # token owner = signer
246- # SPL Token Transfer instruction: opcode=3 (u8) + amount (LE u64)
247- instr_data = bytes ([3 ]) + struct .pack ('<Q' , 50000000 ) # 50M tokens
248- raw_tx = self ._build_tx (from_pubkey , [to_account ], self .TOKEN_PROGRAM , instr_data )
246+ source_ata = b'\x11 ' * 32 # source token account
247+ usdc_mint = b'\x22 ' * 32 # USDC mint (test placeholder)
248+ dest_ata = b'\x33 ' * 32 # destination token account
249+ # TransferChecked: opcode=12 (u8) + amount (LE u64) + decimals (u8)
250+ instr_data = bytes ([12 ]) + struct .pack ('<Q' , 50000000 ) + bytes ([6 ])
251+ # Accounts: [source, mint, destination, owner(signer)]
252+ raw_tx = self ._build_tx (from_pubkey , [source_ata , usdc_mint , dest_ata ],
253+ self .TOKEN_PROGRAM , instr_data )
254+ token_info = messages .SolanaTokenInfo (mint = usdc_mint , symbol = "USDC" , decimals = 6 )
249255 resp = self .client .call (messages .SolanaSignTx (
250- address_n = parse_path ("m/44'/501'/0'/0'" ), raw_tx = raw_tx ))
256+ address_n = parse_path ("m/44'/501'/0'/0'" ),
257+ raw_tx = raw_tx , token_info = [token_info ]))
251258 self .assertEqual (len (resp .signature ), 64 )
252259
253260 def test_solana_sign_token_approve (self ):
0 commit comments