Skip to content

Commit 41be677

Browse files
authored
fix: correct the state types (#139)
1 parent c275a21 commit 41be677

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

examples/lifecycle/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export type LifeCycleAppTypes = {
147147
greeting: BinaryState
148148
times: bigint
149149
}
150+
maps: {}
150151
}
151152
}
152153
}

examples/reti/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,7 @@ export type ValidatorRegistryTypes = {
789789
numStakers: bigint
790790
totalAlgoStaked: bigint
791791
}
792+
maps: {}
792793
}
793794
box: {
794795
keys: {

examples/state/client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ export type StateAppTypes = {
311311
int2: bigint
312312
value: bigint
313313
}
314+
maps: {}
314315
}
315316
local: {
316317
keys: {
@@ -319,6 +320,7 @@ export type StateAppTypes = {
319320
localInt1: bigint
320321
localInt2: bigint
321322
}
323+
maps: {}
322324
}
323325
}
324326
}

examples/voting/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ export type VotingRoundAppTypes = {
232232
*/
233233
voterCount: bigint
234234
}
235+
maps: {}
235236
}
236237
}
237238
}

src/client/app-types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ function* keysAndMaps(
271271
yield `${keySafe}: ${prop.valueType === 'AVMBytes' ? 'BinaryState' : getEquivalentType(prop.valueType, 'output', { app, sanitizer })}`
272272
}
273273
yield DecIndentAndCloseBlock
274+
} else {
275+
yield 'keys: {}'
274276
}
275277

276278
if (maps && Object.keys(maps).length) {
@@ -286,6 +288,8 @@ function* keysAndMaps(
286288
yield `${keySafe}: Map<${getEquivalentType(prop.keyType, 'input', { app, sanitizer })}, ${getEquivalentType(prop.valueType, 'output', { app, sanitizer })}>`
287289
}
288290
yield DecIndentAndCloseBlock
291+
} else {
292+
yield 'maps: {}'
289293
}
290294
}
291295

@@ -295,7 +299,7 @@ function* appState(
295299
): DocumentParts {
296300
const { hasBox, hasGlobal, hasLocal } = stateFlags
297301

298-
if (hasLocal || hasGlobal) {
302+
if (hasLocal || hasGlobal || hasBox) {
299303
yield* jsDoc('Defines the shape of the state of the application.')
300304
yield 'state: {'
301305
yield IncIndent

0 commit comments

Comments
 (0)