Recovers the public key strings from feePayerSignatures field of the given transaction.
Parameters
Name
Type
Description
rawTx
string
The RLP-encoded transaction string to recover public keys from feePayerSignatures. To recover fee payer's public keys, the transaction should be a fee-delegated transaction with the feePayerSignatures field inside.
Return Value
Type
Description
Array
An array containing public keys recovered from feePayerSignatures.
트랜잭션 fee payer로서 서명하며, keyring 내 개인키를 사용하여 트랜잭션 객체에 feePayerSignatures를 첨부합니다.
transaction.feePayer가 정의되어 있지 않은 경우, 주어진 keyring의 주소는 transaction.feePayer로 설정됩니다.
참고 이 함수는 "수수료 대납" 트랜잭션 또는 "수수료 부분 대납" 트랜잭션에서만 작동합니다.
Parameters
Name
Type
Description
keyring
object \
string
index
number
(optional) The index of the private key you want to use. The index must be less than the length of the array of the private keys defined for each role. If an index is not defined, this method will use all the private keys.
hasher
Function
(optional) The hash function to get the hash of the transaction.
Return Value
Promise returning object: The signed transaction.
Type
Description
object
Example
// This example uses the FeeDelegatedValueTransfer transaction.
> const transaction = caver.transaction.feeDelegatedValueTransfer.create({
from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
value: 1,
gas: 30000,
})
> const customHasher = () => { ... }
// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey
> transaction.signAsFeePayer(roleBasedKeyring).then(console.log)
FeeDelegatedValueTransfer {
_type: 'TxTypeFeeDelegatedValueTransfer',
_from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
_gas: '0x7530',
_signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
_feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
_feePayerSignatures: [
SignatureData { _v: '0x4e44', _r: '0x7010e...', _s: '0x65d6b...' },
SignatureData { _v: '0x4e43', _r: '0x96ef2...', _s: '0x77f34...' }
],
_to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
_value: '0x1',
_chainId: '0x2710',
_gasPrice: '0x5d21dba00',
_nonce: '0x0'
}
// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey and index
> transaction.signAsFeePayer(roleBasedKeyring, 1).then(console.log)
FeeDelegatedValueTransfer {
_type: 'TxTypeFeeDelegatedValueTransfer',
_from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
_gas: '0x7530',
_signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
_feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
_feePayerSignatures: [
SignatureData { _v: '0x4e43', _r: '0x96ef2...', _s: '0x77f34...' }
],
_to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
_value: '0x1',
_chainId: '0x2710',
_gasPrice: '0x5d21dba00',
_nonce: '0x0'
}
// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey and hasher
> transaction.signAsFeePayer(roleBasedKeyring, customHasher).then(console.log)
FeeDelegatedValueTransfer {
_type: 'TxTypeFeeDelegatedValueTransfer',
_from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
_gas: '0x7530',
_signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
_feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
_feePayerSignatures: [
SignatureData { _v: '0x4e43', _r: '0xe48bf...', _s: '0x1cf36...' },
SignatureData { _v: '0x4e43', _r: '0x82976...', _s: '0x3c5e0...' }
],
_to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
_value: '0x1',
_chainId: '0x2710',
_gasPrice: '0x5d21dba00',
_nonce: '0x0'
}
// Sign a transaction with the address of RoleBasedKeyring which use two private keys for roleFeePayerKey, index and hasher
> transaction.signAsFeePayer(roleBasedKeyring, 1, customHasher).then(console.log)
FeeDelegatedValueTransfer {
_type: 'TxTypeFeeDelegatedValueTransfer',
_from: '0x6fddbcb99d31b8755c2b840a367f53eea4b4f45c',
_gas: '0x7530',
_signatures: [ SignatureData { _v: '0x01', _r: '0x', _s: '0x' } ],
_feePayer: '0xe7e9184c125020af5d34eab7848bab799a1dcba9',
_feePayerSignatures: [
SignatureData { _v: '0x4e43', _r: '0x82976...', _s: '0x3c5e0...' }
],
_to: '0x3424b91026bdc5ec55df4548e6ebf0f28b60abd7',
_value: '0x1',
_chainId: '0x2710',
_gasPrice: '0x5d21dba00',
_nonce: '0x0'
}
Collects signs in each RLP-encoded transaction string in the given array, combines them with the transaction instance, and returns a RLP-encoded transaction string which includes all signs. Note that the transaction instance doesn't necessarily be signed in advance. If the transaction is either a type of "fee-delegated" or "fee-delegated with ratio", feePayerSignatures is also merged and included in the output RLP-encoded transaction string.
Parameters
Name
Type
Description
rlpEncodedTxs
Array
An array of signed RLP-encoded transaction strings.
Return Value
Type
Description
string
A RLP-encoded transaction string which includes all signatures (and feePayerSignatures if transaction is a type of either "fee-delgated" or "fee-delegated with ratio").
수수료 납부자의 서명을 생성하기 위한 RLP 인코딩된 트랜잭션 문자열을 반환합니다. Note that the returned RLP-encoded transaction string is not added with the signature and rather is used to generate this signature.
NOTE This function works only for "fee-delegated" transactions or "fee-delegated with ratio" transactions.
Return Value
Type
Description
string
A RLP-encoded transaction string without any signature attached.
Before the Magma hard fork, suggestGasPrice returns the unit price of the network. After the Magma hard fork, suggestGasPrice returns baseFee * 2 which is recommended to use as gasPrice.
Return Value
Promise returning string: The suggested gas price in hexadecimal string.
An instance of . For details of each transaction, refer to .
NOTEcaver.transaction.getTransactionByHash is supported since caver-js .
Promise returning object: An instance of . If it fails to receive a transaction object from Klaytn, an error occurs.
An instance of . For details of each transaction, refer to .
NOTEcaver.transaction.recoverPublicKeys is supported since caver-js .
NOTEcaver.transaction.recoverFeePayerPublicKeys is supported since caver-js .
For transaction, use , or otherwise, use in . If the user has not defined an index, transaction.sign signs the transaction using all the private keys used by the role. If index is defined, the transaction.sign signs the transaction using only one private key at the given index.
An instance of signed . The signature is appended to the transaction.signatures.
For signing a transaction as a fee payer, use in keyring. 사용자가 index를 정의하지 않았다면, transaction.signAsFeePayer이 해당 역할에 의해 사용되는 모든 개인키를 가지고 트랜잭션에 서명합니다. index가 정의되어 있다면, transaction.signAsFeePayer이 주어진 인덱스에 대응하는 하나의 개인키를 가지고 트랜잭션에 서명합니다.
If the keyring to be used for signing the transaction was added to caver.wallet, you can use .
An instance of signed . The signature is appended to the transaction.feePayerSignatures.
For information on how to make the RLP-encoded string for each transaction type, see .
rawTransaction 문자열을 반환합니다(RLP 인코딩된 트랜잭션 문자열). This function is same with .
For information on how to make the transaction hash for each transaction type, see .
Returns a of transaction.
The is a hash of the transaction except for the fee payer's address and signature, so and are the same for basic transactions.
For information on how to make the for each transaction type, see .
For information on how to make a RLP-encoded transaction string to generate the transaction sender's signature for each transaction type, see .
For information on how to make a RLP-encoded transaction string to generate the fee payer's signature for each transaction type, see .
Use to get gasPrice, to get nonce and call to get chainId.
참고transaction.recoverPublicKeys는 caver-js 부터 지원됩니다.
참고transaction.recoverFeePayerPublicKeys는 caver-js 부터 지원됩니다.
Returns suggested gas price. This function is used to set gasPrice field in the .
NOTEtransaction.suggestGasPrice is supported since caver-js .