diff --git a/builtin.aqua b/builtin.aqua index ed5d98f..c11fdf6 100644 --- a/builtin.aqua +++ b/builtin.aqua @@ -66,6 +66,10 @@ service Op("op"): string_from_b58(b: string) -> string bytes_to_b58(bs: []u8) -> string bytes_from_b58(b: string) -> []u8 + -- Applies SHA256 to the given string + -- Argument: s - string to apply sha256 to + -- Returns: returns sha256 multihash encoded as base58 + sha256_string(s: string) -> string service Peer("peer"): -- Checks if there is a direct connection to the peer identified by a given PeerId @@ -97,6 +101,14 @@ service Kademlia("kad"): -- Instructs node to return the locally-known nodes -- in the Kademlia neighborhood for a given key neighborhood(key: PeerId, already_hashed: bool) -> []PeerId + -- Merges given lists and sorts them by distance to target + -- Arguments: + -- target – base58 string; result is sorted by XOR distance to target + -- left – list of base58 strings + -- right – list of base58 strings + -- count – how many items to return + -- Returns: list of base58 strings sorted by distance to target; list will contain at most count elements + merge(target: string, left: []string, right: []string, count: u32) -> []string service Srv("srv"): -- Used to create a service on a certain node @@ -120,6 +132,11 @@ service Srv("srv"): -- service_id – ID of the service whose interface you want to name. add_alias(alias: string, service_id: string) + -- Resolves given alias to a service id + -- If there's no such alias, throws an error + -- Returns: service id associated with the given alias + resolve_alias(alias: string) -> string + -- Retrieves the functional interface of a service running -- on the node specified in the service call -- Argument: service_id – ID of the service whose interface you want to retrieve.