Skip to content

Commit bf54124

Browse files
authored
TW-1614: Temple Tap Airdrop confirmation (#182)
1 parent 999f45a commit bf54124

File tree

4 files changed

+33
-3
lines changed

4 files changed

+33
-3
lines changed

.env.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ REDIS_URL=
1111
ADMIN_USERNAME=
1212
ADMIN_PASSWORD=
1313
COVALENT_API_KEY=
14+
TEMPLE_TAP_API_URL=

src/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export const EnvVars = {
1414
ADMIN_USERNAME: getEnv('ADMIN_USERNAME'),
1515
ADMIN_PASSWORD: getEnv('ADMIN_PASSWORD'),
1616
COVALENT_API_KEY: getEnv('COVALENT_API_KEY'),
17-
ALCHEMY_API_KEY: getEnv('ALCHEMY_API_KEY')
17+
ALCHEMY_API_KEY: getEnv('ALCHEMY_API_KEY'),
18+
TEMPLE_TAP_API_URL: getEnv('TEMPLE_TAP_API_URL')
1819
};
1920

2021
for (const name in EnvVars) {

src/index.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import swaggerJSDoc from 'swagger-jsdoc';
1010
import swaggerUi from 'swagger-ui-express';
1111

1212
import { getAdvertisingInfo } from './advertising/advertising';
13-
import { MIN_ANDROID_APP_VERSION, MIN_IOS_APP_VERSION } from './config';
13+
import { EnvVars, MIN_ANDROID_APP_VERSION, MIN_IOS_APP_VERSION } from './config';
1414
import getDAppsStats from './getDAppsStats';
1515
import { getMagicSquareQuestParticipants, startMagicSquareQuest } from './magic-square';
1616
import { basicAuth } from './middlewares/basic-auth.middleware';
@@ -398,6 +398,33 @@ app.get('/api/signing-nonce', (req, res) => {
398398
}
399399
});
400400

401+
app.post('/api/temple-tap/confirm-airdrop-username', async (req, res) => {
402+
try {
403+
const response = await fetch(new URL('/v1/confirm-airdrop-address', EnvVars.TEMPLE_TAP_API_URL), {
404+
method: 'POST',
405+
body: JSON.stringify(req.body),
406+
headers: {
407+
'Content-Type': 'application/json'
408+
}
409+
});
410+
411+
const statusCode = String(response.status);
412+
const responseBody = await response.text();
413+
414+
if (statusCode.startsWith('2') || statusCode.startsWith('4')) {
415+
res.status(response.status).send(responseBody);
416+
417+
return;
418+
}
419+
420+
throw new Error(responseBody);
421+
} catch (error) {
422+
console.error('Temple Tap API proxy endpoint exception:', error);
423+
424+
res.status(500).send({ message: 'Unknown error' });
425+
}
426+
});
427+
401428
const swaggerOptions = {
402429
swaggerDefinition: {
403430
openapi: '3.0.0',

templewallet-backend.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"ALICE_BOB_PUBLIC_KEY": "SECRET_VALUE",
1313
"ALICE_BOB_PRIVATE_KEY": "SECRET_VALUE",
1414
"THREE_ROUTE_API_URL": "SECRET_VALUE",
15-
"THREE_ROUTE_API_AUTH_TOKEN": "SECRET_VALUE"
15+
"THREE_ROUTE_API_AUTH_TOKEN": "SECRET_VALUE",
16+
"TEMPLE_TAP_API_URL": "SECRET_VALUE"
1617
}
1718
}
1819
]

0 commit comments

Comments
 (0)