Skip to content

Commit

Permalink
Build with payload builder
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Oct 11, 2023
1 parent d4c36ef commit 05462da
Showing 1 changed file with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ export class ImageThumbnailDiviner<TParams extends ImageThumbnailDivinerParams =
const { offset } = lastState
// Get next batch of results
const boundWitnessDiviner = await this.getBoundWitnessDivinerForStore('thumbnailStore')
const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema }).fields({
limit: this.payloadDivinerLimit,
offset,
order: 'asc',
payload_schemas: [ImageThumbnailSchema, TimestampSchema],
})
const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })
.fields({
limit: this.payloadDivinerLimit,
offset,
order: 'asc',
payload_schemas: [ImageThumbnailSchema, TimestampSchema],
})
.build()
const batch = await boundWitnessDiviner.divine([query])
if (batch.length === 0) return
// Find all the indexable hashes in this batch
Expand Down Expand Up @@ -216,13 +218,15 @@ export class ImageThumbnailDiviner<TParams extends ImageThumbnailDivinerParams =
protected async retrieveState(): Promise<ImageThumbnailDivinerState | undefined> {
let hash: string = ''
const diviner = await this.getBoundWitnessDivinerForStore('stateStore')
const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema }).fields({
address: this.account.address,
limit: 1,
offset: 0,
order: 'desc',
payload_schemas: [ModuleStateSchema],
})
const query = new PayloadBuilder<BoundWitnessDivinerQueryPayload>({ schema: BoundWitnessDivinerQuerySchema })
.fields({
address: this.account.address,
limit: 1,
offset: 0,
order: 'desc',
payload_schemas: [ModuleStateSchema],
})
.build()
const boundWitnesses = await diviner.divine([query])
if (boundWitnesses.length > 0) {
const boundWitness = boundWitnesses[0]
Expand Down

0 comments on commit 05462da

Please sign in to comment.