Skip to content
This repository was archived by the owner on Nov 14, 2022. It is now read-only.

Commit 710ec9d

Browse files
author
kurdy
committed
refactor greet func
1 parent 5c1314e commit 710ec9d

File tree

1 file changed

+9
-3
lines changed
  • src/dfinity_reactJs_reactRouter_babel

1 file changed

+9
-3
lines changed
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
actor {
2-
public func greet(name : Text) : async Text {
3-
return "Hello, " # name # "!";
1+
import Principal "mo:base/Principal";
2+
import Nat32 "mo:base/Nat32";
3+
4+
5+
shared({caller = canisterOwner}) actor class () {
6+
7+
public shared query ({caller}) func greet(name : Text) : async Text {
8+
let hash = Principal.hash(caller);
9+
return "Hello, " # name # "! caller hash: " # Nat32.toText(hash);
410
};
511
};

0 commit comments

Comments
 (0)