From 8f122ffb9fab63c5887c3ed72a223e4a38758946 Mon Sep 17 00:00:00 2001 From: meriadec Date: Thu, 31 May 2018 12:01:26 +0200 Subject: [PATCH] Use `withLibcore` in libcoreGetVersion --- src/commands/libcoreGetVersion.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/commands/libcoreGetVersion.js b/src/commands/libcoreGetVersion.js index 052079b3..43a9924f 100644 --- a/src/commands/libcoreGetVersion.js +++ b/src/commands/libcoreGetVersion.js @@ -1,16 +1,17 @@ // @flow -import { createCommand, Command } from 'helpers/ipc' import { fromPromise } from 'rxjs/observable/fromPromise' +import { createCommand, Command } from 'helpers/ipc' +import withLibcore from 'helpers/withLibcore' + type Input = void type Result = { stringVersion: string, intVersion: number } const cmd: Command = createCommand('libcoreGetVersion', () => fromPromise( - Promise.resolve().then(() => { - const ledgerCore = require('init-ledger-core')() + withLibcore(ledgerCore => { const core = new ledgerCore.NJSLedgerCore() const stringVersion = core.getStringVersion() const intVersion = core.getIntVersion()