Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

npsables/hdcore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HDCORE TS

Introduction

Hdcore-ts helps with hardened key generation and transaction problems for Hierarchical Deterministic Wallets. (Haven't deal with utxo blockchain)

Installation

npm i hdcore-ts

Usage

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

Testing (Not done)

npm test

References

License

MIT

About

Core of HD wallet

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published