@@ -24,15 +24,7 @@ The endpoint requires authentication using the `SNAPSHOT_AUTH_TOKEN` environment
2424- ** Method** : POST
2525- ** Purpose** : Processes a batch of wallets for balance snapshots (main endpoint)
2626- ** Authentication** : Required (Bearer token)
27- - ** Content-Type** : ` application/json `
28- - ** Body** :
29- ``` json
30- {
31- "batchId" : " string" ,
32- "batchNumber" : number,
33- "batchSize" : number
34- }
35- ```
27+ - ** Parameters** : passed via query string (no request body)
3628- ** Query Parameters** :
3729 - ` batchId ` : Unique identifier for the batch session
3830 - ` batchNumber ` : Current batch number (1-based, must be ≥ 1)
@@ -74,7 +66,12 @@ The endpoint requires authentication using the `SNAPSHOT_AUTH_TOKEN` environment
7466 "isArchived" : boolean,
7567 "verified" : number,
7668 "hasDRepKeys" : boolean,
77- "hasClarityApiKey" : boolean
69+ "scriptCborLength" : number,
70+ "stakeCredentialLength" : number,
71+ "signersAddressesLength" : number,
72+ "signersStakeKeysLength" : number,
73+ "signersDRepKeysLength" : number,
74+ "signersDescriptionsLength" : number
7875 }
7976 }
8077 ]
@@ -83,6 +80,14 @@ The endpoint requires authentication using the `SNAPSHOT_AUTH_TOKEN` environment
8380 }
8481 ```
8582
83+ #### Example (curl)
84+
85+ ``` bash
86+ curl -X POST \
87+ " $API_BASE_URL /api/v1/stats/run-snapshots-batch?batchId=snapshot-$( date +%s) &batchNumber=1&batchSize=5" \
88+ -H " Authorization: Bearer $SNAPSHOT_AUTH_TOKEN "
89+ ```
90+
8691## Batch Processing System
8792
8893The new system processes wallets in small batches to avoid timeout issues:
@@ -94,6 +99,8 @@ The new system processes wallets in small batches to avoid timeout issues:
94994 . ** Fault Tolerant** : Failed batches can be retried individually
951005 . ** Input Validation** : Comprehensive validation for batch parameters
961016 . ** Error Tracking** : Detailed error reporting with wallet structure information
102+ 7 . ** Network Fallback** : If no UTxOs are found on the inferred network, the opposite network is tried
103+ 8 . ** Wallet Build Strategy** : Uses ordered keys via ` MultisigWallet ` when ` signersStakeKeys ` exist; otherwise falls back to legacy ` buildWallet `
97104
98105### Orchestrator Script
99106The ` scripts/batch-snapshot-orchestrator.ts ` script manages the entire process:
@@ -112,7 +119,7 @@ The `scripts/batch-snapshot-orchestrator.ts` script manages the entire process:
112119- ** ` BATCH_SIZE ` ** : Wallets per batch (default: 5, range: 1-5)
113120- ** ` DELAY_BETWEEN_BATCHES ` ** : Seconds between batches (default: 10)
114121- ** ` MAX_RETRIES ` ** : Retry attempts for failed batches (default: 3)
115- - ** ` REQUEST_TIMEOUT ` ** : Request timeout in seconds (default: 60 )
122+ - ** ` REQUEST_TIMEOUT ` ** : Request timeout in seconds (default: 45 )
116123
117124## GitHub Actions Integration
118125
@@ -182,11 +189,13 @@ The orchestrator will:
182189
183190### Type Safety & Validation
184191- ** Fixed Decimal Type** : Proper handling of Decimal types in database operations
185- - ** Input Validation** : Comprehensive validation for batch parameters (batch number ≥ 1, batch size 1-100 )
192+ - ** Input Validation** : Comprehensive validation for batch parameters (batch number ≥ 1, batch size 1-5 )
186193- ** Error Tracking** : Enhanced error handling with detailed wallet structure information
187194
188195### Configuration & Reliability
189196- ** Configurable Timeouts** : Request timeout now configurable via ` REQUEST_TIMEOUT ` environment variable
190197- ** Enhanced Error Handling** : UTxO fetch failures are now properly tracked and reported
191198- ** Network-Specific Reporting** : Separate tracking for mainnet and testnet wallets and balances
192- - ** Improved Documentation** : Updated documentation to reflect all recent changes
199+ - ** Improved Documentation** : Updated documentation to reflect all recent changes
200+ - ** Network Fallback** : Attempts the opposite network if no UTxOs are found
201+ - ** Wallet Build Logic** : Uses ordered keys with ` MultisigWallet ` when stake keys are available, with legacy fallback (no stake keys)
0 commit comments