@@ -157,7 +157,12 @@ async function transferOnChain(
157157 transferAmountEth = transferAmount ;
158158 } else {
159159 // transferRatio is guaranteed to be defined at this point
160- transferAmountEth = ( balanceEth - gasCostEth ) * transferRatio ! ;
160+ if ( transferRatio === undefined ) {
161+ throw new Error (
162+ "Transfer ratio must be defined when amount is not specified" ,
163+ ) ;
164+ }
165+ transferAmountEth = ( balanceEth - gasCostEth ) * transferRatio ;
161166 }
162167
163168 // Round to 10 decimal places to avoid Web3 conversion errors
@@ -299,7 +304,12 @@ function getSelectedChains(argv: {
299304 ) ;
300305 selectedChains = [ ] ;
301306
302- for ( const chainId of argv . chain ! ) {
307+ if ( ! argv . chain ) {
308+ throw new Error (
309+ "Chain argument must be defined for specific chain selection" ,
310+ ) ;
311+ }
312+ for ( const chainId of argv . chain ) {
303313 if ( ! entropyChainIds . has ( chainId ) ) {
304314 throw new Error (
305315 `Chain ${ chainId } does not have entropy contracts deployed` ,
@@ -360,7 +370,10 @@ async function main() {
360370 if ( argv . amount !== undefined ) {
361371 transferMethod = `${ argv . amount } ETH (fixed amount)` ;
362372 } else {
363- transferMethod = `${ ( argv . ratio ! * 100 ) . toFixed ( 1 ) } % of available balance` ;
373+ if ( argv . ratio === undefined ) {
374+ throw new Error ( "Ratio must be defined when amount is not specified" ) ;
375+ }
376+ transferMethod = `${ ( argv . ratio * 100 ) . toFixed ( 1 ) } % of available balance` ;
364377 }
365378
366379 console . log ( `\nConfiguration:` ) ;
0 commit comments