| 限定符和类型 | 字段和说明 |
|---|---|
protected org.web3j.protocol.Web3j |
web3j |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
authorization(String fromAddress,
String prikey,
String multySignContractAddress,
String bep20Address)
BEP20 授权
|
List<org.web3j.abi.datatypes.Type> |
callViewFunction(String contractAddress,
org.web3j.abi.datatypes.Function function)
调用合约的view/constant函数
|
List<org.web3j.abi.datatypes.Type> |
callViewFunction(String contractAddress,
org.web3j.abi.datatypes.Function function,
boolean latest) |
boolean |
canTransferBatch() |
protected void |
checkIfResetWeb3j(int times) |
void |
confirmUnspent(Block block) |
BigInteger |
convertBnbToWei(BigDecimal value) |
String |
convertToNewAddress(String address) |
static BigDecimal |
convertWeiToBnb(BigInteger balance) |
BigDecimal |
getBalance(String address)
BNB余额
|
Block |
getBlock(long height) |
Block |
getBlock(String hash) |
org.web3j.protocol.core.methods.response.EthBlock.Block |
getBlockByHeight(Long height)
Method:getBlockByHeight
Description: 根据高度获取区块
Author: xinjl
Date: 2018/4/16 15:23
|
long |
getBlockHeight() |
int |
getContractTokenDecimals(String tokenContract) |
BigInteger |
getCurrentGasPrice() |
protected org.web3j.abi.datatypes.Function |
getERC20ApproveFunction(String spender,
BigInteger value) |
BigInteger |
getERC20Balance(String address,
String contractAddress)
获取BEP-20 token指定地址余额
|
BigInteger |
getERC20Balance(String address,
String contractAddress,
org.web3j.protocol.core.DefaultBlockParameterName status) |
static BNBWalletApi |
getInstance() |
BigInteger |
getNonce(String from)
获取nonce,Pending模式 适用于连续转账
|
org.web3j.protocol.core.methods.response.Transaction |
getTransaction(Long height,
Integer index)
Method:获取链上交易
Description:
Author: xinjl
Date: 2018/4/16 15:23
|
org.web3j.protocol.core.methods.response.TransactionReceipt |
getTxReceipt(String txHash) |
void |
initialize() |
boolean |
isAuthorized(String fromAddress,
String multySignContractAddress,
String bep20Address)
是否已授权过
|
String |
rechargeBep20(String fromAddress,
String prikey,
BigInteger value,
String toAddress,
String multySignContractAddress,
String bep20ContractAddress)
充值BEP20
1.授权使用BEP20资产
2.充值
|
String |
rechargeBnb(String fromAddress,
String prikey,
BigInteger value,
String toAddress,
String multySignContractAddress)
充值BNB
|
void |
restartApi() |
org.web3j.protocol.core.methods.response.EthSendTransaction |
send(String hexValue)
Method:send
Description: 发送交易
Author: xinjl
Date: 2018/4/16 15:22
|
String |
sendBNB(String fromAddress,
String privateKey,
String toAddress,
BigDecimal value,
BigInteger gasLimit,
BigInteger gasPrice)
发送BNB
|
org.web3j.protocol.core.methods.response.EthSendTransaction |
sendTransaction(String fromAddress,
String secretKey,
Map<String,BigDecimal> transferRequests) |
String |
sendTransaction(String toAddress,
String fromAddress,
String secretKey,
BigDecimal amount) |
org.web3j.protocol.core.methods.response.EthSendTransaction |
sendTransaction(String toAddress,
String fromAddress,
String secretKey,
BigDecimal amount,
String contractAddress) |
String |
sendTx(String fromAddress,
String priKey,
org.web3j.abi.datatypes.Function txFunction,
BigInteger value,
String contract) |
String |
sendTx(String fromAddress,
String priKey,
org.web3j.abi.datatypes.Function txFunction,
String contract) |
BigInteger |
totalSupply(String contractAddress) |
org.web3j.protocol.core.methods.response.EthSendTransaction |
transferERC20Token(String from,
String to,
BigInteger value,
String privateKey,
String contractAddress,
BigInteger gasLimit,
BigInteger gasPrice)
ERC-20Token交易
|
public static BNBWalletApi getInstance()
public void restartApi()
public org.web3j.protocol.core.methods.response.EthSendTransaction transferERC20Token(String from, String to, BigInteger value, String privateKey, String contractAddress, BigInteger gasLimit, BigInteger gasPrice) throws Exception
Exceptionpublic String sendBNB(String fromAddress, String privateKey, String toAddress, BigDecimal value, BigInteger gasLimit, BigInteger gasPrice) throws Exception
Exceptionpublic void initialize()
initialize 在接口中 WalletApipublic long getBlockHeight()
throws Exception
getBlockHeight 在接口中 WalletApiExceptionprotected void checkIfResetWeb3j(int times)
public org.web3j.protocol.core.methods.response.Transaction getTransaction(Long height, Integer index)
public static BigDecimal convertWeiToBnb(BigInteger balance)
public org.web3j.protocol.core.methods.response.EthBlock.Block getBlockByHeight(Long height) throws Exception
Exceptionpublic BigDecimal getBalance(String address) throws Exception
getBalance 在接口中 WalletApiaddress - Exceptionpublic BigInteger getERC20Balance(String address, String contractAddress) throws Exception
address - 查询地址contractAddress - 合约地址InterruptedExceptionExceptionpublic BigInteger getERC20Balance(String address, String contractAddress, org.web3j.protocol.core.DefaultBlockParameterName status) throws Exception
Exceptionpublic boolean canTransferBatch()
canTransferBatch 在接口中 WalletApipublic void confirmUnspent(Block block)
confirmUnspent 在接口中 WalletApipublic org.web3j.protocol.core.methods.response.EthSendTransaction sendTransaction(String fromAddress, String secretKey, Map<String,BigDecimal> transferRequests)
sendTransaction 在接口中 WalletApipublic String sendTransaction(String toAddress, String fromAddress, String secretKey, BigDecimal amount)
sendTransaction 在接口中 WalletApipublic org.web3j.protocol.core.methods.response.EthSendTransaction sendTransaction(String toAddress, String fromAddress, String secretKey, BigDecimal amount, String contractAddress) throws Exception
sendTransaction 在接口中 WalletApiExceptionpublic BigInteger getNonce(String from) throws Exception
from - InterruptedExceptionExceptionpublic org.web3j.protocol.core.methods.response.EthSendTransaction send(String hexValue)
public BigInteger convertBnbToWei(BigDecimal value)
public String convertToNewAddress(String address)
convertToNewAddress 在接口中 WalletApipublic String rechargeBnb(String fromAddress, String prikey, BigInteger value, String toAddress, String multySignContractAddress) throws Exception
Exceptionpublic String rechargeBep20(String fromAddress, String prikey, BigInteger value, String toAddress, String multySignContractAddress, String bep20ContractAddress) throws Exception
Exceptionpublic String authorization(String fromAddress, String prikey, String multySignContractAddress, String bep20Address) throws Exception
Exceptionpublic boolean isAuthorized(String fromAddress, String multySignContractAddress, String bep20Address) throws Exception
Exceptionprotected org.web3j.abi.datatypes.Function getERC20ApproveFunction(String spender, BigInteger value)
public String sendTx(String fromAddress, String priKey, org.web3j.abi.datatypes.Function txFunction, String contract) throws Exception
Exceptionpublic String sendTx(String fromAddress, String priKey, org.web3j.abi.datatypes.Function txFunction, BigInteger value, String contract) throws Exception
Exceptionpublic org.web3j.protocol.core.methods.response.TransactionReceipt getTxReceipt(String txHash) throws Exception
Exceptionpublic List<org.web3j.abi.datatypes.Type> callViewFunction(String contractAddress, org.web3j.abi.datatypes.Function function) throws Exception
Exceptionpublic List<org.web3j.abi.datatypes.Type> callViewFunction(String contractAddress, org.web3j.abi.datatypes.Function function, boolean latest) throws Exception
Exceptionpublic int getContractTokenDecimals(String tokenContract) throws Exception
Exceptionpublic BigInteger totalSupply(String contractAddress) throws Exception
Exceptionpublic BigInteger getCurrentGasPrice() throws IOException
IOExceptionCopyright © 2021. All rights reserved.