From 208a3fb17c526f5cdeeae7dad87ab08c5a54672b Mon Sep 17 00:00:00 2001 From: Xiong Date: Mon, 15 Jul 2024 11:39:08 -0400 Subject: [PATCH] add v1_1 msg parser --- cmd/callisto/stchain.go | 23 +++++++++++++++++++++++ go.mod | 6 +++--- go.sum | 12 ++++++------ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cmd/callisto/stchain.go b/cmd/callisto/stchain.go index a43599296..cb56e22b1 100644 --- a/cmd/callisto/stchain.go +++ b/cmd/callisto/stchain.go @@ -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" ) @@ -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() diff --git a/go.mod b/go.mod index b1b7b3330..3a5fb8b35 100644 --- a/go.mod +++ b/go.mod @@ -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 @@ -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 @@ -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 ) diff --git a/go.sum b/go.sum index c2d883f46..5bcfa5c6e 100644 --- a/go.sum +++ b/go.sum @@ -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=