Skip to content

Commit

Permalink
fix(entity): add aptos global processor (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedragon authored Dec 4, 2024
1 parent 859b10f commit 3a76653
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 20 additions & 0 deletions packages/sdk/src/aptos/aptos-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,26 @@ export class AptosModulesProcessor extends AptosBaseProcessor {
}
}

export class AptosGlobalProcessor {
private baseProcessor
private constructor(options: AptosBindOptions) {
this.baseProcessor = new AptosBaseProcessor('*', options)
}

static bind(options: AptosBindOptions): AptosGlobalProcessor {
return new AptosGlobalProcessor(options)
}

public onTransaction(
handler: (transaction: UserTransactionResponse, ctx: AptosContext) => PromiseOrVoid,
includedFailed = false,
fetchConfig?: Partial<MoveFetchConfig>
): this {
this.baseProcessor.onTransaction(handler, includedFailed, fetchConfig)
return this
}
}

export class AptosResourceProcessorState extends ListStateStorage<AptosResourcesProcessor> {
static INSTANCE = new AptosResourceProcessorState()
}
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk/src/aptos/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export type { TypedEventInstance, TypedFunctionPayload, TypedMoveResource } from './models.js'
export { AptosBaseProcessor, AptosResourcesProcessor, AptosModulesProcessor } from './aptos-processor.js'
export {
AptosBaseProcessor,
AptosResourcesProcessor,
AptosModulesProcessor,
AptosGlobalProcessor
} from './aptos-processor.js'
export { AptosResourceProcessorTemplate } from './aptos-resource-processor-template.js'
export { AptosContext, AptosResourcesContext } from './context.js'
export { AptosBindOptions, AptosNetwork } from './network.js'
Expand Down

0 comments on commit 3a76653

Please sign in to comment.