Skip to content

feat: refinance example — Aave/Spark/Morpho across chains (G2) - #27

Merged
halaprix merged 2 commits into
mainfrom
feat/g2-refinance-example
Jul 23, 2026
Merged

feat: refinance example — Aave/Spark/Morpho across chains (G2)#27
halaprix merged 2 commits into
mainfrom
feat/g2-refinance-example

Conversation

@halaprix

Copy link
Copy Markdown
Owner

Summary

Implements spec G2, the 1.3.0 release-gate example proving the whole 1.x surface composes on real protocols (examples/refinance.ts, type-checked in CI against the built dist — the snippet checker now hard-fails if the example ever drops out of discovery):

  • Aave v3 + Spark getReserveData bulk via defineTask + human-readable ABI, rate fields extracted with t.derive from the faithfully-declared reserve struct.
  • The dynamic-target showcase: Morpho Blue's IRM borrow rate — step 1 reads idToMarketParams/market on Morpho, step 2 calls borrowRateView ON the IRM address that only exists once step 1 resolves (target: Ref<Address | undefined>).
  • Reserves + Morpho run in ONE runMultistepTasks call under Presets.throughput — the mixed-depth batching note from CLAUDE.md demonstrated deliberately (2 round-trips total, not 3).
  • Multichain variant: MultichainResolver + snapshot() + explicit per-chain blocks pinning (mainnet + optional RPC_URL_8453 Base per the env convention), with the snapshot-vs-pinBlock reasoning in comments.
  • main() runs only on direct execution with RPC_URL validated (import-safe); mocked-executor smoke tests cover task construction. On-chain literals that can't be verified without a live RPC are flagged inline (sandbox has no egress; live run available via RPC_URL=... node).

Test evidence

341/341 unit + smoke, compat-vs-dist 38/38, 26 snippets/examples type-checked against dist with the release-gate discovery assertion verified active (both failure branches manually triggered).

Spec: spec.md § 1.3.0 G2.

halaprix added 2 commits July 23, 2026 22:28
- scripts/check-snippets.ts: assert examples/refinance.ts is actually
  discovered by the snippet materializer (generic zero-files check plus a
  specific by-name check) so a missing/unreadable examples/ dir can never
  silently pass CI without type-checking the release-gate example.
- examples/refinance.ts: run main() only on direct execution (compare
  process.argv[1] against this module's own URL via fileURLToPath), not
  merely when RPC_URL happens to be set in the importing process; RPC_URL
  itself is still validated inside main() with a helpful error + exit(1).
@halaprix
halaprix merged commit 9634a0b into main Jul 23, 2026
2 checks passed
@halaprix
halaprix deleted the feat/g2-refinance-example branch July 23, 2026 20:41
halaprix added a commit that referenced this pull request Jul 23, 2026
* chore: release v1.3.0

- Version bump 1.2.0 → 1.3.0 in package.json and npm-lock
- CHANGELOG.md: [1.3.0] entry with facts verified against git log v1.2.0..HEAD (PRs #25, #26, #27):
  * Added: MultichainResolver, examples/refinance.ts
  * Changed: handlers reimplemented on defineTask (parity-gated, observable deltas documented)
  * Bundle size 15→18KB (current 16.8KB measured)
- README.md: updated bundle badge, added MultichainResolver to API table, added Multichain section with compiling example and refinance.ts pointer
- MIGRATION.md: appended v1.2.x → v1.3.0 section (additive, no consumer action required)
- SUMMARY.md: updated TOC with new sections
- docs/benchmarks.md: updated size figures (13.9 → 16.8 KB)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* docs: fix API accuracy — multichain, pinBlock, ethers

- README multichain example: replace task instance reuse with factory pattern (flattened duplicate validation throws before any execution)
- api-reference MultichainResolver.chain(): returns MulticallResolver (cached), throws on unknown chainId (not undefined)
- Remove fake per-chain onPin Record — onPin is single inherited callback from BatchOptions; each chain reports once
- Remove fake chainId < 1 validation rule — real rule: lowest-chainId rejection on concurrent failures
- docs/index.html: Fix ethers claim — "requires an adapter" (domino doesn't depend on ethers)
- pinBlock performance: Clarify +1 RPC only for absent/tag blocks; explicit blockNumber/blockHash add none
- CHANGELOG: Correct MultichainResolver description (blocks map, not per-chain onPin; deterministic rejection)
- Verify all snippets compile and bundle badge matches measured size

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: halaprix <halaprix@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
halaprix added a commit that referenced this pull request Jul 24, 2026
* feat: refinance example — Aave/Spark/Morpho across chains (G2)

* fix: guard release-gate example discovery + entry point (G2 review)

- scripts/check-snippets.ts: assert examples/refinance.ts is actually
  discovered by the snippet materializer (generic zero-files check plus a
  specific by-name check) so a missing/unreadable examples/ dir can never
  silently pass CI without type-checking the release-gate example.
- examples/refinance.ts: run main() only on direct execution (compare
  process.argv[1] against this module's own URL via fileURLToPath), not
  merely when RPC_URL happens to be set in the importing process; RPC_URL
  itself is still validated inside main() with a helpful error + exit(1).

---------

Co-authored-by: halaprix <halaprix@users.noreply.github.com>
halaprix added a commit that referenced this pull request Jul 24, 2026
* chore: release v1.3.0

- Version bump 1.2.0 → 1.3.0 in package.json and npm-lock
- CHANGELOG.md: [1.3.0] entry with facts verified against git log v1.2.0..HEAD (PRs #25, #26, #27):
  * Added: MultichainResolver, examples/refinance.ts
  * Changed: handlers reimplemented on defineTask (parity-gated, observable deltas documented)
  * Bundle size 15→18KB (current 16.8KB measured)
- README.md: updated bundle badge, added MultichainResolver to API table, added Multichain section with compiling example and refinance.ts pointer
- MIGRATION.md: appended v1.2.x → v1.3.0 section (additive, no consumer action required)
- SUMMARY.md: updated TOC with new sections
- docs/benchmarks.md: updated size figures (13.9 → 16.8 KB)


* docs: fix API accuracy — multichain, pinBlock, ethers

- README multichain example: replace task instance reuse with factory pattern (flattened duplicate validation throws before any execution)
- api-reference MultichainResolver.chain(): returns MulticallResolver (cached), throws on unknown chainId (not undefined)
- Remove fake per-chain onPin Record — onPin is single inherited callback from BatchOptions; each chain reports once
- Remove fake chainId < 1 validation rule — real rule: lowest-chainId rejection on concurrent failures
- docs/index.html: Fix ethers claim — "requires an adapter" (domino doesn't depend on ethers)
- pinBlock performance: Clarify +1 RPC only for absent/tag blocks; explicit blockNumber/blockHash add none
- CHANGELOG: Correct MultichainResolver description (blocks map, not per-chain onPin; deterministic rejection)
- Verify all snippets compile and bundle badge matches measured size


---------

Co-authored-by: halaprix <halaprix@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
halaprix added a commit that referenced this pull request Jul 24, 2026
* feat: refinance example — Aave/Spark/Morpho across chains (G2)

* fix: guard release-gate example discovery + entry point (G2 review)

- scripts/check-snippets.ts: assert examples/refinance.ts is actually
  discovered by the snippet materializer (generic zero-files check plus a
  specific by-name check) so a missing/unreadable examples/ dir can never
  silently pass CI without type-checking the release-gate example.
- examples/refinance.ts: run main() only on direct execution (compare
  process.argv[1] against this module's own URL via fileURLToPath), not
  merely when RPC_URL happens to be set in the importing process; RPC_URL
  itself is still validated inside main() with a helpful error + exit(1).

---------

Co-authored-by: halaprix <halaprix@users.noreply.github.com>
halaprix added a commit that referenced this pull request Jul 24, 2026
* chore: release v1.3.0

- Version bump 1.2.0 → 1.3.0 in package.json and npm-lock
- CHANGELOG.md: [1.3.0] entry with facts verified against git log v1.2.0..HEAD (PRs #25, #26, #27):
  * Added: MultichainResolver, examples/refinance.ts
  * Changed: handlers reimplemented on defineTask (parity-gated, observable deltas documented)
  * Bundle size 15→18KB (current 16.8KB measured)
- README.md: updated bundle badge, added MultichainResolver to API table, added Multichain section with compiling example and refinance.ts pointer
- MIGRATION.md: appended v1.2.x → v1.3.0 section (additive, no consumer action required)
- SUMMARY.md: updated TOC with new sections
- docs/benchmarks.md: updated size figures (13.9 → 16.8 KB)


* docs: fix API accuracy — multichain, pinBlock, ethers

- README multichain example: replace task instance reuse with factory pattern (flattened duplicate validation throws before any execution)
- api-reference MultichainResolver.chain(): returns MulticallResolver (cached), throws on unknown chainId (not undefined)
- Remove fake per-chain onPin Record — onPin is single inherited callback from BatchOptions; each chain reports once
- Remove fake chainId < 1 validation rule — real rule: lowest-chainId rejection on concurrent failures
- docs/index.html: Fix ethers claim — "requires an adapter" (domino doesn't depend on ethers)
- pinBlock performance: Clarify +1 RPC only for absent/tag blocks; explicit blockNumber/blockHash add none
- CHANGELOG: Correct MultichainResolver description (blocks map, not per-chain onPin; deterministic rejection)
- Verify all snippets compile and bundle badge matches measured size


---------

Co-authored-by: halaprix <halaprix@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant