Skip to content

Add opt-in Nishvault pre-send receipt before XMTP 402 payment broadcast - #15

Open
cakirasim wants to merge 1 commit into
Metavibez4L:mainfrom
cakirasim:codex/nishvault-pre-send-guard
Open

Add opt-in Nishvault pre-send receipt before XMTP 402 payment broadcast#15
cakirasim wants to merge 1 commit into
Metavibez4L:mainfrom
cakirasim:codex/nishvault-pre-send-guard

Conversation

@cakirasim

Copy link
Copy Markdown

This adds an opt-in guard immediately before the existing USDC transfer broadcast in src/chain/xmtp402.ts.

When NISHVAULT_PRE_SEND_GUARD=1 is set, the payment flow becomes:

402 payment details -> build USDC transfer calldata -> PRE_SEND_PROOF_RECEIPT -> sendTransaction

Default behavior is unchanged because the guard is disabled unless the env var is set.

Configuration:

NISHVAULT_PRE_SEND_GUARD=1
NISHVAULT_SELLER_URL=https://api.nishvault.com
X402_BUYER_PRIVATE_KEY=0x...

Why this fits this repo:

  • This repo already targets Base mainnet.
  • xmtp402.ts already has the exact broadcast slot.
  • The patch does not add a runtime dependency; it calls npx --package nishvault-preflight-buy nishvault-guard-tx only when explicitly enabled.
  • The guard fails closed on non-Base-mainnet chain IDs.

Validation:

npm ci --ignore-scripts
npm run typecheck

Note: the full repo typecheck currently fails on existing unrelated missing modules/config typing errors. A targeted tsc invocation for src/chain/xmtp402.ts reaches only existing src/config.ts strictness errors and does not report errors from the Nishvault patch.

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