Skip to content

Commit

Permalink
use type constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Jun 24, 2024
1 parent 4e8105e commit d02dbc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions templates/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ func AccountKeyToCadenceCryptoKey(key *flow.AccountKey) (cadence.Value, error) {
hash,
weight,
cadence.NewBool(false),
}).WithType(&cadence.StructType{
Location: common.IdentifierLocation("Crypto"),
QualifiedIdentifier: "Crypto.KeyListEntry",
Fields: []cadence.Field{{
}).WithType(cadence.NewStructType(
common.IdentifierLocation("Crypto"),
"Crypto.KeyListEntry",
[]cadence.Field{{
Identifier: "keyIndex",
Type: cadence.IntType,
}, {
Expand All @@ -169,7 +169,8 @@ func AccountKeyToCadenceCryptoKey(key *flow.AccountKey) (cadence.Value, error) {
Identifier: "isRevoked",
Type: cadence.BoolType,
}},
}), nil
nil,
)), nil
}

// CreateAccount generates a transactions that creates a new account.
Expand Down
11 changes: 6 additions & 5 deletions test/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ func (g *Events) New() flow.Event {

location := common.StringLocation("test")

testEventType := &cadence.EventType{
Location: location,
QualifiedIdentifier: identifier,
Fields: []cadence.Field{
testEventType := cadence.NewEventType(
location,
identifier,
[]cadence.Field{
{
Identifier: "a",
Type: cadence.IntType,
Expand All @@ -274,7 +274,8 @@ func (g *Events) New() flow.Event {
Type: cadence.StringType,
},
},
}
nil,
)

testEvent := cadence.NewEvent(
[]cadence.Value{
Expand Down

0 comments on commit d02dbc7

Please sign in to comment.