@flowtyio/flow-contracts 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -20,9 +20,7 @@ access(all) contract NFTCatalog {
|
|
|
20
20
|
nftType : Type,
|
|
21
21
|
storagePath: StoragePath,
|
|
22
22
|
publicPath: PublicPath,
|
|
23
|
-
privatePath: PrivatePath,
|
|
24
23
|
publicLinkedType : Type,
|
|
25
|
-
privateLinkedType : Type,
|
|
26
24
|
displayName : String,
|
|
27
25
|
description: String,
|
|
28
26
|
externalURL : String
|
|
@@ -37,9 +35,7 @@ access(all) contract NFTCatalog {
|
|
|
37
35
|
nftType : Type,
|
|
38
36
|
storagePath: StoragePath,
|
|
39
37
|
publicPath: PublicPath,
|
|
40
|
-
privatePath: PrivatePath,
|
|
41
38
|
publicLinkedType : Type,
|
|
42
|
-
privateLinkedType : Type,
|
|
43
39
|
displayName : String,
|
|
44
40
|
description: String,
|
|
45
41
|
externalURL : String
|
|
@@ -76,16 +72,19 @@ access(all) contract NFTCatalog {
|
|
|
76
72
|
// Used to authenticate proposals made to the catalog
|
|
77
73
|
|
|
78
74
|
access(all) resource interface NFTCatalogProposalManagerPublic {
|
|
79
|
-
access(all) fun getCurrentProposalEntry(): String?
|
|
75
|
+
access(all) view fun getCurrentProposalEntry(): String?
|
|
80
76
|
}
|
|
81
|
-
|
|
77
|
+
|
|
78
|
+
access(all) entitlement ProposalActionOwner
|
|
79
|
+
|
|
80
|
+
access(all) resource NFTCatalogProposalManager: NFTCatalogProposalManagerPublic {
|
|
82
81
|
access(self) var currentProposalEntry: String?
|
|
83
82
|
|
|
84
|
-
access(all) fun getCurrentProposalEntry(): String? {
|
|
83
|
+
access(all) view fun getCurrentProposalEntry(): String? {
|
|
85
84
|
return self.currentProposalEntry
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
access(
|
|
87
|
+
access(ProposalActionOwner) fun setCurrentProposalEntry(identifier: String?) {
|
|
89
88
|
self.currentProposalEntry = identifier
|
|
90
89
|
}
|
|
91
90
|
|
|
@@ -107,7 +106,7 @@ access(all) contract NFTCatalog {
|
|
|
107
106
|
self.shouldUseSnapshot = shouldUseSnapshot
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
access(all) fun getCatalogSnapshot(): {String : NFTCatalogMetadata} {
|
|
109
|
+
access(all) view fun getCatalogSnapshot(): {String : NFTCatalogMetadata} {
|
|
111
110
|
return self.catalogSnapshot
|
|
112
111
|
}
|
|
113
112
|
|
|
@@ -123,28 +122,22 @@ access(all) contract NFTCatalog {
|
|
|
123
122
|
|
|
124
123
|
// NFTCollectionData
|
|
125
124
|
// Represents information about an NFT collection resource
|
|
126
|
-
// Note: Not
|
|
125
|
+
// Note: Not using the struct from Metadata standard due to
|
|
127
126
|
// inability to store functions
|
|
128
127
|
access(all) struct NFTCollectionData {
|
|
129
128
|
|
|
130
129
|
access(all) let storagePath : StoragePath
|
|
131
130
|
access(all) let publicPath : PublicPath
|
|
132
|
-
access(all) let privatePath: PrivatePath
|
|
133
131
|
access(all) let publicLinkedType: Type
|
|
134
|
-
access(all) let privateLinkedType: Type
|
|
135
132
|
|
|
136
133
|
init(
|
|
137
134
|
storagePath : StoragePath,
|
|
138
135
|
publicPath : PublicPath,
|
|
139
|
-
privatePath : PrivatePath,
|
|
140
136
|
publicLinkedType : Type,
|
|
141
|
-
privateLinkedType : Type
|
|
142
137
|
) {
|
|
143
138
|
self.storagePath = storagePath
|
|
144
139
|
self.publicPath = publicPath
|
|
145
|
-
self.privatePath = privatePath
|
|
146
140
|
self.publicLinkedType = publicLinkedType
|
|
147
|
-
self.privateLinkedType = privateLinkedType
|
|
148
141
|
}
|
|
149
142
|
}
|
|
150
143
|
|
|
@@ -192,7 +185,7 @@ access(all) contract NFTCatalog {
|
|
|
192
185
|
If obtaining all elements from the catalog is essential, please
|
|
193
186
|
use the getCatalogKeys and forEachCatalogKey methods instead.
|
|
194
187
|
*/
|
|
195
|
-
access(all) fun getCatalog() : {String : NFTCatalogMetadata} {
|
|
188
|
+
access(all) view fun getCatalog() : {String : NFTCatalogMetadata} {
|
|
196
189
|
let snapshot = self.account.storage.borrow<&NFTCatalog.Snapshot>(from: /storage/CatalogSnapshot)
|
|
197
190
|
if snapshot != nil {
|
|
198
191
|
let snapshot = snapshot!
|
|
@@ -206,7 +199,7 @@ access(all) contract NFTCatalog {
|
|
|
206
199
|
}
|
|
207
200
|
}
|
|
208
201
|
|
|
209
|
-
access(all) fun getCatalogKeys(): [String] {
|
|
202
|
+
access(all) view fun getCatalogKeys(): [String] {
|
|
210
203
|
return self.catalog.keys
|
|
211
204
|
}
|
|
212
205
|
|
|
@@ -218,11 +211,11 @@ access(all) contract NFTCatalog {
|
|
|
218
211
|
return self.catalog[collectionIdentifier]
|
|
219
212
|
}
|
|
220
213
|
|
|
221
|
-
access(all) fun getCollectionsForType(nftTypeIdentifier: String) : {String : Bool}? {
|
|
214
|
+
access(all) view fun getCollectionsForType(nftTypeIdentifier: String) : {String : Bool}? {
|
|
222
215
|
return self.catalogTypeData[nftTypeIdentifier]
|
|
223
216
|
}
|
|
224
217
|
|
|
225
|
-
access(all) fun getCatalogTypeData() : {String : {String : Bool}} {
|
|
218
|
+
access(all) view fun getCatalogTypeData() : {String : {String : Bool}} {
|
|
226
219
|
return self.catalogTypeData
|
|
227
220
|
}
|
|
228
221
|
|
|
@@ -264,7 +257,7 @@ access(all) contract NFTCatalog {
|
|
|
264
257
|
self.removeCatalogProposal(proposalID : proposalID)
|
|
265
258
|
}
|
|
266
259
|
|
|
267
|
-
access(all) fun getCatalogProposals() : {UInt64 : NFTCatalogProposal} {
|
|
260
|
+
access(all) view fun getCatalogProposals() : {UInt64 : NFTCatalogProposal} {
|
|
268
261
|
return self.catalogProposals
|
|
269
262
|
}
|
|
270
263
|
|
|
@@ -272,7 +265,7 @@ access(all) contract NFTCatalog {
|
|
|
272
265
|
return self.catalogProposals[proposalID]
|
|
273
266
|
}
|
|
274
267
|
|
|
275
|
-
access(all) fun getCatalogProposalKeys() : [UInt64] {
|
|
268
|
+
access(all) view fun getCatalogProposalKeys() : [UInt64] {
|
|
276
269
|
return self.catalogProposals.keys
|
|
277
270
|
}
|
|
278
271
|
|
|
@@ -300,9 +293,7 @@ access(all) contract NFTCatalog {
|
|
|
300
293
|
nftType: metadata.nftType,
|
|
301
294
|
storagePath: metadata.collectionData.storagePath,
|
|
302
295
|
publicPath: metadata.collectionData.publicPath,
|
|
303
|
-
privatePath: metadata.collectionData.privatePath,
|
|
304
296
|
publicLinkedType : metadata.collectionData.publicLinkedType,
|
|
305
|
-
privateLinkedType : metadata.collectionData.privateLinkedType,
|
|
306
297
|
displayName : metadata.collectionDisplay.name,
|
|
307
298
|
description: metadata.collectionDisplay.description,
|
|
308
299
|
externalURL : metadata.collectionDisplay.externalURL.url
|
|
@@ -329,9 +320,7 @@ access(all) contract NFTCatalog {
|
|
|
329
320
|
nftType: metadata.nftType,
|
|
330
321
|
storagePath: metadata.collectionData.storagePath,
|
|
331
322
|
publicPath: metadata.collectionData.publicPath,
|
|
332
|
-
privatePath: metadata.collectionData.privatePath,
|
|
333
323
|
publicLinkedType : metadata.collectionData.publicLinkedType,
|
|
334
|
-
privateLinkedType : metadata.collectionData.privateLinkedType,
|
|
335
324
|
displayName : metadata.collectionDisplay.name,
|
|
336
325
|
description: metadata.collectionDisplay.description,
|
|
337
326
|
externalURL : metadata.collectionDisplay.externalURL.url
|
|
@@ -128,15 +128,15 @@ access(all) contract NFTCatalogAdmin {
|
|
|
128
128
|
// A proxy resource that can store
|
|
129
129
|
// a capability to admin controls
|
|
130
130
|
access(all) resource interface IAdminProxy {
|
|
131
|
-
access(all) fun addCapability(capability
|
|
132
|
-
access(all) fun hasCapability()
|
|
131
|
+
access(all) fun addCapability(capability: Capability<auth(CatalogActions) &Admin>)
|
|
132
|
+
access(all) fun hasCapability(): Bool
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
access(all) resource AdminProxy
|
|
135
|
+
access(all) resource AdminProxy: IAdminProxy {
|
|
136
136
|
|
|
137
|
-
access(self) var capability
|
|
137
|
+
access(self) var capability: Capability<auth(CatalogActions) &Admin>?
|
|
138
138
|
|
|
139
|
-
access(all) fun addCapability(capability
|
|
139
|
+
access(all) fun addCapability(capability: Capability<auth(CatalogActions) &Admin>) {
|
|
140
140
|
pre {
|
|
141
141
|
capability.check() : "Invalid Admin Capability"
|
|
142
142
|
self.capability == nil : "Admin Proxy already set"
|
|
@@ -144,11 +144,11 @@ access(all) contract NFTCatalogAdmin {
|
|
|
144
144
|
self.capability = capability
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
access(
|
|
147
|
+
access(CatalogActions) view fun getCapability() : Capability<auth(CatalogActions) &Admin>? {
|
|
148
148
|
return self.capability
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
access(all) fun hasCapability() : Bool {
|
|
151
|
+
access(all) view fun hasCapability() : Bool {
|
|
152
152
|
return self.capability != nil
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -169,7 +169,7 @@ access(all) contract NFTCatalogAdmin {
|
|
|
169
169
|
self.AdminPrivatePath = /private/nftCatalogAdmin
|
|
170
170
|
self.AdminStoragePath = /storage/nftCatalogAdmin
|
|
171
171
|
|
|
172
|
-
let admin
|
|
172
|
+
let admin <- create Admin()
|
|
173
173
|
|
|
174
174
|
self.account.storage.save(<-admin, to: self.AdminStoragePath)
|
|
175
175
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowtyio/flow-contracts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"main": "index.json",
|
|
5
5
|
"description": "An NPM package for common flow contracts",
|
|
6
6
|
"author": "flowtyio",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"commander": "^11.0.0"
|
|
24
24
|
},
|
|
25
25
|
"bin": {
|
|
26
|
-
"flow-contracts": "
|
|
26
|
+
"flow-contracts": "index.js"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"*.js",
|