diff --git a/tests/integration/cli/query.go b/tests/integration/cli/query.go index bf12d7e8f..383ecd9b0 100644 --- a/tests/integration/cli/query.go +++ b/tests/integration/cli/query.go @@ -116,3 +116,19 @@ func QueryResourceCollection(collectionID string) (resourcetypes.QueryCollection return resp, nil } + +func QueryTxn(hash string) (sdk.TxResponse, error) { + res, err := Query("tx", hash) + if err != nil { + return sdk.TxResponse{}, err + } + + var resp sdk.TxResponse + err = helpers.Codec.UnmarshalJSON([]byte(res), &resp) + + if err != nil { + return sdk.TxResponse{}, err + } + + return resp, nil +} diff --git a/tests/integration/cli_resource_pricing_test.go b/tests/integration/cli_resource_pricing_test.go index 78640f5c7..7cb8b03f8 100644 --- a/tests/integration/cli_resource_pricing_test.go +++ b/tests/integration/cli_resource_pricing_test.go @@ -112,7 +112,10 @@ var _ = Describe("cheqd cli - positive resource pricing", func() { Expect(diff).To(Equal(tax.Amount)) By("exporting a readable tx event log") - events := helpers.ReadableEvents(res.Events) + txResp, err := cli.QueryTxn(res.TxHash) + Expect(err).To(BeNil()) + + events := helpers.ReadableEvents(txResp.Events) By("ensuring the events contain the expected tax event") Expect(events).To(ContainElement( @@ -187,7 +190,10 @@ var _ = Describe("cheqd cli - positive resource pricing", func() { Expect(diff).To(Equal(tax.Amount)) By("exporting a readable tx event log") - events := helpers.ReadableEvents(res.Events) + txResp, err := cli.QueryTxn(res.TxHash) + Expect(err).To(BeNil()) + + events := helpers.ReadableEvents(txResp.Events) By("ensuring the events contain the expected tax event") Expect(events).To(ContainElement( @@ -262,7 +268,10 @@ var _ = Describe("cheqd cli - positive resource pricing", func() { Expect(diff).To(Equal(tax.Amount)) By("exporting a readable tx event log") - events := helpers.ReadableEvents(res.Events) + txResp, err := cli.QueryTxn(res.TxHash) + Expect(err).To(BeNil()) + + events := helpers.ReadableEvents(txResp.Events) By("ensuring the events contain the expected tax event") Expect(events).To(ContainElement( diff --git a/tests/integration/helpers/codec.go b/tests/integration/helpers/codec.go index aae70558b..977eb56b0 100644 --- a/tests/integration/helpers/codec.go +++ b/tests/integration/helpers/codec.go @@ -2,8 +2,11 @@ package helpers import ( "github.com/cheqd/cheqd-node/app/params" + didtypes "github.com/cheqd/cheqd-node/x/did/types" + resourcetypes "github.com/cheqd/cheqd-node/x/resource/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" ) var ( @@ -13,6 +16,10 @@ var ( func init() { encodingConfig := params.MakeEncodingConfig() + std.RegisterLegacyAminoCodec(encodingConfig.Amino) + std.RegisterInterfaces(encodingConfig.InterfaceRegistry) + resourcetypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) + didtypes.RegisterInterfaces(encodingConfig.InterfaceRegistry) Codec = encodingConfig.Codec Registry = encodingConfig.InterfaceRegistry }