I want to set a predicate as an input to a script in the following fashion:
let predicate = MyPredicate::load_from( predicate_bin_path,).unwrap();
let script = MyScript::new(wallet, bin_path);
// First wallet transfers amount to predicate.
predicate.receive(first_wallet, 500, asset_id, None).await.unwrap();
// Check predicate balance.
let balance = first_wallet
.get_provider().unwrap()
.get_asset_balance(predicate.address(), asset_id)
.await.unwrap();
assert_eq!(balance, 500);
let inputs = vec![predicate.encode_data(4096, 4096)];
let result = script.main().with_inputs(inputs).call().await.unwrap();
However this results in a mismatched types error since predicate.encode_data(4096, 4096)
is not of type Input
. My question is how to transform a predicate into the Input
type ?