Skip to content

Commit

Permalink
[flowkit] Update to latest stable cadence
Browse files Browse the repository at this point in the history
  • Loading branch information
SupunS committed Sep 19, 2023
1 parent f17b242 commit cc680ac
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 87 deletions.
2 changes: 1 addition & 1 deletion flowkit/arguments/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func ParseWithoutType(args []string, code []byte, fileName string) (scriptArgs [
codes := map[common.Location][]byte{}
location := common.StringLocation(fileName)
program, must := cmd.PrepareProgram(code, location, codes)
checker, _ := cmd.PrepareChecker(program, location, codes, nil, must)
checker, _ := cmd.PrepareChecker(program, location, codes, nil, nil, must)

var parameterList []*ast.Parameter

Expand Down
65 changes: 32 additions & 33 deletions flowkit/arguments/arguments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,84 +45,84 @@ func Test_ParseWithoutType(t *testing.T) {
{
Name: "Address",
Value: cadence.NewAddress([8]byte{0, 0, 0, 0, 0, 0, 0, 1}),
Type: cadence.AddressType{},
Type: cadence.AddressType,
},
{
Name: "Bool",
Value: cadence.NewBool(true),
Type: cadence.BoolType{},
Type: cadence.BoolType,
},
{
Name: "Int",
Value: cadence.NewInt(-42),
Type: cadence.IntType{},
Type: cadence.IntType,
},
{
Name: "Int8",
Value: cadence.NewInt8(-42),
Type: cadence.Int8Type{},
Type: cadence.Int8Type,
},
{
Name: "Int16",
Value: cadence.NewInt16(-42),
Type: cadence.Int16Type{},
Type: cadence.Int16Type,
},
{
Name: "Int32",
Value: cadence.NewInt32(-42),
Type: cadence.Int32Type{},
Type: cadence.Int32Type,
},
{
Name: "Int64",
Value: cadence.NewInt64(-42),
Type: cadence.Int64Type{},
Type: cadence.Int64Type,
},
{
Name: "Int128",
Value: cadence.NewInt128(-42),
Type: cadence.Int128Type{},
Type: cadence.Int128Type,
},
{
Name: "UInt8",
Value: cadence.NewUInt8(42),
Type: cadence.UInt8Type{},
Type: cadence.UInt8Type,
},
{
Name: "UInt16",
Value: cadence.NewUInt16(42),
Type: cadence.UInt16Type{},
Type: cadence.UInt16Type,
},
{
Name: "UInt32",
Value: cadence.NewUInt32(42),
Type: cadence.UInt32Type{},
Type: cadence.UInt32Type,
},
{
Name: "UInt64",
Value: cadence.NewUInt64(42),
Type: cadence.UInt64Type{},
Type: cadence.UInt64Type,
},
{
Name: "UInt128",
Value: cadence.NewUInt128(42),
Type: cadence.UInt128Type{},
Type: cadence.UInt128Type,
},
{
Name: "String",
Value: cadence.String("42"),
Type: cadence.StringType{},
Type: cadence.StringType,
},
{
Name: "String, no quoting",
Literal: `foo`,
Value: cadence.String("foo"),
Type: cadence.StringType{},
Type: cadence.StringType,
},
{
Name: "optional String, nil",
Value: cadence.NewOptional(nil),
Type: &cadence.OptionalType{
Type: cadence.StringType{},
Type: cadence.StringType,
},
},
{
Expand All @@ -131,28 +131,27 @@ func Test_ParseWithoutType(t *testing.T) {
cadence.String("test"),
),
Type: &cadence.OptionalType{
Type: cadence.StringType{},
Type: cadence.StringType,
},
},
{
Name: "doubly optional String, nil",
Value: cadence.NewOptional(
cadence.NewOptional(nil),
),
Type: &cadence.OptionalType{
Type: &cadence.OptionalType{
Type: cadence.StringType,
},
},
},
// TODO: depends on https://github.com/onflow/cadence/pull/2469
//{
// Name: "doubly optional String, nil",
// Value: cadence.NewOptional(
// cadence.NewOptional(nil),
// ),
// Type: &cadence.OptionalType{
// Type: &cadence.OptionalType{
// Type: cadence.StringType{},
// },
// },
//},
{
Name: "variable-sized array",
Value: cadence.NewArray([]cadence.Value{
cadence.String("42"),
}),
Type: &cadence.VariableSizedArrayType{
ElementType: cadence.StringType{},
ElementType: cadence.StringType,
},
},
{
Expand All @@ -161,19 +160,19 @@ func Test_ParseWithoutType(t *testing.T) {
cadence.String("42"),
}),
Type: &cadence.ConstantSizedArrayType{
ElementType: cadence.StringType{},
ElementType: cadence.StringType,
Size: 1,
},
},
{
Name: "identifier (invalid)",
InvalidLiteral: "foo",
Type: cadence.IntType{},
Type: cadence.IntType,
},
{
Name: "expression (invalid)",
InvalidLiteral: "1 + 1",
Type: cadence.IntType{},
Type: cadence.IntType,
},
}

Expand Down
2 changes: 1 addition & 1 deletion flowkit/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func Test_AccountCreatedEvent(t *testing.T) {
flow.EventAccountCreated,
[]cadence.Field{{
Identifier: "address",
Type: cadence.AddressType{},
Type: cadence.AddressType,
}},
[]cadence.Value{cadence.NewAddress(address)},
)
Expand Down
2 changes: 1 addition & 1 deletion flowkit/flowkit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ func TestTransactions(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "\"Bar\"", arg.String())
assert.Equal(t, serviceAddress, tx.Payer)
assert.Len(t, string(tx.Script), 227)
assert.Len(t, string(tx.Script), 224)

t := tests.NewTransaction()
txID = t.ID()
Expand Down
24 changes: 12 additions & 12 deletions flowkit/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ require (
github.com/gosuri/uilive v0.0.4
github.com/invopop/jsonschema v0.7.0
github.com/lmars/go-slip10 v0.0.0-20190606092855-400ba44fee12
github.com/onflow/cadence v0.41.0-stable-cadence.1
github.com/onflow/flow-emulator v0.55.0-stable-cadence.1
github.com/onflow/flow-go v0.31.1-0.20230829185811-090be4adebb5
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1
github.com/onflow/cadence v0.41.0-stable-cadence.1.0.20230918153730-ec4d615b89d8
github.com/onflow/flow-emulator v0.54.1-0.20230915232846-43e906821db9
github.com/onflow/flow-go v0.31.1-0.20230918230928-ba70724dc568
github.com/onflow/flow-go-sdk v0.44.0-stable-cadence.1.0.20230915213126-68e7ffb5595f
github.com/onflow/flow-go/crypto v0.24.9
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.29.0
github.com/spf13/afero v1.9.4
github.com/stretchr/testify v1.8.4
github.com/thoas/go-funk v0.9.2
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df
gonum.org/v1/gonum v0.13.0
google.golang.org/grpc v1.56.1
)
Expand Down Expand Up @@ -109,13 +109,13 @@ require (
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/onflow/atree v0.6.0 // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230822191436-8a95802475f4 // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20230808220007-f00e74ca675b // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230818200853-ab1b03e98a95 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20230818200521-3acffe2472a3 // indirect
github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f // indirect
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20230918230627-2daea3d4f44b // indirect
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20230918230627-2daea3d4f44b // indirect
github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20230913160646-09adc7d3b513 // indirect
github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20230915224343-ca2663ed82cf // indirect
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20230628215638-83439d22e0ce // indirect
github.com/onflow/sdks v0.5.0 // indirect
github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
Expand Down Expand Up @@ -163,7 +163,7 @@ require (
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.114.0 // indirect
Expand Down
Loading

0 comments on commit cc680ac

Please sign in to comment.