类 NerveSDKTool
- java.lang.Object
-
- network.nerve.kit.util.NerveSDKTool
-
public class NerveSDKTool extends Object
-
-
构造器概要
构造器 构造器 说明 NerveSDKTool()
-
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 static Resultbroadcast(String txHex)static Map<String,BigInteger>calcCrossTransferTxFee(CrossTransferTxFeeDto dto)已过时。static BigIntegercalcMultiSignTransferTxFee(MultiSignTransferTxFeeDto dto)static BigIntegercalcTransferTxFee(TransferTxFeeDto dto)static Result<List<String>>createAccount(int count, String password)static ResultcreateAliasTxOffline(AliasDto dto)static ResultcreateCrossTransferTxOffline(TransferDto transferDto)跨链交易static ResultcreateCrossTxSimpleTransferOfNonNvtNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount)跨链交易 便捷版 组装跨链转账非[NULS和NVT]资产的单账户对单账户普通跨链转账(不能用于转NULS和NVT),用于将资产转入NULS主网。static ResultcreateCrossTxSimpleTransferOfNonNvtNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount, long time, String remark)跨链交易 便捷版 组装跨链转账非[NULS和NVT]资产的单账户对单账户普通跨链转账(不能用于转NULS和NVT),用于将资产转入NULS主网。static ResultcreateCrossTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount)跨链交易 便捷版 组装跨链转账NULS资产的单账户对单账户跨链转账,用于将NULS资产转入NULS主网(只能用于转NULS)。static ResultcreateCrossTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount, long time, String remark)跨链交易 便捷版 组装跨链转账NULS资产的单账户对单账户跨链转账,用于将NULS资产转入NULS主网(只能用于转NULS)。static ResultcreateCrossTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount)跨链交易 便捷版 组装跨链转账NVT资产的单账户对单账户跨链转账,用于将NVT资产转入NULS主网(只能用于转NVT)。static ResultcreateCrossTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount, long time, String remark)跨链交易 便捷版 组装跨链转账NVT资产的单账户对单账户跨链转账,用于将NVT资产转入NULS主网(只能用于转NVT)。static ResultcreateMultiSignAccount(List<String> pubKeys, int minSigns)static ResultcreateMultiSignAliasTxOffline(MultiSignAliasDto dto)static ResultcreateMultiSignTransferTxOffline(MultiSignTransferDto transferDto)static Result<List<AccountDto>>createOffLineAccount(int chainId, int count, String prefix, String password)static Result<List<AccountDto>>createOffLineAccount(int count, String password)static ResultcreateTransferTxOffline(TransferDto transferDto)转账交易static ResultcreateTxSimpleTransferOfNonNvt(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount)便捷版 组装在NULS链内,转账非NVT资产的单账户对单账户普通转账(不能用于转NVT)。static ResultcreateTxSimpleTransferOfNonNvt(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount, long time, String remark)便捷版 组装在NULS链内,转账非NVT资产的单账户对单账户普通转账(不能用于转NVT)。static ResultcreateTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount)便捷版 组装在NULS链内,转账NVT资产的单账户对单账户普通转账(只能用于转NVT)。static ResultcreateTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount, long time, String remark)便捷版 组装在NULS链内,转账NVT资产的单账户对单账户普通转账(只能用于转NVT)。static ResultcreateWithdrawalTx(WithdrawalTxDto withdrawalTxDto)异构链提现交易static ResultcreateWithdrawalTx(WithdrawalTxDto withdrawalTxDto, String withdrawalAssetNonce, String nvtFeeAssetNonce)异构链提现交易(完全离线状态)static ResultcrossTransfer(CrossTransferForm transferForm)static ResultdeserializeTxHex(String txHex)根据交易的hex ,反序列化成交易实体类static ResultexportKeyStore(String address, String password, String filePath)static ResultgetAccountBalance(String address, int chainId, int assetsId)static ResultgetAddressByPriKey(String priKey)static ResultgetBestBlock()static ResultgetBestBlockHeader()static ResultgetBlock(long height)static ResultgetBlock(String hash)static ResultgetBlockHeader(long height)static ResultgetBlockHeader(String hash)static Result<Map>getInfo()static ResultgetPriKey(String address, String password)static ResultgetPriKeyOffline(String address, String encryptedPriKey, String password)static ResultgetSymbolInfo(int assetChainId, int assetId)static ResultgetTransaction(String txHash)static ResultgetTx(String txHash)static BigDecimalgetUsdPrice(int assetChainId, int assetId)static ResultimportKeystore(AccountKeyStoreDto keyStore, String password)static ResultimportPriKey(String priKey, String password)ResultmultiSign(int chainId, String prefix, String address, String encryptedPrivateKey, String password, String txHex)static ResultmultiSign(SignDto signDto, String txHex)static ResultresetPassword(String address, String oldPassword, String newPassword)static ResultresetPasswordOffline(String address, String encryptedPriKey, String password, String newPassword)static ResultsetAlias(String address, String alias, String password)static Resultsign(int chainId, String prefix, List<SignDto> signDtoList, String txHex)static Resultsign(String txHex, int chainId, String prefix, String address, String encryptedPrivateKey, String password)static Resultsign(String txHex, String address, String privateKey)static Resultsign(String txHex, String address, String encryptedPrivateKey, String password)static Resultsign(List<SignDto> signDtoList, String txHex)static ResultstableSwapAddLiquidity(String from, BigInteger amount, NerveToken token, String pairAddress, Long deadline, String to, String remark)Stable-Swap 添加StableSwap流动性static ResultstableSwapRemoveLiquidity(String from, BigInteger amountLP, NerveToken tokenLP, Integer[] receiveOrderIndexs, String pairAddress, Long deadline, String to, String remark)Stable-Swap 移除StableSwap流动性static ResultstableSwapTradeTx(String from, String to, NerveTokenAmount[] tokenAmountIns, int tokenOutIndex, String pairAddress, String feeTo, String remark)Stable-Swap稳定币兑换交易static Resulttransfer(TransferForm transferForm)static ResultvalidateAddress(int chainId, String address)static ResultvalidateAddress(String address)static ResultvalidateTx(String txHex)static ResultwithdrawalAdditionalFeeTx(String fromAddress, String txHash, BigInteger amount, long time, String remark)追加异构提现手续费 1.不能为已完成的提现交易追加手续费 2.提现交易与追加手续费交易必须由相同的地址发起(相同私钥签名)static ResultwithdrawalAdditionalFeeTx(String fromAddress, String txHash, BigInteger amount, long time, String remark, String nonce)追加异构提现手续费(完全离线状态) 1.不能为已完成的提现交易追加手续费 2.提现交易与追加手续费交易必须由相同的地址发起(相同私钥签名)
-
-
-
方法详细资料
-
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)
转账交易
-
createTxSimpleTransferOfNonNvt
public static Result createTxSimpleTransferOfNonNvt(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount)
便捷版 组装在NULS链内,转账非NVT资产的单账户对单账户普通转账(不能用于转NVT)。 该方法会主动用fromAddress组装(NVT资产)打包手续费。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(NERVE地址)toAddress- 转入地址(NERVE地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 到账数量- 返回:
- 交易hex
-
createTxSimpleTransferOfNonNvt
public static Result createTxSimpleTransferOfNonNvt(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount, long time, String remark)
便捷版 组装在NULS链内,转账非NVT资产的单账户对单账户普通转账(不能用于转NVT)。 该方法会主动用fromAddress组装(NVT资产)打包手续费。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(NERVE地址)toAddress- 转入地址(NERVE地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 到账数量time- 交易时间remark- 备注- 返回:
- 交易hex
-
createTxSimpleTransferOfNvt
public static Result createTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount)
便捷版 组装在NULS链内,转账NVT资产的单账户对单账户普通转账(只能用于转NVT)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(NERVE地址)toAddress- 转入地址(NERVE地址)amount- 到账数量(不含手续费)- 返回:
- 交易hex
-
createTxSimpleTransferOfNvt
public static Result createTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount, long time, String remark)
便捷版 组装在NULS链内,转账NVT资产的单账户对单账户普通转账(只能用于转NVT)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(NERVE地址)toAddress- 转入地址(NERVE地址)amount- 到账数量(不含手续费)time- 交易时间remark- 备注- 返回:
- 交易hex
-
createCrossTransferTxOffline
public static Result createCrossTransferTxOffline(TransferDto transferDto)
跨链交易
-
createCrossTxSimpleTransferOfNonNvtNuls
public static Result createCrossTxSimpleTransferOfNonNvtNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount, long time, String remark)
跨链交易 便捷版 组装跨链转账非[NULS和NVT]资产的单账户对单账户普通跨链转账(不能用于转NULS和NVT),用于将资产转入NULS主网。 该方法会主动用fromAddress组装(NULS和NVT资产)打包手续费。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(当前链地址)toAddress- 转入地址(NULS地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 转账token数量time- 交易时间remark- 备注- 返回:
-
createCrossTxSimpleTransferOfNonNvtNuls
public static Result createCrossTxSimpleTransferOfNonNvtNuls(String fromAddress, String toAddress, int assetChainId, int assetId, BigInteger amount)
跨链交易 便捷版 组装跨链转账非[NULS和NVT]资产的单账户对单账户普通跨链转账(不能用于转NULS和NVT),用于将资产转入NULS主网。 该方法会主动用fromAddress组装(NULS和NVT资产)打包手续费。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(当前链地址)toAddress- 转入地址(NULS地址)assetChainId- 转账资产链idassetId- 转账资产idamount- 转账token数量- 返回:
-
createCrossTxSimpleTransferOfNuls
public static Result createCrossTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount, long time, String remark)
跨链交易 便捷版 组装跨链转账NULS资产的单账户对单账户跨链转账,用于将NULS资产转入NULS主网(只能用于转NULS)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取(NULS和NVT资产)手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(当前链地址)toAddress- 转入地址(NULS地址)amount-time-remark-- 返回:
-
createCrossTxSimpleTransferOfNuls
public static Result createCrossTxSimpleTransferOfNuls(String fromAddress, String toAddress, BigInteger amount)
跨链交易 便捷版 组装跨链转账NULS资产的单账户对单账户跨链转账,用于将NULS资产转入NULS主网(只能用于转NULS)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取(NULS和NVT资产)手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(当前链地址)toAddress- 转入地址(NULS地址)amount-- 返回:
-
createCrossTxSimpleTransferOfNvt
public static Result createCrossTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount, long time, String remark)
跨链交易 便捷版 组装跨链转账NVT资产的单账户对单账户跨链转账,用于将NVT资产转入NULS主网(只能用于转NVT)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取(NULS和NVT资产)手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(当前链地址)toAddress- 转入地址(NULS地址)amount-time-remark-- 返回:
-
createCrossTxSimpleTransferOfNvt
public static Result createCrossTxSimpleTransferOfNvt(String fromAddress, String toAddress, BigInteger amount)
跨链交易 便捷版 组装跨链转账NVT资产的单账户对单账户跨链转账,用于将NVT资产转入NULS主网(只能用于转NVT)。 !! 打包手续费不包含在amount中, 本函数将从fromAddress中额外获取(NULS和NVT资产)手续费追加到coinfrom中, 请不要将手续费事先加入到amount参数中, amount参数作为实际到账的数量。如果需要完整信息或结构更复杂的转账(比如多账户),请使用完全版的离线交易组装
- 参数:
fromAddress- 转出地址(当前链地址)toAddress- 转入地址(NULS地址)amount-- 返回:
-
createWithdrawalTx
public static Result createWithdrawalTx(WithdrawalTxDto withdrawalTxDto)
异构链提现交易- 参数:
withdrawalTxDto-- 返回:
-
withdrawalAdditionalFeeTx
public static Result withdrawalAdditionalFeeTx(String fromAddress, String txHash, BigInteger amount, long time, String remark)
追加异构提现手续费 1.不能为已完成的提现交易追加手续费 2.提现交易与追加手续费交易必须由相同的地址发起(相同私钥签名)- 参数:
fromAddress- 转出地址(支付手续费地址)txHash- 要追加手续费的提现交易hashamount- 追加手续费数量time- 时间remark- 备注- 返回:
-
createWithdrawalTx
public static Result createWithdrawalTx(WithdrawalTxDto withdrawalTxDto, String withdrawalAssetNonce, String nvtFeeAssetNonce)
异构链提现交易(完全离线状态)
-
withdrawalAdditionalFeeTx
public static Result withdrawalAdditionalFeeTx(String fromAddress, String txHash, BigInteger amount, long time, String remark, String nonce)
追加异构提现手续费(完全离线状态) 1.不能为已完成的提现交易追加手续费 2.提现交易与追加手续费交易必须由相同的地址发起(相同私钥签名)- 参数:
fromAddress- 转出地址(支付手续费地址)txHash- 要追加手续费的提现交易hashamount- 追加手续费数量time- 时间remark- 备注- 返回:
-
calcTransferTxFee
public static BigInteger calcTransferTxFee(TransferTxFeeDto dto)
-
calcCrossTransferTxFee
@Deprecated public static Map<String,BigInteger> calcCrossTransferTxFee(CrossTransferTxFeeDto dto)
已过时。
-
createMultiSignTransferTxOffline
public static Result createMultiSignTransferTxOffline(MultiSignTransferDto transferDto)
-
calcMultiSignTransferTxFee
public static BigInteger calcMultiSignTransferTxFee(MultiSignTransferTxFeeDto dto)
-
createMultiSignAliasTxOffline
public static Result createMultiSignAliasTxOffline(MultiSignAliasDto dto)
-
deserializeTxHex
public static Result deserializeTxHex(String txHex)
根据交易的hex ,反序列化成交易实体类- 参数:
txHex-- 返回:
-
getUsdPrice
public static BigDecimal getUsdPrice(int assetChainId, int assetId)
-
getSymbolInfo
public static Result getSymbolInfo(int assetChainId, int assetId)
-
stableSwapTradeTx
public static Result stableSwapTradeTx(String from, String to, NerveTokenAmount[] tokenAmountIns, int tokenOutIndex, String pairAddress, String feeTo, String remark)
Stable-Swap稳定币兑换交易
-
stableSwapAddLiquidity
public static Result stableSwapAddLiquidity(String from, BigInteger amount, NerveToken token, String pairAddress, Long deadline, String to, String remark)
Stable-Swap 添加StableSwap流动性
-
stableSwapRemoveLiquidity
public static Result stableSwapRemoveLiquidity(String from, BigInteger amountLP, NerveToken tokenLP, Integer[] receiveOrderIndexs, String pairAddress, Long deadline, String to, String remark)
Stable-Swap 移除StableSwap流动性
-
-