程序包 io.nuls.v2.util
类 NulsSDKTool
- java.lang.Object
-
- io.nuls.v2.util.NulsSDKTool
-
public class NulsSDKTool extends Object
-
-
构造器概要
构造器 构造器 说明 NulsSDKTool()
-
方法概要
-
-
-
方法详细资料
-
resetPassword
public static Result resetPassword(String address, String oldPassword, String newPassword)
-
importKeystore
public static Result importKeystore(AccountKeyStoreDto keyStore, String password)
-
exportKeyStore
public static Result exportKeyStore(String address, String password, String filePath)
-
getAccountBalance
public static Result getAccountBalance(String address, int chainId, int assetsId)
-
createOffLineAccount
public static Result<List<AccountDto>> createOffLineAccount(int count, String password)
-
createOffLineAccount
public static Result<List<AccountDto>> createOffLineAccount(int chainId, int count, String prefix, String password)
-
resetPasswordOffline
public static Result resetPasswordOffline(String address, String encryptedPriKey, String password, String newPassword)
-
getPriKeyOffline
public static Result getPriKeyOffline(String address, String encryptedPriKey, String password)
-
sign
public static Result sign(int chainId, String prefix, List<SignDto> signDtoList, String txHex)
-
sign
public static Result sign(String txHex, String address, String encryptedPrivateKey, String password)
-
sign
public static Result sign(String txHex, int chainId, String prefix, String address, String encryptedPrivateKey, String password)
-
multiSign
public Result multiSign(int chainId, String prefix, String address, String encryptedPrivateKey, String password, String txHex)
-
createMultiSignAccount
public static Result createMultiSignAccount(List<String> pubKeys, int minSigns)
-
getBlockHeader
public static Result getBlockHeader(long height)
-
getBlock
public static Result getBlock(long height)
-
getBestBlockHeader
public static Result getBestBlockHeader()
-
getBestBlock
public static Result getBestBlock()
-
transfer
public static Result transfer(TransferForm transferForm)
-
crossTransfer
public static Result crossTransfer(CrossTransferForm transferForm)
-
createTransferTxOffline
public static Result createTransferTxOffline(TransferDto transferDto)
-
createTxSimpleTransferOfNonNuls
public static Result createTxSimpleTransferOfNonNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount)
便捷版 组装在NULS链内,转账非NULS资产的单账户对单账户普通转账(不能用于转NULS)。 该方法会主动用fromAddress组装(NULS资产)打包手续费。 如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装- 参数:
fromAddress- 转出地址(NULS地址)toAddress- 转入地址(NULS地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 到账数量- 返回:
- 交易hex
-
createTxSimpleTransferOfNonNuls
public static Result createTxSimpleTransferOfNonNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount, long time, String remark)
便捷版 组装在NULS链内,转账非NULS资产的单账户对单账户普通转账(不能用于转NULS)。 该方法会主动用fromAddress组装(NULS资产)打包手续费。 如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装- 参数:
fromAddress- 转出地址(NULS地址)toAddress- 转入地址(NULS地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 到账数量time- 交易时间remark- 备注- 返回:
- 交易hex
-
createTxSimpleTransferOfNuls
public static Result createTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount)
便捷版 组装在NULS链内,转账NULS资产的单账户对单账户普通转账(只能用于转NULS)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。 如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装- 参数:
fromAddress- 转出地址(NULS地址)toAddress- 转入地址(NULS地址)amount- 到账数量(不含手续费)- 返回:
- 交易hex
-
createTxSimpleTransferOfNuls
public static Result createTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount, long time, String remark)
便捷版 组装在NULS链内,转账NULS资产的单账户对单账户普通转账(只能用于转NULS)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。 如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装- 参数:
fromAddress- 转出地址(NULS地址)toAddress- 转入地址(NULS地址)amount- 到账数量(不含手续费)time- 交易时间remark- 备注- 返回:
- 交易hex
-
createCrossTxSimpleTransferOfNonNuls
public static Result createCrossTxSimpleTransferOfNonNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount, long time, String remark)
跨链交易 便捷版 组装跨链转账非NULS资产的单账户对单账户普通跨链转账(不能用于转NULS)。 该方法会主动用fromAddress组装(NULS资产)打包手续费。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(NULS地址)toAddress- 转入地址(非NULS地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 转账token数量time- 交易时间remark- 备注- 返回:
-
createCrossTxSimpleTransferOfNonNuls
public static Result createCrossTxSimpleTransferOfNonNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount)
跨链交易 便捷版 组装跨链转账非NULS资产的单账户对单账户普通跨链转账(不能用于转NULS)。 该方法会主动用fromAddress组装(NULS资产)打包手续费。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(NULS地址)toAddress- 转入地址(非NULS地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 转账token数量- 返回:
-
createCrossTxSimpleTransferOfNuls
public static Result createCrossTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount, long time, String remark)
跨链交易 便捷版 组装跨链转账NULS资产的单账户对单账户普通跨链转账(只能用于转NULS)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress-toAddress- (非NULS地址)amount-time-remark-- 返回:
-
createCrossTxSimpleTransferOfNuls
public static Result createCrossTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount)
跨链交易 便捷版 组装跨链转账NULS资产的单账户对单账户普通跨链转账(只能用于转NULS)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress-toAddress- (非NULS地址)amount-- 返回:
-
createCrossTransferTxOffline
public static Result createCrossTransferTxOffline(TransferDto transferDto)
-
calcTransferTxFee
public static BigInteger calcTransferTxFee(TransferTxFeeDto dto)
-
calcCrossTransferTxFee
@Deprecated public static Map<String,BigInteger> calcCrossTransferTxFee(CrossTransferTxFeeDto dto)
已过时。
-
calcCrossTransferNulsTxFee
public static BigInteger calcCrossTransferNulsTxFee(CrossTransferTxFeeDto dto)
-
createMultiSignTransferTxOffline
public static Result createMultiSignTransferTxOffline(MultiSignTransferDto transferDto)
-
calcMultiSignTransferTxFee
public static BigInteger calcMultiSignTransferTxFee(MultiSignTransferTxFeeDto dto)
-
createMultiSignAliasTxOffline
public static Result createMultiSignAliasTxOffline(MultiSignAliasDto dto)
-
createContract
public static Result createContract(ContractCreateForm form)
-
callContract
public static Result callContract(ContractCallForm form)
-
deleteContract
public static Result deleteContract(ContractDeleteForm form)
-
tokentransfer
public static Result tokentransfer(ContractTokenTransferForm form)
-
transferTocontract
public static Result transferTocontract(ContractTransferForm form)
-
getConstructor
public static Result<ContractConstructorInfoDto> getConstructor(String contractCode)
-
getContractMethod
public static Result getContractMethod(ContractMethodForm form)
-
getContractMethodArgsTypes
public static Result getContractMethodArgsTypes(ContractMethodForm form)
-
validateContractCreate
public static Result validateContractCreate(ContractValidateCreateForm form)
-
validateContractCall
public static Result validateContractCall(ContractValidateCallForm form)
-
validateContractDelete
public static Result validateContractDelete(ContractValidateDeleteForm form)
-
imputedContractCreateGas
public static Result imputedContractCreateGas(ImputedGasContractCreateForm form)
-
imputedContractCallGas
public static Result imputedContractCallGas(ImputedGasContractCallForm form)
-
invokeView
public static Result invokeView(ContractViewCallForm form)
-
createContractTxOffline
public static Result<Map> createContractTxOffline(String sender, BigInteger senderBalance, String nonce, String alias, String contractCode, long gasLimit, Object[] args, String[] argsType, String remark)
-
callContractTxOffline
public static Result<Map> callContractTxOffline(String sender, BigInteger senderBalance, String nonce, BigInteger value, String contractAddress, long gasLimit, String methodName, String methodDesc, Object[] args, String[] argsType, String remark, List<ProgramMultyAssetValue> multyAssetValues)
-
callContractTxOffline
public static Result<Map> callContractTxOffline(String sender, BigInteger senderBalance, String nonce, BigInteger value, String contractAddress, long gasLimit, String methodName, String methodDesc, Object[] args, String[] argsType, String remark)
-
deleteContractTxOffline
public static Result<Map> deleteContractTxOffline(String sender, BigInteger senderBalance, String nonce, String contractAddress, String remark)
-
tokenTransferTxOffline
public static Result<Map> tokenTransferTxOffline(String fromAddress, BigInteger senderBalance, String nonce, String toAddress, String contractAddress, long gasLimit, BigInteger amount, String remark)
-
tokenTransferTxOffline
public static Result<Map> tokenTransferTxOffline(String fromAddress, BigInteger senderBalance, String nonce, String toAddress, String contractAddress, long gasLimit, BigInteger amount, long time, String remark)
-
transferToContractTxOffline
public static Result<Map> transferToContractTxOffline(String fromAddress, BigInteger senderBalance, String nonce, String toAddress, long gasLimit, BigInteger amount, String remark)
-
createAgent
public static Result createAgent(CreateAgentForm form)
-
stopAgent
public static Result stopAgent(StopAgentForm form)
-
depositToAgent
public static Result depositToAgent(DepositForm form)
-
withdraw
public static Result withdraw(WithdrawForm form)
-
createConsensusTxOffline
public static Result createConsensusTxOffline(ConsensusDto consensusDto)
-
createDepositTxOffline
public static Result createDepositTxOffline(DepositDto depositDto)
-
createWithdrawDepositTxOffline
public static Result createWithdrawDepositTxOffline(WithDrawDto withDrawDto)
-
createStopConsensusTxOffline
public static Result createStopConsensusTxOffline(StopConsensusDto stopConsensusDto)
-
createMultiSignConsensusTx
public static Result createMultiSignConsensusTx(MultiSignConsensusDto consensusDto)
-
createMultiSignDepositTxOffline
public static Result createMultiSignDepositTxOffline(MultiSignDepositDto depositDto)
-
createMultiSignWithdrawDepositTxOffline
public static Result createMultiSignWithdrawDepositTxOffline(MultiSignWithDrawDto withDrawDto)
-
createMultiSignStopConsensusTx
public static Result createMultiSignStopConsensusTx(MultiSignStopConsensusDto stopConsensusDto)
-
deserializeTxHex
public static Result deserializeTxHex(String txHex)
根据交易的hex ,反序列化成交易实体类- 参数:
txHex-- 返回:
-
nrc20CrossChainTxOffline
public static Result<Map> nrc20CrossChainTxOffline(String fromAddress, BigInteger senderBalance, String nonce, String toAddress, String contractAddress, long gasLimit, BigInteger amount, long time, String remark)
-
getBalance
public static BigDecimal getBalance(int assetChainId, int assetId)
-
getSymbolInfo
public static Result getSymbolInfo(int assetChainId, int assetId)
-
-