Skip to content

Commit 4019a2d

Browse files
committed
chore: fix linter
1 parent d2f03e5 commit 4019a2d

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

datanode/api/trading_data_v2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (t *TradingDataServiceV2) ListVaults(ctx context.Context, req *v2.ListVault
191191
if err != nil {
192192
return nil, err
193193
}
194-
edges := make([]*v2.VaultEdge, len(vaults))
194+
edges := make([]*v2.VaultEdge, 0, len(vaults))
195195
for _, vault := range vaults {
196196
vaultEvent := &v1.VaultState{
197197
Vault: vault.Vault,

datanode/gateway/graphql/vault_resolver.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// Copyright (C) 2023 Gobalsky Labs Limited
2+
//
3+
// This program is free software: you can redistribute it and/or modify
4+
// it under the terms of the GNU Affero General Public License as
5+
// published by the Free Software Foundation, either version 3 of the
6+
// License, or (at your option) any later version.
7+
//
8+
// This program is distributed in the hope that it will be useful,
9+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
// GNU Affero General Public License for more details.
12+
//
13+
// You should have received a copy of the GNU Affero General Public License
14+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
116
package gql
217

318
import (

datanode/sqlstore/vault.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"code.vegaprotocol.io/vega/datanode/entities"
2424
"code.vegaprotocol.io/vega/datanode/metrics"
25-
v2 "code.vegaprotocol.io/vega/protos/data-node/api/v2"
2625

2726
"github.com/georgysavva/scany/pgxscan"
2827
)
@@ -87,15 +86,13 @@ func (vs *Vault) GetByVaultID(
8786
err := pgxscan.Select(ctx, vs.ConnectionSource, &pvs,
8887
`SELECT * FROM vault_party_shares_current WHERE vault_id=$1`,
8988
entities.VaultID(id))
90-
9189
if err != nil {
9290
return vaultState, vs.wrapE(err)
9391
}
9492

9593
err = pgxscan.Get(ctx, vs.ConnectionSource, &vaultState,
9694
`SELECT * FROM vault_state_current WHERE vault_id=$1`,
9795
entities.VaultID(id))
98-
9996
if err != nil {
10097
return vaultState, vs.wrapE(err)
10198
}
@@ -137,7 +134,7 @@ func (v *Vault) ListVaultsWithCursor(ctx context.Context,
137134
vault.PartyShares = pvs
138135
vaultStateWithPartyShare = append(vaultStateWithPartyShare, vault)
139136
}
140-
vaultStateWithPartyShare, pageInfo = entities.PageEntities[*v2.VaultEdge](vaultStateWithPartyShare, pagination)
137+
vaultStateWithPartyShare, pageInfo = entities.PageEntities(vaultStateWithPartyShare, pagination)
141138
return vaultStateWithPartyShare, pageInfo, nil
142139
}
143140

datanode/sqlstore/vault_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ import (
2323
"code.vegaprotocol.io/vega/datanode/sqlstore"
2424
"code.vegaprotocol.io/vega/libs/num"
2525
"code.vegaprotocol.io/vega/protos/vega"
26+
2627
"github.com/stretchr/testify/require"
2728
)
2829

29-
func setupVaultTest(t *testing.T) (*sqlstore.Blocks, *sqlstore.Vault) {
30+
func setupVaultTest(t *testing.T) *sqlstore.Vault {
3031
t.Helper()
31-
bs := sqlstore.NewBlocks(connectionSource)
3232
plbs := sqlstore.NewVault(connectionSource)
3333

34-
return bs, plbs
34+
return plbs
3535
}
3636

3737
func TestVaultState(t *testing.T) {
38-
_, vs := setupVaultTest(t)
38+
vs := setupVaultTest(t)
3939

4040
const (
4141
vault1 = "70432aa1dc6bc20a9b404d30f23e6a8def11a1692609dcef0ad8dc558d9df7db"
@@ -157,7 +157,7 @@ func TestVaultState(t *testing.T) {
157157
}
158158

159159
func TestListVaults(t *testing.T) {
160-
_, vs := setupVaultTest(t)
160+
vs := setupVaultTest(t)
161161

162162
const (
163163
vault1 = "70432aa1dc6bc20a9b404d30f23e6a8def11a1692609dcef0ad8dc558d9df7db"

0 commit comments

Comments
 (0)