fix: correct sBTC contract address and implement txid verification#2
Open
cedarxyz wants to merge 1 commit into
Open
fix: correct sBTC contract address and implement txid verification#2cedarxyz wants to merge 1 commit into
cedarxyz wants to merge 1 commit into
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/aibtc/airdrop402 response (SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-sbtc→SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token)verifySbtcPayment()helper that validates payment txid via Hiro API — checks tx success, correct sBTC contract call, recipient address, and sufficient amountAirdropJobin KV with job trackingChanges
src/index.ts: AddSBTC_CONTRACTandHIRO_APIconstants,verifySbtcPayment()helper, wire verification into POST/aibtc/airdrophandlerTest plan
POST /aibtc/airdropwithout txid → returns 402 with correctSM3VDXK3...sbtc-tokencontractPOST /aibtc/airdropwith invalid txid → returns 402 "Transaction not found"POST /aibtc/airdropwith valid sBTC txid to wrong recipient → returns 402 "Recipient mismatch"POST /aibtc/airdropwith valid sBTC txid, correct recipient, sufficient amount → returns 200 withstatus: "verified"andjobId🤖 Generated with Claude Code