Skip to content

feat: add escrow withdrawal support - #186

Draft
tnunamak wants to merge 4 commits into
mainfrom
tim/escrow-withdraw-sdk-0811
Draft

feat: add escrow withdrawal support#186
tnunamak wants to merge 4 commits into
mainfrom
tim/escrow-withdraw-sdk-0811

Conversation

@tnunamak

@tnunamak tnunamak commented Aug 11, 2026

Copy link
Copy Markdown
Member

Adds SDK support for escrow withdrawals through the Data Gateway. The API follows the same signed authorization and lifecycle model as the withdrawal implementation in data-gateway#67, which is stacked on data-gateway#36.

What changes

  • Adds EIP-712 helpers for WithdrawAuthorization messages containing account, asset, amount, withdrawNonce, and deadline.
  • Adds EscrowGatewayClient.withdraw and typed submitted, confirmed, retryable, reorged, and failed results.
  • Preserves txHash: null for authorizations persisted before broadcast.
  • Retains lifecycle response data in EscrowWithdrawalLifecycleError.
  • Uses one canonical escrow balance shape, including withdrawingAmount and availableAmount.
  • Preserves compatibility for clients that inject only the existing payment method.

Validation

  • TypeScript passed across the workspace.
  • SDK build and package entry-point validation passed for Node ESM, Node CJS, and browser ESM.
  • SDK coverage passed: 62 test files, 854 tests.
  • Focused withdrawal and payment tests, lint, formatting, and package-import probes passed.

Before release

  • Land the matching Data Gateway withdrawal changes.
  • Run the opt-in live-chain withdrawal test against the deployed gateway and escrow contract.

Assisted-by: AI

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
vana-console Ignored Ignored Aug 12, 2026 6:42pm
vana-rbac-auditor Ignored Ignored Aug 12, 2026 6:42pm
vana-vibes-demo Ignored Ignored Aug 12, 2026 6:42pm

Request Review

@github-actions

Copy link
Copy Markdown
  • P2 – Runtime type guard is unsound (escrow.ts): isEscrowWithdrawalFailureResult accepts arbitrary strings for addresses/txHash and does not validate blockNumber. It then exposes the body as a strongly typed lifecycle result. Validate hex/address fields and optional blockNumber, or loosen the public types to match what is actually checked.

Focused tests could not run because dependencies are not installed (vitest: not found).

@github-actions

Copy link
Copy Markdown
  • Medium — escrow.ts:643: validation remains incomplete. amount, withdrawNonce, deadline, and blockNumber accept arbitrary strings such as "invalid" or "-1", despite representing decimal uint256 values. Validate with a digits-only check plus uint256 bounds before creating a typed lifecycle error.

Tests couldn’t run because pnpm is unavailable.

@github-actions

Copy link
Copy Markdown

No actionable issues found.

Non-blocking: add tests for exact uint256 max and max + 1; the current oversized deadline only exercises the 78-character length guard. Tests couldn’t run locally because dependencies are not installed (vitest: not found).

@github-actions

Copy link
Copy Markdown

No issues found in the incremental change. The tests correctly cover inclusive uint256 maximum acceptance and overflow rejection for all three withdrawal numeric fields.

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