| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | if (!trigger.data.hash_of_secret or !trigger.data.destination_address) |
| 9 | bounce("I need:'destination_address' and 'hash_of_secret' and optional 'amount', 'asset_id' and 'duration_in_hours'."); |
| 10 | |
| 11 | }", |
| 12 | "messages": [ |
| 13 | { |
| 14 | "app": "definition", |
| 15 | "payload": { |
| 16 | "definition": [ |
| 17 | "autonomous agent", |
| 18 | { |
| 19 | "base_aa": "{"JH3LOA27OOP443BAGJYBHONKCK6NPLAB"}", |
| 20 | "params": { |
| 21 | "destination_address": "{trigger.data.destination_address}", |
| 22 | "hash_of_secret": "{trigger.data.hash_of_secret}", |
| 23 | "amount": "{trigger.data.amount otherwise 0}", |
| 24 | "asset_id": "{trigger.data.asset_id otherwise "base"}", |
| 25 | "deadline": "{timestamp+(json_parse(trigger.data.duration_in_hours otherwise 12)*60*60)}" |
| 26 | } |
| 27 | } |
| 28 | ] |
| 29 | } |
| 30 | }, |
| 31 | { |
| 32 | "app": "payment", |
| 33 | "payload": { |
| 34 | "asset": "base", |
| 35 | "outputs": [ |
| 36 | { |
| 37 | "address": "{trigger.address}", |
| 38 | "amount": "{balance[base]-2000}" |
| 39 | } |
| 40 | ] |
| 41 | } |
| 42 | }, |
| 43 | { |
| 44 | "app": "state", |
| 45 | "state": "{ |
| 46 | response['message'] = "A lock box (HTLC) as been created for '"||trigger.data.destination_address||"'by the following unit: "||response_unit; |
| 47 | }" |
| 48 | } |
| 49 | ] |
| 50 | } |
| 51 | ] |