I was wondering, why transaction scope is not available in post condition?
This way it would be possible to do something like this:
import FungibleToken from 0x01
transaction {
let account: AuthAccount
prepare(acct: AuthAccount) {
self.account = acct
self.account.link<&FungibleToken.Vault{FungibleToken.Receiver, FungibleToken.Balance}>(/public/MainReceiver, target: /storage/MainVault)
log("Public Receiver reference created!")
}
post {
self.account.getCapability(/public/MainReceiver)!
.check<&FungibleToken.Vault{FungibleToken.Receiver}>():
"Vault Receiver Reference was not created correctly"
}
}
Because in the second transaction, if I send it from 0x02 it will make incorrect check, since itβs checking if capability on 0x01 exists
post {
getAccount(0x01).getCapability(/public/MainReceiver)!
.check<&FungibleToken.Vault{FungibleToken.Receiver}>():
"Vault Receiver Reference was not created correctly"
}