| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "bounce_fees": { |
| 5 | "base": 10000 |
| 6 | }, |
| 7 | "init": "{ |
| 8 | $this = { |
| 9 | dust_collector : "B2UMBICLZSBVDHRC7BYM6BBU4AQEXL2F", |
| 10 | htlc_base_aa : "GXH5UX3ILVMM66HGDXD4RZCAX6YK4R4I" |
| 11 | }; |
| 12 | |
| 13 | }", |
| 14 | "messages": { |
| 15 | "cases": [ |
| 16 | { |
| 17 | "if": "{ !!trigger.data.destination_address and !!trigger.data.hash_of_secret}", |
| 18 | "messages": [ |
| 19 | { |
| 20 | "app": "definition", |
| 21 | "payload": { |
| 22 | "definition": [ |
| 23 | "autonomous agent", |
| 24 | { |
| 25 | "base_aa": "{$this.htlc_base_aa}", |
| 26 | "params": { |
| 27 | "destination_address": "{trigger.data.destination_address}", |
| 28 | "hash_of_secret": "{trigger.data.hash_of_secret}", |
| 29 | "amount": "{trigger.data.amount otherwise 0}", |
| 30 | "asset_id": "{trigger.data.asset_id otherwise "base"}", |
| 31 | "deadline": "{timestamp+(json_parse(trigger.data.duration_in_hours otherwise 12)*60*60)}" |
| 32 | } |
| 33 | } |
| 34 | ] |
| 35 | } |
| 36 | }, |
| 37 | { |
| 38 | "app": "payment", |
| 39 | "payload": { |
| 40 | "asset": "base", |
| 41 | "outputs": [ |
| 42 | { |
| 43 | "address": "{trigger.address}", |
| 44 | "amount": "{balance[base]-2000}" |
| 45 | } |
| 46 | ] |
| 47 | } |
| 48 | }, |
| 49 | { |
| 50 | "app": "state", |
| 51 | "state": "{ |
| 52 | response['message'] = "A lock box (HTLC) as been created for '"||trigger.data.destination_address||"', check the AA address in the Response unit"; |
| 53 | }" |
| 54 | } |
| 55 | ] |
| 56 | }, |
| 57 | { |
| 58 | "messages": [ |
| 59 | { |
| 60 | "app": "state", |
| 61 | "state": "{ |
| 62 | bounce("I need:'destination_address' and 'hash_of_secret' and optional 'amount', 'asset_id' and 'duration_in_hours'."); |
| 63 | }" |
| 64 | } |
| 65 | ] |
| 66 | } |
| 67 | ] |
| 68 | } |
| 69 | } |
| 70 | ] |