@@ -32,11 +32,17 @@ export type ParsedAccountIndexConfig =
3232 | Readonly < { mode : "sequential" ; start : number ; count : number } >
3333 | Readonly < { mode : "random" ; start : number ; count : number ; seed ?: number } > ;
3434
35- export function parseAccountIndexConfig ( rawVars : unknown ) : ParsedAccountIndexConfig {
35+ export function parseAccountIndexConfig (
36+ rawVars : unknown
37+ ) : ParsedAccountIndexConfig {
3638 const vars = requireDict ( rawVars , "context.vars" ) ;
3739
3840 const modeRaw = requireNonEmptyString ( vars . ACCOUNT_MODE , "ACCOUNT_MODE" ) ;
39- if ( modeRaw !== "byIndex" && modeRaw !== "sequential" && modeRaw !== "random" ) {
41+ if (
42+ modeRaw !== "byIndex" &&
43+ modeRaw !== "sequential" &&
44+ modeRaw !== "random"
45+ ) {
4046 throw new Error (
4147 `Missing or invalid ACCOUNT_MODE: ${ modeRaw } (expected 'byIndex', 'sequential', or 'random')`
4248 ) ;
@@ -47,7 +53,11 @@ export function parseAccountIndexConfig(rawVars: unknown): ParsedAccountIndexCon
4753 if ( vars . accountIndex !== undefined ) {
4854 const idx = requireInteger ( vars . accountIndex , "accountIndex" ) ;
4955 if ( idx < 0 ) throw new Error ( "accountIndex must be >= 0" ) ;
50- return { mode : "byIndex" , accountIndex : idx , source : "payload:accountIndex" } ;
56+ return {
57+ mode : "byIndex" ,
58+ accountIndex : idx ,
59+ source : "payload:accountIndex" ,
60+ } ;
5161 }
5262
5363 const idx = requireInteger ( vars . ACCOUNT_INDEX , "ACCOUNT_INDEX" ) ;
@@ -70,7 +80,10 @@ export function parseAccountIndexConfig(rawVars: unknown): ParsedAccountIndexCon
7080
7181 // random
7282 if ( vars . ACCOUNT_RANDOM_SEED !== undefined ) {
73- const seed = requireInteger ( vars . ACCOUNT_RANDOM_SEED , "ACCOUNT_RANDOM_SEED" ) ;
83+ const seed = requireInteger (
84+ vars . ACCOUNT_RANDOM_SEED ,
85+ "ACCOUNT_RANDOM_SEED"
86+ ) ;
7487 return { mode : "random" , start, count, seed } ;
7588 }
7689 return { mode : "random" , start, count } ;
0 commit comments