-
Notifications
You must be signed in to change notification settings - Fork 0
Add operation hook #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| const manifestHash = this.config.contracts.manifests[contractName] | ||
| if (manifestHash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hook will only run on the latest version of the contract, is that intentional?
| throw new Error('Inside OP_ATOMIC: no matching signing key was defined') | ||
| } | ||
| await (opFns[u[0]] as (x: unknown) => Promise<void>)(u[1]) | ||
| sbp('chelonia/private/operationHook', contractID, contractName, message, state, i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that should also be done for config.preOp and config.postOp? I mean, should this be something like this? (ignore the broken processOp part, which would need to be adjusted)
if (config[`preOp_${opT}`]) {
processOp = config[`preOp_${opT}`]!(message, state, i) !== false && processOp
}
if (processOp) {
await (opFns[u[0]] as (x: unknown) => Promise<void>)(u[1])
sbp('chelonia/private/operationHook', contractID, contractName, message, state, i)
config.postOp?.(message, state, i)
config[`postOp_${opT}`]?.(message, state, i) // hack to fix syntax highlighting `
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean to ask whether we should also call postOp/preOp here inside of the OP_ATOMIC, no, I think that's excessive.
Relates to okTurtles/group-income#2988