This repository has been archived by the owner on Dec 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from ethereumjs/fix/browser-build
Migrate browser folder files to typescript & fix npm build
- Loading branch information
Showing
8 changed files
with
108 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import Common from 'ethereumjs-common' | ||
const level = require('level') | ||
|
||
// Blockchain | ||
export * from '../lib/blockchain/chain' | ||
|
||
// Peer | ||
export * from '../lib/net/peer/peer' | ||
export * from '../lib/net/peer/libp2ppeer' | ||
export * from './libp2pnode' | ||
|
||
// Peer Pool | ||
export * from '../lib/net/peerpool' | ||
|
||
// Protocol | ||
export * from '../lib/net/protocol/protocol' | ||
export * from '../lib/net/protocol/ethprotocol' | ||
export * from '../lib/net/protocol/lesprotocol' | ||
export * from '../lib/net/protocol/flowcontrol' | ||
|
||
// Server | ||
export * from '../lib/net/server/server' | ||
export * from '../lib/net/server/libp2pserver' | ||
|
||
// Node | ||
export * from '../lib/node' | ||
|
||
// Service | ||
export * from '../lib/service/service' | ||
export * from '../lib/service/fastethereumservice' | ||
export * from '../lib/service/lightethereumservice' | ||
|
||
// Synchronizer | ||
export * from '../lib/sync/sync' | ||
export * from '../lib/sync/fastsync' | ||
export * from '../lib/sync/lightsync' | ||
|
||
// Utilities | ||
export * from '../lib/util' | ||
|
||
// Logging | ||
export * from './logging' | ||
import { getLogger } from './logging' | ||
|
||
export function createNode(args: any) { | ||
const logger = getLogger({ loglevel: args.loglevel }) | ||
const options = { | ||
common: new Common(args.network || 'mainnet'), | ||
servers: [new exports.Libp2pServer({ multiaddrs: [], ...args })], | ||
syncmode: args.syncmode || 'fast', | ||
db: level(args.db || 'ethereumjs'), | ||
logger: logger, | ||
} | ||
return new exports.Node(options) | ||
} | ||
|
||
export function run(args: any) { | ||
const node = createNode(args) | ||
const logger = node.logger | ||
logger.info('Initializing Ethereumjs client...') | ||
logger.info(`Connecting to network: ${node.common.chainName()}`) | ||
node.on('error', (err: any) => logger.error(err)) | ||
node.on('listening', (details: any) => { | ||
logger.info(`Listener up transport=${details.transport} url=${details.url}`) | ||
}) | ||
node.on('synchronized', () => { | ||
logger.info('Synchronized') | ||
}) | ||
node.open().then(() => { | ||
logger.info('Synchronizing blockchain...') | ||
node.start() | ||
}) | ||
return node | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const pino = require('pino') | ||
|
||
export function getLogger(options = { loglevel: 'info' }) { | ||
return pino({ | ||
level: options.loglevel, | ||
base: null, | ||
}) | ||
} | ||
|
||
export const defaultLogger = getLogger({ loglevel: 'debug' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters