Skip to main content

index/classes/PrivateKeySigner.md

A GalaChain native signer backed by a secp256k1 private key.

Native signing produces the bare GalaChain signature format, without a personal-sign prefix or EIP-712 metadata. The private-key identity is recovered by the chain.

Implements​

Constructors​

Constructor​

new PrivateKeySigner(privateKey): PrivateKeySigner

Creates a native signer from a hex or base64 secp256k1 private key.

Parameters​

ParameterType
privateKeystring

Returns​

PrivateKeySigner

Example​

const signer = new PrivateKeySigner('1'.padStart(64, '0'));
const signed = await signer.signObject('RequestTrade', { token0: 'GALA', token1: 'GUSDC' });

Methods​

signObject()​

signObject<T>(_methodName, dto): Promise<SignedDto<T>>

Signs the DTO with GalaChain native signing.

Type Parameters​

Type Parameter
T extends Record<string, unknown>

Parameters​

ParameterType
_methodNamestring
dtoT

Returns​

Promise<SignedDto<T>>

Example​

const signed = await signer.signObject('RequestTrade', {
token0: 'GALA',
token1: 'GUSDC',
fee: 3000,
});

Implementation of​

GalaChainSigner.signObject