UNPKG

@tronlink/core

Version:

The library serves as a core module within TronLink Extension, which provides low-level wallet functionality for both Tron and Ethereum networks, primary features includes account generation and transaction signing

19 lines 702 B
// @ts-ignore import bip39 from 'bip39'; import { isPositiveInteger } from '../utils'; import { InvalidParameterError } from './error'; export class BaseWallet { static generateRandomMnemonic() { return bip39.generateMnemonic(128); } static validateMnemonic(mnemonic) { return bip39.validateMnemonic(mnemonic); } derivePath(params = { accountIndex: 0, addressIndex: 0 }) { if (!isPositiveInteger(params.accountIndex) || !isPositiveInteger(params.addressIndex)) { throw new InvalidParameterError(); } return `m/44'/${this.getCoinType()}'/${params.accountIndex}'/0/${params.addressIndex}`; } } //# sourceMappingURL=wallet.js.map