mirror of
https://github.com/fluencelabs/examples
synced 2024-12-04 19:20:17 +00:00
add AIR scripts
This commit is contained in:
parent
9d86c66583
commit
0569b82717
16
multi-service/air-scripts/ethqlite_init.clj
Normal file
16
multi-service/air-scripts/ethqlite_init.clj
Normal file
@ -0,0 +1,16 @@
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call node_1 (service "init_service") [use_owner use_paywall api_key] 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%])
|
||||
)
|
||||
)
|
17
multi-service/air-scripts/ethqlite_owner.clj
Normal file
17
multi-service/air-scripts/ethqlite_owner.clj
Normal file
@ -0,0 +1,17 @@
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call node_1 (service "am_i_owner") [] result)
|
||||
; (call node_1 (service "get_tplet") [] 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/ethqlite_reset.clj
Normal file
16
multi-service/air-scripts/ethqlite_reset.clj
Normal file
@ -0,0 +1,16 @@
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call node_1 (service "owner_nuclear_reset") [] 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%])
|
||||
)
|
||||
)
|
88
multi-service/air-scripts/ethqlite_roundtrip.clj
Normal file
88
multi-service/air-scripts/ethqlite_roundtrip.clj
Normal file
@ -0,0 +1,88 @@
|
||||
(xor
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(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)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") [int_block_result])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(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])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call sqlite_node (sqlite_service "update_reward_blocks") [block_result] insert_result)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") [insert_result])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call sqlite_node (sqlite_service "get_latest_reward_block") [] select_result)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") [select_result])
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call sqlite_node (sqlite_service "get_reward_block") [int_block_result] select_result_2)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") [select_result_2])
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call sqlite_node (sqlite_service "get_miner_rewards") [select_result_2.$.["block_miner"]!] select_result_3)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") [select_result_3])
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(seq
|
||||
(call relay ("op" "identity") [])
|
||||
(call %init_peer_id% (returnService "run") ["XOR FAILED" %last_error%])
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user