diff --git a/src/lib/stable/ic_apis/accept_message.ts b/src/lib/stable/ic_apis/accept_message.ts index d7c5120066..92452d7c4d 100644 --- a/src/lib/stable/ic_apis/accept_message.ts +++ b/src/lib/stable/ic_apis/accept_message.ts @@ -8,8 +8,6 @@ import { inspectMessage } from '../canister_methods/inspect_message'; // Used fo * * @remarks * - Signals that a message should proceed to execution - * - Cannot be called after reject_message - * - Traps if called outside {@link inspectMessage} context * - **Call Context**: * - inspectMessage */ diff --git a/src/lib/stable/ic_apis/arg_data_raw.ts b/src/lib/stable/ic_apis/arg_data_raw.ts index 580361ce07..6e4344fdc5 100644 --- a/src/lib/stable/ic_apis/arg_data_raw.ts +++ b/src/lib/stable/ic_apis/arg_data_raw.ts @@ -6,10 +6,12 @@ * @remarks * - **Call Context**: * - init + * - postUpgrade * - update - * - query + * - query (replicated and non-replicated) * - composite query - * - reply + * - after a cross-canister call + * - after a cross-canister call from a composite query * - inspectMessage */ export function argDataRaw(): Uint8Array { diff --git a/src/lib/stable/ic_apis/call.ts b/src/lib/stable/ic_apis/call.ts index fa1beb61a4..769e9450a0 100644 --- a/src/lib/stable/ic_apis/call.ts +++ b/src/lib/stable/ic_apis/call.ts @@ -24,9 +24,12 @@ import { idlDecode, idlEncode } from '../execute_with_candid_serde'; * - **Call Context**: * - update * - composite query - * - reply + * - after a cross-canister call + * - 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 * - heartbeat - * - global_timer + * - timer */ export async function call( canisterId: Principal | string, diff --git a/src/lib/stable/ic_apis/caller.ts b/src/lib/stable/ic_apis/caller.ts index f28dea73bc..bc942fd995 100644 --- a/src/lib/stable/ic_apis/caller.ts +++ b/src/lib/stable/ic_apis/caller.ts @@ -11,7 +11,7 @@ import { Principal } from '@dfinity/principal'; * - For user calls, returns the user's Principal * - For anonymous calls, returns the anonymous Principal * - **Call Context**: - * - Any method + * - Any method (not start) */ export function caller(): Principal { if ( diff --git a/src/lib/stable/ic_apis/canister_balance.ts b/src/lib/stable/ic_apis/canister_balance.ts index 4b8a297b3c..72170f7163 100644 --- a/src/lib/stable/ic_apis/canister_balance.ts +++ b/src/lib/stable/ic_apis/canister_balance.ts @@ -5,7 +5,7 @@ * * @remarks * - **Call Context**: - * - Any method + * - Any method (not start) */ export function canisterBalance(): bigint { if ( diff --git a/src/lib/stable/ic_apis/canister_version.ts b/src/lib/stable/ic_apis/canister_version.ts index 2194dc1523..bbe65b1fc2 100644 --- a/src/lib/stable/ic_apis/canister_version.ts +++ b/src/lib/stable/ic_apis/canister_version.ts @@ -20,7 +20,7 @@ * have been made to the canister's state or configuration. * * - **Call Context**: - * - Any method + * - Any method (not start) */ export function canisterVersion(): bigint { if ( diff --git a/src/lib/stable/ic_apis/chunk.ts b/src/lib/stable/ic_apis/chunk.ts index 146d0dd689..60fdbeb5e9 100644 --- a/src/lib/stable/ic_apis/chunk.ts +++ b/src/lib/stable/ic_apis/chunk.ts @@ -12,9 +12,10 @@ import { id } from './id'; * - Current instruction limits are ~40B for update calls * - See: https://internetcomputer.org/docs/current/developer-docs/smart-contracts/maintain/resource-limits * - **Call Context**: - * - Update calls and their reply/reject callbacks - * - Timers - * - Heartbeat methods + * - update + * - after a cross-canister call (only from updates?) + * - heartbeat + * - timer */ export async function chunk(): Promise { if ( diff --git a/src/lib/stable/ic_apis/clear_timer.ts b/src/lib/stable/ic_apis/clear_timer.ts index e4c851839a..f4bf3252b6 100644 --- a/src/lib/stable/ic_apis/clear_timer.ts +++ b/src/lib/stable/ic_apis/clear_timer.ts @@ -10,11 +10,15 @@ * - No effect if timer ID doesn't exist * - **Call Context**: * - init + * - postUpgrade * - preUpgrade * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call * - heartbeat - * - global_timer + * - timer + * - Note: Assuming same as timer + * - Note: Also cleanupCallback */ export function clearTimer(timerId: bigint): void { if ( diff --git a/src/lib/stable/ic_apis/cycles_burn.ts b/src/lib/stable/ic_apis/cycles_burn.ts index abf2dfefdb..4cd79787f6 100644 --- a/src/lib/stable/ic_apis/cycles_burn.ts +++ b/src/lib/stable/ic_apis/cycles_burn.ts @@ -8,11 +8,14 @@ * - Cannot burn more cycles than the canister has available * - **Call Context**: * - init + * - postUpgrade * - preUpgrade * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call * - heartbeat - * - global_timer + * - timer + * - Note: Also cleanupCallback */ export function cyclesBurn(amount: bigint): bigint { if ( diff --git a/src/lib/stable/ic_apis/data_certificate.ts b/src/lib/stable/ic_apis/data_certificate.ts index 19f75a6e1d..d7d17b56c4 100644 --- a/src/lib/stable/ic_apis/data_certificate.ts +++ b/src/lib/stable/ic_apis/data_certificate.ts @@ -14,7 +14,7 @@ import { setCertifiedData } from './set_certified_data'; // Used for links in co * - Enables query calls to return certified responses * - Only meaningful during query calls * - **Call Context**: - * - query + * - query (non-replicated) * - composite query */ export function dataCertificate(): Uint8Array | undefined { diff --git a/src/lib/stable/ic_apis/id.ts b/src/lib/stable/ic_apis/id.ts index 7268eca1d9..0c62e7ea65 100644 --- a/src/lib/stable/ic_apis/id.ts +++ b/src/lib/stable/ic_apis/id.ts @@ -8,7 +8,7 @@ import { Principal } from '@dfinity/principal'; * @remarks * - Every canister has a unique Principal * - **Call Context**: - * - Any method + * - Any method (not start) */ export function id(): Principal { if ( diff --git a/src/lib/stable/ic_apis/msg_cycles_accept.ts b/src/lib/stable/ic_apis/msg_cycles_accept.ts index ebe8175cd5..251fd77cf1 100644 --- a/src/lib/stable/ic_apis/msg_cycles_accept.ts +++ b/src/lib/stable/ic_apis/msg_cycles_accept.ts @@ -8,7 +8,8 @@ * - Cannot accept more cycles than are available in the current call * - **Call Context**: * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call */ export function msgCyclesAccept(maxAmount: bigint): bigint { if ( diff --git a/src/lib/stable/ic_apis/msg_cycles_available.ts b/src/lib/stable/ic_apis/msg_cycles_available.ts index edd1e4d223..f237280b86 100644 --- a/src/lib/stable/ic_apis/msg_cycles_available.ts +++ b/src/lib/stable/ic_apis/msg_cycles_available.ts @@ -7,7 +7,8 @@ * - Amount decreases as cycles are accepted by the canister * - **Call Context**: * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call */ export function msgCyclesAvailable(): bigint { if ( diff --git a/src/lib/stable/ic_apis/msg_cycles_refunded.ts b/src/lib/stable/ic_apis/msg_cycles_refunded.ts index 20b1273d75..70bf97fea2 100644 --- a/src/lib/stable/ic_apis/msg_cycles_refunded.ts +++ b/src/lib/stable/ic_apis/msg_cycles_refunded.ts @@ -7,8 +7,8 @@ * - Only meaningful after a cross-canister call * - Refunded cycles are already added to canister balance * - **Call Context**: - * - reply callback - * - reject callback + * - after a cross-canister call + * - after a rejected cross-canister call */ export function msgCyclesRefunded(): bigint { if ( diff --git a/src/lib/stable/ic_apis/notify.ts b/src/lib/stable/ic_apis/notify.ts index e4bfba5246..2acaa9bfc1 100644 --- a/src/lib/stable/ic_apis/notify.ts +++ b/src/lib/stable/ic_apis/notify.ts @@ -21,9 +21,13 @@ import { idlEncode } from '../execute_with_candid_serde'; * - **Call Context**: * - update * - composite query - * - reply + * - after a cross-canister call + * - 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 * - heartbeat - * - global_timer + * - timer + * - Note: Assuming same as call */ export function notify( canisterId: Principal | string, diff --git a/src/lib/stable/ic_apis/reject.ts b/src/lib/stable/ic_apis/reject.ts index f8cd84707a..e267bcd347 100644 --- a/src/lib/stable/ic_apis/reject.ts +++ b/src/lib/stable/ic_apis/reject.ts @@ -8,9 +8,12 @@ * - Used in canister methods marked with { manual: true } * - **Call Context**: * - update - * - query + * - query (replicated and non-replicated) * - composite query - * - reply + * - after a cross-canister call + * - 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 */ export function reject(message: string): void { if ( diff --git a/src/lib/stable/ic_apis/reject_code.ts b/src/lib/stable/ic_apis/reject_code.ts index e2d97638e7..ef1b35fe3f 100644 --- a/src/lib/stable/ic_apis/reject_code.ts +++ b/src/lib/stable/ic_apis/reject_code.ts @@ -43,10 +43,10 @@ export const RejectionCode = IDL.Variant({ * * @remarks * - **Call Context**: - * - reply callback - * - reply callback in a composite query - * - reject callback - * - reject callback in a composite query + * - after a cross-canister call + * - 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 */ export function rejectCode(): RejectionCode { if ( diff --git a/src/lib/stable/ic_apis/reject_message.ts b/src/lib/stable/ic_apis/reject_message.ts index 652de2e081..16284d1f23 100644 --- a/src/lib/stable/ic_apis/reject_message.ts +++ b/src/lib/stable/ic_apis/reject_message.ts @@ -10,8 +10,8 @@ import { rejectCode } from './reject_code'; // Used for links in comments * - Will trap if there is no reject message available * - Always check {@link rejectCode} before calling this function * - **Call Context**: - * - reject callback - * - reject callback in a composite query + * - after a rejected cross-canister call + * - after a rejected cross-canister call from a composite query */ export function rejectMessage(): string { if ( diff --git a/src/lib/stable/ic_apis/reply.ts b/src/lib/stable/ic_apis/reply.ts index 82d36cd1a4..3db48943e9 100644 --- a/src/lib/stable/ic_apis/reply.ts +++ b/src/lib/stable/ic_apis/reply.ts @@ -34,9 +34,12 @@ type ReplyInput = * - If idlType is omitted, the data will be encoded as an empty type * - **Call Context**: * - update - * - query + * - query (replicated and non-replicated) * - composite query - * - reply + * - after a cross-canister call + * - 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 */ export function reply(input: ReplyInput): void { if ( diff --git a/src/lib/stable/ic_apis/set_certified_data.ts b/src/lib/stable/ic_apis/set_certified_data.ts index 989bd04c68..1cfaba8e83 100644 --- a/src/lib/stable/ic_apis/set_certified_data.ts +++ b/src/lib/stable/ic_apis/set_certified_data.ts @@ -12,11 +12,13 @@ import { dataCertificate } from './data_certificate'; // Used for links in comme * - Limited to 32 bytes of data (traps if exceeded) * - **Call Context**: * - init + * - postUpgrade * - preUpgrade * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call * - heartbeat - * - global_timer + * - timer */ export function setCertifiedData(data: Uint8Array): void { if ( diff --git a/src/lib/stable/ic_apis/set_timer.ts b/src/lib/stable/ic_apis/set_timer.ts index 8b32bc6ba7..65a83c7704 100644 --- a/src/lib/stable/ic_apis/set_timer.ts +++ b/src/lib/stable/ic_apis/set_timer.ts @@ -15,11 +15,14 @@ import { v4 } from 'uuid'; * - The callback registration is automatically cleaned up after execution * - **Call Context**: * - init + * - postUpgrade * - preUpgrade * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call * - heartbeat - * - global_timer + * - timer + * - Note: Also cleanupCallback */ export function setTimer( delay: bigint, diff --git a/src/lib/stable/ic_apis/set_timer_interval.ts b/src/lib/stable/ic_apis/set_timer_interval.ts index cddbafe9cf..5904a75161 100644 --- a/src/lib/stable/ic_apis/set_timer_interval.ts +++ b/src/lib/stable/ic_apis/set_timer_interval.ts @@ -16,11 +16,14 @@ import { v4 } from 'uuid'; * - Callbacks remain registered even if they throw errors * - **Call Context**: * - init + * - postUpgrade * - preUpgrade * - update - * - reply + * - after a cross-canister call + * - after a rejected cross-canister call * - heartbeat - * - global_timer + * - timer + * - Note: Also cleanupCallback */ export function setTimerInterval( interval: bigint, diff --git a/src/lib/stable/ic_apis/time.ts b/src/lib/stable/ic_apis/time.ts index 1fa976ff86..35870bc499 100644 --- a/src/lib/stable/ic_apis/time.ts +++ b/src/lib/stable/ic_apis/time.ts @@ -8,7 +8,7 @@ * - Returns the number of nanoseconds since 1970-01-01 (Unix epoch). * - Within an invocation of one entry point, the time is constant * - **Call Context**: - * - Any method + * - Any method (not start) */ export function time(): bigint { if (