Skip to content

Commit

Permalink
fix: don't ever display a 404 for the wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Nov 7, 2020
1 parent e4ea0c4 commit 4fb3d48
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions packages/cosmic-swingset/lib/ag-solo/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,26 @@ export default async function start(basedir, argv) {
resetOutdatedState,
} = d;

// Remove wallet traces.
await unlink('html/wallet').catch(_ => {});

const { wallet } = JSON.parse(fs.readFileSync('options.json', 'utf-8'));

// Symlink the wallet.
const pjs = require.resolve(`${wallet}/package.json`);
const {
'agoric-wallet': {
htmlBasedir = 'ui/build',
deploy = ['contract/deploy.js', 'api/deploy.js'],
} = {},
} = JSON.parse(fs.readFileSync(pjs, 'utf-8'));

const agWallet = path.dirname(pjs);
const agWalletHtml = path.resolve(agWallet, htmlBasedir);
symlink(agWalletHtml, 'html/wallet').catch(e => {
console.error('Cannot link html/wallet:', e);
});

let hostport;
await Promise.all(
connections.map(async c => {
Expand Down Expand Up @@ -351,9 +371,6 @@ export default async function start(basedir, argv) {
startTimer(1200);
resetOutdatedState();

// Remove wallet traces.
await unlink('html/wallet').catch(_ => {});

log.info(`swingset running`);
swingSetRunning = true;
deliverOutbound();
Expand All @@ -362,20 +379,6 @@ export default async function start(basedir, argv) {
return;
}

const { wallet } = JSON.parse(fs.readFileSync('options.json', 'utf-8'));

// Symlink the wallet.
const pjs = require.resolve(`${wallet}/package.json`);
const {
'agoric-wallet': {
htmlBasedir = 'ui/build',
deploy = ['contract/deploy.js', 'api/deploy.js'],
} = {},
} = JSON.parse(fs.readFileSync(pjs, 'utf-8'));

const agWallet = path.dirname(pjs);
const agWalletHtml = path.resolve(agWallet, htmlBasedir);

const deploys = typeof deploy === 'string' ? [deploy] : deploy;
// TODO: Shell-quote the deploy list.
const agWalletDeploy = deploys
Expand All @@ -396,10 +399,6 @@ export default async function start(basedir, argv) {
// Report the error.
process.stderr.write(stderr);
}
// Now that the deploy is done, link the wallet!
symlink(agWalletHtml, 'html/wallet').catch(e => {
console.error('Cannot link html/wallet:', e);
});
},
);
}

0 comments on commit 4fb3d48

Please sign in to comment.