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
gala chain signer
Constructors
Constructor
new PrivateKeySigner(
privateKey):PrivateKeySigner
Creates a native signer from a hex or base64 secp256k1 private key.
Parameters
| Parameter | Type |
|---|---|
privateKey | string |
Returns
PrivateKeySigner
Example
const signer = new PrivateKeySigner('1'.padStart(64, '0'));
const signed = await signer.signObject('RequestTrade', { token0: 'GALA', token1: 'GUSDC' });
private key signer
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
| Parameter | Type |
|---|---|
_methodName | string |
dto | T |
Returns
Promise<SignedDto<T>>
Example
const signed = await signer.signObject('RequestTrade', {
token0: 'GALA',
token1: 'GUSDC',
fee: 3000,
});
Implementation of
sign object method name signed dto gala chain signer