Skip to content

@gala-chain/clientReadme | API


@gala-chain/client / ChainUser

Class: ChainUser

Represents a user configuration object, containing all the information needed to authenticate and sign transactions.

ChainUser

Constructors

new ChainUser(config)

new ChainUser(config): ChainUser

Parameters

config

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.

Returns

ChainUser

Source

generic/ChainUser.ts:44

Properties

ethAddress

readonly ethAddress: string

Source

generic/ChainUser.ts:29


identityKey

readonly identityKey: string

Source

generic/ChainUser.ts:28


name

readonly name: string

Source

generic/ChainUser.ts:27


prefix

readonly prefix: string

Source

generic/ChainUser.ts:26


privateKey

readonly privateKey: string

Source

generic/ChainUser.ts:30


publicKey

readonly publicKey: string

Source

generic/ChainUser.ts:31

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

ChainUser

  • A new ChainUser object with the generated random keys and the provided or default name.

Source

generic/ChainUser.ts:70