From 41be677aab84b9fe9c3a757816858eba8a0faa67 Mon Sep 17 00:00:00 2001 From: Neil Campbell Date: Mon, 9 Dec 2024 21:03:41 +0800 Subject: [PATCH] fix: correct the state types (#139) --- examples/lifecycle/client.ts | 1 + examples/reti/client.ts | 1 + examples/state/client.ts | 2 ++ examples/voting/client.ts | 1 + src/client/app-types.ts | 6 +++++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/lifecycle/client.ts b/examples/lifecycle/client.ts index ba41ab0..9bfd5e7 100644 --- a/examples/lifecycle/client.ts +++ b/examples/lifecycle/client.ts @@ -147,6 +147,7 @@ export type LifeCycleAppTypes = { greeting: BinaryState times: bigint } + maps: {} } } } diff --git a/examples/reti/client.ts b/examples/reti/client.ts index 0471bb0..0eed101 100644 --- a/examples/reti/client.ts +++ b/examples/reti/client.ts @@ -789,6 +789,7 @@ export type ValidatorRegistryTypes = { numStakers: bigint totalAlgoStaked: bigint } + maps: {} } box: { keys: { diff --git a/examples/state/client.ts b/examples/state/client.ts index 92fad71..84e773f 100644 --- a/examples/state/client.ts +++ b/examples/state/client.ts @@ -311,6 +311,7 @@ export type StateAppTypes = { int2: bigint value: bigint } + maps: {} } local: { keys: { @@ -319,6 +320,7 @@ export type StateAppTypes = { localInt1: bigint localInt2: bigint } + maps: {} } } } diff --git a/examples/voting/client.ts b/examples/voting/client.ts index a2c96a7..5833f1c 100644 --- a/examples/voting/client.ts +++ b/examples/voting/client.ts @@ -232,6 +232,7 @@ export type VotingRoundAppTypes = { */ voterCount: bigint } + maps: {} } } } diff --git a/src/client/app-types.ts b/src/client/app-types.ts index ee5e3e2..7f98fcf 100644 --- a/src/client/app-types.ts +++ b/src/client/app-types.ts @@ -271,6 +271,8 @@ function* keysAndMaps( yield `${keySafe}: ${prop.valueType === 'AVMBytes' ? 'BinaryState' : getEquivalentType(prop.valueType, 'output', { app, sanitizer })}` } yield DecIndentAndCloseBlock + } else { + yield 'keys: {}' } if (maps && Object.keys(maps).length) { @@ -286,6 +288,8 @@ function* keysAndMaps( yield `${keySafe}: Map<${getEquivalentType(prop.keyType, 'input', { app, sanitizer })}, ${getEquivalentType(prop.valueType, 'output', { app, sanitizer })}>` } yield DecIndentAndCloseBlock + } else { + yield 'maps: {}' } } @@ -295,7 +299,7 @@ function* appState( ): DocumentParts { const { hasBox, hasGlobal, hasLocal } = stateFlags - if (hasLocal || hasGlobal) { + if (hasLocal || hasGlobal || hasBox) { yield* jsDoc('Defines the shape of the state of the application.') yield 'state: {' yield IncIndent