FlowF
Flow2y ago
joshua

joshua | Flow (2024-05-06)

I updated to the latest preview of flow-go-sdk, cadence, and emulator and I am getting this error in my Go tests now:
./nft_test_helpers.go:37:19: evt.Value.Fields undefined (type cadence.Event has no field or method Fields)

This is my code:
type Withdrawn struct {
    nftType      string
    id           uint64
    uuid         uint64
    from         string
    providerUuid uint64
}

type WithdrawnEvent flow.Event

func (evt WithdrawnEvent) NftType() cadence.String {
    return evt.Value.Fields[0].(cadence.String)
}

I checked the cadence value code for events and tried
fields
, and
getFieldValues()
but those aren't found either.

    github.com/onflow/cadence v1.0.0-preview.25
    github.com/onflow/flow-emulator v1.0.0-preview.22
    github.com/onflow/flow-go-sdk v1.0.0-preview.25

Any idea what I should be using there to get a field from an event?
Was this page helpful?