caver.account is a package that provides functionality related to Account that is used when updating an account.
Class
Account
const account = new caver.account(address, accountKey)
Account is a class that contains information needed to update the of the account in the Klaytn blockchain platform (Klaytn). This is the default class for the caver.account package. To create an Account instance with public key string(s), please refer to caver.account.create.
const accountKeyLegacy = new caver.account.accountKey.accountKeyLegacy()
AccountKeyLegacy is used to update the AccountKey of an account in the Klaytn with . To create an Account instance with AccountKeyLegacy, please refer to caver.account.createWithAccountKeyLegacy.
AccountKeyPublic
const accountKeyPublic = new caver.account.accountKey.accountKeyPublic(publicKey)
AccountKeyPublic is used to update the AccountKey of an account in the Klaytn with . By updating AccountKey to AccountKeyPublic, you can change your existing AccountKey into the new public key, which will be used to validate a transaction in Klaytn. This change is necessary when you decouple your private key from the address of your account. See and for details.
const weightedPublicKey = new caver.account.accountKey.weightedPublicKey(weight, publicKey)
WeightedPublicKey contains a public key and its weight. WeightedPublicKey is a class that contains the public key and the weight of the key, and it is used in AccountKeyWeightedMultiSig.
properties
Name
Type
Description
weight
number
publicKey
string
The public key string.
WeightedMultiSigOptions
const weightedMultiSigOptions = new caver.account.weightedMultiSigOptions(threshold, weights)
WeightedMultiSigOptions contains a threshold and weights. WeightedMultiSigOptions is a class for defining the options of AccountKeyWeightedMultiSig.
Generates an Account instance with an address and an accountKey.
If accountKey is a public key string, an Account instance with AccountKeyPublic as accountKey is created. If accountKey is an array containing public key strings, an Account instance with AccountKeyWeightedMultiSig as accountKey is created. If options are not defined as the last parameter, it is created using a default option with a threshold of 1 and a weight of 1 for each key. If accountKey is an array containing accountKeys that are used for each role, an Account instance with AccountKeyRoleBased is created. Options must be defined for each role with WeightedMultiSigOptions. If options are not defined, the default option is used for roles that use multiple public keys. Please refer to the example below for how to use it.
Parameters
Name
Type
Description
address
string
The address of account to be updated.
accountKey
string | Array
A public key string, an array of public keys, or a 2D array of which each element contains an array of key(s) to be used for each role.
AccountKeyFail is used to update AccountKey of an account in the Klaytn with . To create an Account instance with AccountKeyFail, please refer to caver.account.createWithAccountKeyFail.
AccountKeyWeightedMultiSig is used to update AccountKey of an account in the Klaytn with . By updating your AccountKey to AccountKeyWeightedMultiSig, you can change your existing AccountKey into the new public key, which will be used to validate a transaction in Klaytn. This change is necessary when you decouple your private key from the address of your account. See and for details.
AccountKeyRoleBased is used to update AccountKey of an account in the Klaytn with . By updating your AccountKey to AccountKeyRoleBased, you can change the AccountKey(s) assigned for each role, all of which are used to validate a transaction in Klaytn. See and for more details.