[
"autonomous agent",
{
"getters": "{
$fetchNFT = $asset => {
$unitInfo = unit[$asset];
if ($unitInfo.sequence != "good")
bounce("Bad unit");
$definedBy = $unitInfo.authors[0].authentifiers
? $unitInfo.authors[0].address //Is a person
: unit[$unitInfo.trigger_unit].authors[0].address; //Can be either AA (they can also define NFTs) or a person
$metadata = $unitInfo.messages[[.app='data']].payload;
$assetMetadata = $unitInfo.messages[[.app='asset']].payload;
return {asset: $assetMetadata, meta: $metadata};
};
}",
"messages": [
{
"if": "{NOT var["a"]}",
"app": "data",
"payload": {
"name": "Untitled",
"author": "{trigger.address}",
"ipfs": "Qmmmsdmjsdjf",
"type": "IMG",
"decimals": 0
}
},
{
"app": "asset",
"payload": {
"cap": 1,
"is_private": false,
"is_transferrable": true,
"auto_destroy": false,
"fixed_denominations": false,
"issued_by_definer_only": true,
"cosigned_by_definer": false,
"spender_attested": false
}
},
{
"if": "{var["a"]}",
"app": "data",
"payload": {
"nft": "{$fetchNFT(var["a"])}"
}
},
{
"app": "state",
"state": "{
var["a"] = response_unit;
}"
}
]
}
]