@@ -80,16 +80,20 @@ def _init_token_transfers(
8080
8181 def _init_nft_transfers (
8282 self ,
83- nft_transfers : Union [Dict [TokenId , List [Tuple [AccountId , AccountId , int , bool ]]],List [TokenNftTransfer ]]
83+ nft_transfers : Union [
84+ Dict [TokenId , List [Tuple [AccountId , AccountId , int , bool ]]],
85+ List [TokenNftTransfer ]
86+ ]
8487 ) -> None :
8588 """Initializes the transaction with a list of NFT transfers.
8689
8790 Iterates through the provided list and adds each transfer using the
8891 private `_add_nft_transfer` method.
8992
9093 Args:
91- nft_transfers (Union[Dict[TokenId, List[Tuple[AccountId, AccountId, int, bool]]], List[TokenNftTransfer]]):
92- A list or dictionary describing NFT transfers.
94+ nft_transfers (Union[
95+ Dict[TokenId, List[Tuple[AccountId, AccountId, int, bool]]], List[TokenNftTransfer]]
96+ ):A list or dictionary describing NFT transfers.
9397
9498 Raises:
9599 TypeError: If `nft_transfers` is neither a list nor a dictionary.
@@ -113,7 +117,7 @@ def _init_nft_transfers(
113117 raise TypeError (
114118 "Invalid type for `nft_transfers`. Expected a list of TokenNftTransfer "
115119 "or a dict[TokenId, List[Tuple[AccountId, AccountId, int, bool]]]."
116- )
120+ )
117121
118122 def _add_token_transfer (
119123 self ,
@@ -150,7 +154,7 @@ def _add_token_transfer(
150154 raise TypeError ("expected_decimals must be an integer." )
151155 if not isinstance (is_approved , bool ):
152156 raise TypeError ("is_approved must be a boolean." )
153-
157+
154158 for transfer in self .token_transfers [token_id ]:
155159 if transfer .account_id == account_id :
156160 transfer .amount += amount
@@ -190,7 +194,7 @@ def _add_nft_transfer(
190194 raise TypeError ("receiver_id must be an AccountId instance." )
191195 if not isinstance (is_approved , bool ):
192196 raise TypeError ("is_approved must be a boolean." )
193-
197+
194198 self .nft_transfers [token_id ].append (
195199 TokenNftTransfer (token_id , sender_id , receiver_id , serial_number , is_approved )
196200 )
@@ -299,11 +303,13 @@ def add_nft_transfer(
299303 Self: The current instance of the transaction for chaining.
300304 """
301305 self ._require_not_frozen ()
302-
306+
303307 if not isinstance (nft_id , NftId ):
304308 raise TypeError ("nft_id must be a NftId instance." )
305-
306- self ._add_nft_transfer (nft_id .token_id , sender_id , receiver_id , nft_id .serial_number , is_approved )
309+
310+ self ._add_nft_transfer (
311+ nft_id .token_id , sender_id , receiver_id , nft_id .serial_number , is_approved
312+ )
307313 return self
308314
309315 def add_approved_nft_transfer (
@@ -324,10 +330,10 @@ def add_approved_nft_transfer(
324330 Self: The current instance of the transaction for chaining.
325331 """
326332 self ._require_not_frozen ()
327-
333+
328334 if not isinstance (nft_id , NftId ):
329335 raise TypeError ("nft_id must be a NftId instance." )
330-
336+
331337 self ._add_nft_transfer (nft_id .token_id , sender_id , receiver_id , nft_id .serial_number , True )
332338 return self
333339
@@ -358,7 +364,7 @@ def build_token_transfers(self) -> 'List[basic_types_pb2.TokenTransferList]':
358364
359365 for token_transfer in token_transfers :
360366 token_list .add_token_transfer (token_transfer )
361-
367+
362368 token_transfer_list .append (token_list )
363369
364370 # NFTs
@@ -367,7 +373,7 @@ def build_token_transfers(self) -> 'List[basic_types_pb2.TokenTransferList]':
367373
368374 for nft_transfer in nft_transfers :
369375 nft_list .add_nft_transfer (nft_transfer )
370-
376+
371377 token_transfer_list .append (nft_list )
372378
373379 token_transfer_proto : list [basic_types_pb2 .TokenTransferList ] = []
0 commit comments