Package com.klaytn.caver.transaction
Class AbstractFeeDelegatedTransaction
- java.lang.Object
-
- com.klaytn.caver.transaction.AbstractTransaction
-
- com.klaytn.caver.transaction.AbstractFeeDelegatedTransaction
-
- Direct Known Subclasses:
AbstractFeeDelegatedWithRatioTransaction
,FeeDelegatedAccountUpdate
,FeeDelegatedCancel
,FeeDelegatedChainDataAnchoring
,FeeDelegatedSmartContractDeploy
,FeeDelegatedSmartContractExecution
,FeeDelegatedValueTransfer
,FeeDelegatedValueTransferMemo
public abstract class AbstractFeeDelegatedTransaction extends AbstractTransaction
Abstract class that implements common logic for each fee delegated transaction type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractFeeDelegatedTransaction.Builder<B extends AbstractFeeDelegatedTransaction.Builder>
Represent a AbstractFeeDelegatedTransaction builder
-
Constructor Summary
Constructors Constructor Description AbstractFeeDelegatedTransaction(Klay klaytnCall, java.lang.String type, java.lang.String from, java.lang.String nonce, java.lang.String gas, java.lang.String chainId, java.util.List<SignatureData> signatures, java.lang.String feePayer, java.util.List<SignatureData> feePayerSignatures)
Create an AbstractFeeDelegatedTransaction instanceAbstractFeeDelegatedTransaction(AbstractFeeDelegatedTransaction.Builder builder)
Create an AbstractFeeDelegatedTransaction instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendFeePayerSignatures(SignatureData signatureData)
Appends fee payer's signatures to the transaction.void
appendFeePayerSignatures(java.util.List<SignatureData> signatureData)
Appends fee payer's signatures to the transaction.boolean
compareTxField(AbstractFeeDelegatedTransaction txObj, boolean checkSig)
Check equals txObj passed parameter and current instance.java.lang.String
getFeePayer()
Getter function for feePayerjava.util.List<SignatureData>
getFeePayerSignatures()
Getter function for feePayerSignaturesjava.lang.String
getRLPEncodingForFeePayerSignature()
Returns a RLP-encoded transaction string for making fee payer's signature.java.util.List<java.lang.String>
recoverFeePayerPublicKeys()
Recovers the public key strings from "feePayerSignatures" field in transaction object.void
setFeePayer(java.lang.String feePayer)
Setter function for feePayervoid
setFeePayerSignatures(java.util.List<SignatureData> feePayerSignatures)
AbstractFeeDelegatedTransaction
signAsFeePayer(AbstractKeyring keyring)
Sign the transaction as a fee payer using all private keys used as roleFeePayerKey in the Keyring instance.AbstractFeeDelegatedTransaction
signAsFeePayer(AbstractKeyring keyring, int index)
Sign the the transaction as a fee payer using a private key at the index among the private keys used as roleFeePayerKey in the Keyring instance.AbstractFeeDelegatedTransaction
signAsFeePayer(AbstractKeyring keyring, int index, java.util.function.Function<AbstractFeeDelegatedTransaction,java.lang.String> hasher)
Sign the the transaction as a fee payer using a private key at the index among the private keys used as roleFeePayerKey in the Keyring instance.AbstractFeeDelegatedTransaction
signAsFeePayer(AbstractKeyring keyring, java.util.function.Function<AbstractFeeDelegatedTransaction,java.lang.String> hasher)
Sign the transaction as a fee payer using all private keys used as roleFeePayerKey in the Keyring instance.AbstractFeeDelegatedTransaction
signAsFeePayer(java.lang.String keyString)
Signs to the transaction with a single private key as a fee payer.AbstractFeeDelegatedTransaction
signAsFeePayer(java.lang.String keyString, java.util.function.Function<AbstractFeeDelegatedTransaction,java.lang.String> hasher)
Signs to the transaction with a single private key as a fee payer.-
Methods inherited from class com.klaytn.caver.transaction.AbstractTransaction
appendSignatures, appendSignatures, combineSignedRawTransactions, compareTxField, fillTransaction, getChainId, getCommonRLPEncodingForSignature, getFrom, getGas, getKeyType, getKlaytnCall, getNonce, getRawTransaction, getRLPEncoding, getRLPEncodingForSignature, getSenderTxHash, getSignatures, getTransactionHash, getType, recoverPublicKeys, refineSignature, setChainId, setChainId, setFrom, setGas, setGas, setKlaytnCall, setNonce, setNonce, setSignatures, setType, sign, sign, sign, sign, sign, sign, suggestGasPrice, validateOptionalValues
-
-
-
-
Constructor Detail
-
AbstractFeeDelegatedTransaction
public AbstractFeeDelegatedTransaction(AbstractFeeDelegatedTransaction.Builder builder)
Create an AbstractFeeDelegatedTransaction instance- Parameters:
builder
- AbstractFeeDelegatedTransaction.Builder
-
AbstractFeeDelegatedTransaction
public AbstractFeeDelegatedTransaction(Klay klaytnCall, java.lang.String type, java.lang.String from, java.lang.String nonce, java.lang.String gas, java.lang.String chainId, java.util.List<SignatureData> signatures, java.lang.String feePayer, java.util.List<SignatureData> feePayerSignatures)
Create an AbstractFeeDelegatedTransaction instance- Parameters:
klaytnCall
- Klay RPC instancetype
- Transaction's type stringfrom
- The address of the sender.nonce
- A value used to uniquely identify a sender’s transaction.gas
- The maximum amount of gas the transaction is allowed to use.chainId
- Network IDsignatures
- A Signature listfeePayer
- The address of the fee payer.feePayerSignatures
- The fee payers's signatures.
-
-
Method Detail
-
signAsFeePayer
public AbstractFeeDelegatedTransaction signAsFeePayer(java.lang.String keyString) throws java.io.IOException
Signs to the transaction with a single private key as a fee payer. It sets Hasher default value. - signer : TransactionHasher.getHashForFeePayerSignature()- Parameters:
keyString
- The private key string.- Returns:
- AbstractFeeDelegatedTransaction
- Throws:
java.io.IOException
-
signAsFeePayer
public AbstractFeeDelegatedTransaction signAsFeePayer(java.lang.String keyString, java.util.function.Function<AbstractFeeDelegatedTransaction,java.lang.String> hasher) throws java.io.IOException
Signs to the transaction with a single private key as a fee payer.- Parameters:
keyString
- The private key string.hasher
- The function to get hash of transaction.- Returns:
- AbstractFeeDelegatedTransaction
- Throws:
java.io.IOException
-
signAsFeePayer
public AbstractFeeDelegatedTransaction signAsFeePayer(AbstractKeyring keyring) throws java.io.IOException
Sign the transaction as a fee payer using all private keys used as roleFeePayerKey in the Keyring instance. It sets index and Hasher default value. - signer : TransactionHasher.getHashForFeePayerSignature()- Parameters:
keyring
- The Keyring instance.- Returns:
- AbstractFeeDelegatedTransaction
- Throws:
java.io.IOException
-
signAsFeePayer
public AbstractFeeDelegatedTransaction signAsFeePayer(AbstractKeyring keyring, int index) throws java.io.IOException
Sign the the transaction as a fee payer using a private key at the index among the private keys used as roleFeePayerKey in the Keyring instance.- Parameters:
keyring
- The Keyring instance.index
- The index of private key to use in Keyring instance.- Returns:
- AbstractFeeDelegatedTransaction
- Throws:
java.io.IOException
-
signAsFeePayer
public AbstractFeeDelegatedTransaction signAsFeePayer(AbstractKeyring keyring, java.util.function.Function<AbstractFeeDelegatedTransaction,java.lang.String> hasher) throws java.io.IOException
Sign the transaction as a fee payer using all private keys used as roleFeePayerKey in the Keyring instance.- Parameters:
keyring
- The Keyring instance.hasher
- The function to get hash of transaction.- Returns:
- AbstractFeeDelegatedTransaction
- Throws:
java.io.IOException
-
signAsFeePayer
public AbstractFeeDelegatedTransaction signAsFeePayer(AbstractKeyring keyring, int index, java.util.function.Function<AbstractFeeDelegatedTransaction,java.lang.String> hasher) throws java.io.IOException
Sign the the transaction as a fee payer using a private key at the index among the private keys used as roleFeePayerKey in the Keyring instance.- Parameters:
keyring
- The Keyring instance.index
- The index of private key to use in Keyring instance.hasher
- The function to get hash of transaction.- Returns:
- AbstractFeeDelegatedTransaction
- Throws:
java.io.IOException
-
appendFeePayerSignatures
public void appendFeePayerSignatures(SignatureData signatureData)
Appends fee payer's signatures to the transaction.- Parameters:
signatureData
- SignatureData instance contains ECDSA signature data
-
appendFeePayerSignatures
public void appendFeePayerSignatures(java.util.List<SignatureData> signatureData)
Appends fee payer's signatures to the transaction.- Parameters:
signatureData
- List of SignatureData contains ECDSA signature data
-
getRLPEncodingForFeePayerSignature
public java.lang.String getRLPEncodingForFeePayerSignature()
Returns a RLP-encoded transaction string for making fee payer's signature.- Returns:
- String
-
compareTxField
public boolean compareTxField(AbstractFeeDelegatedTransaction txObj, boolean checkSig)
Check equals txObj passed parameter and current instance.- Parameters:
txObj
- The AbstractFeeDelegatedTransaction Object to comparecheckSig
- Check whether signatures field is equal.- Returns:
- boolean
-
recoverFeePayerPublicKeys
public java.util.List<java.lang.String> recoverFeePayerPublicKeys()
Recovers the public key strings from "feePayerSignatures" field in transaction object.If you want to derive an address from public key, please use
Utils.publicKeyToAddress(String)
.Example :
List<String> publicKeys = tx.recoverFeePayerPublicKeys();
- Returns:
- List<String>
-
getFeePayer
public java.lang.String getFeePayer()
Getter function for feePayer- Returns:
- String
-
setFeePayer
public void setFeePayer(java.lang.String feePayer)
Setter function for feePayer- Parameters:
feePayer
- The address of fee payer.
-
getFeePayerSignatures
public java.util.List<SignatureData> getFeePayerSignatures()
Getter function for feePayerSignatures- Returns:
- List
-
setFeePayerSignatures
public void setFeePayerSignatures(java.util.List<SignatureData> feePayerSignatures)
-
-