mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
add more AIR scripts
This commit is contained in:
parent
e2b1d73c94
commit
9c948c79e6
53
multi-service/air-scripts/block_tripper.clj
Normal file
53
multi-service/air-scripts/block_tripper.clj
Normal file
@ -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%])
|
||||
)
|
||||
)
|
18
multi-service/air-scripts/curl_req.clj
Normal file
18
multi-service/air-scripts/curl_req.clj
Normal file
@ -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%])
|
||||
)
|
||||
)
|
||||
|
||||
|
16
multi-service/air-scripts/get_address.clj
Normal file
16
multi-service/air-scripts/get_address.clj
Normal file
@ -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%])
|
||||
)
|
||||
)
|
16
multi-service/air-scripts/get_block_simple.clj
Normal file
16
multi-service/air-scripts/get_block_simple.clj
Normal file
@ -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%])
|
||||
)
|
||||
)
|
16
multi-service/air-scripts/hex2int.clj
Normal file
16
multi-service/air-scripts/hex2int.clj
Normal file
@ -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%])
|
||||
)
|
||||
)
|
10
multi-service/air-scripts/test_air.clj
Normal file
10
multi-service/air-scripts/test_air.clj
Normal file
@ -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%])
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user