Skip to content

Commit

Permalink
feat: wallet is synced header
Browse files Browse the repository at this point in the history
  • Loading branch information
frantzarty committed Jul 21, 2022
1 parent d187404 commit e501287
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
assertWalletIsAvailable,
} from './utils/data-assertions';
import packageJson from '../package.json';
import datalayer from './datalayer';

const { API_KEY, READ_ONLY, IS_GOVERNANCE_BODY } = getConfig().APP;

Expand All @@ -23,6 +24,7 @@ const headerKeys = Object.freeze({
CR_READY_ONLY_HEADER_KEY: 'cw-read-only',
DATA_MODEL_VERION_HEADER_KEY: 'x-datamodel-version',
GOVERNANCE_BODY_HEADER_KEY: 'x-governance-body',
WALLET_SYNCED: 'x-wallet-synced',
});

const app = express();
Expand Down Expand Up @@ -99,6 +101,11 @@ app.use(function (req, res, next) {
next();
});

app.use(async function (req, res, next) {
res.setHeader(headerKeys.WALLET_SYNCED, await datalayer.walletIsSynced());
next();
});

app.use('/v1', V1Router);

app.use((err, req, res, next) => {
Expand Down

0 comments on commit e501287

Please sign in to comment.