UNPKG

@nekoproject/wallets

Version:

Cross-chain Wallet

71 lines (57 loc) 1.86 kB
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/no-explicit-any */ import * as bip39 from 'bip39'; export abstract class Wallet { private _wallet: any; constructor(wallet: any) { this._wallet = wallet; } get address(): string { throw new Error('Abstract Method has no implementation'); } get signer() { return this._wallet; } getPrivateKey(): string { throw new Error('Abstract Method has no implementation'); } getSeedsPhrase(): { phrase: string; path?: string; locale?: string } { throw new Error('Abstract Method has no implementation'); } getSecretKey(): Uint8Array { throw new Error('Abstract Method has no implementation'); } static validate(privateKey: string): boolean { throw new Error('Abstract Method has no implementation'); } // @solana static generateWallet(): Wallet { throw new Error('Abstract Method has no implementation'); } // @solana static fromSeed(seed: Uint8Array): Wallet { throw new Error('Abstract Method has no implementation'); } // @solana static fromSecretKey(secretKey: Uint8Array): Wallet { throw new Error('Abstract Method has no implementation'); } static fromPrivateKey(secretKey: string): Wallet { throw new Error('Abstract Method has no implementation'); } static async mnemonicToSeed(mnemonic: string): Promise<Buffer> { if (!bip39.validateMnemonic(mnemonic)) { throw new Error('Invalid seed phrase'); } return await bip39.mnemonicToSeed(mnemonic); } static async fromMnemonic(mnemonic: string): Promise<Wallet> { throw new Error('Abstract Method has no implementation'); } static async generateWalletWithIndex( seed: Buffer, index: number ): Promise<Wallet> { throw new Error('Abstract Method has no implementation'); } }