@nekoproject/wallets
Version:
Cross-chain Wallet
62 lines (57 loc) • 2.1 kB
TypeScript
/// <reference types="node" />
import * as web3 from '@solana/web3.js';
import { ethers } from 'ethers';
declare abstract class Wallet {
private _wallet;
constructor(wallet: any);
get address(): string;
get signer(): any;
getPrivateKey(): string;
getSeedsPhrase(): {
phrase: string;
path?: string;
locale?: string;
};
getSecretKey(): Uint8Array;
static validate(privateKey: string): boolean;
static generateWallet(): Wallet;
static fromSeed(seed: Uint8Array): Wallet;
static fromSecretKey(secretKey: Uint8Array): Wallet;
static fromPrivateKey(secretKey: string): Wallet;
static mnemonicToSeed(mnemonic: string): Promise<Buffer>;
static fromMnemonic(mnemonic: string): Promise<Wallet>;
static generateWalletWithIndex(seed: Buffer, index: number): Promise<Wallet>;
}
interface SolanaKeypair {
publicKey: web3.PublicKey;
secretKey: Uint8Array;
}
declare class SPLWallet extends Wallet {
constructor(wallet: SolanaKeypair);
get address(): string;
getPrivateKey(): string;
getSecretKey(): Uint8Array;
static validate(privateKey: string): boolean;
static generateWallet(): Wallet;
static fromMnemonic(mnemonic: string, delivePath?: string): Promise<Wallet>;
static generateWalletWithIndex(seed: Buffer, index: number): Promise<Wallet>;
static fromSecretKey(secretKey: Uint8Array): Wallet;
static fromPrivateKey(secretKey: string): Wallet;
}
declare class ETHWallet extends Wallet {
constructor(wallet: ethers.Wallet);
get address(): string;
getPrivateKey(): string;
getSeedsPhrase(): {
phrase: string;
path: string;
locale: string;
};
static validate(privateKey: string): boolean;
static generateWallet(): Wallet;
static fromSeed(seed: Uint8Array): Wallet;
static fromPrivateKey(secretKey: string): Wallet;
static fromMnemonic(mnemonic: string): Promise<Wallet>;
static generateWalletWithIndex(seed: Buffer, index: number): Promise<Wallet>;
}
export { ETHWallet, SPLWallet, SolanaKeypair, Wallet };