From 9c948c79e68ed5dc45e02ead2947db38c86a10e0 Mon Sep 17 00:00:00 2001 From: boneyard93501 <4523011+boneyard93501@users.noreply.github.com> Date: Thu, 4 Mar 2021 01:57:19 -0600 Subject: [PATCH] add more AIR scripts --- multi-service/air-scripts/block_tripper.clj | 53 +++++++++++++++++++ multi-service/air-scripts/curl_req.clj | 18 +++++++ multi-service/air-scripts/get_address.clj | 16 ++++++ .../air-scripts/get_block_simple.clj | 16 ++++++ multi-service/air-scripts/hex2int.clj | 16 ++++++ multi-service/air-scripts/test_air.clj | 10 ++++ 6 files changed, 129 insertions(+) create mode 100644 multi-service/air-scripts/block_tripper.clj create mode 100644 multi-service/air-scripts/curl_req.clj create mode 100644 multi-service/air-scripts/get_address.clj create mode 100644 multi-service/air-scripts/get_block_simple.clj create mode 100644 multi-service/air-scripts/hex2int.clj create mode 100644 multi-service/air-scripts/test_air.clj diff --git a/multi-service/air-scripts/block_tripper.clj b/multi-service/air-scripts/block_tripper.clj new file mode 100644 index 0000000..ba45ac0 --- /dev/null +++ b/multi-service/air-scripts/block_tripper.clj @@ -0,0 +1,53 @@ +(xor + (seq + (seq + (seq + (seq + (call relay ("op" "identity") []) + (call node_1 (service_1 "get_latest_block") [api_key] hex_block_result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [hex_block_result]) + ) + ) + (seq + (seq + (call relay ("op" "identity") []) + (call node_2 (service_2 "hex_to_int") [hex_block_result] int_block_result) ; "0xb69e2e" + ; (call node_2 (service_2 "hex_to_int") ["0xb69e2e"] int_block_result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [int_block_result]) + ) + ) + ) + (seq + (par + (seq + (call relay ("op" "identity") []) + (call node_1 (service_1 "get_block") [api_key int_block_result] block_result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [block_result]) + ) + ) + (par + (seq + (call relay ("op" "identity") []) + (call node_1 (service_1 "get_block") [api_key int_block_result-1] block_result_1) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [block_result_1]) + ) + ) + ) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%]) + ) +) \ No newline at end of file diff --git a/multi-service/air-scripts/curl_req.clj b/multi-service/air-scripts/curl_req.clj new file mode 100644 index 0000000..cf04eea --- /dev/null +++ b/multi-service/air-scripts/curl_req.clj @@ -0,0 +1,18 @@ +(xor + (seq + (seq + (call relay ("op" "identity") []) + (call node_1 (service "curl_request") ["https://api.duckduckgo.com/?q=homotopy&format=json"] result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [result]) + ) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [%last_error%]) + ) +) + + diff --git a/multi-service/air-scripts/get_address.clj b/multi-service/air-scripts/get_address.clj new file mode 100644 index 0000000..428fc0f --- /dev/null +++ b/multi-service/air-scripts/get_address.clj @@ -0,0 +1,16 @@ +(xor + (seq + (seq + (call relay ("op" "identity") []) + (call my_node (service "extract_miner_address") [json_string] result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [result]) + ) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%]) + ) +) \ No newline at end of file diff --git a/multi-service/air-scripts/get_block_simple.clj b/multi-service/air-scripts/get_block_simple.clj new file mode 100644 index 0000000..6de4e11 --- /dev/null +++ b/multi-service/air-scripts/get_block_simple.clj @@ -0,0 +1,16 @@ +(xor + (seq + (seq + (call relay ("op" "identity") []) + (call node_1 (service "get_block") [api_key block_num] result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [result]) + ) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%]) + ) +) \ No newline at end of file diff --git a/multi-service/air-scripts/hex2int.clj b/multi-service/air-scripts/hex2int.clj new file mode 100644 index 0000000..bc29a82 --- /dev/null +++ b/multi-service/air-scripts/hex2int.clj @@ -0,0 +1,16 @@ +(xor + (seq + (seq + (call relay ("op" "identity") []) + (call node_1 (service "hex_to_int") [hex_string] hex_result) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") [hex_result]) + ) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%]) + ) +) \ No newline at end of file diff --git a/multi-service/air-scripts/test_air.clj b/multi-service/air-scripts/test_air.clj new file mode 100644 index 0000000..0398b3b --- /dev/null +++ b/multi-service/air-scripts/test_air.clj @@ -0,0 +1,10 @@ + (xor + (seq + (call relay (service "get_latest_block") [api_key] result) + (call %init_peer_id% (returnService "run") [result]) + ) + (seq + (call relay ("op" "identity") []) + (call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%]) + ) +)