Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

doichain

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doichain - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

lib/broadcastTransaction.js

7

index.js

@@ -1,3 +0,4 @@

export const printHello = () => {
return 'hello'
}
export default const bla = "3"
import './lib/network'
export changeNetwork
export DEFAULT_NETWORK,DEFAULT_SETTINGS
{
"name": "doichain",
"version": "0.0.4",
"version": "0.0.5",
"description": "A js-Doichain library. The goal is to fully cover the Doichain protocoll",

@@ -37,4 +37,7 @@ "main": "index.js",

"dependencies": {
"bip39": "^3.0.2"
"bip39": "^3.0.2",
"bitcoinjs-lib": "^5.1.7",
"browser-or-node": "^1.2.1",
"hdkey": "^1.1.1"
}
}

@@ -10,3 +10,3 @@ # js-doichain

- create and validate mnemonic seed phrases
- hd-keys (from mnemonic seed phrases)
- create hd-key (from mnemonic seed phrases)
- Doichain addresses

@@ -13,0 +13,0 @@ - "double opt-in/DOI" request transaction

import chai from 'chai'
import {printHello} from '../index'
chai.Assertion.addProperty('uppercase', function () {
var obj = this._obj;
new chai.Assertion(obj).to.be.a('string');
this.assert(
obj === obj.toUpperCase() // adapt as needed
, 'expected #{this} to be all uppercase' // error message when fail for normal
, 'expected #{this} to not be all uppercase' // error message when fail for negated
);
});
import {generateMnemonic} from '../lib/generateMnemonic'
import {validateMnemonic} from "../lib/validateMnemonic";
import {createHdKeyFromMnemonic} from "../lib/createHdKeyFromMnemonic"
import {createDoichainWalletFromHdKey,noEmailError} from "../lib/createDoichainWalletFromHdKey"
import {getAddress} from "../lib/getAddress"
import {changeNetwork, DEFAULT_NETWORK, DOICHAIN_REGTEST,DOICHAIN_TESTNET,DOICHAIN} from "../lib/network"
import {fundWallet} from "../lib/fundWallet";

@@ -20,4 +34,68 @@ describe('js-doichain', function(){

it('should create a hdkey from a mnemonic without password', function() {
const mnemonic = "balance blanket camp festival party robot social stairs noodle piano copy drastic"
const hdKey = createHdKeyFromMnemonic(mnemonic)
chai.expect(hdKey).to.have.own.property('_privateKey');
chai.expect(hdKey).to.have.own.property('_publicKey');
})
it('should create a new Doichain wallet from a seed in mainnet', function () {
const mnemonic = "balance blanket camp festival party robot social stairs noodle piano copy drastic"
const hdKey = createHdKeyFromMnemonic(mnemonic)
chai.expect(() => createDoichainWalletFromHdKey(hdKey)).to.throw();
chai.expect(() => createDoichainWalletFromHdKey(hdKey,'alice@ci-doichain.org')).to.not.throw();
const wallet = createDoichainWalletFromHdKey(hdKey,'alice@ci-doichain.org',DOICHAIN)
// bitcoin testnet P2PKH addresses start with a 'm' or 'n'
chai.assert.strictEqual(wallet.addresses[0].address.startsWith('M') || wallet.addresses[0].address.startsWith('N'),true)
chai.expect(wallet.addresses[0].address).to.have.length(34)
chai.expect(wallet.addresses[0].address.substring(0,1)).to.be.uppercase
})
it('should create a new Doichain wallet from a seed in testnet', function () {
const mnemonic = "balance blanket camp festival party robot social stairs noodle piano copy drastic"
const hdKey = createHdKeyFromMnemonic(mnemonic)
const wallet = createDoichainWalletFromHdKey(hdKey,'alice@ci-doichain.org',DOICHAIN_TESTNET)
chai.assert.strictEqual(wallet.addresses[0].address.startsWith('m') || wallet.addresses[0].address.startsWith('n'),true)
chai.expect(wallet.addresses[0].address).to.have.length(34)
chai.expect(wallet.addresses[0].address.substring(0,1)).to.not.be.uppercase
})
it('should create a new Doichain address for a regtest wallet ', function () {
changeNetwork('regtest')
const mnemonic = "balance blanket camp festival party robot social stairs noodle piano copy drastic"
const hdKey = createHdKeyFromMnemonic(mnemonic)
const wallet = createDoichainWalletFromHdKey(hdKey,'alice@ci-doichain.org',DEFAULT_NETWORK)
chai.assert.strictEqual(wallet.addresses[0].address.startsWith('m') || wallet.addresses[0].address.startsWith('n'),true)
chai.expect(wallet.addresses[0].address).to.have.length(34)
chai.expect(wallet.addresses[0].address.substring(0,1)).to.not.be.uppercase
fundWallet(wallet.addresses[0].address)
const doi = 10
//sendDoicoinToAddress()
})
it('should fund a new regtest wallet ', function () {
const address = undefined
chai.expect(address).to.have.length(34)
chai.expect(address.substring(0,1).to.be.uppercase)
})
it('should get all transactinos for a wallet', function () {
const transactions = undefined
chai.expect(transactions).to.be.an('array')
})
it('should get all transactinos for an address', function () {
const transactions = undefined
chai.expect(transactions).to.be.an('array')
})
it('should create a new Doichain change address in wallet', function () {
const transactions = undefined
chai.expect(transactions).to.be.an('array')
})
})
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc