Repository: vegaprotocol/go-wallet (go)

Issue:
Update protos to rename SubmitTransactionV2 into SubmitTransaction
Do what the title says.

Pull request:
SubmitTransactionV2 -> SubmitTransaction
close #242 

Patch:
diff --git a/cmd/command.go b/cmd/command.go
index fc72eed..080f9a9 100644
--- a/cmd/command.go
+++ b/cmd/command.go
@@ -120,7 +120,7 @@ func runCommand(_ *cobra.Command, pos []string) error {
 
 	log.Info("transaction successfully signed", zap.String("signature", tx.Signature.Value))
 
-	if err = forwarder.SendTx(ctx, tx, api.SubmitTransactionV2Request_TYPE_ASYNC); err != nil {
+	if err = forwarder.SendTx(ctx, tx, api.SubmitTransactionRequest_TYPE_ASYNC); err != nil {
 		return fmt.Errorf("couldn't send transaction: %w", err)
 	}
 
diff --git a/go.mod b/go.mod
index 27f900e..e41fa3f 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module code.vegaprotocol.io/go-wallet
 go 1.16
 
 require (
-	code.vegaprotocol.io/protos v0.42.0-pre6
+	code.vegaprotocol.io/protos v0.42.1-0.20210923113049-6d9549525594
 	code.vegaprotocol.io/shared v0.0.0-20210907092733-405b656c2f5b
 	github.com/blang/semver/v4 v4.0.0
 	github.com/cenkalti/backoff/v4 v4.0.2
diff --git a/go.sum b/go.sum
index 5bc139d..90664b7 100644
--- a/go.sum
+++ b/go.sum
@@ -12,6 +12,8 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k
 cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
 code.vegaprotocol.io/protos v0.42.0-pre6 h1:pUSVqPvUXC/E2vTY5alOKxn4Y2JlRy6xAKNNBNfXkbc=
 code.vegaprotocol.io/protos v0.42.0-pre6/go.mod h1:NORK22Evpwn0GoetL7H6/oVUzGcfjAJEJTzw+zTkSyE=
+code.vegaprotocol.io/protos v0.42.1-0.20210923113049-6d9549525594 h1:UHb5EQHIEgAVrY2SZ+8CJRnBLTYjiGQ+NhxwlPMWQ+g=
+code.vegaprotocol.io/protos v0.42.1-0.20210923113049-6d9549525594/go.mod h1:NORK22Evpwn0GoetL7H6/oVUzGcfjAJEJTzw+zTkSyE=
 code.vegaprotocol.io/shared v0.0.0-20210907092733-405b656c2f5b h1:4KzukI1unzR/+7+8L13g/2wYM1UVdgeaG1qxnRraOuY=
 code.vegaprotocol.io/shared v0.0.0-20210907092733-405b656c2f5b/go.mod h1:dmahiiphuDJvjXXDvQvo22tFPx7yk9wW8z1glU/JgHE=
 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
diff --git a/node/forwarder.go b/node/forwarder.go
index 791ae33..e4a4b81 100644
--- a/node/forwarder.go
+++ b/node/forwarder.go
@@ -103,15 +103,15 @@ func (n *Forwarder) LastBlockHeight(ctx context.Context) (uint64, error) {
 	return height, err
 }
 
-func (n *Forwarder) SendTx(ctx context.Context, tx *commandspb.Transaction, ty api.SubmitTransactionV2Request_Type) error {
-	req := api.SubmitTransactionV2Request{
+func (n *Forwarder) SendTx(ctx context.Context, tx *commandspb.Transaction, ty api.SubmitTransactionRequest_Type) error {
+	req := api.SubmitTransactionRequest{
 		Tx:   tx,
 		Type: ty,
 	}
 	return backoff.Retry(
 		func() error {
 			clt := n.nextClt()
-			resp, err := clt.SubmitTransactionV2(ctx, &req)
+			resp, err := clt.SubmitTransaction(ctx, &req)
 			if err != nil {
 				n.log.Error("failed to send transaction", zap.Error(err))
 				return err
diff --git a/service/mocks/node_forward_mock.go b/service/mocks/node_forward_mock.go
index 25e76d9..578ad0a 100644
--- a/service/mocks/node_forward_mock.go
+++ b/service/mocks/node_forward_mock.go
@@ -65,7 +65,7 @@ func (mr *MockNodeForwardMockRecorder) LastBlockHeight(arg0 interface{}) *gomock
 }
 
 // SendTx mocks base method
-func (m *MockNodeForward) SendTx(arg0 context.Context, arg1 *v1.Transaction, arg2 api.SubmitTransactionV2Request_Type) error {
+func (m *MockNodeForward) SendTx(arg0 context.Context, arg1 *v1.Transaction, arg2 api.SubmitTransactionRequest_Type) error {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "SendTx", arg0, arg1, arg2)
 	ret0, _ := ret[0].(error)
diff --git a/service/service.go b/service/service.go
index 7ff8ffc..0798cfa 100644
--- a/service/service.go
+++ b/service/service.go
@@ -391,7 +391,7 @@ type Auth interface {
 // NodeForward ...
 //go:generate go run github.com/golang/mock/mockgen -destination mocks/node_forward_mock.go -package mocks code.vegaprotocol.io/go-wallet/service NodeForward
 type NodeForward interface {
-	SendTx(context.Context, *commandspb.Transaction, api.SubmitTransactionV2Request_Type) error
+	SendTx(context.Context, *commandspb.Transaction, api.SubmitTransactionRequest_Type) error
 	HealthCheck(context.Context) error
 	LastBlockHeight(context.Context) (uint64, error)
 }
@@ -695,18 +695,18 @@ func (s *Service) VerifyAny(_ string, w http.ResponseWriter, r *http.Request, _
 }
 
 func (s *Service) SignTxSync(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params) {
-	s.signTx(token, w, r, p, api.SubmitTransactionV2Request_TYPE_SYNC)
+	s.signTx(token, w, r, p, api.SubmitTransactionRequest_TYPE_SYNC)
 }
 
 func (s *Service) SignTxCommit(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params) {
-	s.signTx(token, w, r, p, api.SubmitTransactionV2Request_TYPE_COMMIT)
+	s.signTx(token, w, r, p, api.SubmitTransactionRequest_TYPE_COMMIT)
 }
 
 func (s *Service) SignTx(token string, w http.ResponseWriter, r *http.Request, p httprouter.Params) {
-	s.signTx(token, w, r, p, api.SubmitTransactionV2Request_TYPE_ASYNC)
+	s.signTx(token, w, r, p, api.SubmitTransactionRequest_TYPE_ASYNC)
 }
 
-func (s *Service) signTx(token string, w http.ResponseWriter, r *http.Request, _ httprouter.Params, ty api.SubmitTransactionV2Request_Type) {
+func (s *Service) signTx(token string, w http.ResponseWriter, r *http.Request, _ httprouter.Params, ty api.SubmitTransactionRequest_Type) {
 	defer r.Body.Close()
 
 	req, errs := ParseSubmitTransactionRequest(r)


Test patch:
diff --git a/service/service_test.go b/service/service_test.go
index 160bf73..ae44a5f 100644
--- a/service/service_test.go
+++ b/service/service_test.go
@@ -665,7 +665,7 @@ func testSigningTransactionSucceeds(t *testing.T) {
 		Times(1).
 		Return(&commandspb.Transaction{}, nil)
 	s.nodeForward.EXPECT().
-		SendTx(gomock.Any(), &commandspb.Transaction{}, api.SubmitTransactionV2Request_TYPE_ASYNC).
+		SendTx(gomock.Any(), &commandspb.Transaction{}, api.SubmitTransactionRequest_TYPE_ASYNC).
 		Times(0)
 	s.nodeForward.EXPECT().LastBlockHeight(gomock.Any()).
 		Times(1).Return(uint64(42), nil)
@@ -699,7 +699,7 @@ func testSigningTransactionWithPropagationSucceeds(t *testing.T) {
 		Times(1).
 		Return(&commandspb.Transaction{}, nil)
 	s.nodeForward.EXPECT().
-		SendTx(gomock.Any(), &commandspb.Transaction{}, api.SubmitTransactionV2Request_TYPE_SYNC).
+		SendTx(gomock.Any(), &commandspb.Transaction{}, api.SubmitTransactionRequest_TYPE_SYNC).
 		Times(1).
 		Return(nil)
 	s.nodeForward.EXPECT().LastBlockHeight(gomock.Any()).
@@ -734,7 +734,7 @@ func testSigningTransactionWithFailedPropagationFails(t *testing.T) {
 		Times(1).
 		Return(&commandspb.Transaction{}, nil)
 	s.nodeForward.EXPECT().
-		SendTx(gomock.Any(), &commandspb.Transaction{}, api.SubmitTransactionV2Request_TYPE_SYNC).
+		SendTx(gomock.Any(), &commandspb.Transaction{}, api.SubmitTransactionRequest_TYPE_SYNC).
 		Times(1).
 		Return(errors.New("failure"))
 	s.nodeForward.EXPECT().LastBlockHeight(gomock.Any()).