Skip to main content

Class: PrivateKeySigner

GalaChain core SDK 1.0.0-rc.8


GalaChain core SDK 1.0.0-rc.8 / index / PrivateKeySigner

Class: PrivateKeySigner

Defined in: packages/gala-core-sdk/dist/index.d.ts:1334

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

Defined in: packages/gala-core-sdk/dist/index.d.ts:1345

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

Parameters​

privateKey​

string

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>>

Defined in: packages/gala-core-sdk/dist/index.d.ts:1358

Signs the DTO with GalaChain native signing.

Type Parameters​

T​

T extends Record<string, unknown>

Parameters​

_methodName​

string

dto​

T

Returns​

Promise<SignedDto<T>>

Example​

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

Implementation of​

GalaChainSigner.signObject