@gala-chain/client ∙ API
API > ChainUser
Class: ChainUser
Represents a user configuration object, containing all the information needed to authenticate and sign transactions.
Contents
- Constructors
- new ChainUser(config)
- Properties
- ethAddress
- identityKey
- name
- prefix
- privateKey
- publicKey
- Methods
- withRandomKeys()
Constructors
new ChainUser(config)
new ChainUser(
config
):ChainUser
Parameters
▪ config: object
Configuration object for the constructor.
▪ config.name?: string
If provided, the resulting prefix will be
client
and identityKey will be client|${name}
. Otherwise, the prefix
will be eth
and identityKey will be eth|${ethAddress}
.
▪ config.privateKey: string
A secp256k1 private key to be used for cryptographic operations. It will be used to calculate the public key and the ethAddress, and will be used to sign transactions.
Source
Properties
ethAddress
readonly
ethAddress:string
Source
identityKey
readonly
identityKey:string
Source
name
readonly
name:string
Source
prefix
readonly
prefix:string
Source
privateKey
readonly
privateKey:string
Source
publicKey
readonly
publicKey:string
Source
Methods
withRandomKeys()
static
withRandomKeys(name
?):ChainUser
Generates a new ChainUser object with random keys.
Parameters
▪ name?: string
The name to be used for the ChainUser.
If provided, the resulting identityKey will be client|${name}
.
Otherwise, the identityKey will be eth|${ethAddress}
.
Returns
- A new ChainUser object with the generated random keys and the provided or default name.