Repository navigation
feat: integrate @genlayer/transaction-kit fee approval flow - #63
Conversation
Replace the hand-rolled fee preset estimation and approval UI with the GenLayerTransactionPanel from @genlayer/transaction-kit-react for both contract writes (create_bet, resolve_bet). The panel handles the full flow: estimate -> fee receipt review -> hold-to-sign -> timeline -> outcome. - add useTransactionKit hook wiring createTransactionKit to the existing studionet chain config and MetaMask EIP-1193 provider - swap CreateBetModal fee preset grid + mutation for a review step hosting the panel; swap BetsTable confirm() flow for a panel dialog - drop lib/genlayer/fees.ts and the write/estimate methods from FootballBets (reads stay); replace write mutations with a useInvalidateBetsData helper - add vitest + RTL setup and panel tests backed by createMockKit - deps installed as github branch refs (#pkg/core, #pkg/react) until the npm rc is published
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- frontend/fee-profile.json: committed developer fee profile (decimal
strings, measured shape produced by 'gltest --fee-profile'); seeded with
plausible deploy/create_bet/resolve_bet values
- useTransactionKit passes it verbatim as 'suggestions' to
createTransactionKit; the panel then quotes with PolicyQuote.source
'developer' and renders the measured-profile source line
- npm run test:fees regenerates the profile via gltest over
tests/integration (requires a running Studio; not wired into CI)
- package-lock: re-resolved the kit git deps to pick up the force-refreshed
pkg/core and pkg/react branches with the suggestions API
- vitest: assert both source lines (network defaults vs developer profile
via createMockKit({ suggestions: true }))
|
Added the developer fee-suggestions flow on top of the panel integration:
Frontend verification: |



What
Integrates the new
@genlayer/transaction-kitas the showcase fee-approval flow for the boilerplate frontend, replacing the ad-hoc fee integration from the v0.6 sweep.Replaced
lib/genlayer/fees.ts(manual low/standard/high preset estimation viaestimateTransactionFees+ simulation) — deletedCreateBetModal— replaced by the panel's built-in preset selector + fee receiptconfirm()popup + fire-and-forget mutation forresolve_betinBetsTable— replaced by a dialog hosting the panelcreateBet/resolveBetwrite methods (estimate ->writeContract({fees})->waitForTransactionReceipt) inFootballBets— the kit now owns estimate/submit/track; the class keeps reads onlyuseCreateBet/useResolveBetmutations — replaced by auseInvalidateBetsData()helper invoked from the panel'sonDoneAdded
lib/genlayer/kit.ts—useTransactionKit(address)wiringcreateTransactionKitto the existingstudionetchain config and the MetaMask EIP-1193 providerGenLayerTransactionPanelfor both writes (create_bet,resolve_bet): estimate -> fee receipt review -> hold-to-sign -> timeline -> outcome,trackUntil="decided"app/layout.tsxvitest.config.ts,vitest.setup.ts,npm test) with panel tests backed bycreateMockKit: quote renders + hold-to-sign enabled, and approve drives the flow todonetxprops are memoized —useTransactionFlowre-estimates ontxidentity change, so inline literals would reset the flow mid-signing on unrelated re-rendersDependency note
Installed as github branch refs (
github:genlayerlabs/genlayer-transaction-kit#pkg/core/#pkg/react) because npm github deps can't reach monorepo subpackages — packed branches exist for this. Will be moved to the npm rc once published.Verification
npm run lint(tsc --noEmit) — passnpm test— 2/2 passnpm run build(Next 16 production build) — pass