-
Notifications
You must be signed in to change notification settings - Fork 17
/
create_editions.template.cdc
46 lines (42 loc) · 1.43 KB
/
create_editions.template.cdc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {{ contractName }} from {{{ contractAddress }}}
/// This transaction creates a batch of edition templates.
///
/// Parameters:
/// - mintIDs: a unique identifier for each edition, used to prevent duplicate mints.
/// - limits: an optional limit for each edition.
{{#each fields}}
/// - {{ this.name }}: a {{ this.name }} metadata value for each NFT (must be same length as limits).
{{/each}}
///
transaction(
mintIDs: [String],
limits: [UInt64?],
{{#each fields}}
{{ this.name }}: [{{ this.asCadenceTypeString }}],
{{/each}}
) {
let admin: &{{ contractName }}.Admin
prepare(signer: AuthAccount) {
self.admin = signer.borrow<&{{ contractName }}.Admin>(from: {{ contractName }}.AdminStoragePath)
?? panic("Could not borrow a reference to the NFT admin")
}
execute {
for i, mintID in mintIDs {
self.admin.createEdition(
mintID: mintID,
limit: limits[i],
{{#each fields}}
{{ this.name }}: {{ this.name }}[i],
{{/each}}
// Use the attributes dictionary to add additional metadata
// not defined in the original schema.
//
// The attributes dictionary is empty by default.
//
// Attributes must be string values.
//
attributes: {}
)
}
}
}