Skip to content

Commit

Permalink
Add CCF encoded events to rosetta
Browse files Browse the repository at this point in the history
  • Loading branch information
koko1123 committed Nov 1, 2023
1 parent 3367250 commit 45ac6fe
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 74 deletions.
16 changes: 10 additions & 6 deletions access/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"crypto/x509"
"encoding/hex"
"fmt"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"
"math/rand"
"strconv"
"strings"
"time"

"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/metric"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
libp2ptls "github.com/libp2p/go-libp2p/p2p/security/tls"
"github.com/onflow/cadence"
Expand Down Expand Up @@ -165,8 +166,9 @@ func (c Client) BlockEvents(ctx context.Context, blockID []byte, typ string) ([]
resp, err := c.client.GetEventsForBlockIDs(
ctx,
&access.GetEventsForBlockIDsRequest{
BlockIds: [][]byte{blockID},
Type: typ,
BlockIds: [][]byte{blockID},
Type: typ,
EventEncodingVersion: entities.EventEncodingVersion_CCF_V0,
},
)
cancel()
Expand Down Expand Up @@ -386,7 +388,8 @@ func (c Client) Transaction(ctx context.Context, hash []byte) (*entities.Transac
resp, err := c.client.GetTransaction(
ctx,
&access.GetTransactionRequest{
Id: hash,
Id: hash,
EventEncodingVersion: entities.EventEncodingVersion_CCF_V0,
},
)
cancel()
Expand Down Expand Up @@ -453,7 +456,8 @@ func (c Client) TransactionResultsByBlockID(ctx context.Context, blockID []byte)
resp, err := c.client.GetTransactionResultsByBlockID(
ctx,
&access.GetTransactionsByBlockIDRequest{
BlockId: blockID,
BlockId: blockID,
EventEncodingVersion: entities.EventEncodingVersion_CCF_V0,
},
)
cancel()
Expand Down
45 changes: 23 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ require (
github.com/golang/protobuf v1.5.3
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/libp2p/go-libp2p v0.28.1
github.com/onflow/cadence v0.41.1
github.com/onflow/flow-go v0.32.1-0.20231005181129-9c6f9fff84a0
github.com/onflow/cadence v0.42.1
github.com/onflow/flow-go v0.32.3
github.com/onflow/flow-go/crypto v0.24.9
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230915140723-432828f7afb9
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231018182244-e72527c55c63
github.com/rs/zerolog v1.29.0
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/otel v1.17.0
Expand All @@ -26,18 +26,18 @@ require (
go.opentelemetry.io/otel/sdk/metric v0.40.0
go.opentelemetry.io/otel/trace v1.17.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.10.0
google.golang.org/grpc v1.57.0
golang.org/x/crypto v0.11.0
google.golang.org/grpc v1.58.3
google.golang.org/protobuf v1.31.0
lukechampine.com/blake3 v1.2.1
)

require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/compute v1.19.1 // indirect
cloud.google.com/go v0.110.4 // indirect
cloud.google.com/go/compute v1.21.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.13.0 // indirect
cloud.google.com/go/storage v1.28.1 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/storage v1.30.1 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/aws/aws-sdk-go-v2 v1.17.7 // indirect
github.com/aws/aws-sdk-go-v2/config v1.18.19 // indirect
Expand Down Expand Up @@ -99,7 +99,6 @@ require (
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/go-test/deep v1.1.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.1.0 // indirect
Expand All @@ -110,9 +109,10 @@ require (
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gopacket v1.1.19 // indirect
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.1 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/zerolog/v2 v2.0.0-rc.2 // indirect
Expand Down Expand Up @@ -153,6 +153,7 @@ require (
github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/k0kubun/pp/v3 v3.2.0 // indirect
github.com/kevinburke/go-bindata v3.23.0+incompatible // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
Expand Down Expand Up @@ -202,8 +203,8 @@ require (
github.com/onflow/atree v0.6.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230703193002-53362441b57d // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.3 // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.0 // indirect
github.com/onflow/flow-go-sdk v0.41.10 // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230711213910-baad011d2b13 // indirect
github.com/onflow/flow-go-sdk v0.41.12 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.0 // indirect
github.com/onflow/go-bitswap v0.0.0-20230703214630-6d3db958c73d // indirect
github.com/onflow/sdks v0.5.0 // indirect
Expand Down Expand Up @@ -265,21 +266,21 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.1.0 // indirect
golang.org/x/tools v0.9.1 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/api v0.114.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading

0 comments on commit 45ac6fe

Please sign in to comment.