QYSTQT6UVXG552I5YDE6XH52QMLBI4EC
[
"autonomous agent",
{
"messages": {
"cases": [
{
"if": "{
$checkaddress = trigger.data.address;
if ( !$checkaddress ) bounce( 'input: { address : address , [ data : passthur_data ] , [ newaddress : newaddress ] , [ checkonly : false ] }' ); // USAGE
// doesn't matter if checkaddress is valid or not because it will bounce when routing to the invalid address
$logicaladdress = var[ $checkaddress ];
if ( $logicaladdress ){ // FOUND LOGICAL ADDRESS
$currentaddress = var[ $logicaladdress ]; // GET LATEST ADDRESS
$newaddress = trigger.data.newaddress;
if( $newaddress ){ // again doesn't matter if newaddress is valid or not , RECEIVED NEW ADDRESS
if( var[ $currentaddress ][ 'authors' ] == trigger.address ){ // CHECK OWNERSHIP
// transfer of arbitrary address types will be possible in the future when AA can explore DAG
$route = $newaddress; // ROUTE TO NEW ADDRESS
// actual ownership transfer done in app state
} else {
bounce( 'Trigger address does not match with var[ authors ] in ' || $currentaddress || ' which is require to make newaddress transfer' );
}
} else {
$route = $currentaddress; // ROUTE TO LATEST ADDRESS
}
}else{
$route = $checkaddress; // registration will be done at app state , ROUTE TO CHECK ADRESS FIRST TIME
}
if( trigger.data.checkonly ){ // CHECKONLY
if( $checkaddress != $route ) bounce( 'Please use latest address at ' || $route );
else bounce( 'This address ' || $checkaddress || ' is the latest');
}
// ROUTE with pass thur data
$route
}",
"messages": [
{
"app": "payment",
"payload": {
"asset": "base",
"outputs": [
{
"address": "{$route}"
}
]
}
},
{
"app": "data",
"payload": "{trigger.data}"
},
{
"app": "state",
"state": "{
if( !$logicaladdress ){
var[ 'L' || $checkaddress ] = $checkaddress; // create logical address
var[ $checkaddress ] = 'L' || $checkaddress; // set checkaddress to logical address
$msg = ' a new address registration';
}
if( $newaddress AND $logicaladdress AND $currentaddress AND var[ $currentaddress ][ 'authors' ] == trigger.address ){
var[ $logicaladdress ] = $newaddress;
var[ $newaddress ] = $logicaladdress;
$msg = ' address has been transferred from ' || $currentaddress;
}
response[ 'message' ] = 'Routing to ' || $route || $msg;
var[ 'authors' ] = '7MDNSRYFRLJ4PQMPD5TZPIO5JHCTYNQI';
}"
}
]
}
]
}
}
]
- MCI: 981022
- Bounced
- Response: {
"error": "This address QYSTQT6UVXG552I5YDE6XH52QMLBI4EC is the latest"
}
- MCI: 980998
- Not bounced
- Response unit:
- Response: {
"responseVars": {
"message": "Routing to QYSTQT6UVXG552I5YDE6XH52QMLBI4EC a new address registration"
}
}
Show transactions in assets:
No transactions found, it may be worth changing the filter
Unit ID
Date
From
Direction
To
Amount
03.08.2019 07:26:54
in
QYSTQT6UVXG552I5YDE6XH52QMLBI4EC
03.08.2019 07:18:33
QYSTQT6UVXG552I5YDE6XH52QMLBI4EC
out
QYSTQT6UVXG552I5YDE6XH52QMLBI4EC
03.08.2019 07:18:33
in
QYSTQT6UVXG552I5YDE6XH52QMLBI4EC