Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@

all: build

relic:
./environ/build-relic.py

go-build:
go build -tags relic -o server cmd/server/server.go
go build -o server cmd/server/server.go

build: relic go-build
build: go-build

deps:
go mod download -x

lint:
@go mod tidy
@staticcheck -tags relic ./...

proto:
@echo ">> Generating model/model.pb.go"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ config file:
mode. During offline mode, only certain Rosetta API endpoints are
functional.

* `network: "mainnet" | "testnet" | "canary" | "localnet"`
* `network: "mainnet" | "testnet" | "previewnet" | "localnet"`

* This defines the specific Flow chain that is being used.

Expand Down
7 changes: 4 additions & 3 deletions access/access.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ 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"
jsoncdc "github.com/onflow/cadence/encoding/json"
"github.com/onflow/cadence/runtime/common"
"github.com/onflow/flow-go/crypto"
"github.com/onflow/crypto"
"github.com/onflow/flow-go/network/p2p/keyutils"
"github.com/onflow/flow/protobuf/go/flow/access"
"github.com/onflow/flow/protobuf/go/flow/entities"
Expand Down
4 changes: 2 additions & 2 deletions api/account_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ func (s *Server) getSequenceNumber(ctx context.Context, addr []byte, block *mode
if err != nil {
return 0, err
}
nonce, ok := resp.ToGoValue().(int64)
nonce, ok := resp.(cadence.Int64)
if !ok {
return 0, fmt.Errorf("failed to convert get_proxy_nonce result to int64")
return 0, fmt.Errorf("failed to convert get_proxy_nonce result to cadence.Int64")
}
if nonce >= 0 {
return uint64(nonce), nil
Expand Down
22 changes: 18 additions & 4 deletions api/call_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (s *Server) accountPublicKeys(ctx context.Context, params map[string]interf
if err != nil {
return nil, handleExecutionErr(err, "execute get_proxy_public_key")
}
rawKey, ok := resp.ToGoValue().(string)
rawKey, ok := resp.(cadence.String)
if !ok {
return nil, wrapErrorf(
errInternal, "failed to convert get_proxy_public_key result to string",
Expand All @@ -146,7 +146,7 @@ func (s *Server) accountPublicKeys(ctx context.Context, params map[string]interf
len(keys),
)
}
pub, err := hex.DecodeString(rawKey)
pub, err := hex.DecodeString(rawKey.String())
if err != nil {
return nil, wrapErrorf(
errInternal,
Expand Down Expand Up @@ -246,14 +246,28 @@ func (s *Server) getOnchainData(ctx context.Context, addr []byte, block []byte)
if err != nil {
return nil, handleExecutionErr(err, "execute "+scriptName)
}
fields, ok := resp.ToGoValue().([]interface{})
array, ok := resp.(cadence.Array)
if !ok {
return nil, wrapErrorf(
errInternal,
"failed to convert %s result to Go slice",
"failed to convert %s result to cadence.Array",
scriptName,
)
}
fields := []interface{}{}

for _, el := range array.Values {
field, ok := el.(interface{})
if !ok {
return nil, wrapErrorf(
errInternal,
"failed to convert %s result to interface{}",
scriptName,
)
}
fields = append(fields, field)
}

if len(fields) != 3 {
return nil, wrapErrorf(
errInternal,
Expand Down
Loading