Skip to content

Commit

Permalink
Merge pull request #1664 from onflow/auto-update-onflow-cadence-v1.0.…
Browse files Browse the repository at this point in the history
…0-preview.35
  • Loading branch information
turbolent authored Jun 28, 2024
2 parents db96781 + e778984 commit 9d41db9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 47 deletions.
26 changes: 13 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ require (
github.com/gosuri/uilive v0.0.4
github.com/logrusorgru/aurora/v4 v4.0.0
github.com/manifoldco/promptui v0.9.0
github.com/onflow/cadence v1.0.0-preview.34
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.32
github.com/onflow/cadence-tools/lint v1.0.0-preview.32
github.com/onflow/cadence-tools/test v1.0.0-preview.32
github.com/onflow/cadence v1.0.0-preview.35
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.33
github.com/onflow/cadence-tools/lint v1.0.0-preview.33
github.com/onflow/cadence-tools/test v1.0.0-preview.33
github.com/onflow/contract-updater/lib/go/templates v1.0.1
github.com/onflow/fcl-dev-wallet v0.8.0-stable-cadence.1
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.18
github.com/onflow/flow-core-contracts/lib/go/templates v1.0.0
github.com/onflow/flow-emulator v1.0.0-preview.32
github.com/onflow/flow-evm-gateway v0.19.0
github.com/onflow/flow-go v0.35.14-crescendo-preview.27
github.com/onflow/flow-go-sdk v1.0.0-preview.36
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.24
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.19
github.com/onflow/flow-core-contracts/lib/go/templates v1.3.0
github.com/onflow/flow-emulator v1.0.0-preview.33
github.com/onflow/flow-evm-gateway v0.21.0
github.com/onflow/flow-go v0.35.14-crescendo-preview.27.0.20240626210601-604590f19db9
github.com/onflow/flow-go-sdk v1.0.0-preview.37
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.25
github.com/onflow/go-ethereum v1.13.4
github.com/onflowser/flowser/v3 v3.2.1-0.20240131200229-7d4d22715f48
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
Expand Down Expand Up @@ -203,14 +203,14 @@ require (
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.7.0-rc.2 // indirect
github.com/onflow/crypto v0.25.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.1.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.0 // indirect
github.com/onflow/flow-ft/lib/go/contracts v1.0.0 // indirect
github.com/onflow/flow-ft/lib/go/templates v1.0.0 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.2.1 // indirect
github.com/onflow/flow-nft/lib/go/templates v1.2.0 // indirect
github.com/onflow/flow/protobuf/go/flow v0.4.4 // indirect
github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 // indirect
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
github.com/onflow/sdks v0.6.0-preview.1 // indirect
github.com/onflow/wal v1.0.2 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
Expand Down
51 changes: 26 additions & 25 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2157,55 +2157,56 @@ github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f/go.mod h1:xvP61FoOs
github.com/onflow/atree v0.7.0-rc.2 h1:mZmVrl/zPlfI44EjV3FdR2QwIqT8nz1sCONUBFcML/U=
github.com/onflow/atree v0.7.0-rc.2/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/cadence v1.0.0-M3/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8=
github.com/onflow/cadence v1.0.0-preview.34 h1:MJSli75W6LJVUqSx/tq4MQe64H1+EcQBD/sNgpOO4jE=
github.com/onflow/cadence v1.0.0-preview.34/go.mod h1:jOwvPSSLTr9TvaKMs7KKiBYMmpdpNNAFxBsjMlrqVD0=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.32 h1:bcXyutzucIKXvrOPU3YcTcYMNUsEVQpnPwBT4Y4n3eI=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.32/go.mod h1:jD3nHNc67XrWd/IC714vN1N7odAXjCfg8M/y+f5OdH4=
github.com/onflow/cadence-tools/lint v1.0.0-preview.32 h1:ikRHM2aBd1OT8go4Ru/UWmmoEgfRHsWo1Hh4uOlQ91o=
github.com/onflow/cadence-tools/lint v1.0.0-preview.32/go.mod h1:0DlaXiefoamdXaOvMDLY5xg+qtkjG2YP82iCaDAGkp0=
github.com/onflow/cadence-tools/test v1.0.0-preview.32 h1:UBxfDY+za0cU0Dxt2t5bro+XtnZyvdPKiAHtRIujLfk=
github.com/onflow/cadence-tools/test v1.0.0-preview.32/go.mod h1:V5JDHX9mm+ta2Ejl+oActaxGNiToaABs4M+m1a871TY=
github.com/onflow/cadence v1.0.0-preview.35 h1:HZgt/9Foa6sCSH9SNaIFUSXK6q2ZxETg0ivsZbf+hhU=
github.com/onflow/cadence v1.0.0-preview.35/go.mod h1:jOwvPSSLTr9TvaKMs7KKiBYMmpdpNNAFxBsjMlrqVD0=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.33 h1:eepGWEYAh0V/xklsh8XFpENrnWJ3x/Hu3XhUGtwiu6Y=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.33/go.mod h1:3gRwz39hOVR9++tdUbV07eEYb1p0eXtPylLOqYmequw=
github.com/onflow/cadence-tools/lint v1.0.0-preview.33 h1:nTdKGCIBW/nWDLLBjkVgvMQxgaj+9F5+8o2NMXGs1Ac=
github.com/onflow/cadence-tools/lint v1.0.0-preview.33/go.mod h1:j+eA2hhi5a+g8SIPZhLLvw9SNFaASg+LS1m+kpb6fDc=
github.com/onflow/cadence-tools/test v1.0.0-preview.33 h1:LfV5rphRD0KeTcJskMjjzA6QU3hQNNKPsVzB9OfK17w=
github.com/onflow/cadence-tools/test v1.0.0-preview.33/go.mod h1:iehbYZI1AYGWFQ4ve+OmSgPEd5c9A/ygpmoXZc3P8Lw=
github.com/onflow/contract-updater/lib/go/templates v1.0.1 h1:xPj898Y8OgLLbXH8+JeKVBV6J+nqPZjiLgGM3Abucto=
github.com/onflow/contract-updater/lib/go/templates v1.0.1/go.mod h1:OXO6s0X7OW4Q6QTfAfnjoOmibEPgs0psOfMi+tPyzQE=
github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A=
github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI=
github.com/onflow/fcl-dev-wallet v0.8.0-stable-cadence.1 h1:IqdUzdqFCSW0klWmA3J9c17ZyQTab9SWcWSLouX6o0Q=
github.com/onflow/fcl-dev-wallet v0.8.0-stable-cadence.1/go.mod h1:kc42jkiuoPJmxMRFjfbRO9XvnR/3XLheaOerxVMDTiw=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.18 h1:3IznBzxdXKrVJ8YDaA2dSQD2HQeWmsL3HsjZY86L+5o=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.18/go.mod h1:dZqcdrsDdvBs5433bkXC8KN0l/jCamerWcmaB1P7YM4=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.1.0 h1:AegPBm079X0qjneUYs+mRCpEUxSZ1lw5h4MbuXHlqn0=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.1.0/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg=
github.com/onflow/flow-core-contracts/lib/go/templates v1.0.0 h1:za6bxPPW4JIsthhasUDTa1ruKjIO8DIhun9INQfj61Y=
github.com/onflow/flow-core-contracts/lib/go/templates v1.0.0/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30=
github.com/onflow/flow-emulator v1.0.0-preview.32 h1:VkJL7u75XUB8077CQvojKhxSCGirGCrsjAxjTOUIpD4=
github.com/onflow/flow-emulator v1.0.0-preview.32/go.mod h1:wwHM6+cJ5s3BIS9Wj0pXTRumj9n929fqwNuXqOD1g7g=
github.com/onflow/flow-evm-gateway v0.19.0 h1:gFhwFftwrbLbveLDfTm9R9IDCPgHmHlgsveaneQ3Kz8=
github.com/onflow/flow-evm-gateway v0.19.0/go.mod h1:yvA5LRcr7xn7EniccsX19ap0yUHzfMUj2nxLyRwiu+Y=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.19 h1:B8WO5T36P+TJ7CodehFze8VTOXw7RcKwbFTKNEAn1d0=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.19/go.mod h1:Dyqp/qkvrIzVzebZi2OlauljPmr65mtVZpc12wjIhR0=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.0 h1:cq3RfBr9TnTSnsGlUHMjMGZib24Horfb1XJqMpkN5ew=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.3.0/go.mod h1:u/mkP/B+PbV33tEG3qfkhhBlydSvAKxfLZSfB4lsJHg=
github.com/onflow/flow-core-contracts/lib/go/templates v1.3.0 h1:aMFJdB2CW+Dzm+AJ5QN6J1yWh+a0l2RxHN2/TtLaXUo=
github.com/onflow/flow-core-contracts/lib/go/templates v1.3.0/go.mod h1:NgbMOYnMh0GN48VsNKZuiwK7uyk38Wyo8jN9+C9QE30=
github.com/onflow/flow-emulator v1.0.0-preview.33 h1:1LFVpZJrgAZjPr5Jou3dbg6zOO5GMREnmE1dr9ndnJE=
github.com/onflow/flow-emulator v1.0.0-preview.33/go.mod h1:4T/kFzo8jccGF8GbxLlu3b/jwBH6GxX8p0hTPURHZ7k=
github.com/onflow/flow-evm-gateway v0.21.0 h1:8pbSLatORAqnvycOFECwD7aFvrezbPgfJX43Z9ajirw=
github.com/onflow/flow-evm-gateway v0.21.0/go.mod h1:GkRS6AN1YS7ltXWbMNKA32btSQcXUt5EoqPJ+y5nBgo=
github.com/onflow/flow-ft/lib/go/contracts v1.0.0 h1:mToacZ5NWqtlWwk/7RgIl/jeKB/Sy/tIXdw90yKHcV0=
github.com/onflow/flow-ft/lib/go/contracts v1.0.0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
github.com/onflow/flow-ft/lib/go/templates v1.0.0 h1:6cMS/lUJJ17HjKBfMO/eh0GGvnpElPgBXx7h5aoWJhs=
github.com/onflow/flow-ft/lib/go/templates v1.0.0/go.mod h1:uQ8XFqmMK2jxyBSVrmyuwdWjTEb+6zGjRYotfDJ5pAE=
github.com/onflow/flow-go v0.35.14-crescendo-preview.27 h1:sWjWsutcFOP9o/etZF3Zii0eq4MMqKQchquwmyElWCQ=
github.com/onflow/flow-go v0.35.14-crescendo-preview.27/go.mod h1:P7AnyTH5W+hNm5pmhnYasIh7T6Z2kU4tiy53NJKvhZA=
github.com/onflow/flow-go v0.35.14-crescendo-preview.27.0.20240626210601-604590f19db9 h1:9GfHBXy9T8QEAkwX+KkmZjJadSOAVgiyn2n8s7sSueY=
github.com/onflow/flow-go v0.35.14-crescendo-preview.27.0.20240626210601-604590f19db9/go.mod h1:SE4kph7kpF6ydOXObtueEecGk3Hrjy/if/0UHY/eRO8=
github.com/onflow/flow-go-sdk v1.0.0-M1/go.mod h1:TDW0MNuCs4SvqYRUzkbRnRmHQL1h4X8wURsCw9P9beo=
github.com/onflow/flow-go-sdk v1.0.0-preview.36 h1:3g72MjmZPEEVAbtDATbjwqKoNSB7yHLWswUHSAB5zwQ=
github.com/onflow/flow-go-sdk v1.0.0-preview.36/go.mod h1:mjkXIluC+kseYyd8Z1aTq73IiffAUeoY5fuX/C2Z+1w=
github.com/onflow/flow-go-sdk v1.0.0-preview.37 h1:ujeIQheD+skzFt9+eOT9nXcc1rFxVLSCzwisEI3+2DA=
github.com/onflow/flow-go-sdk v1.0.0-preview.37/go.mod h1:2aSN7RdKzxWoCtCyOJz9W/ZNqkLgQDQS3hKLYwPlvGw=
github.com/onflow/flow-nft/lib/go/contracts v1.2.1 h1:woAAS5z651sDpi7ihAHll8NvRS9uFXIXkL6xR+bKFZY=
github.com/onflow/flow-nft/lib/go/contracts v1.2.1/go.mod h1:2gpbza+uzs1k7x31hkpBPlggIRkI53Suo0n2AyA2HcE=
github.com/onflow/flow-nft/lib/go/templates v1.2.0 h1:JSQyh9rg0RC+D1930BiRXN8lrtMs+ubVMK6aQPon6Yc=
github.com/onflow/flow-nft/lib/go/templates v1.2.0/go.mod h1:p+2hRvtjLUR3MW1NsoJe5Gqgr2eeH49QB6+s6ze00w0=
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flow/protobuf/go/flow v0.4.4 h1:lD1owoZGFgLcvdLZDmP0Kc4GOuQeSU3/d7hrujFzt6k=
github.com/onflow/flow/protobuf/go/flow v0.4.4/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.24 h1:D6cbWqxuwjg/vXtNWyvViCNpWjUPMYfMewA9P4oT14s=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.24/go.mod h1:89ipBRMJE9nWRimoqaa02+l6kCQuBiVyzszI6N3a6Sk=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.25 h1:O5+TsPkN7nzVAaDZTnAww5Dx5p9ZczQHgLOZdq0xJFI=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.25/go.mod h1:xEMke42kCoEtqkzc7+zkaWU5l22EpThdJ1YZuKutAMY=
github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc=
github.com/onflow/go-ethereum v1.13.4/go.mod h1:cE/gEUkAffhwbVmMJYz+t1dAfVNHNwZCgc3BWtZxBGY=
github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 h1:sxyWLqGm/p4EKT6DUlQESDG1ZNMN9GjPCm1gTq7NGfc=
github.com/onflow/nft-storefront/lib/go/contracts v1.0.0/go.mod h1:kMeq9zUwCrgrSojEbTUTTJpZ4WwacVm2pA7LVFr+glk=
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba h1:rIehuhO6bj4FkwE4VzwEjX7MoAlOhUJENBJLqDqVxAo=
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
github.com/onflow/sdks v0.6.0-preview.1 h1:mb/cUezuqWEP1gFZNAgUI4boBltudv4nlfxke1KBp9k=
github.com/onflow/sdks v0.6.0-preview.1/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
github.com/onflow/wal v1.0.2 h1:5bgsJVf2O3cfMNK12fiiTyYZ8cOrUiELt3heBJfHOhc=
github.com/onflow/wal v1.0.2/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
github.com/onflowser/flowser/v3 v3.2.1-0.20240131200229-7d4d22715f48 h1:eBS8Rm1V9TTGpj9lcpoCi6MIwWgYQZ8crJ7cSrS39Y4=
Expand Down
29 changes: 20 additions & 9 deletions internal/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"encoding/json"
"fmt"
"io"
"sort"

"github.com/onflow/cadence"
jsoncdc "github.com/onflow/cadence/encoding/json"
Expand Down Expand Up @@ -119,37 +120,47 @@ func eventString(writer io.Writer, event flow.Event) {
_, _ = fmt.Fprintf(writer, " Tx ID\t%s\n", event.TransactionID)
_, _ = fmt.Fprintf(writer, " Values\n")

fields := cadence.FieldsMappedByName(event.Value)
evt := event.Value

for _, field := range event.Value.EventType.Fields {
value := fields[field.Identifier]
printField(writer, field, value)
values := evt.FieldsMappedByName()
fields := evt.EventType.FieldsMappedByName()

names := make([]string, 0, len(fields))
for name := range fields {
names = append(names, name)
}
sort.Strings(names)

for _, name := range names {
ty := fields[name]
value := values[name]
printField(writer, name, ty, value)
}
}

func printValues(writer io.Writer, fieldIdentifier, typedId, valueString string) {
_, _ = fmt.Fprintf(writer, "\t\t- %s (%s): %s \n", fieldIdentifier, typedId, valueString)
}

func printField(writer io.Writer, field cadence.Field, value cadence.Value) {
func printField(writer io.Writer, name string, ty cadence.Type, value cadence.Value) {
v := value.String()
var typeId string

defer func() {
if err := recover(); err != nil {
printValues(writer, field.Identifier, "?", v)
printValues(writer, name, "?", v)
}
}()

if field.Type != nil {
if ty != nil {
//TODO: onflow/cadence issue #1672
//currently getting ID for cadence array will cause panic
typeId = field.Type.ID()
typeId = ty.ID()
}

if typeId == "" { // exception for not known typeId workaround for cadence arrays
v = fmt.Sprintf("%s\n\t\thex: %x", v, v)
typeId = "?"
}
printValues(writer, field.Identifier, typeId, v)
printValues(writer, name, typeId, v)
}

0 comments on commit 9d41db9

Please sign in to comment.