diff --git a/src/runtime/http/express-router.ts b/src/runtime/http/express-router.ts index e48e9cc..8065b3d 100644 --- a/src/runtime/http/express-router.ts +++ b/src/runtime/http/express-router.ts @@ -575,8 +575,9 @@ export class AnchorExpressRouter { return; } + const serverConfig = this.config.get('server'); const selectedAsset = this.config.getAsset(transaction.assetCode); - sendJson(res, 200, { + const responseData: Record & { more_info_url?: string } = { id: transaction.id, kind: transaction.kind, status: transaction.status, @@ -584,10 +585,17 @@ export class AnchorExpressRouter { asset_code: transaction.assetCode, asset_issuer: selectedAsset?.issuer, account: transaction.account, - interactive_url: `${this.config.get('server').interactiveDomain ?? 'http://localhost:3000'}/deposit/${transaction.id}`, + interactive_url: `${serverConfig.interactiveDomain ?? 'http://localhost:3000'}/deposit/${transaction.id}`, created_at: transaction.createdAt, updated_at: transaction.updatedAt, - }); + }; + + // Add more_info_url only when interactive domain is configured + if (serverConfig.interactiveDomain) { + responseData.more_info_url = `${serverConfig.interactiveDomain}/deposit/${transaction.id}`; + } + + sendJson(res, 200, responseData); return; } diff --git a/tests/mvp-express.integration.test.ts b/tests/mvp-express.integration.test.ts index 61cbcfb..c5b7910 100644 --- a/tests/mvp-express.integration.test.ts +++ b/tests/mvp-express.integration.test.ts @@ -564,6 +564,7 @@ describe('MVP Express-mounted integration', () => { expect(response.body.interactive_url).toBe( `https://anchor.example.com/deposit/${transactionId}`, ); + expect(response.body.more_info_url).toBe(`https://anchor.example.com/deposit/${transactionId}`); }); it('7b) transaction lookup returns 404 for non-existent ID', async () => {