@@ -66,7 +66,7 @@ def send_token(self, to, amount, token_id, account=None):
6666 Args:
6767 to (str): is the recipient address
6868 amount (int): is the amount of token to transfer. must be integer instead of float
69- token_id (str ): Token Name(NOT SYMBOL)
69+ token_id (any ): Token Name and id
7070 account: (str): is the address of the withdrawal account
7171
7272 Returns:
@@ -84,21 +84,21 @@ def send_token(self, to, amount, token_id, account=None):
8484 if not isinstance (amount , int ) or amount <= 0 :
8585 raise InvalidTronError ('Invalid amount provided' )
8686
87- if not is_string ( token_id ) or not len ( token_id ) :
87+ if not token_id :
8888 raise InvalidTronError ('Invalid token ID provided' )
8989
9090 if not self .tron .isAddress (account ):
9191 raise InvalidTronError ('Invalid origin address provided' )
9292
9393 _to = self .tron .address .to_hex (to )
9494 _from = self .tron .address .to_hex (account )
95- _token_id = self .tron .toHex (text = token_id )
95+ _token_id = self .tron .toHex (text = str ( token_id ) )
9696
9797 if _to == _from :
9898 raise TronError ('Cannot transfer TRX to the same account' )
9999
100100 # In case if "TRX" is specified, we redirect to another method.
101- if token_id .upper () == 'TRX' :
101+ if is_string ( token_id ) and token_id .upper () == 'TRX' :
102102 return self .send_transaction (_to , amount , _from )
103103
104104 return self .tron .manager .request ('/wallet/transferasset' , {
0 commit comments