Comparing version 0.0.16 to 0.0.17
@@ -9,2 +9,3 @@ import * as network from './lib/network' | ||
import {getBalanceOfAddresses} from "./lib/getBalanceOfAddresses" | ||
import {sendToAddress} from "./lib/sendToAddress" | ||
import {encryptAES} from "./lib/encryptAES" | ||
@@ -22,3 +23,4 @@ import {decryptAES} from "./lib/decryptAES" | ||
decryptAES, | ||
encryptAES | ||
encryptAES, | ||
sendToAddress | ||
} |
@@ -11,4 +11,7 @@ import {getBalanceOfWallet} from "./getBalanceOfWallet"; | ||
const derivationPath = "m/"+walletIndex+"/"+chainIndex+"/"+addressIndex | ||
const walletDerivationPath = "m/"+walletIndex | ||
//1 deriveKey | ||
let walletKey = hdkey.derive(walletDerivationPath) | ||
const getBalanceOfWalletObj = await getBalanceOfWallet(hdkey,derivationPath) | ||
@@ -18,2 +21,3 @@ //console.log('getBalanceOfWalletObj',getBalanceOfWalletObj) | ||
const childKey = hdkey.derive(derivationPath) | ||
// walletKey = hdkey.derive(walletDerivationPath) | ||
const address = getAddress(childKey.publicKey,network) | ||
@@ -30,3 +34,4 @@ getBalanceOfWalletObj.addresses = [{address:address}] | ||
wallet.senderEmail = email | ||
wallet.publicExtendedKey = walletKey.publicExtendedKey | ||
return wallet | ||
} |
@@ -5,3 +5,3 @@ const bitcoin = require("bitcoinjs-lib") | ||
export const getNewAddress = (publicKey, network) => { | ||
if(network==undefined) network = networkUtils.DEFAULT_NETWORK | ||
if(network===undefined) network = networkUtils.DEFAULT_NETWORK | ||
} |
{ | ||
"name": "doichain", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "A js-Doichain library. The goal is to fully cover the Doichain protocoll", | ||
@@ -30,7 +30,7 @@ "main": "index.js", | ||
"@babel/cli": "^7.8.4", | ||
"@babel/core": "^7.8.6", | ||
"@babel/core": "^7.9.0", | ||
"@babel/preset-env": "^7.8.6", | ||
"@babel/register": "^7.8.6", | ||
"chai": "^4.2.0", | ||
"mocha": "^7.1.0" | ||
"mocha": "^7.1.1" | ||
}, | ||
@@ -37,0 +37,0 @@ "dependencies": { |
@@ -26,2 +26,7 @@ import chai from 'chai' | ||
import {decryptAES} from "../lib/decryptAES"; | ||
<<<<<<< HEAD | ||
import {sendToAddress} from "../lib/sendToAddress"; | ||
======= | ||
import { generateNewAddress } from '../lib/generateNewAddress'; | ||
>>>>>>> e4cc78922c7e1914425782b0fbb2d78f702c5c3b | ||
@@ -83,2 +88,3 @@ const MNEMONIC = "refuse brush romance together undo document tortoise life equal trash sun ask" | ||
const funding = await fundWallet(newWallet.addresses[0].address,doi) | ||
chai.assert.notEqual(funding.status,"fail","blockchain problem") | ||
const address = funding.data.address | ||
@@ -125,4 +131,19 @@ chai.expect(address).to.have.length(34) | ||
}) | ||
<<<<<<< HEAD | ||
it.only('should send Doicoins to another wallet', () => { | ||
======= | ||
it('creates a master key and generates a address from it ', async function () { | ||
const mnemonic = "refuse brush romance together undo document tortoise life equal trash sun ask" | ||
changeNetwork('regtest') | ||
const hdKey = createHdKeyFromMnemonic(mnemonic) | ||
const newWallet = await createNewWallet(hdKey,0) | ||
chai.expect(newWallet).to.have.own.property('publicExtendedKey'); | ||
const address = generateNewAddress(newWallet.publicExtendedKey, newWallet.addresses[newWallet.addresses.length-1].derivationPath, network) | ||
chai.expect(address).to.have.length(34) | ||
>>>>>>> e4cc78922c7e1914425782b0fbb2d78f702c5c3b | ||
}) | ||
}) | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26088
26
548