From fd555e04cc6a1cabafa563544166a82d0d3444f6 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 6 Dec 2023 15:20:12 -0600 Subject: [PATCH] fix missing Principal import in Func, RequireExactlyOne import in Variant, tsType for AzleBlob --- .../candid/constructed/variant_arb/definition_arbs.ts | 2 +- .../arbitraries/candid/reference/func_arb/definition_arb.ts | 3 ++- src/lib/candid/types/constructed/blob.ts | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts b/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts index 86aa63fbfa..ab2ac8a16a 100644 --- a/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts +++ b/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts @@ -67,7 +67,7 @@ function generateImports(fields: Field[]): Set { const fieldImports = fields.flatMap((field) => [ ...field[1].candidMeta.imports ]); - return new Set([...fieldImports, 'Variant']); + return new Set([...fieldImports, 'RequireExactlyOne', 'Variant']); } function generateVariableAliasDeclarations( diff --git a/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts b/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts index ef90b1b7df..d219bc8558 100644 --- a/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts @@ -57,7 +57,8 @@ export function FuncDefinitionArb( const imports = new Set([ ...params.flatMap((param) => [...param.candidMeta.imports]), ...returnFunc.candidMeta.imports, - 'Func' + 'Func', + 'Principal' ]); return { diff --git a/src/lib/candid/types/constructed/blob.ts b/src/lib/candid/types/constructed/blob.ts index 0f23db9b97..6a48ecfd50 100644 --- a/src/lib/candid/types/constructed/blob.ts +++ b/src/lib/candid/types/constructed/blob.ts @@ -6,6 +6,8 @@ export class AzleBlob { _azleKind: 'AzleBlob' = 'AzleBlob'; static _azleKind: 'AzleBlob' = 'AzleBlob'; + static tsType: AzleBlob; + static toBytes(data: any) { return encode(this, data); }