You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/functions/typescript/ic-cdk.mdx
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,14 +28,14 @@ You have to follow the pace of the Juno release to ensure compatibility. Refer t
28
28
29
29
---
30
30
31
-
## id
31
+
## canisterSelf
32
32
33
33
Retrieves the Principal ID of the current Satellite.
34
34
35
35
This is useful when you want to use functions such as [setDocStore](./sdk.mdx#setdocstore) with the caller set as the administrator. Since the code is running on the backend side (inside the container), the Satellite itself is considered the caller and has admin-level permissions.
36
36
37
37
```typescript
38
-
functionid():Principal;
38
+
functioncanisterSelf():Principal;
39
39
```
40
40
41
41
📦 Import from `@junobuild/functions/ic-cdk`
@@ -47,6 +47,7 @@ function id(): Principal;
47
47
#### Notes:
48
48
49
49
- This function is a JavaScript binding for the Rust function [ic_cdk::id()](https://docs.rs/ic-cdk/latest/ic_cdk/fn.id.html).
50
+
- It was previously named `id()` and is also accessible as `satelliteSelf()`.
50
51
51
52
---
52
53
@@ -80,6 +81,28 @@ function call<T>(params: CallParams): Promise<T | undefined>;
80
81
81
82
---
82
83
84
+
## msgCaller
85
+
86
+
Returns the Principal ID of the caller of the current function.
87
+
88
+
```typescript
89
+
function msgCaller():Principal;
90
+
```
91
+
92
+
📦 Import from `@junobuild/functions/ic-cdk`
93
+
94
+
#### Returns:
95
+
96
+
-`Principal`: The Principal ID of the caller.
97
+
98
+
#### Notes:
99
+
100
+
- This function is a JavaScript binding for the Rust function [ic_cdk::api::msg_caller()](https://docs.rs/ic-cdk/latest/ic_cdk/api/fn.msg_caller.html).
101
+
- In serverless hooks, the caller is the Satellite itself. The end user's Principal can be retrieved from the payload instead.
102
+
- This function was previously named `caller()`.
103
+
104
+
---
105
+
83
106
## time
84
107
85
108
Returns the current timestamp in nanoseconds since the Unix epoch.
0 commit comments