Skip to content

Commit

Permalink
Merge pull request #16 from stratosnet/v6.0.0-stratos_fix-parse-issue
Browse files Browse the repository at this point in the history
Fix/ST-365: Add v1_1 msg parser
  • Loading branch information
Xiong-stratos authored Sep 30, 2024
2 parents 5df7d73 + 208a3fb commit ccf6bf5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
23 changes: 23 additions & 0 deletions cmd/callisto/stchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/forbole/juno/v5/types"
pottypes "github.com/stratosnet/stratos-chain/x/pot/types"
registertypes "github.com/stratosnet/stratos-chain/x/register/types"
registertypes_v1_1 "github.com/stratosnet/stratos-chain/x/register/types/v1_1"
sdstypes "github.com/stratosnet/stratos-chain/x/sds/types"
)

Expand All @@ -16,8 +17,30 @@ var stchainMessageAddressesParser = junomessages.JoinMessageParsers(
registerMessageAddressesParser,
potMessageAddressesParser,
sdsMessageAddressesParser,
registerV1_1MessageAddressesParser,
)

func registerV1_1MessageAddressesParser(tx *types.Tx) ([]string, error) {
txMsgs := tx.GetMsgs()
for _, cosmosMsg := range txMsgs {
switch msg := cosmosMsg.(type) {
case *registertypes_v1_1.MsgCreateResourceNode:
return []string{msg.NetworkAddress, msg.OwnerAddress}, nil

case *registertypes_v1_1.MsgCreateMetaNode:
return []string{msg.NetworkAddress, msg.OwnerAddress}, nil

case *registertypes_v1_1.MsgUpdateResourceNode:
return []string{msg.NetworkAddress, msg.OwnerAddress}, nil

case *registertypes_v1_1.MsgUpdateMetaNode:
return []string{msg.NetworkAddress, msg.OwnerAddress}, nil
}

}
return nil, errors.New("Tx not supported: " + tx.RawLog)
}

// registerMessageAddressesParser represents a MessageAddressesParser for the x/register module
func registerMessageAddressesParser(tx *types.Tx) ([]string, error) {
txMsgs := tx.GetMsgs()
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/proullon/ramsql v0.1.3
github.com/rs/zerolog v1.32.0
github.com/spf13/cobra v1.8.0
github.com/stratosnet/stratos-chain v0.12.1
github.com/stratosnet/stratos-chain v0.11.4-0.20240712192943-56122dd51997
github.com/stretchr/testify v1.9.0
github.com/tendermint/tendermint v0.35.9
google.golang.org/grpc v1.62.1
Expand Down Expand Up @@ -294,7 +294,7 @@ require (
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
github.com/stratosnet/ledger-stratos-go v0.0.0-20230728214905-432bf09f4b6c // indirect
github.com/stratosnet/stratos-chain/api v0.0.0-20240318144156-bf3328f863f6 // indirect
github.com/stratosnet/stratos-chain/api v0.0.0-20240711220534-c9cbef9fd8e4 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
Expand Down Expand Up @@ -365,6 +365,6 @@ require (

replace (
// use stratos fork of cosmos-sdk: v0.47.x-stratos
github.com/cosmos/cosmos-sdk => github.com/stratosnet/cosmos-sdk v0.47.12-0.20240521173001-c32cdc9a1e54
github.com/cosmos/cosmos-sdk => github.com/stratosnet/cosmos-sdk v0.47.12-0.20240711204239-ae99645b490a
golang.org/x/exp => golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1642,14 +1642,14 @@ github.com/ssgreg/nlreturn/v2 v2.2.1 h1:X4XDI7jstt3ySqGU86YGAURbxw3oTDPK9sPEi6YE
github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I=
github.com/stbenjam/no-sprintf-host-port v0.1.1 h1:tYugd/yrm1O0dV+ThCbaKZh195Dfm07ysF0U6JQXczc=
github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I=
github.com/stratosnet/cosmos-sdk v0.47.12-0.20240521173001-c32cdc9a1e54 h1:8uIe3hXJaPg/cgd6FqHSdiy8ntQQtzuA2C+3aFZTtkI=
github.com/stratosnet/cosmos-sdk v0.47.12-0.20240521173001-c32cdc9a1e54/go.mod h1:c7xno1ENztUrUOqZ70W5gi0pTh3pT/3C6O0y1WzHSwU=
github.com/stratosnet/cosmos-sdk v0.47.12-0.20240711204239-ae99645b490a h1:2wf/13Pu9ZYf7tlaVF1x8rvQisPbMOAqgbeH6WWavbo=
github.com/stratosnet/cosmos-sdk v0.47.12-0.20240711204239-ae99645b490a/go.mod h1:c7xno1ENztUrUOqZ70W5gi0pTh3pT/3C6O0y1WzHSwU=
github.com/stratosnet/ledger-stratos-go v0.0.0-20230728214905-432bf09f4b6c h1:EuJdqCo1DYeKjkXaIYNnU7WIFmu+FzJwJtzYhY3sQpQ=
github.com/stratosnet/ledger-stratos-go v0.0.0-20230728214905-432bf09f4b6c/go.mod h1:9T0Ii/AMWWnJRtvKYKB4kDdraaOP76J+K5/IbRXQgyc=
github.com/stratosnet/stratos-chain v0.12.1 h1:3Ti2oi4zy+duE13eUMrfHGtDPGb7Zsbue4C/1u7QamA=
github.com/stratosnet/stratos-chain v0.12.1/go.mod h1:NcYrg9Y8opCIuudm3K4OsxbfgQM2si2EbBhFo/JSQTA=
github.com/stratosnet/stratos-chain/api v0.0.0-20240318144156-bf3328f863f6 h1:xrwEM+1tq/DEuHQCKr83C40SX61DEUALaWq7YEpR/uM=
github.com/stratosnet/stratos-chain/api v0.0.0-20240318144156-bf3328f863f6/go.mod h1:FN6crwtoVjf2errz8Nsj0y/zRxuIRtxs5w8qLHKVBqA=
github.com/stratosnet/stratos-chain v0.11.4-0.20240712192943-56122dd51997 h1:ryC8DCvHpngtmcZpoBbei4G/ofoIxSzd6OmGaEKx8H8=
github.com/stratosnet/stratos-chain v0.11.4-0.20240712192943-56122dd51997/go.mod h1:sm0/MAyc/q8T+WBGFyeVe5ORLveQvjkbtM/WiMJLB/U=
github.com/stratosnet/stratos-chain/api v0.0.0-20240711220534-c9cbef9fd8e4 h1:ci6Hgh39u4FjCV9t+YIohc53v/gE1IpgxUpTTo4ggSY=
github.com/stratosnet/stratos-chain/api v0.0.0-20240711220534-c9cbef9fd8e4/go.mod h1:FN6crwtoVjf2errz8Nsj0y/zRxuIRtxs5w8qLHKVBqA=
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
Expand Down

0 comments on commit ccf6bf5

Please sign in to comment.