public class IERC20Proxy extends TronContractProxy
Constructor and Description |
---|
IERC20Proxy(TronClient client,
TronAddress contractAddress)
Creates a new instance of IERC20Proxy.
|
Modifier and Type | Method and Description |
---|---|
BigInteger |
allowance(TronAddress address,
TronAddress spender)
Retrieves the allowance of an account.
|
TronTransaction |
approve(TronWallet sender,
TronAddress spender,
BigInteger value)
Approves another account to spend tokens.
|
BigInteger |
balanceOf(TronAddress address)
Retrieves the balance of an account.
|
void |
handleEvent(String eventName,
String eventSignature,
Map<String,String> types,
Map<String,Object> values)
Handles a contract event.
|
void |
handleNotInterpretableEvent(TronTransactionInformation.Log event)
handles an event that cannot be interpreted bases on the contract ABI.
|
BigInteger |
totalSupply()
Retrieves the total supply of token.
|
TronTransaction |
transfer(TronWallet sender,
TronAddress to,
BigInteger value)
Transfers tokens.
|
TronTransaction |
transferFrom(TronWallet sender,
TronAddress from,
TronAddress to,
BigInteger value)
Transfers from one account to another account.
|
callMethod, callMethod
getContract, handleBlock, handleTransaction
public IERC20Proxy(TronClient client, TronAddress contractAddress) throws GRPCException
client
- contractAddress
- GRPCException
public BigInteger totalSupply() throws GRPCException, TransactionException, EncodingException, InvalidCallDataException
GRPCException
- If an error occurs in the GRPC protocol, generally connection problems.TransactionException
- If The transaction fails to be sent.EncodingException
- If the method call is invalidInvalidCallDataException
- If the method result is invalidpublic BigInteger balanceOf(TronAddress address) throws GRPCException, TransactionException, EncodingException, InvalidCallDataException
address
- The address of the account.GRPCException
- If an error occurs in the GRPC protocol, generally connection problems.TransactionException
- If The transaction fails to be sent.EncodingException
- If the method call is invalidInvalidCallDataException
- If the method result is invalidpublic BigInteger allowance(TronAddress address, TronAddress spender) throws GRPCException, TransactionException, EncodingException, InvalidCallDataException
address
- The account with the founds.spender
- The spender account.GRPCException
- If an error occurs in the GRPC protocol, generally connection problems.TransactionException
- If The transaction fails to be sent.EncodingException
- If the method call is invalidInvalidCallDataException
- If the method result is invalidpublic TronTransaction transfer(TronWallet sender, TronAddress to, BigInteger value) throws GRPCException, TransactionException, EncodingException, InvalidCallDataException
sender
- The sender of the transaction (owner of the tokens).to
- The receiver.value
- The amount.GRPCException
- If an error occurs in the GRPC protocol, generally connection problems.TransactionException
- If The transaction fails to be sent.EncodingException
- If the method call is invalidInvalidCallDataException
- If the method result is invalidpublic TronTransaction approve(TronWallet sender, TronAddress spender, BigInteger value) throws GRPCException, TransactionException, EncodingException, InvalidCallDataException
sender
- The sender of the transaction (owner of the tokens).spender
- The spender address.value
- The amount.GRPCException
- If an error occurs in the GRPC protocol, generally connection problems.TransactionException
- If The transaction fails to be sent.EncodingException
- If the method call is invalidInvalidCallDataException
- If the method result is invalidpublic TronTransaction transferFrom(TronWallet sender, TronAddress from, TronAddress to, BigInteger value) throws GRPCException, TransactionException, EncodingException, InvalidCallDataException
sender
- The sender of the transaction.from
- The owner of the tokens.to
- The receiver.value
- The amount.GRPCException
- If an error occurs in the GRPC protocol, generally connection problems.TransactionException
- If The transaction fails to be sent.EncodingException
- If the method call is invalidInvalidCallDataException
- If the method result is invalidpublic void handleEvent(String eventName, String eventSignature, Map<String,String> types, Map<String,Object> values)
SmartContractEventListener
handleEvent
in class SmartContractEventListener
eventName
- Event name.eventSignature
- Event signature.types
- Mapping parameter names to types.values
- Mapping parameter names to values.public void handleNotInterpretableEvent(TronTransactionInformation.Log event)
SmartContractEventListener
handleNotInterpretableEvent
in class SmartContractEventListener
event
- the event data.Copyright © 2020. All rights reserved.