@exodus/solana-web3.js
Version:
Solana Javascript API
56 lines (55 loc) • 1.56 kB
TypeScript
import { Ed25519Keypair } from './utils/ed25519.js';
import { PublicKey } from './publickey.js';
/**
* Keypair signer interface
*/
export interface Signer {
publicKey: PublicKey;
secretKey: Uint8Array;
}
/**
* An account keypair used for signing transactions.
*/
export declare class Keypair {
private _keypair;
/**
* Create a new keypair instance.
* Generate random keypair if no {@link Ed25519Keypair} is provided.
*
* @param keypair ed25519 keypair
*/
constructor(keypair?: Ed25519Keypair);
/**
* Generate a new random keypair
*/
static generate(): Keypair;
/**
* Create a keypair from a raw secret key byte array.
*
* This method should only be used to recreate a keypair from a previously
* generated secret key. Generating keypairs from a random seed should be done
* with the {@link Keypair.fromSeed} method.
*
* @throws error if the provided secret key is invalid and validation is not skipped.
*
* @param secretKey secret key byte array
* @param options: skip secret key validation
*/
static fromSecretKey(secretKey: Uint8Array, options?: {
skipValidation?: boolean;
}): Keypair;
/**
* Generate a keypair from a 32 byte seed.
*
* @param seed seed byte array
*/
static fromSeed(seed: Uint8Array): Keypair;
/**
* The public key for this keypair
*/
get publicKey(): PublicKey;
/**
* The raw secret key for this keypair
*/
get secretKey(): Uint8Array;
}