2.0.10 • Published 1 year ago

encode-mnemonic-wallet v2.0.10

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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.

2.0.10

1 year ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.7.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago