The Coingrig Core library handling the wallet interactions
Import the library in your project with yarn add @coingrig/core
Run yarn. (Installs dependencies and links packages in the workspace.)
Create an .env file to configure the platform: TESTNET=true|false.
The default value is TESTNET=false.
Jest tests are set up to run with TESTNET=true yarn test.
- 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
Kind: global class
Generate the wallet's XPUB
Kind: static method of GenericGenerator
Returns: string -
The XPUB value
| Param | Type |
|---|---|
| mnemonic | string |
| config | * |
Generate the wallet's Private Key
Kind: static method of GenericGenerator
Returns: string -
The Private Key
| Param | Type |
|---|---|
| mnemonic | string |
| derivation | integer |
| config | * |
Generate teh wallet's Public Address
Kind: static method of GenericGenerator
Returns: string -
The Public Key
| Param | Type |
|---|---|
| xpub | string |
| derivation | integer |
| config | * |
Implements the Factory pattern to help generate easily wallets for the supported blockchains.
Kind: global class
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 |
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 |
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 |
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 |
Don't use the generic wallet, for a new coin write an implementation
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" |
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.
The Coingrig Core Library is licensed under the MIT License.