Skip to content

Commit d02dbc7

Browse files
committed
use type constructors
1 parent 4e8105e commit d02dbc7

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

templates/accounts.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ func AccountKeyToCadenceCryptoKey(key *flow.AccountKey) (cadence.Value, error) {
150150
hash,
151151
weight,
152152
cadence.NewBool(false),
153-
}).WithType(&cadence.StructType{
154-
Location: common.IdentifierLocation("Crypto"),
155-
QualifiedIdentifier: "Crypto.KeyListEntry",
156-
Fields: []cadence.Field{{
153+
}).WithType(cadence.NewStructType(
154+
common.IdentifierLocation("Crypto"),
155+
"Crypto.KeyListEntry",
156+
[]cadence.Field{{
157157
Identifier: "keyIndex",
158158
Type: cadence.IntType,
159159
}, {
@@ -169,7 +169,8 @@ func AccountKeyToCadenceCryptoKey(key *flow.AccountKey) (cadence.Value, error) {
169169
Identifier: "isRevoked",
170170
Type: cadence.BoolType,
171171
}},
172-
}), nil
172+
nil,
173+
)), nil
173174
}
174175

175176
// CreateAccount generates a transactions that creates a new account.

test/entities.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@ func (g *Events) New() flow.Event {
261261

262262
location := common.StringLocation("test")
263263

264-
testEventType := &cadence.EventType{
265-
Location: location,
266-
QualifiedIdentifier: identifier,
267-
Fields: []cadence.Field{
264+
testEventType := cadence.NewEventType(
265+
location,
266+
identifier,
267+
[]cadence.Field{
268268
{
269269
Identifier: "a",
270270
Type: cadence.IntType,
@@ -274,7 +274,8 @@ func (g *Events) New() flow.Event {
274274
Type: cadence.StringType,
275275
},
276276
},
277-
}
277+
nil,
278+
)
278279

279280
testEvent := cadence.NewEvent(
280281
[]cadence.Value{

0 commit comments

Comments
 (0)