From 5bcd633a69a3021e75d058a5bac3ba1ecc1477ed Mon Sep 17 00:00:00 2001 From: Michael de Hoog Date: Tue, 7 Jan 2025 10:38:50 -1000 Subject: [PATCH] op-withdrawer: support txs with multiple deposits (#46) --- op-withdrawer/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/op-withdrawer/main.go b/op-withdrawer/main.go index 7dedbee..a9590fc 100644 --- a/op-withdrawer/main.go +++ b/op-withdrawer/main.go @@ -189,12 +189,14 @@ func DepositHash(cliCtx *cli.Context) error { if err != nil { return err } - if len(deposits) != 1 { - return fmt.Errorf("expected 1 deposit, got %d", len(deposits)) + if len(deposits) == 0 { + return fmt.Errorf("no deposits found") } - hash := types.NewTx(deposits[0]).Hash() - fmt.Println(hash.Hex()) + // a single tx can contain multiple deposits; print them all + for _, deposit := range deposits { + fmt.Println(types.NewTx(deposit).Hash().Hex()) + } return nil }