From 2ca6aaeed656f608bfa7ed9f25527b70dc97f613 Mon Sep 17 00:00:00 2001 From: Jordan Ribbink Date: Tue, 17 Sep 2024 14:43:10 -0700 Subject: [PATCH] Update fee event filter to align with Crescendo update (#1751) --- internal/transactions/transactions.go | 2 +- internal/transactions/transactions_test.go | 34 ++++++++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/internal/transactions/transactions.go b/internal/transactions/transactions.go index fa61bef2f..64dc90ab2 100644 --- a/internal/transactions/transactions.go +++ b/internal/transactions/transactions.go @@ -99,7 +99,7 @@ func (r *transactionResult) JSON() any { func (r *transactionResult) String() string { var b bytes.Buffer writer := util.CreateTabWriter(&b) - const feeEventsCountAppended = 3 + const feeEventsCountAppended = 5 const feeDeductedEvent = "FeesDeducted" if r.result != nil { diff --git a/internal/transactions/transactions_test.go b/internal/transactions/transactions_test.go index e7fcc9620..a7637efcc 100644 --- a/internal/transactions/transactions_test.go +++ b/internal/transactions/transactions_test.go @@ -325,20 +325,32 @@ func Test_Result(t *testing.T) { ) event.Payload = []byte("mock_payload") - withdrawEvent := tests.NewEvent( + withdrawFlowEvent := tests.NewEvent( 1, "A.1654653399040a61.FlowToken.TokensWithdrawn", []cadence.Field{{Type: cadence.StringType, Identifier: "bar"}}, []cadence.Value{cadence.NewInt(1)}, ) - depositEvent := tests.NewEvent( + withdrawFungiEvent := tests.NewEvent( 2, + "A.9a0766d93b6608b7.FungibleToken.TokensWithdrawn", + []cadence.Field{{Type: cadence.StringType, Identifier: "bar"}}, + []cadence.Value{cadence.NewInt(1)}, + ) + depositFlowEvent := tests.NewEvent( + 3, "A.1654653399040a61.FlowToken.TokensDeposited", []cadence.Field{{Type: cadence.StringType, Identifier: "bar"}}, []cadence.Value{cadence.NewInt(1)}, ) + depositFungiEvent := tests.NewEvent( + 4, + "A.9a0766d93b6608b7.FungibleToken.TokensDeposited", + []cadence.Field{{Type: cadence.StringType, Identifier: "bar"}}, + []cadence.Value{cadence.NewInt(1)}, + ) feeEvent := tests.NewEvent( - 3, + 5, "A.f919ee77447b7497.FlowFees.FeesDeducted", []cadence.Field{{Type: cadence.StringType, Identifier: "bar"}}, []cadence.Value{cadence.NewInt(1)}, @@ -354,7 +366,7 @@ func Test_Result(t *testing.T) { txResultFeeEvents := &flow.TransactionResult{ Status: flow.TransactionStatusSealed, Error: nil, - Events: []flow.Event{*event, *withdrawEvent, *depositEvent, *feeEvent}, + Events: []flow.Event{*event, *withdrawFlowEvent, *withdrawFungiEvent, *depositFlowEvent, *depositFungiEvent, *feeEvent}, BlockID: flow.HexToID("7aa74143741c1c3b837d389fcffa7a5e251b67b4ffef6d6887b40cd9c803f537"), BlockHeight: 1, } @@ -513,12 +525,24 @@ Events: - bar (String): 1 Index 2 - Type A.1654653399040a61.FlowToken.TokensDeposited + Type A.9a0766d93b6608b7.FungibleToken.TokensWithdrawn Tx ID 0000000000000000000000000000000000000000000000000000000000000000 Values - bar (String): 1 Index 3 + Type A.1654653399040a61.FlowToken.TokensDeposited + Tx ID 0000000000000000000000000000000000000000000000000000000000000000 + Values + - bar (String): 1 + + Index 4 + Type A.9a0766d93b6608b7.FungibleToken.TokensDeposited + Tx ID 0000000000000000000000000000000000000000000000000000000000000000 + Values + - bar (String): 1 + + Index 5 Type A.f919ee77447b7497.FlowFees.FeesDeducted Tx ID 0000000000000000000000000000000000000000000000000000000000000000 Values