Skip to content

Commit 671094f

Browse files
authored
Merge pull request #762 from graphprotocol/pcv/coerce-if-not-null
fix(cli): when sending to L2, only coerce gas params if not null
2 parents ff25e0f + 1793fc5 commit 671094f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cli/commands/bridge/to-l2.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ const checkAndRedeemMessage = async (l1ToL2Message: L1ToL2MessageWriter) => {
4141
logger.info(`Transfer successful: ${l2TxHash}`)
4242
}
4343

44+
const ifNotNullToBN = (val: string | null) => (val == null ? val : toBN(val))
45+
4446
export const sendToL2 = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<void> => {
4547
logger.info(`>>> Sending tokens to L2 <<<\n`)
4648

@@ -172,9 +174,9 @@ export const sendToL2Command = {
172174
description: 'Calldata to pass to the recipient. Must be allowlisted in the bridge',
173175
})
174176
.coerce({
175-
maxGas: toBN,
176-
gasPriceBid: toBN,
177-
maxSubmissionCost: toBN,
177+
maxGas: ifNotNullToBN,
178+
gasPriceBid: ifNotNullToBN,
179+
maxSubmissionCost: ifNotNullToBN,
178180
})
179181
},
180182
handler: async (argv: CLIArgs): Promise<void> => {

0 commit comments

Comments
 (0)