Code Monkey home page Code Monkey logo

core's Introduction

๐Ÿ…’๐Ÿ…–๐Ÿ…’ Coingrig Core

The Coingrig Core library handling the wallet interactions

Usage in your project

Import the library in your project with yarn add @coingrig/core

Library Development setup

Run yarn. (Installs dependencies and links packages in the workspace.)

Compilation

Create an .env file to configure the platform: TESTNET=true|false.
The default value is TESTNET=false.

Test

Jest tests are set up to run with TESTNET=true yarn test.


Documentation

Classes

BitcoinGenerator โ‡ GenericGenerator
BscGenerator โ‡ EthereumGenerator
EthereumGenerator โ‡ GenericGenerator
PolygonGenerator โ‡ EthereumGenerator
GenericGenerator
WalletFactory
WalletGenerator
GenericWallet

Don't use the generic wallet, for a new coin write an implementation

BitcoinGenerator โ‡ GenericGenerator

Kind: global class
Extends: GenericGenerator

BscGenerator โ‡ EthereumGenerator

Kind: global class
Extends: EthereumGenerator

EthereumGenerator โ‡ GenericGenerator

Kind: global class
Extends: GenericGenerator

PolygonGenerator โ‡ EthereumGenerator

Kind: global class
Extends: EthereumGenerator

GenericGenerator

Kind: global class

GenericGenerator.generateWalletXpub(mnemonic, config) โ‡’ string

Generate the wallet's XPUB

Kind: static method of GenericGenerator
Returns: string -

The XPUB value

Param Type
mnemonic string
config *

GenericGenerator.generatePrivateKeyFromMnemonic(mnemonic, derivation, config) โ‡’ string

Generate the wallet's Private Key

Kind: static method of GenericGenerator
Returns: string -

The Private Key

Param Type
mnemonic string
derivation integer
config *

GenericGenerator.generateAddressFromXPub(xpub, derivation, config) โ‡’ string

Generate teh wallet's Public Address

Kind: static method of GenericGenerator
Returns: string -

The Public Key

Param Type
xpub string
derivation integer
config *

WalletFactory

Kind: global class

new WalletFactory()

Implements the Factory pattern to help generate easily wallets for the supported blockchains.

WalletGenerator

Kind: global class

WalletGenerator.generateMnemonic([size]) โ‡’ string

Generates a string containing the 12 words used as a mnemonic to create the private and public wallet keys.

Kind: static method of WalletGenerator
Returns: string -

The mnemonic

Param Type Default Description
[size] number 128

Or use 256 for 24 words

WalletGenerator.getDriver(chain) โ‡’ GenericGenerator

Offers direct access to the drivers that offer the key generation.

Kind: static method of WalletGenerator

Param Type
chain Chains

WalletGenerator.generateWalletXpub(chain, mnemonic, [config]) โ‡’ string

Generate the wallet's XPUB address. The source of all addresses to be generated for the public.

Kind: static method of WalletGenerator
Returns: string -

The wallet's XPUB address

Param Type Default Description
chain Chains

The type of chain

mnemonic string
[config] * CONFIG

WalletGenerator.generatePrivateKeyFromMnemonic(chain, mnemonic, derivation, [config]) โ‡’ string

Generate the wallet's private key.

Kind: static method of WalletGenerator
Returns: string -

The wallet's private key

Param Type Default Description
chain Chains

The type of chain

mnemonic string
derivation integer

The derivation key to allow generation of more private keys for the same chain

[config] * CONFIG

WalletGenerator.generateAddressFromXPub(chain, xpub, derivation, [config]) โ‡’ string

Generate the public wallet address for the specified chain

Kind: static method of WalletGenerator
Returns: string -

The wallet's public address

Param Type Default Description
chain Chains

The type of chain

xpub string
derivation integer
[config] * CONFIG

GenericWallet

Don't use the generic wallet, for a new coin write an implementation

Kind: global class

Chains : enum

Enum for supported blockchains types

Kind: global enum
Read only: true
Properties

Name Type Description
BTC string

"BTC"

ETH string

"ETH"

MATIC string

"MATIC"

BSC string

"BSC"


Code of Conduct

This library has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.

License

The Coingrig Core Library is licensed under the MIT License.

core's People

Contributors

florindumitru avatar rvulpescu avatar

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.