Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #546 from vegaprotocol/release/v0.14.2-pre1
Browse files Browse the repository at this point in the history
Release/v0.14.2 pre1
  • Loading branch information
jeremyletang authored Apr 22, 2022
2 parents 981344d + d9b742b commit 82d4d8d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
### 🐛 Fixes
- [](https://github.com/vegaprotocol/vegawallet/pull/) -

## 0.14.2

### 🛠 Improvements
- [544](https://github.com/vegaprotocol/vegawallet/issues/544) - Display transaction hash after sending transaction

## 0.14.1

### 🐛 Fixes
Expand Down
3 changes: 3 additions & 0 deletions cmd/tx_send.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ func SendTx(w io.Writer, rf *RootFlags, req *SendTxRequest) error {
}

log.Info("transaction successfully sent", zap.String("hash", txHash))
if rf.Output == flags.InteractiveOutput {
p.CheckMark().InfoText("Transaction sent:").SuccessText(txHash).NextLine()
}

return nil
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module code.vegaprotocol.io/vegawallet
go 1.17

require (
code.vegaprotocol.io/protos v0.50.1
code.vegaprotocol.io/protos v0.50.3
code.vegaprotocol.io/shared v0.0.0-20220321185018-3b5684b00533
github.com/blang/semver/v4 v4.0.0
github.com/cenkalti/backoff/v4 v4.1.2
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
code.vegaprotocol.io/protos v0.50.1-0.20220412212930-5d74f8a446c0 h1:qy9Kk53fpfsZU7HXL95ZE7yDKVPBv0EtIwdKr/zKvMs=
code.vegaprotocol.io/protos v0.50.1-0.20220412212930-5d74f8a446c0/go.mod h1:4BqwDw6jhc/mnwbXq8ZFUtYBFCnk8tBW6zuPsBt8OrQ=
code.vegaprotocol.io/protos v0.50.1 h1:/DQ57iSPMR6Uk+TVGw/GcBfNcTqSCd3Bk/nia11o/+c=
code.vegaprotocol.io/protos v0.50.1/go.mod h1:4BqwDw6jhc/mnwbXq8ZFUtYBFCnk8tBW6zuPsBt8OrQ=
code.vegaprotocol.io/protos v0.50.3 h1:9gSw3SDnvZ8oaPooEl2Mg7MbfMroKwutqMTvaLTD5NE=
code.vegaprotocol.io/protos v0.50.3/go.mod h1:4BqwDw6jhc/mnwbXq8ZFUtYBFCnk8tBW6zuPsBt8OrQ=
code.vegaprotocol.io/shared v0.0.0-20220321185018-3b5684b00533 h1:IxTWvyF0i0AgUAS+FTgQKIpbsS6Ki/Y9Ug0GSlgChJw=
code.vegaprotocol.io/shared v0.0.0-20220321185018-3b5684b00533/go.mod h1:pNHKwqRDkotUN0s6jErl7Eb2EpZa2HAf03lyPMTCUT0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
Expand Down
4 changes: 4 additions & 0 deletions service/mocks/policies_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ func (p *MockConsentPolicy) Ask(tx *v1.SubmitTransactionRequest) (bool, error) {
}
return true, nil
}

func (p *MockConsentPolicy) NeedsInteractiveOutput() bool {
return true
}
9 changes: 9 additions & 0 deletions service/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (r *ConsentRequest) GetTxID() string {

type Policy interface {
Ask(tx *v1.SubmitTransactionRequest) (bool, error)
NeedsInteractiveOutput() bool
}

type AutomaticConsentPolicy struct{}
Expand All @@ -48,6 +49,10 @@ func (p *AutomaticConsentPolicy) Ask(_ *v1.SubmitTransactionRequest) (bool, erro
return true, nil
}

func (p *AutomaticConsentPolicy) NeedsInteractiveOutput() bool {
return false
}

type ExplicitConsentPolicy struct {
pendingEvents chan ConsentRequest
}
Expand All @@ -67,3 +72,7 @@ func (p *ExplicitConsentPolicy) Ask(tx *v1.SubmitTransactionRequest) (bool, erro
c := <-confirmations
return c.Decision, nil
}

func (p *ExplicitConsentPolicy) NeedsInteractiveOutput() bool {
return true
}
6 changes: 6 additions & 0 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
commandspb "code.vegaprotocol.io/protos/vega/commands/v1"
walletpb "code.vegaprotocol.io/protos/vega/wallet/v1"
vgcrypto "code.vegaprotocol.io/shared/libs/crypto"
"code.vegaprotocol.io/vegawallet/cmd/printer"
wcommands "code.vegaprotocol.io/vegawallet/commands"
"code.vegaprotocol.io/vegawallet/network"
"code.vegaprotocol.io/vegawallet/version"
Expand Down Expand Up @@ -793,6 +794,11 @@ func (s *Service) signTx(token string, w http.ResponseWriter, r *http.Request, _
return
}

if s.policy.NeedsInteractiveOutput() {
p := printer.NewInteractivePrinter(w)
p.CheckMark().InfoText("Transaction sent:").SuccessText(txHash).NextLine()
}

s.writeSuccess(w, struct {
TxHash string `json:"txHash"`
Tx *commandspb.Transaction `json:"tx"`
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const (
ReleasesAPI = "https://api.github.com/repos/vegaprotocol/vegawallet/releases"
ReleasesURL = "https://github.com/vegaprotocol/vegawallet/releases"
defaultVersionHash = "unknown"
defaultVersion = "v0.14.1"
defaultVersion = "v0.14.2"
)

var (
Expand Down

0 comments on commit 82d4d8d

Please sign in to comment.