程序包 io.nuls.v2.util

类 NulsSDKTool


  • public class NulsSDKTool
    extends Object
    • 构造器详细资料

      • NulsSDKTool

        public NulsSDKTool()
    • 方法详细资料

      • getInfo

        public static Result<Map> getInfo()
      • getAccountBalance

        public static Result getAccountBalance​(String address,
                                               int chainId,
                                               int assetsId)
      • validateAddress

        public static Result validateAddress​(String address)
      • validateAddress

        public static Result validateAddress​(int chainId,
                                             String address)
      • resetPasswordOffline

        public static Result resetPasswordOffline​(String address,
                                                  String encryptedPriKey,
                                                  String password,
                                                  String newPassword)
      • getPriKeyOffline

        public static Result getPriKeyOffline​(String address,
                                              String encryptedPriKey,
                                              String password)
      • createMultiSignAccount

        public static Result createMultiSignAccount​(List<String> pubKeys,
                                                    int minSigns)
      • getAddressByPriKey

        public static Result getAddressByPriKey​(String priKey)
      • changeV1addressToV2address

        public static Result changeV1addressToV2address​(String v1Address)
      • getBlockHeader

        public static Result getBlockHeader​(long height)
      • getBlockHeader

        public static Result getBlockHeader​(String hash)
      • getBlock

        public static Result getBlock​(long height)
      • getBestBlockHeader

        public static Result getBestBlockHeader()
      • getBestBlock

        public static Result getBestBlock()
      • getTransaction

        public static Result getTransaction​(String txHash)
      • validateTx

        public static Result validateTx​(String txHex)
      • broadcast

        public static Result broadcast​(String txHex)
      • 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 - 转账资产链id
        assetId - 转账资产id
        amount - 到账数量
        返回:
        交易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 - 转账资产链id
        assetId - 转账资产id
        amount - 到账数量
        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 - 转账资产链id
        assetId - 转账资产id
        amount - 转账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 - 转账资产链id
        assetId - 转账资产id
        amount - 转账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)
      • createAliasTxOffline

        public static Result createAliasTxOffline​(AliasDto dto)
      • getTokenBalance

        public static Result getTokenBalance​(String contractAddress,
                                             String address)
      • getContractInfo

        public static Result getContractInfo​(String contractAddress)
      • getContractResult

        public static Result getContractResult​(String hash)
      • getDepositList

        public static Result getDepositList​(String agentHash)
      • 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)
      • createMultiSignWithdrawDepositTxOffline

        public static Result createMultiSignWithdrawDepositTxOffline​(MultiSignWithDrawDto withDrawDto)
      • deserializeTxHex

        public static Result deserializeTxHex​(String txHex)
        根据交易的hex ,反序列化成交易实体类
        参数:
        txHex -
        返回:
      • getBalance

        public static BigDecimal getBalance​(int assetChainId,
                                            int assetId)
      • getSymbolInfo

        public static Result getSymbolInfo​(int assetChainId,
                                           int assetId)