examples/intro/3-hello-world-web3/aqua/getting-started.aqua

29 lines
925 B
Plaintext
Raw Permalink Normal View History

2021-07-20 14:00:26 +03:00
import "@fluencelabs/aqua-lib/builtin.aqua"
const helloWorldNodePeerId ?= "12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf"
const helloWorldServiceId ?= "ba24be5b-9789-48ac-b38a-82c9d3eb0d34"
2021-07-20 14:00:26 +03:00
data HelloResponse:
2021-07-20 14:00:26 +03:00
msg: string
reply: string
-- The service runs on a Fluence node
service HelloWorld:
hello_world(from: PeerId) -> HelloResponse
2021-07-20 14:00:26 +03:00
-- The service runs inside browser
service HelloPeer("HelloPeer"):
hello(message: string) -> string
2021-07-20 14:00:26 +03:00
func sayHello(targetPeerId: PeerId, targetRelayPeerId: PeerId) -> string:
-- execute computation on a Peer in the network
on helloWorldNodePeerId:
HelloWorld helloWorldServiceId
comp <- HelloWorld.hello_world(%init_peer_id%)
2021-07-20 14:00:26 +03:00
-- send the result to target browser in the background
co on targetPeerId via targetRelayPeerId:
res <- HelloPeer.hello(%init_peer_id%)
2021-07-20 14:00:26 +03:00
-- send the result to the initiator
2021-07-20 14:00:26 +03:00
<- comp.reply