Skip to content

Commit

Permalink
restore missing transactions
Browse files Browse the repository at this point in the history
nialexsan committed Oct 3, 2024
1 parent 4fc6eb9 commit 533199f
Showing 2 changed files with 33 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cadence/transactions/set_snapshot_enabled_admin.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import "MetadataViews"
import "NFTCatalog"

transaction(shouldUseSnapshot: Bool) {
let snapshotResource: &NFTCatalog.Snapshot

prepare(acct: auth(BorrowValue) &Account) {
self.snapshotResource = acct.borrow<&NFTCatalog.Snapshot>(from: /storage/CatalogSnapshot)!
}

execute {
self.snapshotResource.setShouldUseSnapshot(shouldUseSnapshot)
}
}
19 changes: 19 additions & 0 deletions cadence/transactions/update_snapshot_admin.cdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "MetadataViews"
import "NFTCatalog"

transaction(collectionIdentifiers: [String]) {
let snapshotResource: &NFTCatalog.Snapshot
prepare(acct: auth(BorrowValue) &Account) {
let snapshot = acct.borrow<&NFTCatalog.Snapshot>(from: /storage/CatalogSnapshot)
if snapshot == nil {
acct.save(<-NFTCatalog.createEmptySnapshot(), to: /storage/CatalogSnapshot)
}
self.snapshotResource = acct.borrow<&NFTCatalog.Snapshot>(from: /storage/CatalogSnapshot)!
}
execute {
for id in collectionIdentifiers {
let entry = NFTCatalog.getCatalogEntry(collectionIdentifier: id)
self.snapshotResource.setPartialSnapshot(id, entry!)
}
}
}

0 comments on commit 533199f

Please sign in to comment.