Skip to content

Commit 3915a93

Browse files
committed
fix test
1 parent de98710 commit 3915a93

3 files changed

Lines changed: 18 additions & 16 deletions

File tree

lib/go/contracts/internal/assets/assets.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/go/templates/internal/assets/assets.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
11
import TopShot from 0xTOPSHOTADDRESS
22

3-
// This transaction updates an existing play struct
4-
// and stores it in the Top Shot smart contract
5-
// We currently stringify the metadata and insert it into the
6-
// transaction string, but want to use transaction arguments soon
3+
// This transaction updates multiple existing plays' taglines
4+
// and stores them in the Top Shot smart contract
75

86
// Parameters:
97
//
10-
// metadata: A dictionary of all the play metadata associated
8+
// plays: A dictionary of {playID: tagline} pairs
119

1210
transaction(plays: {UInt32: String}) {
1311

1412
// Local variable for the topshot Admin object
1513
let adminRef: &TopShot.Admin
14+
let firstKey: UInt32
15+
let lastKey: UInt32
1616

1717
prepare(acct: AuthAccount) {
1818

1919
// borrow a reference to the admin resource
2020
self.adminRef = acct.borrow<&TopShot.Admin>(from: /storage/TopShotAdmin)
2121
?? panic("No admin resource in storage")
22+
self.firstKey = plays.keys[0]
23+
self.lastKey = plays.keys[plays.keys.length - 1]
2224
}
2325

2426
execute {
25-
// update a play with the specified metadata
27+
// update multiple plays with the specified metadata
2628
for key in plays.keys {
2729
self.adminRef.updatePlayTagline(playID: key, tagline: plays[key] ?? panic("No tagline for play"))
2830
}
2931
}
3032

3133
post {
32-
for key in plays.keys {
33-
TopShot.getPlayMetaDataByField(playID: key, field: "tagline") != nil:
34-
"tagline doesnt exist"
35-
}
34+
TopShot.getPlayMetaDataByField(playID: self.firstKey, field: "tagline") != nil:
35+
"first play's tagline doesnt exist"
36+
TopShot.getPlayMetaDataByField(playID: self.lastKey, field: "tagline") != nil:
37+
"last play's tagline doesnt exist"
3638
}
3739
}

0 commit comments

Comments
 (0)