@@ -673,6 +673,20 @@ pub fn parse_token_transaction(
673673 TokenSwapBack :: try_from ( ( InputMessage ( inputs) , version) )
674674 . map ( TokenWalletTransaction :: SwapBack )
675675 . ok ( )
676+ } else if function_id == functions. internal_transfer . input_id {
677+ let inputs = functions
678+ . internal_transfer
679+ . decode_input ( body, true , true )
680+ . ok ( ) ?;
681+
682+ JettonIncomingTransfer :: try_from ( InputMessage ( inputs) )
683+ . map ( |x| {
684+ TokenWalletTransaction :: IncomingTransfer ( TokenIncomingTransfer {
685+ tokens : x. tokens ,
686+ sender_address : x. from ,
687+ } )
688+ } )
689+ . ok ( )
676690 } else {
677691 None
678692 }
@@ -682,8 +696,8 @@ pub fn parse_jetton_transaction(
682696 tx : & ton_block:: Transaction ,
683697 description : & ton_block:: TransactionDescrOrdinary ,
684698) -> Option < JettonWalletTransaction > {
685- const STANDART_JETTON_CELLS : usize = 0 ;
686- const STANDART_JETTON_BURN_CELLS : usize = 1 ;
699+ const STANDARD_JETTON_CELLS : usize = 0 ;
700+ const STANDARD_JETTON_BURN_CELLS : usize = 1 ;
687701 const MINTLESS_JETTON_CELLS : usize = 2 ;
688702
689703 if description. aborted {
@@ -702,7 +716,7 @@ pub fn parse_jetton_transaction(
702716 let cell = body. reference_opt ( 1 ) ?;
703717 SliceData :: load_cell ( cell) . ok ( ) ?
704718 }
705- STANDART_JETTON_CELLS | STANDART_JETTON_BURN_CELLS => body,
719+ STANDARD_JETTON_CELLS | STANDARD_JETTON_BURN_CELLS => body,
706720 _ => return None ,
707721 }
708722 } ;
@@ -821,6 +835,8 @@ struct TokenWalletFunctions {
821835 // Incoming
822836 accept_transfer : & ' static ton_abi:: Function ,
823837 // Incoming
838+ internal_transfer : & ' static ton_abi:: Function ,
839+ // Incoming
824840 burn : & ' static ton_abi:: Function ,
825841 // Outgoing
826842 accept_burn : & ' static ton_abi:: Function ,
@@ -837,6 +853,7 @@ impl TokenWalletFunctions {
837853 transfer : old_tip3:: token_wallet_contract:: transfer_to_recipient ( ) ,
838854 transfer_to_wallet : old_tip3:: token_wallet_contract:: transfer ( ) ,
839855 accept_transfer : old_tip3:: token_wallet_contract:: internal_transfer ( ) ,
856+ internal_transfer : old_tip3:: token_wallet_contract:: stub ( ) ,
840857 burn : old_tip3:: token_wallet_contract:: burn_by_owner ( ) ,
841858 accept_burn : old_tip3:: root_token_contract:: tokens_burned ( ) ,
842859 } )
@@ -850,6 +867,7 @@ impl TokenWalletFunctions {
850867 transfer : tip3_1:: token_wallet_contract:: transfer ( ) ,
851868 transfer_to_wallet : tip3_1:: token_wallet_contract:: transfer_to_wallet ( ) ,
852869 accept_transfer : tip3_1:: token_wallet_contract:: accept_transfer ( ) ,
870+ internal_transfer : tip3_1:: token_wallet_contract:: internal_transfer ( ) ,
853871 burn : tip3_1:: token_wallet_contract:: burnable:: burn ( ) ,
854872 accept_burn : tip3_1:: root_token_contract:: accept_burn ( ) ,
855873 } )
@@ -887,6 +905,19 @@ impl TryFrom<(InputMessage, TokenWalletVersion)> for TokenSwapBack {
887905 }
888906}
889907
908+ impl TryFrom < InputMessage > for JettonIncomingTransfer {
909+ type Error = UnpackerError ;
910+
911+ fn try_from ( value : InputMessage ) -> Result < Self , Self :: Error > {
912+ let input: tip3_1:: token_wallet_contract:: InternalTransferInputs = value. 0 . unpack ( ) ?;
913+
914+ Ok ( Self {
915+ tokens : BigUint :: from ( input. amount . as_u128 ( ) ) ,
916+ from : input. from ,
917+ } )
918+ }
919+ }
920+
890921struct Accept {
891922 tokens : BigUint ,
892923}
@@ -1266,4 +1297,26 @@ mod tests {
12661297 ) ;
12671298 }
12681299 }
1300+
1301+ #[ test]
1302+ fn test_tip3_jetton_incoming_transfer ( ) {
1303+ let ( tx, description) = parse_transaction ( "te6ccgECDAEAAlgAA7V3f+qdGMi8JjYzPKoZ9Z+bpmydkT1wisdXZ77gk1AFAhAAATx7yfqggC6iE75ppDvdzLmbyOcBCnxe+PDJ76cRgKt2Cy2ZIX6gAAE8e8n6oGaTw/dQADR5NE8IBQQBAhUECQBgwdZYeJGNEQMCAG/Jh6EgTBRYQAAAAAAABAACAAAAA8B4u2hCcp/bPN/dOsHOMIcjI4f1rR546mtVo5GE4BN0QFAVzACcRkopjFAAAAAAAAAAAPgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIJyH/HuNcxrNisZ3/ASNUm6oHt2S6OudgNcpDuLoGVKnHwuA9ejj3pxHzny2lpNan1PV91FIMUuTxfTeFZjxPvbkQIB4AgGAQHfBwCvSADv/VOjGReExsZnlUM+s/N0zZOyJ64RWOrs99wSagCgQwAOHyuzYYkse8JXNaFlfA3D8btggzNVZE6THxza4AOKz4684sQGFFhgAAAnj3k/VBLSeH7qQAGxaAHCojMY4mNubPmLxrR8IqPe3s4jRkwozPitECYHybqYEwAd/6p0YyLwmNjM8qhn1n5umbJ2RPXCKx1dnvuCTUAUCFAGDB1kBige6gAAJ495P1QK0nh+6sAJAacXjUUZAAAAAAAAAABDuaygCABw+V2bDElj3hK5rQsr4G4fjdsEGZqrInSY+ObXABxWfQAOHyuzYYkse8JXNaFlfA3D8btggzNVZE6THxza4AOKz4MKAQFACwAA" ) ;
1304+ let tip3_transaction =
1305+ parse_token_transaction ( & tx, & description, TokenWalletVersion :: Tip3 ) . unwrap ( ) ;
1306+
1307+ if let TokenWalletTransaction :: IncomingTransfer ( TokenIncomingTransfer {
1308+ tokens,
1309+ sender_address,
1310+ } ) = tip3_transaction
1311+ {
1312+ assert_eq ! ( tokens. to_u128( ) . unwrap( ) , 1000000000 ) ;
1313+ assert_eq ! (
1314+ sender_address,
1315+ MsgAddressInt :: from_str(
1316+ "0:387caecd8624b1ef095cd68595f0370fc6ed820ccd55913a4c7c736b800e2b3e"
1317+ )
1318+ . unwrap( )
1319+ ) ;
1320+ }
1321+ }
12691322}
0 commit comments