npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

encode-mnemonic-wallet

v2.0.10

Published

Even if your phrase is stolen from you, it will be useless without a password.

Downloads

36

Readme

Good wallet for you (BSC, ETH, TRX) (+Tokens)

Cryptocurrency wallet that has all the standard features and even a little more. See docs.

npm i encode-mnemonic-wallet

Create/restore methods

Wallet.generateMnemonic() : string;
Wallet.fromPrivateKey(key : string) : Promise<Wallet>;
Wallet.fromSeed(seed : string) : Promise<Wallet>;
Wallet.fromMnemonic(mnemonic : string) : Promise<Wallet>;
Wallet.fromProtectedMnemonic(mnemonic : string, password : string) : Promise<Wallet>;
Wallet.createWallet() : Promise<WalletInfo>;
Wallet.createProtectedWallet(password : string) : Promise<WalletInfo>;

Wallets Methods

let wallet = Wallet.fromMnemonic('...');

For access to this methods - you must use

wallet.trx.[method] wallet.bsc.[method] wallet.eth.[method]

send(amount : number, toAddress : string) : Promise<string>;
sendToken(contract : Contract, amount : number, toAddress : string) : Promise<string>;
createSendTransaction(amount : number, toAddress : string) : Promise<TransactionInterface>;
createSendTokenTransaction(contract : Contract, amount : number, toAddress : string) : Promise<TransactionInterface>;
getBalanceToken(contract : Contract) : Promise<number>;
getBalance() : Promise<number>;
signTransaction(transaction : TransactionInterface) : Promise<any>;
sendTransaction(transaction : TransactionInterface) : Promise<string>;
sendSignedTransaction(signedTransaction : any) : Promise<string>;

Contracts

let bscContract = new BscContract(address : string, abi : any);
let ethContract = new EthContract(address : string, abi : any);
let trxContract = new TrxContract(address : string, abi : any);

Default contracts for you (USDT, BUSD, USDC):

import {EthTokens, TrxTokens, BscTokens} from 'encode-mnemonic-wallet';

Feature: Protected wallet

We are so afraid for our mnemonic phrases (12 words), but why not just protect your wallet with a password (salt)?

Even if your phrase is stolen from you, it will be useless without a password.

let test = await Wallet.createProtectedWallet('1234');
console.log(test);
{
  mnemonic: 'dad novel inject measure venture doctor armor elevator spare debris pizza call',
  privateKey: 'baf1f79a16ba2c0687ce49c2eb0237bc549002d9f0d04fc2c56192b85c6e4a56',
  trxAddress: 'TFdU1iDGsFHhtyJKA39joKG296as6dzwz7',
  bscAddress: '0x3e14F75a8B78239d2c40Fa58Fc386f94Ca80FE22',
  ethAddress: '0x3e14F75a8B78239d2c40Fa58Fc386f94Ca80FE22'
}

Example #1 (Wrong)

Imagine that a mnemonic phrase was stolen from you. An attacker is trying to enter your wallet through third-party crypto wallets.

let usualWallet = await Wallet.fromMnemonic('dad novel inject measure venture doctor armor elevator spare debris pizza call');
console.log(usualWallet.privateKey);

It's useless, it's not your wallet:

cd3245a2223cc7cb1c7c9c3465c8295e6782e4c0d898d733eda39c7ea978767e

Example #2 (True)

Only your password will allow access to your wallet.

let encodeWallet = await Wallet.fromProtectedMnemonic('dad novel inject measure venture doctor armor elevator spare debris pizza call', '1234');
console.log(usualWallet.privateKey);
baf1f79a16ba2c0687ce49c2eb0237bc549002d9f0d04fc2c56192b85c6e4a56

After receiving the private key, you can also use it to enter third-party crypto wallets. Your private key = your money.