diff --git a/packages/plugins/packages/payloadset/packages/image-thumbnail/packages/diviner/src/Diviner/Diviner.ts b/packages/plugins/packages/payloadset/packages/image-thumbnail/packages/diviner/src/Diviner/Diviner.ts index 679770abc5d..99d71baa89b 100644 --- a/packages/plugins/packages/payloadset/packages/image-thumbnail/packages/diviner/src/Diviner/Diviner.ts +++ b/packages/plugins/packages/payloadset/packages/image-thumbnail/packages/diviner/src/Diviner/Diviner.ts @@ -157,13 +157,10 @@ export class ImageThumbnailDiviner { - const payload = new PayloadBuilder>({ schema: ModuleStateSchema }).fields({ state }).build() - const [bw] = await new BoundWitnessBuilder().payloads([payload]).witness(this.account).build() - await archivist.insert([bw, payload]) - }) + const archivist = await this.getArchivistForStore('stateStore') + const payload = new PayloadBuilder>({ schema: ModuleStateSchema }).fields({ state }).build() + const [bw] = await new BoundWitnessBuilder().payloads([payload]).witness(this.account).build() + await archivist.insert([bw, payload]) } protected override async divineHandler(payloads: Payload[] = []): Promise { @@ -246,17 +243,11 @@ export class ImageThumbnailDiviner { - const payloads = await archivist.get([hash]) - if (payloads.length > 0) { - const payload = payloads[0] - if (isModuleState(payload)) { - return payload.state as ImageThumbnailDivinerState - } - } - }) + const archivist = await this.getArchivistForStore('stateStore') + const payload = (await archivist.get([hash])).find(isModuleState) + if (payload) { + return payload.state as ImageThumbnailDivinerState + } } return undefined }