Skip to content

fix: correct sBTC contract address and implement txid verification#2

Open
cedarxyz wants to merge 1 commit into
pbtc21:masterfrom
cedarxyz:fix/sbtc-contract-and-verification
Open

fix: correct sBTC contract address and implement txid verification#2
cedarxyz wants to merge 1 commit into
pbtc21:masterfrom
cedarxyz:fix/sbtc-contract-and-verification

Conversation

@cedarxyz
Copy link
Copy Markdown

Summary

  • Fix wrong sBTC contract address in /aibtc/airdrop 402 response (SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-sbtcSM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token)
  • Add verifySbtcPayment() helper that validates payment txid via Hiro API — checks tx success, correct sBTC contract call, recipient address, and sufficient amount
  • Replace the TODO stub with full verification flow: on valid payment, creates an AirdropJob in KV with job tracking

Changes

  • src/index.ts: Add SBTC_CONTRACT and HIRO_API constants, verifySbtcPayment() helper, wire verification into POST /aibtc/airdrop handler

Test plan

  • POST /aibtc/airdrop without txid → returns 402 with correct SM3VDXK3...sbtc-token contract
  • POST /aibtc/airdrop with invalid txid → returns 402 "Transaction not found"
  • POST /aibtc/airdrop with valid sBTC txid to wrong recipient → returns 402 "Recipient mismatch"
  • POST /aibtc/airdrop with valid sBTC txid, correct recipient, sufficient amount → returns 200 with status: "verified" and jobId

🤖 Generated with Claude Code

- Fix wrong sBTC contract on /aibtc/airdrop 402 response
  (SP3K8BC0P...token-sbtc → SM3VDXK3...sbtc-token)
- Add verifySbtcPayment() helper that validates txid via Hiro API:
  confirms tx success, correct contract, recipient, and amount
- Replace TODO stub with full verification flow that creates
  an AirdropJob in KV on successful payment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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