public class OKTTool extends Object
| 构造器和说明 |
|---|
OKTTool() |
| 限定符和类型 | 方法和说明 |
|---|---|
static EthSendTransactionPo |
addFeeRechargeKip20(String fromAddress,
String privateKey,
BigInteger value,
String toAddress,
String multySignContractAddress,
String bep20ContractAddress,
BigInteger gasPrice,
BigInteger nonce)
(充值KIP20资产)追加手续费
BSC网络向NERVE网络充值KIP20资产
|
static EthSendTransactionPo |
addFeeRechargeOkt(String fromAddress,
String privateKey,
BigInteger value,
String toAddress,
String multySignContractAddress,
BigInteger gasPrice,
BigInteger nonce)
(充值OKT) 追加手续费
HECO网络向NERVE网络充值HT
|
static String |
authorization(String fromAddress,
String privateKey,
String multySignContractAddress,
String erc20ContractAddress)
授权使用KIP20资产
|
static List<org.web3j.abi.datatypes.Type> |
callViewFunction(String contractAddress,
org.web3j.abi.datatypes.Function function)
调用合约的view/constant函数
|
static BigDecimal |
calNVTByGasPrice(BigDecimal nvtUSD,
BigDecimal gasPrice,
BigDecimal ethUSD,
BigDecimal gasLimit) |
static BigDecimal |
calNVTOfWithdraw(BigDecimal nvtUSD,
BigDecimal gasPrice,
BigDecimal ethUSD,
boolean isETHToken) |
static EthSendTransactionPo |
createRechargeKip20(String fromAddress,
String privateKey,
BigInteger value,
String toAddress,
String multySignContractAddress,
String erc20ContractAddress)
充值KIP20资产
以太坊网络向NERVE网络充值KIP20资产
|
static EthSendTransactionPo |
createRechargeOkt(String fromAddress,
String privateKey,
BigInteger value,
String toAddress,
String multySignContractAddress)
(只组装交易)充值OKT
以太坊网络向NERVE网络充值OKT
|
static EthSendTransactionPo |
createTransferKip20(String fromAddress,
String privateKey,
String toAddress,
BigInteger value,
String contractAddress,
BigInteger gasLimit,
BigInteger gasPrice)
在OKT上转账KIP20资产(只组装交易 不广播)
|
static EthSendTransactionPo |
createTransferOkt(String fromAddress,
String privateKey,
String toAddress,
BigDecimal value,
BigInteger gasLimit,
BigInteger gasPrice)
在OKT上转账OKT资产(只组装交易 不广播)
|
static int |
getContractTokenDecimals(String tokenContract) |
static BigInteger |
getCurrentGasPrice() |
static BigInteger |
getKip20Balance(String address,
String contractAddress)
获取KIP20资产余额
|
static BigDecimal |
getOktBalance(String address)
获取OKT资产余额
|
static org.web3j.protocol.core.methods.response.TransactionReceipt |
getTxReceipt(String txHash) |
static void |
init(String rpcAddress)
自定义 OKT RPC地址
|
static boolean |
isAuthorized(String fromAddress,
String multySignContractAddress,
String erc20ContractAddress)
查询是否已经授权使用KIP20资产
|
static MetaMaskWalletApi |
metaMask() |
static EthSendTransactionPo |
rechargeKip20(String fromAddress,
String privateKey,
BigInteger value,
String toAddress,
String multySignContractAddress,
String erc20ContractAddress)
充值KIP20资产
以太坊网络向NERVE网络充值KIP20资产
|
static EthSendTransactionPo |
rechargeOkt(String fromAddress,
String privateKey,
BigInteger value,
String toAddress,
String multySignContractAddress)
充值OKT
以太坊网络向NERVE网络充值OKT
|
static BigInteger |
totalSupply(String contractAddress) |
static org.web3j.protocol.core.methods.response.EthSendTransaction |
transferKip20(String fromAddress,
String privateKey,
String toAddress,
BigInteger value,
String contractAddress,
BigInteger gasLimit,
BigInteger gasPrice)
在OKT上转账KIP20资产
|
static String |
transferOkt(String fromAddress,
String privateKey,
String toAddress,
BigDecimal value,
BigInteger gasLimit,
BigInteger gasPrice)
在OKT上转账OKT资产
|
public static MetaMaskWalletApi metaMask()
public static void init(String rpcAddress)
rpcAddress - public static String transferOkt(String fromAddress, String privateKey, String toAddress, BigDecimal value, BigInteger gasLimit, BigInteger gasPrice) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥toAddress - 接收地址value - 转出数量gasLimit - gasPrice - Exceptionpublic static EthSendTransactionPo createTransferOkt(String fromAddress, String privateKey, String toAddress, BigDecimal value, BigInteger gasLimit, BigInteger gasPrice) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥toAddress - 接收地址value - 转出数量gasLimit - gasPrice - Exceptionpublic static org.web3j.protocol.core.methods.response.EthSendTransaction transferKip20(String fromAddress, String privateKey, String toAddress, BigInteger value, String contractAddress, BigInteger gasLimit, BigInteger gasPrice) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥toAddress - 接收地址value - 转出数量(根据小数位数换算后的整数)contractAddress - ERC20资产合约地址Exceptionpublic static EthSendTransactionPo createTransferKip20(String fromAddress, String privateKey, String toAddress, BigInteger value, String contractAddress, BigInteger gasLimit, BigInteger gasPrice) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥toAddress - 接收地址value - 转出数量(根据小数位数换算后的整数)contractAddress - ERC20资产合约地址Exceptionpublic static BigDecimal getOktBalance(String address) throws Exception
address - Exceptionpublic static BigInteger getKip20Balance(String address, String contractAddress) throws Exception
address - contractAddress - Exceptionpublic static EthSendTransactionPo rechargeOkt(String fromAddress, String privateKey, BigInteger value, String toAddress, String multySignContractAddress) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址Exceptionpublic static EthSendTransactionPo addFeeRechargeOkt(String fromAddress, String privateKey, BigInteger value, String toAddress, String multySignContractAddress, BigInteger gasPrice, BigInteger nonce) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址Exceptionpublic static EthSendTransactionPo createRechargeOkt(String fromAddress, String privateKey, BigInteger value, String toAddress, String multySignContractAddress) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址Exceptionpublic static EthSendTransactionPo rechargeKip20(String fromAddress, String privateKey, BigInteger value, String toAddress, String multySignContractAddress, String erc20ContractAddress) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址erc20ContractAddress - KIP20 token合约地址Exceptionpublic static EthSendTransactionPo createRechargeKip20(String fromAddress, String privateKey, BigInteger value, String toAddress, String multySignContractAddress, String erc20ContractAddress) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址erc20ContractAddress - ERC20 token合约地址Exceptionpublic static EthSendTransactionPo addFeeRechargeKip20(String fromAddress, String privateKey, BigInteger value, String toAddress, String multySignContractAddress, String bep20ContractAddress, BigInteger gasPrice, BigInteger nonce) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥value - 转出数量(根据小数位数换算后的整数)toAddress - 接收token的NERVE地址multySignContractAddress - 多签合约地址bep20ContractAddress - KIP20 token合约地址Exceptionpublic static String authorization(String fromAddress, String privateKey, String multySignContractAddress, String erc20ContractAddress) throws Exception
fromAddress - 转出地址privateKey - 转出地址私钥multySignContractAddress - 多签合约地址erc20ContractAddress - KIP20 token合约地址Exceptionpublic static boolean isAuthorized(String fromAddress, String multySignContractAddress, String erc20ContractAddress) throws Exception
fromAddress - 转出地址multySignContractAddress - 多签合约地址erc20ContractAddress - KIP20 token合约地址Exceptionpublic static List<org.web3j.abi.datatypes.Type> callViewFunction(String contractAddress, org.web3j.abi.datatypes.Function function) throws Exception
contractAddress - function - Exceptionpublic static org.web3j.protocol.core.methods.response.TransactionReceipt getTxReceipt(String txHash) throws Exception
Exceptionpublic static int getContractTokenDecimals(String tokenContract) throws Exception
Exceptionpublic static BigInteger totalSupply(String contractAddress) throws Exception
Exceptionpublic static BigInteger getCurrentGasPrice() throws IOException
IOExceptionpublic static BigDecimal calNVTOfWithdraw(BigDecimal nvtUSD, BigDecimal gasPrice, BigDecimal ethUSD, boolean isETHToken)
public static BigDecimal calNVTByGasPrice(BigDecimal nvtUSD, BigDecimal gasPrice, BigDecimal ethUSD, BigDecimal gasLimit)
Copyright © 2021. All rights reserved.