Skip to content

Commit

Permalink
update to new flowkit and underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bjartek committed May 7, 2024
1 parent 0cf1462 commit b089c0f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 41 deletions.
9 changes: 1 addition & 8 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,10 @@ func (o *OverflowState) ParseEventsWithIdPrefix(events []flow.Event, idPrefix st
overflowEvents := OverflowEvents{}
fee := OverflowEvent{}
for i, event := range events {
var fieldNames []string

for _, eventTypeFields := range event.Value.EventType.Fields {
fieldNames = append(fieldNames, eventTypeFields.Identifier)
}

finalFields := map[string]interface{}{}
addresses := map[string][]string{}

for id, field := range event.Value.Fields {
name := fieldNames[id]
for name, field := range cadence.FieldsMappedByName(event.Value) {

adr := underflow.ExtractAddresses(field)
if len(adr) > 0 {
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ go 1.21

require (
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/bjartek/underflow v1.2.0
github.com/bjartek/underflow v1.3.0
github.com/enescakir/emoji v1.0.0
github.com/fatih/color v1.16.0
github.com/hexops/autogold v1.3.1
github.com/onflow/cadence v1.0.0-preview.23
github.com/onflow/cadence v1.0.0-preview.25
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.10
github.com/onflow/flow-emulator v1.0.0-preview.21
github.com/onflow/flow-go v0.34.0-crescendo-preview.17
github.com/onflow/flow-go-sdk v1.0.0-preview.22
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.16
github.com/onflow/flow-emulator v1.0.0-preview.22
github.com/onflow/flow-go v0.34.0-crescendo-preview.18
github.com/onflow/flow-go-sdk v1.0.0-preview.25
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.18
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.29.1
github.com/sanity-io/litter v1.5.5
Expand Down Expand Up @@ -144,7 +144,7 @@ require (
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/nightlyone/lockfile v1.0.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df // indirect
github.com/onflow/atree v0.7.0-rc.1 // indirect
github.com/onflow/crypto v0.25.1 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1074,8 +1074,8 @@ github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edY
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/bjartek/underflow v1.2.0 h1:1nENhL0DiVm+E4pLvjzSadU7fzLvn7q+M1V0Zzz5Eh4=
github.com/bjartek/underflow v1.2.0/go.mod h1:W9QqoZo7yTp7zo+AP/FeXHJ3alO5rRM69wyWFjwK9OQ=
github.com/bjartek/underflow v1.3.0 h1:HOE1ZEuAMkFUXCsXwV+gCFUHjyJA9d9nTIJu+RHI7SI=
github.com/bjartek/underflow v1.3.0/go.mod h1:JO6QNXSxgqr1CeegDk3DXbNhffRP1K/+DPBvB8Q+/N8=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
Expand Down Expand Up @@ -1961,11 +1961,11 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df h1:9dmE37nSKCV1obdPFtUgjKFH2yUHmfSkULX5h35l8yo=
github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM=
github.com/onflow/atree v0.7.0-rc.1 h1:g2DFhC3JeaA+L7/HZOp4NwE+OfxvfJ8nibymHHw7i3g=
github.com/onflow/atree v0.7.0-rc.1/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.23 h1:2YgRu+e3MQRiz4HBwTj1NrT2nY9rD6wiyrM10JLjbWA=
github.com/onflow/cadence v1.0.0-preview.23/go.mod h1:3UHGl+T7JjK2S8P+FHOjWwBoTYwAimN0QXW/UYb2PjQ=
github.com/onflow/cadence v1.0.0-preview.25 h1:kSmWjxmg9PS+bsk8C3j1NUTkFAl/jNrintVhlh6miM0=
github.com/onflow/cadence v1.0.0-preview.25/go.mod h1:fGhLBbuEmv5rh48qv0ZS0tUz53gxWsHpB4dPsF09h6E=
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=
Expand All @@ -1975,26 +1975,26 @@ github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5/go.mod h1:+4JWLclBOT+emyBh6NAZSEbqEwzHcWHpIbfsXmRASgY=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5 h1:6Cg0h+8Iyy/Nnefk5j0gdeVoMTNpUooAMjyV8sk6zoA=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5/go.mod h1:0oTx6Nkc+LdOXaZe3PRtV1cY+J5z5ig08alR8d+OPHs=
github.com/onflow/flow-emulator v1.0.0-preview.21 h1:ysrlVUPyvhojvaWLQsTGbpgLgR7h3f7Hjcwm9GuFn+U=
github.com/onflow/flow-emulator v1.0.0-preview.21/go.mod h1:Q9tMIfY3p0SLaoNJ/4GRxnm0LRGXRk4ElsvzOeX2Xvc=
github.com/onflow/flow-emulator v1.0.0-preview.22 h1:l0BPXlDvK0gZDqQhY3Kc7pBm38pE/FbfefiZe7j6Ngg=
github.com/onflow/flow-emulator v1.0.0-preview.22/go.mod h1:60M4QPVpdpEhEdz6NGOtLule+jcRLLKID1gYv2ehLvw=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240424211859-3ff4c0fe2a1e h1:2LO6Rtmz2PVfH+ZXnMwvTwVeIz3PCy0fs3lQraqog14=
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240424211859-3ff4c0fe2a1e/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
github.com/onflow/flow-ft/lib/go/templates v0.7.1-0.20240424211859-3ff4c0fe2a1e h1:jl7SYAui/gYRmBofrY//Ln8ixRJwvLzvwLstNfRKmWY=
github.com/onflow/flow-ft/lib/go/templates v0.7.1-0.20240424211859-3ff4c0fe2a1e/go.mod h1:uQ8XFqmMK2jxyBSVrmyuwdWjTEb+6zGjRYotfDJ5pAE=
github.com/onflow/flow-go v0.34.0-crescendo-preview.17 h1:HnISCj+nZkfwDHmVF1VmbmyuVbOH76GNGKFTMbthD7c=
github.com/onflow/flow-go v0.34.0-crescendo-preview.17/go.mod h1:WbsDXtDBGRil+pQevdxTlP2r3a67/Aq5Y7+ab/P0aFw=
github.com/onflow/flow-go v0.34.0-crescendo-preview.18 h1:Bre7uU/n1PjOEcIkTtaJDo4T5tngjKcr/cAOvxr3se4=
github.com/onflow/flow-go v0.34.0-crescendo-preview.18/go.mod h1:bwjzi2kSev1emRVN685FqYfCLYcZ6t2A5z5ztYXfvH8=
github.com/onflow/flow-go-sdk v1.0.0-M1/go.mod h1:TDW0MNuCs4SvqYRUzkbRnRmHQL1h4X8wURsCw9P9beo=
github.com/onflow/flow-go-sdk v1.0.0-preview.22 h1:ahHlppdDd4TjHMfnE73SD15AR16KTgbczdhFjGjAtFM=
github.com/onflow/flow-go-sdk v1.0.0-preview.22/go.mod h1:0hJfpIajLtBvaAUfJAdvWx6WBVp5hS0DJidc0NJLgE4=
github.com/onflow/flow-go-sdk v1.0.0-preview.25 h1:wL/+cK7oxSww31qSqTpt1Yfr26c8hJ8YHh9nIdq6PlI=
github.com/onflow/flow-go-sdk v1.0.0-preview.25/go.mod h1:Px1fQdB7WFC0yhYsEM3rhKzuE+Zi8GpBjR4qVuDAwMA=
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240429184308-40c3de711140 h1:oTj4RGgfuJSSBE1aDVrlh6avxKBMraucpNtRg0K+yhg=
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240429184308-40c3de711140/go.mod h1:2gpbza+uzs1k7x31hkpBPlggIRkI53Suo0n2AyA2HcE=
github.com/onflow/flow-nft/lib/go/templates v0.0.0-20240429184308-40c3de711140 h1:7NwSIG4SEdm+96gr+Aaqx291jZ/Bqkxk/ghVnens9CU=
github.com/onflow/flow-nft/lib/go/templates v0.0.0-20240429184308-40c3de711140/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.1-0.20240412170550-911321113030 h1:I+aosSiJny88O4p3nPbCiUcp/UqN6AepvO6uj82bjH0=
github.com/onflow/flow/protobuf/go/flow v0.4.1-0.20240412170550-911321113030/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.16 h1:9R14g2xBrSOp0CVv/lOqWbu2/yzjW+8kaxNrLlTXYwE=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.16/go.mod h1:imdFpb5iHenT2kHL4MNmiUzeYtECX6AGNteScqYtZpY=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.18 h1:vgQ1SpQ9mpTX+c6x1hm71DmaLnHoMr3kIG479Ye0ll4=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.18/go.mod h1:uQiVIHhm6dXrXDM9SQG00FIaEQgh+TdVvM+ortvpF+M=
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/sdks v0.5.1-0.20230912225508-b35402f12bba h1:rIehuhO6bj4FkwE4VzwEjX7MoAlOhUJENBJLqDqVxAo=
Expand Down
12 changes: 0 additions & 12 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@ func parseTime(timeString string, location string) (string, error) {
return fmt.Sprintf("%d.0", t.Unix()), nil
}

func getAndUnquoteString(value cadence.Value) string {
result, err := strconv.Unquote(value.String())
if err != nil {
result = value.String()
if strings.Contains(result, "\\u") || strings.Contains(result, "\\U") {
result = value.ToGoValue().(string)
}
}

return strings.ReplaceAll(result, "\x00", "")
}

func exists(path string) (bool, error) {
_, err := os.Stat(path)

Expand Down

0 comments on commit b089c0f

Please sign in to comment.