Code Monkey home page Code Monkey logo

encode-mnemonic-marshmallow's Introduction

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.

encode-mnemonic-marshmallow's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.