use module style exports to maintain the way JS imports the compiled code
This commit is contained in:
parent
384860ea6b
commit
733e49b7e9
|
@ -35,11 +35,6 @@ package-lock.json
|
||||||
# Optional REPL history
|
# Optional REPL history
|
||||||
.node_repl_history
|
.node_repl_history
|
||||||
|
|
||||||
# Build folder
|
|
||||||
# Update 2018-08-07: currently build is done to / (before: dist/) due to
|
|
||||||
# backwards compatibility reasons, JS files from root and root test/ folder
|
|
||||||
# are excluded
|
|
||||||
/*.js
|
|
||||||
|
|
||||||
# IDE and text editor config files
|
# IDE and text editor config files
|
||||||
.idea
|
.idea
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('@ethereumjs/config-prettier')
|
|
@ -1,8 +1,8 @@
|
||||||
import { Wallet } from './index'
|
import Wallet = require('./index')
|
||||||
|
|
||||||
const HDKey = require('hdkey')
|
const HDKey = require('hdkey')
|
||||||
|
|
||||||
export class EthereumHDKey {
|
class EthereumHDKey {
|
||||||
public static fromMasterSeed(seedBuffer: Buffer): EthereumHDKey {
|
public static fromMasterSeed(seedBuffer: Buffer): EthereumHDKey {
|
||||||
return new EthereumHDKey(HDKey.fromMasterSeed(seedBuffer))
|
return new EthereumHDKey(HDKey.fromMasterSeed(seedBuffer))
|
||||||
}
|
}
|
||||||
|
@ -39,3 +39,5 @@ export class EthereumHDKey {
|
||||||
return Wallet.fromPublicKey(this._hdkey._publicKey, true)
|
return Wallet.fromPublicKey(this._hdkey._publicKey, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export = EthereumHDKey
|
||||||
|
|
|
@ -101,7 +101,7 @@ function stripUnusedKDFParamsForScrypt(params: KDFParams): Partial<KDFParams> {
|
||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Wallet {
|
class Wallet {
|
||||||
// static methods
|
// static methods
|
||||||
|
|
||||||
public static generate(icapDirect: boolean = false): Wallet {
|
public static generate(icapDirect: boolean = false): Wallet {
|
||||||
|
@ -309,6 +309,9 @@ export class Wallet {
|
||||||
throw new Error('Cannot supply both a private and a public key to the constructor')
|
throw new Error('Cannot supply both a private and a public key to the constructor')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!privateKey && !publicKey) {
|
||||||
|
}
|
||||||
|
|
||||||
if (privateKey && !ethUtil.isValidPrivate(privateKey)) {
|
if (privateKey && !ethUtil.isValidPrivate(privateKey)) {
|
||||||
throw new Error('Private key does not satisfy the curve requirements (ie. it is invalid)')
|
throw new Error('Private key does not satisfy the curve requirements (ie. it is invalid)')
|
||||||
}
|
}
|
||||||
|
@ -442,3 +445,5 @@ function runCipherBuffer(cipher: crypto.Cipher | crypto.Decipher, data: Buffer):
|
||||||
function keyExists(k: Buffer | undefined): k is Buffer {
|
function keyExists(k: Buffer | undefined): k is Buffer {
|
||||||
return k !== undefined
|
return k !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export = Wallet
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Wallet } from './index'
|
import Wallet = require('./index')
|
||||||
|
|
||||||
const HookedWalletEthTxSubprovider = require('web3-provider-engine/subproviders/hooked-wallet-ethtx')
|
const HookedWalletEthTxSubprovider = require('web3-provider-engine/subproviders/hooked-wallet-ethtx')
|
||||||
|
|
||||||
export class WalletSubprovider extends HookedWalletEthTxSubprovider {
|
class WalletSubprovider extends HookedWalletEthTxSubprovider {
|
||||||
constructor(wallet: Wallet, opts?: any) {
|
constructor(wallet: Wallet, opts?: any) {
|
||||||
if (!opts) {
|
if (!opts) {
|
||||||
opts = {}
|
opts = {}
|
||||||
|
@ -20,3 +20,5 @@ export class WalletSubprovider extends HookedWalletEthTxSubprovider {
|
||||||
super(opts)
|
super(opts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export = WalletSubprovider
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as crypto from 'crypto'
|
import * as crypto from 'crypto'
|
||||||
import * as ethUtil from 'ethereumjs-util'
|
import * as ethUtil from 'ethereumjs-util'
|
||||||
|
|
||||||
import { Wallet } from './index'
|
import Wallet = require('./index')
|
||||||
|
|
||||||
const scryptsy = require('scrypt.js')
|
const scryptsy = require('scrypt.js')
|
||||||
const utf8 = require('utf8')
|
const utf8 = require('utf8')
|
||||||
|
@ -239,9 +239,11 @@ function fromQuorumWallet(passphrase: string, userid: string): Wallet {
|
||||||
return new Wallet(seed)
|
return new Wallet(seed)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Thirdparty = {
|
const Thirdparty = {
|
||||||
fromEtherWallet,
|
fromEtherWallet,
|
||||||
fromEtherCamp,
|
fromEtherCamp,
|
||||||
fromKryptoKit,
|
fromKryptoKit,
|
||||||
fromQuorumWallet,
|
fromQuorumWallet,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export = Thirdparty
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as assert from 'assert'
|
import * as assert from 'assert'
|
||||||
import { EthereumHDKey } from '../src/hdkey'
|
import EthereumHDKey = require('../src/hdkey')
|
||||||
|
|
||||||
// from BIP39 mnemonic: awake book subject inch gentle blur grant damage process float month clown
|
// from BIP39 mnemonic: awake book subject inch gentle blur grant damage process float month clown
|
||||||
const fixtureseed = Buffer.from(
|
const fixtureseed = Buffer.from(
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import * as assert from 'assert'
|
import * as assert from 'assert'
|
||||||
import * as ethUtil from 'ethereumjs-util'
|
import * as ethUtil from 'ethereumjs-util'
|
||||||
|
|
||||||
import { Wallet } from '../src'
|
import Wallet = require('../src')
|
||||||
import { Thirdparty } from '../src/thirdparty'
|
import Thirdparty = require('../src/thirdparty')
|
||||||
|
|
||||||
const fixturePrivateKey = 'efca4cdd31923b50f4214af5d2ae10e7ac45a5019e9431cc195482d707485378'
|
const fixturePrivateKey = 'efca4cdd31923b50f4214af5d2ae10e7ac45a5019e9431cc195482d707485378'
|
||||||
const fixturePrivateKeyStr = '0x' + fixturePrivateKey
|
const fixturePrivateKeyStr = '0x' + fixturePrivateKey
|
||||||
|
|
Loading…
Reference in New Issue