mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-03-31 09:41:11 +00:00
18 lines
523 B
Plaintext
18 lines
523 B
Plaintext
-- set `PeerId` name to be a type alias for `string` type
|
|
alias PeerId : string
|
|
|
|
-- define data structure (ADT)
|
|
data NodeId:
|
|
peerId: PeerId
|
|
name: string
|
|
|
|
-- define service `NodeIdGetter` that will be callable on local client via `somesrv` service id
|
|
service NodeIdGetter("somesrv"):
|
|
get: -> NodeId
|
|
|
|
-- showcases a function that gets data structure from a local service,
|
|
-- and then retrieves aliased data type from that structure
|
|
func getAliasedData() -> PeerId:
|
|
res <- NodeIdGetter.get()
|
|
<- res.peerId
|