diff --git a/access/http/convert_test.go b/access/http/convert_test.go index e277bb27e..265e38ece 100644 --- a/access/http/convert_test.go +++ b/access/http/convert_test.go @@ -24,6 +24,7 @@ import ( "testing" "github.com/onflow/cadence" + "github.com/stretchr/testify/require" "github.com/onflow/flow-go-sdk" @@ -119,12 +120,24 @@ func Test_ConvertTransactionResult(t *testing.T) { } func Test_EncodeCadenceArgs(t *testing.T) { - v1, _ := cadence.NewValue("Hello") - v2, _ := cadence.NewValue("World") + t.Parallel() + + v1, err := cadence.NewString("Hello") + require.NoError(t, err) + + v2, err := cadence.NewString("World") + require.NoError(t, err) res, err := encodeCadenceArgs([]cadence.Value{v1, v2}) assert.NoError(t, err) - assert.Equal(t, []string{"eyJ2YWx1ZSI6IkhlbGxvIiwidHlwZSI6IlN0cmluZyJ9Cg==", "eyJ2YWx1ZSI6IldvcmxkIiwidHlwZSI6IlN0cmluZyJ9Cg=="}, res) + + assert.Equal(t, + []string{ + "eyJ2YWx1ZSI6IkhlbGxvIiwidHlwZSI6IlN0cmluZyJ9Cg==", + "eyJ2YWx1ZSI6IldvcmxkIiwidHlwZSI6IlN0cmluZyJ9Cg==", + }, + res, + ) } func Test_ConvertExecutionResults(t *testing.T) { diff --git a/event.go b/event.go index 8dd9612c1..6eb474c73 100644 --- a/event.go +++ b/event.go @@ -23,6 +23,7 @@ import ( "time" "github.com/onflow/cadence" + "github.com/onflow/cadence/runtime/stdlib" "github.com/onflow/crypto/hash" "github.com/onflow/flow-go-sdk/crypto" @@ -126,7 +127,11 @@ type AccountCreatedEvent Event // Address returns the address of the newly-created account. func (evt AccountCreatedEvent) Address() Address { - return BytesToAddress(evt.Value.Fields[0].(cadence.Address).Bytes()) + address := cadence.SearchFieldByName( + evt.Value, + stdlib.AccountEventAddressParameter.Identifier, + ).(cadence.Address) + return BytesToAddress(address.Bytes()) } // EventFilter is used to filter events based on given parameters. diff --git a/go.mod b/go.mod index 4c8eb3551..2ecba21ed 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/aws/aws-sdk-go-v2 v1.26.1 github.com/aws/aws-sdk-go-v2/config v1.27.11 github.com/aws/aws-sdk-go-v2/service/kms v1.31.0 - github.com/onflow/cadence v1.0.0-preview.23 + github.com/onflow/cadence v1.0.0-preview.24 github.com/onflow/crypto v0.25.1 github.com/onflow/flow/protobuf/go/flow v0.4.0 github.com/onflow/go-ethereum v1.13.4 @@ -57,7 +57,7 @@ require ( github.com/logrusorgru/aurora/v4 v4.0.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/onflow/atree v0.6.1-0.20240416233652-f4568c0c03df // indirect + github.com/onflow/atree v0.6.1-0.20240429171449-cb486ceb1f9c // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rivo/uniseg v0.4.4 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect diff --git a/go.sum b/go.sum index 4b81c5242..1c3cd2e1a 100644 --- a/go.sum +++ b/go.sum @@ -125,10 +125,10 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -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/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/atree v0.6.1-0.20240429171449-cb486ceb1f9c h1:Ol+qFATYiS7LfwQQKBjfLJ8z6VwzZehVrYH1JI2ssUU= +github.com/onflow/atree v0.6.1-0.20240429171449-cb486ceb1f9c/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ0tHf4DRuM= +github.com/onflow/cadence v1.0.0-preview.24 h1:fMF/4RrpeifPQzXuNnk6uM0sEdozCIo5h8c4mV6bXBA= +github.com/onflow/cadence v1.0.0-preview.24/go.mod h1:fGhLBbuEmv5rh48qv0ZS0tUz53gxWsHpB4dPsF09h6E= github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A= github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI= github.com/onflow/flow/protobuf/go/flow v0.4.0 h1:5TGmPwRmnSt7aawgtPGF9ehoGHHir9Cy9LVoAiU9t/E=