Hdcore-ts helps with hardened key generation and transaction problems for Hierarchical Deterministic Wallets. (Haven't deal with utxo blockchain)
npm i hdcore-ts
import * as hdcore from 'hdcore-ts'
Example on Solana:
- bip39 generation:
const mnem = hdcore.account.createMnemonic()
const seed = hdcore.account.createSeed(mnem)
- Master account generation on Solana:
const master = hdcore.account.createMasterAccount('501', seed)
// {pub: ..., prv: ...}
- Child account generation on Solana:
const childindex = 1
const path = hdcore.account.getPath(0,501,childindex)
//("m/44'/501'/0'/0'/1'")
const acc1 = hdcore.account.createChildAccount('501', seed, path)
- Fund account: (devnet solana)
const transaction = hdcore.account.getTransaction('501')
transaction.airdrop_one(a.pub)
// true
- Get balance: (devnet solana)
transaction.get_balance(acc1.pub)
// 1
- Send: (devnet solana)
transaction.send(acc1.pub, acc1.prv, "recieve pubkey", 0.05)
// return transaction id
npm test
MIT