Skip to content

Commit

Permalink
Debug tx
Browse files Browse the repository at this point in the history
  • Loading branch information
lealobanov committed Dec 10, 2024
1 parent e040be8 commit 9807343
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions cadence/transactions/create_vault.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@ transaction {

log("Empty Vault stored")

// Create a public Receiver capability to the Vault
let receiverCap = acct.capabilities.storage.issue<&ExampleToken.Vault{ExampleToken.Receiver, ExampleToken.Balance}>(/storage/MainVault)
// Create a public capability to the Vault for the Receiver interface
let receiverCap = acct.capabilities.storage.issue<&ExampleToken.Vault>(/storage/MainVault)
acct.capabilities.publish(receiverCap, at: /public/MainReceiver)

log("References created")
}
log("Receiver capability created")

// Create a public capability to the Vault for the Balance interface
let balanceCap = acct.capabilities.storage.issue<&ExampleToken.Vault>(/storage/MainVault)
acct.capabilities.publish(balanceCap, at: /public/MainBalance)

log("Balance capability created")

post {
// Check that the capabilities were created correctly
getAccount(0x02)
.capabilities
.borrow<&ExampleToken.Vault{ExampleToken.Receiver}>(/public/MainReceiver) != nil:
"Vault Receiver Reference was not created correctly"
let account = getAccount(acct.address)
assert(account.capabilities.borrow<&ExampleToken.Vault>(/public/MainReceiver) != nil,
message: "Vault Receiver Reference was not created correctly")
}
}

0 comments on commit 9807343

Please sign in to comment.