diff --git a/src/compiler/generate_candid_and_canister_methods.ts b/src/compiler/generate_candid_and_canister_methods.ts index d131710925..a57db95414 100644 --- a/src/compiler/generate_candid_and_canister_methods.ts +++ b/src/compiler/generate_candid_and_canister_methods.ts @@ -36,10 +36,10 @@ export function generateCandidAndCanisterMethods(mainJs: string): { const canisterMethods = (sandbox.exports as any).canisterMethods; - const candidInfo = canisterMethods.getIDL([]).accept(new DidVisitor(), { + const candidInfo = canisterMethods.getIdl([]).accept(new DidVisitor(), { ...getDefaultVisitorData(), isFirstService: true, - systemFuncs: canisterMethods.getSystemFunctionIDLs() + systemFuncs: canisterMethods.getSystemFunctionIdls() }); return { diff --git a/src/lib/candid/recursive.ts b/src/lib/candid/recursive.ts index 77dc55abbb..9eb11a3042 100644 --- a/src/lib/candid/recursive.ts +++ b/src/lib/candid/recursive.ts @@ -6,7 +6,7 @@ export type _AzleRecursiveFunction = { (...args: any[]): CandidType; _azleName?: string; _azleIsRecursive?: boolean; - getIDL?: (parents: Parent[]) => IDL.Type; + getIdl?: (parents: Parent[]) => IDL.Type; }; export function Recursive(candidTypeCallback: any): any { @@ -22,13 +22,13 @@ export function Recursive(candidTypeCallback: any): any { result._azleName = name; result._azleIsRecursive = true; - result.getIDL = (parents: Parent[]) => { + result.getIdl = (parents: Parent[]) => { const idl = IDL.Rec(); let filler = candidTypeCallback(); if (filler._azleIsCanister) { filler = filler(result); } - idl.fill(filler.getIDL([...parents, { idl: idl, name }])); + idl.fill(filler.getIdl([...parents, { idl: idl, name }])); return idl; }; diff --git a/src/lib/candid/to_Idl.ts b/src/lib/candid/to_Idl.ts index 6ca282239b..1b6ff9c6af 100644 --- a/src/lib/candid/to_Idl.ts +++ b/src/lib/candid/to_Idl.ts @@ -16,7 +16,7 @@ export function toIdl( ); // If the parent isn't undefined (ie we found one with the same name) // this is a recursive type and we should return the parent rec idl - // instead of calling getIDL + // instead of calling getIdl if (parent !== undefined) { return parent.idl; } @@ -24,8 +24,8 @@ export function toIdl( if ('_azleIsCanister' in candidType && candidType._azleIsCanister) { return toIdl((candidType as any)(), parents); } - // All CandidTypes ought to have a getIDL function defined for them - return (candidType as any).getIDL(parents); + // All CandidTypes ought to have a getIdl function defined for them + return (candidType as any).getIdl(parents); } export function toParamIdls( diff --git a/src/lib/candid/types/constructed/blob.ts b/src/lib/candid/types/constructed/blob.ts index e2d552057c..2d4e178a3c 100644 --- a/src/lib/candid/types/constructed/blob.ts +++ b/src/lib/candid/types/constructed/blob.ts @@ -4,7 +4,7 @@ export class AzleBlob { _kind: 'AzleBlob' = 'AzleBlob'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Vec(IDL.Nat8); } } diff --git a/src/lib/candid/types/constructed/opt.ts b/src/lib/candid/types/constructed/opt.ts index 74c7bf06e3..510f8981a8 100644 --- a/src/lib/candid/types/constructed/opt.ts +++ b/src/lib/candid/types/constructed/opt.ts @@ -35,7 +35,7 @@ export class AzleOpt { _azleCandidType?: '_azleCandidType'; _kind: 'AzleOpt' = 'AzleOpt'; - getIDL(parents: Parent[]) { + getIdl(parents: Parent[]) { return IDL.Opt(toIdl(this._azleType, parents)); } } diff --git a/src/lib/candid/types/constructed/record.ts b/src/lib/candid/types/constructed/record.ts index c6601d6f88..e1a3397920 100644 --- a/src/lib/candid/types/constructed/record.ts +++ b/src/lib/candid/types/constructed/record.ts @@ -13,7 +13,7 @@ export function Record< } & { _azleCandidType?: '_azleCandidType' } { return { ...obj, - getIDL(parents: Parent[]) { + getIdl(parents: Parent[]) { return IDL.Record(toIdlMap(obj as CandidMap, parents)); } } as any; diff --git a/src/lib/candid/types/constructed/tuple.ts b/src/lib/candid/types/constructed/tuple.ts index 08e020c0ca..8465379e01 100644 --- a/src/lib/candid/types/constructed/tuple.ts +++ b/src/lib/candid/types/constructed/tuple.ts @@ -10,7 +10,7 @@ export class AzleTuple { _azleTypes: CandidType[]; _azleCandidType?: '_azleCandidType'; - getIDL(parents: Parent[]) { + getIdl(parents: Parent[]) { const idls = this._azleTypes.map((value) => { return toIdl(value, parents); }); diff --git a/src/lib/candid/types/constructed/variant.ts b/src/lib/candid/types/constructed/variant.ts index 9d91e7314d..2a6f658878 100644 --- a/src/lib/candid/types/constructed/variant.ts +++ b/src/lib/candid/types/constructed/variant.ts @@ -13,7 +13,7 @@ export function Variant< }> & { _azleCandidType?: '_azleCandidType' } { return { ...obj, - getIDL(parents: any) { + getIdl(parents: any) { return IDL.Variant(toIdlMap(obj as CandidMap, parents)); } } as any; diff --git a/src/lib/candid/types/constructed/vec.ts b/src/lib/candid/types/constructed/vec.ts index 2ed97d9fa6..3901fc4c92 100644 --- a/src/lib/candid/types/constructed/vec.ts +++ b/src/lib/candid/types/constructed/vec.ts @@ -10,7 +10,7 @@ export class AzleVec { _azleType: CandidType; _azleCandidType?: '_azleCandidType'; - getIDL(parents: Parent[]) { + getIdl(parents: Parent[]) { return IDL.Vec(toIdl(this._azleType, parents)); } } diff --git a/src/lib/candid/types/primitive/bool.ts b/src/lib/candid/types/primitive/bool.ts index 8a02ef350e..5163a24beb 100644 --- a/src/lib/candid/types/primitive/bool.ts +++ b/src/lib/candid/types/primitive/bool.ts @@ -4,7 +4,7 @@ export class AzleBool { _kind: 'AzleBool' = 'AzleBool'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Bool; } } diff --git a/src/lib/candid/types/primitive/empty.ts b/src/lib/candid/types/primitive/empty.ts index 27d0609058..ac0b1954d5 100644 --- a/src/lib/candid/types/primitive/empty.ts +++ b/src/lib/candid/types/primitive/empty.ts @@ -4,7 +4,7 @@ export class AzleEmpty { _kind: 'AzleEmpty' = 'AzleEmpty'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Empty; } } diff --git a/src/lib/candid/types/primitive/floats/float32.ts b/src/lib/candid/types/primitive/floats/float32.ts index ae35a13244..8029f0bfdf 100644 --- a/src/lib/candid/types/primitive/floats/float32.ts +++ b/src/lib/candid/types/primitive/floats/float32.ts @@ -4,7 +4,7 @@ export class AzleFloat32 { _kind: 'AzleFloat32' = 'AzleFloat32'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Float32; } } diff --git a/src/lib/candid/types/primitive/floats/float64.ts b/src/lib/candid/types/primitive/floats/float64.ts index ee1f8dfac5..fe224b420f 100644 --- a/src/lib/candid/types/primitive/floats/float64.ts +++ b/src/lib/candid/types/primitive/floats/float64.ts @@ -4,7 +4,7 @@ export class AzleFloat64 { _kind: 'AzleFloat64' = 'AzleFloat64'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Float64; } } diff --git a/src/lib/candid/types/primitive/ints/int.ts b/src/lib/candid/types/primitive/ints/int.ts index 4ebde40e80..4ceaed8e4f 100644 --- a/src/lib/candid/types/primitive/ints/int.ts +++ b/src/lib/candid/types/primitive/ints/int.ts @@ -4,7 +4,7 @@ export class AzleInt { _kind: 'AzleInt' = 'AzleInt'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Int; } } diff --git a/src/lib/candid/types/primitive/ints/int16.ts b/src/lib/candid/types/primitive/ints/int16.ts index 4577fe8cce..e0640ee593 100644 --- a/src/lib/candid/types/primitive/ints/int16.ts +++ b/src/lib/candid/types/primitive/ints/int16.ts @@ -4,7 +4,7 @@ export class AzleInt16 { _kind: 'AzleInt16' = 'AzleInt16'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Int16; } } diff --git a/src/lib/candid/types/primitive/ints/int32.ts b/src/lib/candid/types/primitive/ints/int32.ts index a976e32531..80c54b16a1 100644 --- a/src/lib/candid/types/primitive/ints/int32.ts +++ b/src/lib/candid/types/primitive/ints/int32.ts @@ -4,7 +4,7 @@ export class AzleInt32 { _kind: 'AzleInt32' = 'AzleInt32'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Int32; } } diff --git a/src/lib/candid/types/primitive/ints/int64.ts b/src/lib/candid/types/primitive/ints/int64.ts index 3a21733a28..925adda269 100644 --- a/src/lib/candid/types/primitive/ints/int64.ts +++ b/src/lib/candid/types/primitive/ints/int64.ts @@ -4,7 +4,7 @@ export class AzleInt64 { _kind: 'AzleInt64' = 'AzleInt64'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Int64; } } diff --git a/src/lib/candid/types/primitive/ints/int8.ts b/src/lib/candid/types/primitive/ints/int8.ts index cb9e46ecc0..2d54a2951e 100644 --- a/src/lib/candid/types/primitive/ints/int8.ts +++ b/src/lib/candid/types/primitive/ints/int8.ts @@ -4,7 +4,7 @@ export class AzleInt8 { _kind: 'AzleInt8' = 'AzleInt8'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Int8; } } diff --git a/src/lib/candid/types/primitive/nats/nat.ts b/src/lib/candid/types/primitive/nats/nat.ts index 0cc7a539c0..c4f68059fc 100644 --- a/src/lib/candid/types/primitive/nats/nat.ts +++ b/src/lib/candid/types/primitive/nats/nat.ts @@ -4,7 +4,7 @@ export class AzleNat { _kind: 'AzleNat' = 'AzleNat'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Nat; } } diff --git a/src/lib/candid/types/primitive/nats/nat16.ts b/src/lib/candid/types/primitive/nats/nat16.ts index fbcd5cb783..fac8214301 100644 --- a/src/lib/candid/types/primitive/nats/nat16.ts +++ b/src/lib/candid/types/primitive/nats/nat16.ts @@ -4,7 +4,7 @@ export class AzleNat16 { _kind: 'AzleNat16' = 'AzleNat16'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Nat16; } } diff --git a/src/lib/candid/types/primitive/nats/nat32.ts b/src/lib/candid/types/primitive/nats/nat32.ts index f82a8c1c18..e4233c50c4 100644 --- a/src/lib/candid/types/primitive/nats/nat32.ts +++ b/src/lib/candid/types/primitive/nats/nat32.ts @@ -4,7 +4,7 @@ export class AzleNat32 { _kind: 'AzleNat32' = 'AzleNat32'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Nat32; } } diff --git a/src/lib/candid/types/primitive/nats/nat64.ts b/src/lib/candid/types/primitive/nats/nat64.ts index 0911576b38..5675605ac5 100644 --- a/src/lib/candid/types/primitive/nats/nat64.ts +++ b/src/lib/candid/types/primitive/nats/nat64.ts @@ -4,7 +4,7 @@ export class AzleNat64 { _kind: 'AzleNat64' = 'AzleNat64'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Nat64; } } diff --git a/src/lib/candid/types/primitive/nats/nat8.ts b/src/lib/candid/types/primitive/nats/nat8.ts index 3aa9c8fecb..74bc3c0564 100644 --- a/src/lib/candid/types/primitive/nats/nat8.ts +++ b/src/lib/candid/types/primitive/nats/nat8.ts @@ -4,7 +4,7 @@ export class AzleNat8 { _kind: 'AzleNat8' = 'AzleNat8'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Nat8; } } diff --git a/src/lib/candid/types/primitive/null.ts b/src/lib/candid/types/primitive/null.ts index 06cef35d3a..5a4d690759 100644 --- a/src/lib/candid/types/primitive/null.ts +++ b/src/lib/candid/types/primitive/null.ts @@ -4,7 +4,7 @@ export class AzleNull { _kind: 'AzleNull' = 'AzleNull'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Null; } } diff --git a/src/lib/candid/types/primitive/reserved.ts b/src/lib/candid/types/primitive/reserved.ts index 2c371657af..88e10f65fc 100644 --- a/src/lib/candid/types/primitive/reserved.ts +++ b/src/lib/candid/types/primitive/reserved.ts @@ -4,7 +4,7 @@ export class AzleReserved { _kind: 'AzleReserved' = 'AzleReserved'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Reserved; } } diff --git a/src/lib/candid/types/primitive/text.ts b/src/lib/candid/types/primitive/text.ts index 5b21662cfe..e8af782ef3 100644 --- a/src/lib/candid/types/primitive/text.ts +++ b/src/lib/candid/types/primitive/text.ts @@ -4,7 +4,7 @@ export class AzleText { _kind: 'AzleText' = 'AzleText'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return IDL.Text; } } diff --git a/src/lib/candid/types/primitive/void.ts b/src/lib/candid/types/primitive/void.ts index 1bb3bca7e2..84de2348b1 100644 --- a/src/lib/candid/types/primitive/void.ts +++ b/src/lib/candid/types/primitive/void.ts @@ -2,7 +2,7 @@ export class AzleVoid { _kind: 'AzleVoid' = 'AzleVoid'; _azleCandidType?: '_azleCandidType'; - static getIDL() { + static getIdl() { return []; } } diff --git a/src/lib/candid/types/reference/func.ts b/src/lib/candid/types/reference/func.ts index 1a46cc0bdc..e5298f71c3 100644 --- a/src/lib/candid/types/reference/func.ts +++ b/src/lib/candid/types/reference/func.ts @@ -17,7 +17,7 @@ export function Func( mode: Mode ): [Principal, string] & { _azleCandidType?: '_azleCandidType' } { return { - getIDL(parents: Parent[]) { + getIdl(parents: Parent[]) { return IDL.Func( toParamIdls(paramCandidTypes, parents), toReturnIdl(returnCandidTypes, parents), diff --git a/src/lib/candid/types/reference/principal.ts b/src/lib/candid/types/reference/principal.ts index ec3156d6d0..f98637387f 100644 --- a/src/lib/candid/types/reference/principal.ts +++ b/src/lib/candid/types/reference/principal.ts @@ -4,7 +4,7 @@ import { Principal as DfinityPrincipal } from '@dfinity/principal'; export class Principal extends DfinityPrincipal { static _azleCandidType?: '_azleCandidType'; - static getIDL?() { + static getIdl?() { return IDL.Principal; } } diff --git a/src/lib/candid/types/reference/service/canister_function/index.ts b/src/lib/candid/types/reference/service/canister_function/index.ts index fbd3dac632..9fcde3bc0d 100644 --- a/src/lib/candid/types/reference/service/canister_function/index.ts +++ b/src/lib/candid/types/reference/service/canister_function/index.ts @@ -30,8 +30,8 @@ type _AzleFunctionReturnType = { queries?: any[]; updates?: any[]; callbacks?: any; - getSystemFunctionIDLs?: (parents: Parent[]) => IDL.FuncClass[]; - getIDL?: (parents: Parent[]) => IDL.Type; + getSystemFunctionIdls?: (parents: Parent[]) => IDL.FuncClass[]; + getIdl?: (parents: Parent[]) => IDL.Type; }; type CallRawFunction = typeof ic.callRaw | typeof ic.callRaw128; @@ -60,8 +60,8 @@ export function createCanisterFunction(canisterOptions: CanisterOptions) { canister.queries = createQueryMethods(canisterOptions); canister.updates = createUpdateMethods(canisterOptions); canister.callbacks = createCallbacks(canisterOptions); - canister.getIDL = createGetIdlFunction(canisterOptions); - canister.getSystemFunctionIDLs = + canister.getIdl = createGetIdlFunction(canisterOptions); + canister.getSystemFunctionIdls = createGetSystemFunctionIdlFunction(canisterOptions); return canister; diff --git a/src/lib/system_types/result.ts b/src/lib/system_types/result.ts index 2e6542157c..d8c860a66b 100644 --- a/src/lib/system_types/result.ts +++ b/src/lib/system_types/result.ts @@ -13,7 +13,7 @@ export class AzleResult { _azleCandidType?: '_azleCandidType'; - getIDL(parents: Parent[]) { + getIdl(parents: Parent[]) { return IDL.Variant({ Ok: toIdl(this._azleOk, parents), Err: toIdl(this._azleErr, parents)