Skip to content

Commit

Permalink
finish ic api js doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 8, 2025
1 parent 92e97ff commit 7e6bfd8
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/lib/stable/ic_apis/accept_message.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { inspectMessage } from '../canister_methods/inspect_message'; // Used for links in comments

/**
* Accepts an ingress message during message inspection.
*
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stable/ic_apis/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { idlDecode, idlEncode } from '../execute_with_candid_serde';
* - heartbeat
* - timer
* - **When called outside of Call Context**:
* - Traps
* - Throws
*/
export async function call<Args extends any[] | undefined, Return = any>(
canisterId: Principal | string,
Expand Down
5 changes: 4 additions & 1 deletion src/lib/stable/ic_apis/chunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ import { id } from './id';
* - See: https://internetcomputer.org/docs/current/developer-docs/smart-contracts/maintain/resource-limits
* - **Call Context**:
* - update
* - after a cross-canister call (only from updates?)
* - after a cross-canister call
* - after a rejected cross-canister call
* - heartbeat
* - timer
* - **When called outside of Call Context**:
* - Throws
*/
export async function chunk(): Promise<void> {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/clear_timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* - timer
* - Note: Assuming same as timer
* - Note: Also cleanupCallback
* - **When called outside of Call Context**:
* - No effect
*/
export function clearTimer(timerId: bigint): void {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/cycles_burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* - heartbeat
* - timer
* - Note: Also cleanupCallback
* - **When called outside of Call Context**:
* - Traps
*/
export function cyclesBurn(amount: bigint): bigint {
if (
Expand Down
1 change: 0 additions & 1 deletion src/lib/stable/ic_apis/data_certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { setCertifiedData } from './set_certified_data'; // Used for links in co
* @remarks
* - Used in conjunction with {@link setCertifiedData}
* - Enables query calls to return certified responses
* - Only meaningful during query calls
* - **Call Context**:
* - query (non-replicated)
* - composite query
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/msg_cycles_accept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* - update
* - after a cross-canister call
* - after a rejected cross-canister call
* - **When called outside of Call Context**:
* - Traps
*/
export function msgCyclesAccept(maxAmount: bigint): bigint {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/msg_cycles_available.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* - update
* - after a cross-canister call
* - after a rejected cross-canister call
* - **When called outside of Call Context**:
* - Traps
*/
export function msgCyclesAvailable(): bigint {
if (
Expand Down
3 changes: 2 additions & 1 deletion src/lib/stable/ic_apis/msg_cycles_refunded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
* @returns The amount of cycles refunded from the last call, or 0n if called outside the IC environment
*
* @remarks
* - Only meaningful after a cross-canister call
* - Refunded cycles are already added to canister balance
* - **Call Context**:
* - after a cross-canister call
* - after a rejected cross-canister call
* - **When called outside of Call Context**:
* - Traps
*/
export function msgCyclesRefunded(): bigint {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/reject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* - after a rejected cross-canister call
* - after a cross-canister call from a composite query
* - after a rejected cross-canister call from a composite query
* - **When called outside of Call Context**:
* - Traps
*/
export function reject(message: string): void {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/reject_code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const RejectionCode = IDL.Variant({
* - after a rejected cross-canister call
* - after a cross-canister call from a composite query
* - after a rejected cross-canister call from a composite query
* - **When called outside of Call Context**:
* - Traps
*/
export function rejectCode(): RejectionCode {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type ReplyInput<T> =
* - after a rejected cross-canister call
* - after a cross-canister call from a composite query
* - after a rejected cross-canister call from a composite query
* - **When called outside of Call Context**:
* - Throws
*/
export function reply<T>(input: ReplyInput<T>): void {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/set_certified_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { dataCertificate } from './data_certificate'; // Used for links in comme
* - after a rejected cross-canister call
* - heartbeat
* - timer
* - **When called outside of Call Context**:
* - Traps
*/
export function setCertifiedData(data: Uint8Array): void {
if (
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/set_timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { v4 } from 'uuid';
* - heartbeat
* - timer
* - Note: Also cleanupCallback
* - **When called outside of Call Context**:
* - Traps
*/
export function setTimer(
delay: bigint,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/stable/ic_apis/set_timer_interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { v4 } from 'uuid';
* - heartbeat
* - timer
* - Note: Also cleanupCallback
* - **When called outside of Call Context**:
* - Traps
*/
export function setTimerInterval(
interval: bigint,
Expand Down

0 comments on commit 7e6bfd8

Please sign in to comment.