diff --git a/indexer/api/routes/deposits.go b/indexer/api/routes/deposits.go index fbb0849d1379..5845ef36bcad 100644 --- a/indexer/api/routes/deposits.go +++ b/indexer/api/routes/deposits.go @@ -30,7 +30,7 @@ type DepositResponse struct { // TODO this is original spec but maybe include the l2 block info too for the relayed tx // FIXME make a pure function that returns a struct instead of newWithdrawalResponse func newDepositResponse(deposits []*database.L1BridgeDepositWithTransactionHashes) DepositResponse { - var items []DepositItem + items := make([]DepositItem, len(deposits)) for _, deposit := range deposits { item := DepositItem{ Guid: deposit.L1BridgeDeposit.TransactionSourceHash.String(), diff --git a/indexer/api/routes/withdrawals.go b/indexer/api/routes/withdrawals.go index 02a57fe155f7..0f125527a540 100644 --- a/indexer/api/routes/withdrawals.go +++ b/indexer/api/routes/withdrawals.go @@ -43,7 +43,7 @@ type WithdrawalResponse struct { // FIXME make a pure function that returns a struct instead of newWithdrawalResponse func newWithdrawalResponse(withdrawals []*database.L2BridgeWithdrawalWithTransactionHashes) WithdrawalResponse { - var items []WithdrawalItem + items := make([]WithdrawalItem, len(withdrawals)) for _, withdrawal := range withdrawals { item := WithdrawalItem{ Guid: withdrawal.L2BridgeWithdrawal.TransactionWithdrawalHash.String(),