StateMachine client on PAB needs a lookup in order to mint ThreadToken
kindofdev opened this issue · comments
Describe the feature you'd like
I've been trying to run a simple state machine on PAB over Cardano Testnet as follows:
tt <- getThreadToken
logInfo @String $ "tt to be mint: " <> show tt -- Show an UTXO owned by me (all my local components in sync with Testnet)
void $ runInitialise client (GameDatum x) v -- Fail here with TxOutRefNotFound error.
However when I run it, fails with a TxOutRefNotFound
error. I've checked that the UTXO obtained from getThreadToken
really exists and keeps unspent. However, for some reason, at the time of minting fails because PAB can't find it.
As far I understand this should work.
On the other hand, if I run previous code on EmulatorTrace works as expected.
I don't know whether this is the expected behaviour.
This has been tested using tag:6e3f6a59d64f6d4cd9d38bf263972adaf4f7b244 ( https://github.com/input-output-hk/plutus-apps.git )
Describe alternatives you've considered
I could workaround the issue by adding a lookup with the UTXO ref as follows:
tt <- getThreadToken
logInfo @String $ "tt to be mint: " <> show tt -- Show an UTXO owned by me (all my local components in sync with Testnet)
let ttUtxoRef = ttOutRef tt
ttUtxoMap <- txOutFromRef ttUtxoRef >>= maybe (throwError "utxo not found") (return . Map.singleton ttUtxoRef)
void $ runInitialiseWith (Constraints.unspentOutputs ttUtxoMap) mempty client (GameDatum x) v
Did you include tt
in the client
variable? Ex. client = machineClient inst tt params
? As a reference point, look at the Auction
example in plutus-use-cases
.
Also, it is normal that the tt
is not a utxo yet. When you use getThreadToken
, it does not actually submit a transaction in the blockchain for creating the thread token.
Did you include tt in the client variable?
Yes, I did. You can see it here:
Hi, any update?