Skip to content

Instantly share code, notes, and snippets.

@bjartek
Created December 8, 2023 22:40
Show Gist options
  • Save bjartek/2b6979426866be14ccac0f6ee4ffa683 to your computer and use it in GitHub Desktop.
Save bjartek/2b6979426866be14ccac0f6ee4ffa683 to your computer and use it in GitHub Desktop.
import "BasicNFT"
transaction(receiver:Address, name:String) {
prepare(signer: auth(StorageCapabilities, PublishInboxCapability) &Account) {
let storage= signer.capabilities.storage
//we issue a capability from our storage
let capability = storage.issue<&BasicNFT.Minter>(BasicNFT.minterPath)
//we set the name as tag so it is easy for us to revoke it later using a friendly name
let capcon = storage.getController(byCapabilityID:capability.id)!
capcon.setTag(name)
//we publish this capability to the inbox of the receiver
signer.inbox.publish(capability, name:name, recipient:receiver)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment