Class TransactionHelper


  • public class TransactionHelper
    extends java.lang.Object
    This class is a helper class provides methods that handles Transaction object comfortably.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static AbstractTransaction getTransactionByHash​(Klay klay, java.lang.String transactionHash)
      Querys transaction from Klaytn and converts to a caver transaction instance.
      static boolean isEthereumTransaction​(int type)
      Returns true if the tx type is EthereumTransaction.
      static boolean isEthereumTransaction​(java.lang.String type)
      Returns true if the tx type is EthereumTransaction.
      static boolean isEthereumTypedTransaction​(int type)  
      static boolean isEthereumTypedTransaction​(java.lang.String type)  
      static java.util.List<java.lang.String> recoverFeePayerPublicKeys​(java.lang.String rawTx)
      Recovers the public keys from "feePayerSignatures" filed in raw transaction string.
      static java.util.List<java.lang.String> recoverPublicKeys​(java.lang.String rawTx)
      Recovers the public keys from "signatures" filed in raw transaction string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransactionHelper

        public TransactionHelper()
    • Method Detail

      • getTransactionByHash

        public static AbstractTransaction getTransactionByHash​(Klay klay,
                                                               java.lang.String transactionHash)
        Querys transaction from Klaytn and converts to a caver transaction instance.
        Parameters:
        klay - The Klay instance.
        transactionHash - The transaction hash string to query from Klaytn.
        Returns:
        AbstractTransaction
        See Also:
        Example :
      • recoverPublicKeys

        public static java.util.List<java.lang.String> recoverPublicKeys​(java.lang.String rawTx)
        Recovers the public keys from "signatures" filed in raw transaction string.

        If you want to derive an address from public key, please use Utils.publicKeyToAddress(String)

        Example :
         
         List<String> publicKeys = caver.transaction.recoverPublicKeys("0x{RLP-encoded transaction string}");
         
         
        Parameters:
        rawTx - The RLP-encoded transaction string to recover public keys from "signatures".
        Returns:
        List<String>
      • recoverFeePayerPublicKeys

        public static java.util.List<java.lang.String> recoverFeePayerPublicKeys​(java.lang.String rawTx)
        Recovers the public keys from "feePayerSignatures" filed in raw transaction string.

        If you want to derive an address from public key, please use Utils.publicKeyToAddress(String)

        Example :
         
         List<String> publicKeys = caver.transaction.recoverFeePayerPublicKeys("0x{RLP-encoded transaction string}");
         
         
        Parameters:
        rawTx - The RLP-encoded transaction string to recover public keys from "signatures".
        Returns:
        List<String>
      • isEthereumTransaction

        public static boolean isEthereumTransaction​(int type)
        Returns true if the tx type is EthereumTransaction.
        Parameters:
        type - Transaction type integer.
        Returns:
      • isEthereumTransaction

        public static boolean isEthereumTransaction​(java.lang.String type)
        Returns true if the tx type is EthereumTransaction.
        Parameters:
        type - Transaction type string.
        Returns:
      • isEthereumTypedTransaction

        public static boolean isEthereumTypedTransaction​(int type)
      • isEthereumTypedTransaction

        public static boolean isEthereumTypedTransaction​(java.lang.String type)