public class HeterogeneousTool extends Object
| 构造器和说明 |
|---|
HeterogeneousTool(String symbol,
String chainName,
String rpcAddress) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
addFeeRechargeErc20(String fromAddress,
BigInteger value,
String toAddress,
String multySignContractAddress,
String bep20ContractAddress,
BigInteger gasPrice,
BigInteger nonce)
充值合约资产 加速 [ERC20/BEP20 ... ](只组装交易 不签名 不广播)
|
String |
addFeeRechargeMainAsset(String fromAddress,
BigInteger value,
String toAddress,
String multySignContractAddress,
BigInteger gasPrice,
BigInteger nonce) |
String |
assembleRechargeERC20Token(String fromAddress,
BigInteger value,
String toAddress,
String multySignContractAddress,
String bep20ContractAddress)
充值合约资产[ERC20/BEP20 ... ](只组装交易 不签名 不广播)
|
String |
assembleRechargeMainAsset(String fromAddress,
BigInteger value,
String toAddress,
String multySignContractAddress)
充值主资产 [ETH/BNB/HT/OKT] (只组装交易 不签名 不广播)
|
String |
assembleTransferERC20Token(String fromAddress,
String toAddress,
BigInteger amount,
String contractAddress,
BigInteger gasLimit,
BigInteger gasPrice)
转账合约资产[ERC20/BEP20 ... ](只组装交易 不签名 不广播)
|
String |
assembleTransferMainAsset(String fromAddress,
String toAddress,
BigDecimal amount,
BigInteger gasLimit,
BigInteger gasPrice)
转账主资产[ETH/BNB/HT/OKT](只组装交易 不签名 不广播)
|
String |
authorization(String fromAddress,
String multySignContractAddress,
String erc20ContractAddress)
授权使用ERC20资产 (只组装交易 不签名 不广播)
|
List<org.web3j.abi.datatypes.Type> |
callViewFunction(String contractAddress,
org.web3j.abi.datatypes.Function function)
`
调用合约的view/constant函数
|
String |
ethSign(String priKey,
String dataHex) |
BigDecimal |
getBalance(String address)
获取主资产余额
|
int |
getContractTokenDecimals(String tokenContract) |
BigInteger |
getCurrentGasPrice() |
BigInteger |
getErc20Balance(String address,
String contractAddress)
获取合约资产余额
|
org.web3j.protocol.core.methods.response.TransactionReceipt |
getTxReceipt(String txHash)
查询交易打包结果
|
boolean |
isAuthorized(String fromAddress,
String multySignContractAddress,
String erc20ContractAddress)
查询是否已经授权使用ERC20资产
|
MetaMaskWalletApi |
metaMask() |
String |
personalSign(String priKey,
String data) |
org.web3j.protocol.core.methods.response.EthSendTransaction |
sendTxAsync(String txHex)
广播交易
|
String |
signTypedDataV4(String priKey,
String json) |
BigInteger |
totalSupply(String contractAddress) |
public MetaMaskWalletApi metaMask()
public String assembleTransferMainAsset(String fromAddress, String toAddress, BigDecimal amount, BigInteger gasLimit, BigInteger gasPrice) throws Exception
fromAddress - 转出地址toAddress - 接收地址amount - 转出数量gasLimit - gasPrice - Exceptionpublic String assembleTransferERC20Token(String fromAddress, String toAddress, BigInteger amount, String contractAddress, BigInteger gasLimit, BigInteger gasPrice) throws Exception
fromAddress - toAddress - amount - contractAddress - gasLimit - gasPrice - Exceptionpublic String assembleRechargeMainAsset(String fromAddress, BigInteger value, String toAddress, String multySignContractAddress) throws Exception
fromAddress - 转出地址value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址Exceptionpublic String addFeeRechargeMainAsset(String fromAddress, BigInteger value, String toAddress, String multySignContractAddress, BigInteger gasPrice, BigInteger nonce) throws Exception
Exceptionpublic String assembleRechargeERC20Token(String fromAddress, BigInteger value, String toAddress, String multySignContractAddress, String bep20ContractAddress) throws Exception
fromAddress - value - toAddress - multySignContractAddress - bep20ContractAddress - Exceptionpublic String addFeeRechargeErc20(String fromAddress, BigInteger value, String toAddress, String multySignContractAddress, String bep20ContractAddress, BigInteger gasPrice, BigInteger nonce) throws Exception
Exceptionpublic BigDecimal getBalance(String address) throws Exception
address - Exceptionpublic BigInteger getErc20Balance(String address, String contractAddress) throws Exception
address - contractAddress - Exceptionpublic String authorization(String fromAddress, String multySignContractAddress, String erc20ContractAddress) throws Exception
fromAddress - 转出地址multySignContractAddress - 多签合约地址erc20ContractAddress - ERC20 token合约地址Exceptionpublic boolean isAuthorized(String fromAddress, String multySignContractAddress, String erc20ContractAddress) throws Exception
fromAddress - 转出地址multySignContractAddress - 多签合约地址erc20ContractAddress - ERC20 token合约地址Exceptionpublic org.web3j.protocol.core.methods.response.TransactionReceipt getTxReceipt(String txHash) throws Exception
txHash - Exceptionpublic int getContractTokenDecimals(String tokenContract) throws Exception
Exceptionpublic BigInteger totalSupply(String contractAddress) throws Exception
Exceptionpublic BigInteger getCurrentGasPrice() throws IOException
IOExceptionpublic List<org.web3j.abi.datatypes.Type> callViewFunction(String contractAddress, org.web3j.abi.datatypes.Function function) throws Exception
contractAddress - function - Exceptionpublic org.web3j.protocol.core.methods.response.EthSendTransaction sendTxAsync(String txHex) throws Exception
txHex - 交易HEXExceptionpublic String signTypedDataV4(String priKey, String json) throws IOException
IOExceptionCopyright © 2021. All rights reserved.