Skip to content

Commit

Permalink
ran linter and fixed rosetta CLI test
Browse files Browse the repository at this point in the history
Signed-off-by: bizk <[email protected]>
  • Loading branch information
bizk committed Nov 21, 2023
1 parent 6d98718 commit 66c56df
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 4 additions & 5 deletions converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (s *ConverterTestSuite) SetupTest() {
s.unsignedTx = builder.GetTx()
}

//func (s *ConverterTestSuite) TestFromRosettaOpsToTxSuccess() {
// func (s *ConverterTestSuite) TestFromRosettaOpsToTxSuccess() {
// addr1 := sdk.AccAddress("address1").String()
// addr2 := sdk.AccAddress("address2").String()
//
Expand Down Expand Up @@ -169,14 +169,13 @@ func (s *ConverterTestSuite) TestOpsAndSigners() {
_, err := s.txConf.TxEncoder()(sdkTx)
s.Require().NoError(err)

//ops, signers, err := s.c.ToRosetta().OpsAndSigners(txBytes)
//s.Require().NoError(err)
// s.Require().NoError(err)

_, err = sdkTx.GetSigners()
s.Require().NoError(err)
//s.Require().Equal(len(ops), len(sdkTx.GetMsgs())*len(signerAddrs), "operation number mismatch")
// s.Require().Equal(len(ops), len(sdkTx.GetMsgs())*len(signerAddrs), "operation number mismatch")
//
//s.Require().Equal(len(signers), len(signerAddrs), "signers number mismatch")
// s.Require().Equal(len(signers), len(signerAddrs), "signers number mismatch")
})
}

Expand Down
2 changes: 1 addition & 1 deletion tests/rosetta-cli/rosetta-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"blockchain": "cosmos",
"network": "cosmos"
},
"online_url":"http://localhost:8081",
"online_url":"http://localhost:8080",
"data_directory":"",
"http_timeout":10,
"max_retries":5,
Expand Down
9 changes: 5 additions & 4 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package rosetta
import (
"encoding/json"
"fmt"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"strconv"
"time"

authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"

v1beta1 "cosmossdk.io/api/cosmos/base/v1beta1"
txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1"
signing2 "cosmossdk.io/x/tx/signing"
Expand Down Expand Up @@ -59,11 +60,11 @@ func parseSignerData(signerData authsigning.SignerData) signing2.SignerData {
return signing2.SignerData{Address: strconv.FormatUint(signerData.AccountNumber, 10), ChainID: signerData.ChainID, AccountNumber: signerData.AccountNumber, Sequence: signerData.Sequence, PubKey: &parsedSignerDataPublicKey}
}

func parseTxTip(tx authsigning.Tx) txv1beta1.Tip {
func parseTxTip(tx authsigning.Tx) txv1beta1.Tip { // nolint: staticcheck // Because we still need to use
parsedTipAmount := []*v1beta1.Coin{}
tipper := string(tx.FeePayer())

//if tx.GetTip() != nil {
// if tx.GetTip() != nil {
// for _, txCoin := range tx.GetTip().Amount {
// parsedTipAmount = append(parsedTipAmount, &v1beta1.Coin{
// Denom: txCoin.Denom,
Expand All @@ -73,7 +74,7 @@ func parseTxTip(tx authsigning.Tx) txv1beta1.Tip {
// tipper = tx.GetTip().Tipper
//}

return txv1beta1.Tip{
return txv1beta1.Tip{ // nolint: staticcheck // Because we still need to use
Amount: parsedTipAmount,
Tipper: tipper,
}
Expand Down

0 comments on commit 66c56df

Please sign in to comment.