-
-
Notifications
You must be signed in to change notification settings - Fork 10
Generating addresses & keys for In Wallet cryptocurrencies
ADAMANT offers an opportunity to store and send in-Chat other cryptocurrencies, Ethereum for example. Their addresses and private keys are derived from account's ADM key pair. The library provides modules to get coin's key pairs.
- See also Working with ADM key pairs.
Refer to eth
module of the library:
import { eth } from 'adamant-api'
Generates ETH address and private keys with provided passphrase of ADAMANT account.
-
Typing
function keys(passphrase: string): { address: string; privateKey: string; }
-
Parameters
-
passphrase
— 12 words Mnemonic ADAMANT passphrase to generate Ethereum's key pair, string.
-
-
Returns
-
address
— Ethereum address, bound to ADAMANT account of provided passphrase. -
privateKey
— Ethereum account's private key.
-
-
Example
import { eth } from 'adamant-api' const { address } = eth.keys(process.env.PASSPHRASE); console.log(`Your eth address: ${address}`)
Refer to btc
module of the library:
import { btc } from 'adamant-api'
Generates BTC address and private keys with provided passphrase of ADAMANT account.
-
Typing
function keys(passphrase: string): { network: Network; keyPair: ECPairInterface; address: string | undefined; privateKey: string | undefined; privateKeyWIF: string; }
-
Parameters
-
passphrase
— 12 words Mnemonic ADAMANT passphrase to generate Bitcoin's key pair, string.
-
-
Returns
-
address
— P2PKH Bitcoin address, bound to ADAMANT account of provided passphrase. -
keyPair
—ECPair
's key pair. -
privateKey
— Regular 256-bit (32 bytes, 64 characters) private key. -
privateKeyWIF
— Wallet Import Format (52 base58 characters). -
network
—coininfo
's network info.
-
-
Example
import { btc } from 'adamant-api' const { address } = btc.keys(process.env.PASSPHRASE); console.log(`Your bitcoin address: ${address}`)
Checks if a given string is valid bitcoin address in any format.
-
Typing
function isValidAddress(address: string): boolean
-
Parameters
-
address
— a string to test.
-
-
Example
import { btc } from 'adamant-api' const result = btc.isValidAddress('13rK42XbSJV9BdvKQvDJeH3n45zNBbXsUV'); if (result) { console.log('This address is valid.') }
Refer to dash
module of the library:
import { dash } from 'adamant-api'
Generates DASH address and private keys with provided passphrase of ADAMANT account.
-
Typing
function keys(passphrase: string): { network: Network; keyPair: ECPairInterface; address: string | undefined; privateKey: string | undefined; privateKeyWIF: string; }
-
Parameters
-
passphrase
— 12 words Mnemonic ADAMANT passphrase to generate Dash's key pair, string.
-
-
Returns
-
address
— P2PKH Dash address, bound to ADAMANT account of provided passphrase. -
keyPair
—ECPair
's key pair. -
privateKey
— Regular 256-bit (32 bytes, 64 characters) private key. -
privateKeyWIF
— Wallet Import Format (52 base58 characters). -
network
—coininfo
's network info.
-
-
Example
import { dash } from 'adamant-api' const { address } = dash.keys(process.env.PASSPHRASE); console.log(`Your dash address: ${address}`)
Checks if a given string is valid dash address in any format.
-
Typing
function isValidAddress(address: string): boolean
-
Parameters
-
address
— a string to test.
-
-
Example
import { dash } from 'adamant-api' const result = dash.isValidAddress('XdY9tHBVQ1hjLaWuGoXXVojZtRa4GfEdNP'); if (result) { console.log('This address is valid.') }
Refer to doge
module of the library:
import { doge } from 'adamant-api'
Generates DOGE address and private keys with provided passphrase of ADAMANT account.
-
Typing
function keys(passphrase: string): { network: Network; keyPair: ECPairInterface; address: string | undefined; privateKey: string | undefined; privateKeyWIF: string; }
-
Parameters
-
passphrase
— 12 words Mnemonic ADAMANT passphrase to generate Doge's key pair, string.
-
-
Returns
-
address
— P2PKH Doge address, bound to ADAMANT account of provided passphrase. -
keyPair
—ECPair
's key pair. -
privateKey
— Regular 256-bit (32 bytes, 64 characters) private key. -
privateKeyWIF
— Wallet Import Format (52 base58 characters). -
network
—coininfo
's network info.
-
-
Example
import { doge } from 'adamant-api' const { address } = doge.keys(process.env.PASSPHRASE); console.log(`Your doge address: ${address}`)
Checks if a given string is valid doge address in any format.
-
Typing
function isValidAddress(address: string): boolean
-
Parameters
-
address
— a string to test.
-
-
Example
import { doge } from 'adamant-api' const result = doge.isValidAddress('D7zQbHUEjiPRie6v9WCsC3DNwDifUdbFdd'); if (result) { console.log('This address is valid.') }
Refer to lsk
module of the library:
import { lsk } from 'adamant-api'
Generates LISK address and private keys with provided passphrase of ADAMANT account.
-
Typing
function keys(passphrase: string): { network: { name: string; port: number; wsPort: number; unit: string; }; keyPair: { publicKey: Buffer; secretKey: Buffer; }; address: string; addressHexBinary: Buffer; addressHex: string; privateKey: string; }
-
Parameters
-
passphrase
— 12 words Mnemonic ADAMANT passphrase to generate Lisk's key pair, string.
-
-
Example
import { lsk } from 'adamant-api' const { address } = lsk.keys(process.env.PASSPHRASE); console.log(`Your lisk address: ${address}`)