diff --git a/src/lib/candid/index.ts b/src/lib/candid/index.ts index 4fa2a1a7b7..6722110160 100644 --- a/src/lib/candid/index.ts +++ b/src/lib/candid/index.ts @@ -1,7 +1,7 @@ import { IDL } from '@dfinity/candid'; import { AzleBlob, blob } from './types/constructed/blob'; -import { AzleVec } from './types/constructed/vector'; -import { AzleOpt, Opt } from './types/constructed/option'; +import { AzleVec } from './types/constructed/vec'; +import { AzleOpt, Opt } from './types/constructed/opt'; import { AzleTuple } from './types/constructed/tuple'; import { AzleNull, Null } from './types/primitive/null'; import { AzleReserved, reserved } from './types/primitive/reserved'; diff --git a/src/lib/candid/types/constructed/index.ts b/src/lib/candid/types/constructed/index.ts index 33c877c1ce..b0cc78fac7 100644 --- a/src/lib/candid/types/constructed/index.ts +++ b/src/lib/candid/types/constructed/index.ts @@ -2,11 +2,11 @@ import { CandidType, Parent, toIDLType } from '../../index'; import { IDL } from '@dfinity/candid'; export * from './blob'; -export * from './option'; +export * from './opt'; export * from './record'; export * from './tuple'; export * from './variant'; -export * from './vector'; +export * from './vec'; type CandidMap = { [key: string]: CandidType }; type IdlMap = { [key: string]: IDL.Type }; diff --git a/src/lib/candid/types/constructed/option.ts b/src/lib/candid/types/constructed/opt.ts similarity index 94% rename from src/lib/candid/types/constructed/option.ts rename to src/lib/candid/types/constructed/opt.ts index e69e0c45e2..1733d16fbc 100644 --- a/src/lib/candid/types/constructed/option.ts +++ b/src/lib/candid/types/constructed/opt.ts @@ -1,5 +1,5 @@ import { CandidType, Parent, toIDLType } from '../../index'; -import { RequireExactlyOne } from '../constructed/variant'; +import { RequireExactlyOne } from './variant'; import { IDL } from '@dfinity/candid'; /** diff --git a/src/lib/candid/types/constructed/vector.ts b/src/lib/candid/types/constructed/vec.ts similarity index 100% rename from src/lib/candid/types/constructed/vector.ts rename to src/lib/candid/types/constructed/vec.ts diff --git a/src/lib/ic/accept_message.ts b/src/lib/ic/accept_message.ts index 53805b9b12..dad0cc6aea 100644 --- a/src/lib/ic/accept_message.ts +++ b/src/lib/ic/accept_message.ts @@ -4,8 +4,4 @@ import { Void } from '../candid/types/primitive/void'; * Accepts the ingress message. Calling from outside the * {@link $inspectMessage} context will cause the canister to trap. */ -export function acceptMessage(): Void { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const acceptMessage = () => Void; diff --git a/src/lib/ic/arg_data_raw_size.ts b/src/lib/ic/arg_data_raw_size.ts index fb3371d323..b98a22854f 100644 --- a/src/lib/ic/arg_data_raw_size.ts +++ b/src/lib/ic/arg_data_raw_size.ts @@ -4,8 +4,4 @@ import { nat } from '../candid/types/primitive/nats/nat'; * Gets the length of the raw-argument-data-bytes * @returns the data size */ -export function argDataRawSize(): nat { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const argDataRawSize = () => nat; diff --git a/src/lib/ic/data_certificate.ts b/src/lib/ic/data_certificate.ts index 27ee84b419..1e27904962 100644 --- a/src/lib/ic/data_certificate.ts +++ b/src/lib/ic/data_certificate.ts @@ -1,5 +1,5 @@ import { blob } from '../candid/types/constructed/blob'; -import { None, Opt, Some } from '../candid/types/constructed/option'; +import { None, Opt, Some } from '../candid/types/constructed/opt'; /** * When called from a query call, returns the data certificate diff --git a/src/lib/ic/method_name.ts b/src/lib/ic/method_name.ts index fa27c4d514..f38248af45 100644 --- a/src/lib/ic/method_name.ts +++ b/src/lib/ic/method_name.ts @@ -4,8 +4,4 @@ import { text } from '../candid/types/primitive/text'; * Returns the name of the current canister methods * @returns the current canister method */ -export function methodName(): text { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const methodName = () => text; diff --git a/src/lib/ic/print.ts b/src/lib/ic/print.ts index eedb4e6936..a059ee0206 100644 --- a/src/lib/ic/print.ts +++ b/src/lib/ic/print.ts @@ -4,8 +4,4 @@ import { Void } from '../candid/types/primitive/void'; * Prints the given message * @param args the message to print */ -export function print(...args: any): Void { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const print = (...args: any) => Void; diff --git a/src/lib/ic/reject.ts b/src/lib/ic/reject.ts index 8dbb284eee..b8a1e75d28 100644 --- a/src/lib/ic/reject.ts +++ b/src/lib/ic/reject.ts @@ -5,8 +5,4 @@ import { Void } from '../candid/types/primitive/void'; * Rejects the current call with the provided message * @param message the rejection message */ -export function reject(message: text): Void { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const reject = (message: text) => Void; diff --git a/src/lib/ic/reject_message.ts b/src/lib/ic/reject_message.ts index b4586815bb..ab572a53ac 100644 --- a/src/lib/ic/reject_message.ts +++ b/src/lib/ic/reject_message.ts @@ -9,8 +9,4 @@ import { text } from '../candid/types/primitive/text'; * * @returns the rejection message */ -export function rejectMessage(): text { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const rejectMessage = () => text; diff --git a/src/lib/ic/trap.ts b/src/lib/ic/trap.ts index 397d72f0a0..772ec00efa 100644 --- a/src/lib/ic/trap.ts +++ b/src/lib/ic/trap.ts @@ -6,8 +6,4 @@ import { text } from '../candid/types/primitive/text'; * (5) rejection code and the provided message * @param message the rejection message */ -export function trap(message: text): empty { - throw new Error( - 'This function should not be called directly. It is implemented directly on the ic object' - ); -} +export const trap = (message: text) => empty; diff --git a/src/lib/stable_b_tree_map.ts b/src/lib/stable_b_tree_map.ts index a604619fb4..a0ba6925fe 100644 --- a/src/lib/stable_b_tree_map.ts +++ b/src/lib/stable_b_tree_map.ts @@ -1,5 +1,5 @@ import { CandidType, TypeMapping, toIDLType } from './candid'; -import { None, Opt, Some } from './candid/types/constructed/option'; +import { None, Opt, Some } from './candid/types/constructed/opt'; import { IDL } from '@dfinity/candid'; import { nat64 } from './candid/types/primitive/nats/nat64'; import { nat8 } from './candid/types/primitive/nats/nat8';