feat: implement claim creation transaction hook - #299
Open
MuhammadDG wants to merge 8 commits into
Open
Conversation
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.
Overview
This PR implements the canonical Claim Creation Transaction Hook for TruthBounty's Optimism/EVM runtime. It encodes the claim creation call with content digest, bounty asset/amount, and frozen configuration expectations; integrates allowance, simulation, submission, confirmation, and indexed-claim reconciliation; and returns typed protocol errors without fabricating a claim record. The implementation builds on the frozen V2-FE-005/009/010, V2-SC-006, and V2-BE-024 interfaces and includes an audit of overlapping current code identifying reused, replaced, and deleted paths.
Related Issue
Closes V2-FE-011
Changes
🔐 Canonical Claim Encoding
[MODIFY]
src/lib/contracts/index.tsencodeClaimCreationCall(contentDigest, bountyAsset, bountyAmount, frozenConfig)returning exact-integer calldata.[MODIFY]
src/app/types/claim.ts⚙️ Transaction Machine
[MODIFY]
src/lib/transaction-machine/transaction-machine.types.tsidle,allowance-check,allowance-approval,simulation,submission,confirmation,reconciliation, and typed terminal errors (WrongNetwork,Rejected,Reverted,Stale,Unauthorized,InvalidContent).[MODIFY]
src/lib/transaction-machine/transaction-machine.ts[MODIFY]
src/lib/transaction-machine/index.ts🧩 Hook and UI Integration
[ADD]
src/hooks/useClaimCreationTransaction.tscreateClaim, current state, typed protocol errors, and safe retry/reload behavior.[MODIFY]
src/components/features/claim-submission/ClaimSubmissionForm.tsx[ADD]
src/hooks/useStateReconciliation.ts🧪 Tests
♻️ Reused / Replaced / Deleted Paths
src/lib/transaction-machineinfrastructure andsrc/lib/contractsregistry pattern.ClaimSubmissionForm.tsx, Stellar account logic, and hardcoded integration assumptions.Verification Results
encodeClaimCreationCallencodes digest + asset/amount + frozen config; unit-testedCloses #246