Skip to content

Add missing subpath exports, delete dead horizon.ts, and add the RPC/hook regression tests (#100, #104, #107, #110) - #201

Merged
meshackyaro merged 11 commits into
trustflow-protocol:mainfrom
Jaydbrown:fix/exports-rpc-hook-dead-code-100-110
Aug 31, 2026
Merged

Add missing subpath exports, delete dead horizon.ts, and add the RPC/hook regression tests (#100, #104, #107, #110)#201
meshackyaro merged 11 commits into
trustflow-protocol:mainfrom
Jaydbrown:fix/exports-rpc-hook-dead-code-100-110

Conversation

@Jaydbrown

Copy link
Copy Markdown
Contributor

Four SDK issues — a packaging bug, two type-check bugs (already fixed on main by #148, so this adds the regression tests their acceptance criteria require), and a dead-code removal.

#100 — missing ./escrow subpath export (packaging bug)

The README Quick Start does import { createEscrow } from '@trustflow/sdk/escrow' (and /wallet, /utils), but package.json's exports only declared . and ./react, so those imports fail with ERR_PACKAGE_PATH_NOT_EXPORTED for anyone installing the published package.

  • tsup.config.ts builds src/escrow/index.ts, src/wallet/index.ts, src/utils/index.ts as their own targets → dist/escrow/index.* etc.
  • package.json exports gains ./escrow, ./wallet, ./utils with matching types / import / require.
  • tests/exports-resolution.test.ts — a CI step (per the AC) that pulls every @trustflow/sdk/* specifier out of README.md and asserts each resolves against the exports map, every condition points at a ./dist/… path, and each non-root subpath is a tsup entry.

#104SorobanRpc import (already fixed on main, test added)

src/contract/{invoke,read,simulate}.ts already import rpc (not the nonexistent SorobanRpc) and use new rpc.Server(...). What was missing is the AC's "regression test would fail if this import broke again": tests/contract-rpc-smoke.test.ts constructs rpc.Server through src/contract/index.ts's dependency graph and asserts the old SorobanRpc name stays gone.

#107useEscrow import of createEscrow/releaseEscrow

src/escrow/index.ts now re-exports both free functions (from create.ts / release.ts), and both take client: TrustFlowClient and go through invokeContract — so useEscrow type-checks against the real API, not a phantom one. This PR:

  • exports useEscrow from src/hooks/index.ts (it still ships only from the @trustflow/sdk/react subpath, per Export React hooks from package entrypoint and declare react as a peerDependency #81) and replaces the now-inaccurate "these imports don't exist" comment;
  • adds tests/use-escrow.test.ts — React stubbed for Jest node, covering create/release success (resolves, stores, clears error) and failure (surfaces message, rethrows).

#110 — dead duplicate submitTransaction

src/stellar/horizon.ts exported a second submitTransaction(client, xdr) that nothing imports (not on the src/stellar barrel, no call sites — MultiSigEscrowClient.submitWhenReady uses the (xdr, horizonUrl) version in src/stellar/transaction.ts). Deleted. tests/stellar-single-submit.test.ts fails if a second implementation reappears or horizon.ts comes back.


Not built or run in this environment. src changes are limited to tsup.config.ts, package.json, src/hooks/index.ts, and deleting src/stellar/horizon.ts; the rest are new test files and docs. CHANGELOG [Unreleased] updated (no version bump, so tests/version.test.ts is unaffected).

Closes #100, closes #104, closes #107, closes #110

The README Quick Start imports from `@trustflow/sdk/escrow`, `/wallet`, and
`/utils`, but only `src/index.ts` and `src/hooks/index.ts` were built. Add
the three barrels as their own build targets.

Refs trustflow-protocol#100
…rts map

Node package-exports resolution makes any subpath not listed unresolvable,
so `import { createEscrow } from '@trustflow/sdk/escrow'` failed with
`ERR_PACKAGE_PATH_NOT_EXPORTED` for consumers of the published package.
Each subpath gets matching `types` / `import` / `require` conditions.

Closes trustflow-protocol#100
…xports map

Static check: extracts every `@trustflow/sdk/*` specifier from README.md,
asserts each is an `exports` key, that every condition points at a dist
path, and that each non-root subpath is a tsup entry.

Refs trustflow-protocol#100
…izon.ts

`src/stellar/horizon.ts` exported a second `submitTransaction(client, xdr)`
that nothing imports — not on the `src/stellar` barrel, no call sites. The
used implementation is `(xdr, horizonUrl)` in `src/stellar/transaction.ts`
(called by `MultiSigEscrowClient.submitWhenReady`). Remove the orphan so a
future contributor can't extend the wrong one.

Closes trustflow-protocol#110
Fails if a second `export async function submitTransaction` reappears
anywhere in `src/stellar`, or if `horizon.ts` comes back.

Refs trustflow-protocol#110
`src/contract/{invoke,read,simulate}.ts` use `rpc` (not the `SorobanRpc`
that does not exist in `@stellar/stellar-sdk@15`). This constructs
`rpc.Server` via `src/contract/index.ts` and asserts the old name stays
gone, so a future SDK bump breaking the import is caught at once.

Closes trustflow-protocol#104
…note

`useEscrow` imports `createEscrow` / `releaseEscrow` from '../escrow' — both
are re-exported there (from `create.ts` / `release.ts`), both take a
`client: TrustFlowClient`, and both go through `invokeContract`, so the hook
type-checks. The comment claiming the imports do not exist is now wrong.
It ships from the `@trustflow/sdk/react` subpath, like the other hooks.

Refs trustflow-protocol#107
React is stubbed (cell-array `useState`, identity `useCallback`) so the hook
runs under Jest node. Covers: create resolves and stores the escrow,
create rejects and surfaces the message, and the same for release.

Closes trustflow-protocol#107
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Jaydbrown Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@meshackyaro
meshackyaro merged commit 582b06c into trustflow-protocol:main Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants