index/classes/PrivateKeySigner.md
A private-key signer that supports both native GalaChain writes and launchpad bundler typed-data writes.
Example
const signer = new PrivateKeySigner(`0x${'1'.repeat(64)}`);
const body = await signer.signTypedData('BuyWithNative', { amount: '1' });
console.log(body.signature);
Extends
PrivateKeySigner
private key signer
Implements
launchpad signer
Constructors
Constructor
new PrivateKeySigner(
privateKey):PrivateKeySigner
Parameters
| Parameter | Type |
|---|---|
privateKey | string |
Returns
PrivateKeySigner
Overrides
CorePrivateKeySigner.constructor
private key signer core
Properties
| Property | Modifier | Type | Description |
|---|---|---|---|
walletAddress | readonly | string | The GalaChain identity this key signs for (eth|<checksummed address>, no 0x). |
wallet address
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
Inherited from
CorePrivateKeySigner.signObject
sign object method name signed dto launchpad signer core private key
signTypedData()
signTypedData(
method,rawDto):Promise<SignedTypedDataBody>
Sign the same EIP-712 types that the bundler receives.
Parameters
| Parameter | Type |
|---|---|
method | string |
rawDto | Record<string, unknown> |
Returns
Promise<SignedTypedDataBody>
Example
const body = await signer.signTypedData('BuyWithNative', { amount: '1' });
console.log(body.domain.name);
Implementation of
sign typed data raw dto signed body launchpad signer