@@ -107,22 +107,19 @@ def test_token_creation_basics(self):
107107 tx .update_hash ()
108108 self .assertFalse (tx .verify_pow ())
109109
110- def test_token_creation_with_fee_version (self ):
111- """Test TokenCreationTransaction with token_version=2 (FEE)"""
112- from hathorlib .token_creation_tx import TokenVersion
110+ def test_token_creation_with_fee_header (self ):
111+ """Test TokenCreationTransaction with fee header"""
112+ from hathorlib .token_creation_tx import TokenCreationTransaction , TokenVersion
113+
114+ data = bytes .fromhex (
115+ '0002010400000672c17c8fcf7277eece0b8cbe3f0efbdf6205e5e8554ccff5ca85ec8e49000069463044022070c5bfcd3b2f177'
116+ 'c842de1937c8a089bec64ea2d27754056fb7d7882e731aad7022073b6811313a52f74a88cedbbb2d951ddd5c6d2bba97332eea74'
117+ '2e020d7717f04210299138e77a8039c31a112941480231cccefc9e627fef5ff4a391e7a2689b319d40000000900001976a914ba6'
118+ 'a16b0ab2c2bf132e1cfbdc01ef86a8c749a7188ac0000006401001976a914ba6a16b0ab2c2bf132e1cfbdc01ef86a8c749a7188a'
119+ 'c0000000181001976a914ba6a16b0ab2c2bf132e1cfbdc01ef86a8c749a7188ac0000000281001976a914ba6a16b0ab2c2bf132e'
120+ '1cfbdc01ef86a8c749a7188ac0209546f6b656e4e616d6503544b4e4031b96d6968b53e690472ad000000000011010000000001'
121+ )
113122
114- # Using the same structure as test_token_creation_basics but with token_version=2
115- data = bytes .fromhex ('00020104000005551d7740fd7d3c0acc50b5677fdd844f1225985aa431e1712af2a2fd'
116- '8900006a473045022100a445edb5cd6c79a0a7b5ed837582fd65b8d511ee60b64fd076'
117- 'e07bd8f63f75a202202dca24320bffc4c3ca2a07cdfff38f7c839bde70ed49ef634ac6'
118- '588972836cab2103bfa995d676e3c0ed7b863c74cfef9683fab3163b42b6f21442326a'
119- '023fc57fba0000264800001976a9146876f9578221fdb678d4e8376503098a9228b132'
120- '88ac00004e2001001976a914031761ef85a24603203c97e75af355b83209f08f88ac00'
121- '00000181001976a9149f091256cb98649c7c35df0aad44d7805710691e88ac00000002'
122- '81001976a914b1d7a5ee505ad4d3b93ea1a5162ba83d5049ec4e88ac0209546f546865'
123- '4d6f6f6e04f09f9a804034a52aec6cece75e0fc0e30200001a72272f48339fcc5d5ec5'
124- 'deaf197855964b0eb912e8c6eefe00928b6cf600001055641c20b71871ed2c5c7d4096'
125- 'a34f40888d79c25bce74421646e732dc01ff730d' )
126123 tx = TokenCreationTransaction .create_from_struct (data )
127124
128125 # Verify the token version is FEE (2)
@@ -134,12 +131,23 @@ def test_token_creation_with_fee_version(self):
134131 # Verify basic transaction properties
135132 self .assertTrue (tx .is_transaction )
136133 self .assertFalse (tx .is_block )
134+ self .assertTrue (tx .has_fees ())
135+
136+ # Verify the fee header contains the expected fee entry
137+ fee_header = tx .get_fee_header ()
138+ self .assertEqual (len (fee_header .fees ), 1 )
139+ self .assertEqual (fee_header .fees [0 ].token_index , 0 )
140+ self .assertEqual (fee_header .fees [0 ].amount , 1 )
141+
142+ self .assertEqual (len (fee_header .get_fees ()), 1 )
143+ self .assertEqual (fee_header .get_fees ()[0 ].amount , 1 )
144+ self .assertEqual (fee_header .get_fees ()[0 ].token_uid , settings .HATHOR_TOKEN_UID )
137145
138146 # Verify the string representation includes token_version=2
139147 str_repr = str (tx )
140148 self .assertIn ('token_version=2' , str_repr )
141- self .assertIn ('token_name=ToTheMoon ' , str_repr )
142- self .assertIn ('token_symbol=🚀 ' , str_repr )
149+ self .assertIn ('token_name=TokenName ' , str_repr )
150+ self .assertIn ('token_symbol=TKN ' , str_repr )
143151
144152 def test_script_basics (self ):
145153 create_output_script (decode_address ('HVZjvL1FJ23kH3buGNuttVRsRKq66WHUVZ' ))
0 commit comments