@@ -5,27 +5,26 @@ import { TransactionDB } from "../../../shared/db/transactions/db";
55import { standardResponseSchema } from "../../schemas/shared-api-schemas" ;
66
77// SPECIAL LOGIC FOR AMEX
8- // added two admin routes to backfill tx hashes to the backfill table
9- // loadBackfillRoute and clearBackfillRoute
10- // loadBackfillRoute is used to load tx hashes to the backfill table
11- // clearBackfillRoute is used to clear the backfill table
12- // these routes are used by the AMEX script to backfill tx hashes to the backfill table
13- // see https://github.com/thirdweb-dev/solutions-customer-scripts/blob/main/amex/scripts/load-backfill-via-api.ts
14- // loadBackfillRoute is used to load tx hashes to the backfill table
15- // clearBackfillRoute is used to clear the backfill table
16- // these routes are used by the AMEX script to backfill tx hashes to the backfill table
17- // see https://github.com/thirdweb-dev/solutions-customer-scripts/blob/main/amex/scripts/load-backfill-via-api.ts
8+ // Two admin routes to backfill transaction data:
9+ // - loadBackfillRoute: Load queueId to status/transactionHash mappings
10+ // - clearBackfillRoute: Clear all backfill entries
11+ // See https://github.com/thirdweb-dev/solutions-customer-scripts/blob/main/amex/scripts/load-backfill-via-api.ts
12+
13+ const MinedEntrySchema = Type . Object ( {
14+ queueId : Type . String ( { description : "Queue ID (UUID)" } ) ,
15+ status : Type . Literal ( "mined" ) ,
16+ transactionHash : Type . String ( { description : "Transaction hash (0x...)" } ) ,
17+ } ) ;
18+
19+ const ErroredEntrySchema = Type . Object ( {
20+ queueId : Type . String ( { description : "Queue ID (UUID)" } ) ,
21+ status : Type . Literal ( "errored" ) ,
22+ } ) ;
1823
1924const loadRequestBodySchema = Type . Object ( {
2025 entries : Type . Array (
21- Type . Object ( {
22- queueId : Type . String ( { description : "Queue ID (UUID)" } ) ,
23- status : Type . Union ( [ Type . Literal ( "mined" ) , Type . Literal ( "errored" ) ] , {
24- description : "Transaction status: 'mined' for successful transactions, 'errored' for failed ones" ,
25- } ) ,
26- transactionHash : Type . Optional (
27- Type . String ( { description : "Transaction hash (0x...). Required for mined transactions." } ) ,
28- ) ,
26+ Type . Union ( [ MinedEntrySchema , ErroredEntrySchema ] , {
27+ description : "Entry with status 'mined' requires transactionHash; status 'errored' does not" ,
2928 } ) ,
3029 {
3130 description : "Array of queueId to status/transactionHash mappings" ,
0 commit comments