@@ -10,7 +10,7 @@ import swaggerJSDoc from 'swagger-jsdoc';
1010import swaggerUi from 'swagger-ui-express' ;
1111
1212import { 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' ;
1414import getDAppsStats from './getDAppsStats' ;
1515import { getMagicSquareQuestParticipants , startMagicSquareQuest } from './magic-square' ;
1616import { 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+
401428const swaggerOptions = {
402429 swaggerDefinition : {
403430 openapi : '3.0.0' ,
0 commit comments