clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Chainhooks requests

Open aulneau opened this issue 3 years ago • 1 comments

In playing with chainhooks so far, I have a few requests that would greatly improve the DX of working with them (imo):

Wildcard/debug mode

I'd love an ability to run clarinet test --chainhooksDebug where any events that would be able to be captured by a predicate option (contract-call, print event) etc be either dumped to a data file (json), or be emitted to an action endpoint. The rationale behind this request is it would help folks be able to write their chainhooks better by being informed by what kind of events will be generated when running their tests.

Default directory

It's likely the case that folks will have many chainhooks, having to manually pass in each like this:

clarinet test --chainhooks=chainhooks/unwrap-btc.chainhook.yaml --chainhooks=chainhooks/wrap-btc.chainhook.yaml --mine-block-delay=10

Is pretty brittle and cannot scale well (imagine having 50 chainhooks).

Instead, I think having the default behavior be set to scan chainhooks folder for any and all chainhooks, and in the case that a developer would want to use only one or some chainhooks, then they can pass them in manually to overwrite the default behavior.

Multiple predicates per contract

It might be the case that a single contract could produce many different events that someone would want to capture. It seems to be the case currently that you'd need separate .yaml/json POSTs for defining them. It'd be great if you could pass in multiple for a given chainhook.


Amazing work with this @lgalabru -- I cannot overstate how great this tool is becoming.

aulneau avatar Oct 10 '22 14:10 aulneau

Thanks @aulneau! I'll address your feedbacks #583.

lgalabru avatar Oct 12 '22 14:10 lgalabru

Shipped with v1.0.4

lgalabru avatar Oct 18 '22 14:10 lgalabru