Skip to content

Commit

Permalink
[DDW-1131] Cardano wallet launcher improvement to accept CARDANO_WALL…
Browse files Browse the repository at this point in the history
…ET_STAKE_POOL_REGISTRY_URL
  • Loading branch information
Tomislav Horaček committed Dec 13, 2019
1 parent 234753a commit eaac7f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
19 changes: 12 additions & 7 deletions source/main/cardano/CardanoWalletLauncher.js
Expand Up @@ -3,6 +3,7 @@ import { spawn } from 'child_process';
import { dirname } from 'path';
import type { ChildProcess } from 'child_process';
import { configureJormungandrDeps } from './nodes';
import { CARDANO_WALLET_STAKE_POOL_REGISTRY_URL } from '../config';

export type WalletOpts = {
path: string,
Expand All @@ -26,6 +27,15 @@ export async function CardanoWalletLauncher(
path,
walletArgs,
} = walletOpts;
const walletStdio: string[] = ['pipe', 'pipe', 'pipe', 'ipc'];
const nodePath = dirname(nodeBin);
const PATH: string = (process.env.PATH: any);
const envVariables: {
PATH: string,
CARDANO_WALLET_STAKE_POOL_REGISTRY_URL?: string,
} = {
PATH: `${nodePath}:${PATH}`,
};

// This switch statement handles any node specifc
// configuration, prior to spawning the child process
Expand All @@ -37,23 +47,18 @@ export async function CardanoWalletLauncher(
// The selfnode is identified by the unique genesis-block wallet arg
if (walletArgs.findIndex(arg => arg === '--genesis-block') > -1) {
await configureJormungandrDeps(cliBin, stateDir);
Object.assign(envVariables, { CARDANO_WALLET_STAKE_POOL_REGISTRY_URL });
}
break;
default:
break;
}

const walletStdio: string[] = ['pipe', 'pipe', 'pipe', 'ipc'];
const nodePath = dirname(nodeBin);
const PATH: string = (process.env.PATH: any);

const childProcess = spawn(path, walletArgs, {
stdio: walletStdio,
env: {
...process.env,
PATH: `${nodePath}:${PATH}`,
CARDANO_WALLET_STAKE_POOL_REGISTRY_URL:
'https://github.com/input-output-hk/cardano-wallet/raw/master/lib/jormungandr/test/data/jormungandr/stake_pools/registry/test-integration-registry.zip',
...envVariables,
},
});

Expand Down
4 changes: 4 additions & 0 deletions source/main/config.js
Expand Up @@ -129,3 +129,7 @@ export const DISK_SPACE_CHECK_LONG_INTERVAL = 10 * 60 * 1000; // 10 minutes | un
export const DISK_SPACE_CHECK_MEDIUM_INTERVAL = 60 * 1000; // 1 minute | unit: milliseconds
export const DISK_SPACE_CHECK_SHORT_INTERVAL = isTest ? 2000 : 10 * 1000; // 10 seconds | unit: milliseconds
export const DISK_SPACE_RECOMMENDED_PERCENTAGE = 15; // 15% of the total disk space

// CardanoWallet config
export const CARDANO_WALLET_STAKE_POOL_REGISTRY_URL =
'https://github.com/input-output-hk/cardano-wallet/raw/master/lib/jormungandr/test/data/jormungandr/stake_pools/registry/test-integration-registry.zip';

0 comments on commit eaac7f6

Please sign in to comment.