Page MenuHomePhabricator

[Chronik] Plugins: Add `Tx`, `TokenTxEntry` and other tx related objects
ClosedPublic

Authored by tobias_ruck on Jan 12 2024, 19:53.

Details

Summary

This allows plugins to access all the data available to us in Chronik so they can later attach output data.

We wrap non-primitive types in Py wrappers, which allow plugins to access the data on the Python heap without having to build new object on every access.

See spec: https://ecashbuilders.notion.site/Chronik-Python-Plugin-Spec-9956b524cef54495b8fab3bf6e354151

Currently, this omits PluginData, which will be added in a later diff.

Test Plan

cargo test -p chronik-plugin

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

redesign, now based on NamedTuples in tx.py and token.py

Failed tests logs:

====== /blockchain-info: "before each" hook for "gives us the blockchain info after unparking the last block"./blockchain-info "before each" hook for "gives us the blockchain info after unparking the last block" ======
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/work/modules/chronik-client/test/integration/blockchain_info.ts)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

Each failure log is accessible here:
/blockchain-info: "before each" hook for "gives us the blockchain info after unparking the last block"./blockchain-info "before each" hook for "gives us the blockchain info after unparking the last block"

tobias_ruck edited the summary of this revision. (Show Details)
Fabien added inline comments.
chronik/chronik-plugin/src/token.py
83 ↗(On Diff #44276)
This revision is now accepted and ready to land.Jan 18 2024, 09:56