-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Registration Discount codes #1084
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
✅ Heimdall Review Status
|
Approved review 2370486781 from ricardoMogg is now dismissed due to new commit. Re-request for approval.
lgtm but we do need that mainnet address uncommented before merge right? |
Approved review 2375576845 from zencephalon is now dismissed due to new commit. Re-request for approval.
@JFrankfurt yes waiting for contract on mainnet before mergin this. I'll also do a sepolia/codeflow test deploy first |
Review Error for JFrankfurt @ 2024-10-18 20:26:44 UTC |
* discount code temp * comments * BE: Proof of concept * mark/increment code as consumed * bad code * bad code * dry it up * remove test code * cleanup and fix * suspense * undo change * refactor: use internal transaction/capacities hooks for registration flow * refetch basename * fix: wrong name being used when reverseRecord is false * prefetch * ssr code instead of search params * add banner & code
* discount code temp * comments * BE: Proof of concept * mark/increment code as consumed * bad code * bad code * dry it up * remove test code * cleanup and fix * suspense * undo change * refactor: use internal transaction/capacities hooks for registration flow * refetch basename * fix: wrong name being used when reverseRecord is false * prefetch * ssr code instead of search params * add banner & code
* discount code temp * comments * BE: Proof of concept * mark/increment code as consumed * bad code * bad code * dry it up * remove test code * cleanup and fix * suspense * undo change * refactor: use internal transaction/capacities hooks for registration flow * refetch basename * fix: wrong name being used when reverseRecord is false * prefetch * ssr code instead of search params * add banner & code
* [Tutorial] Apply custom theme to Swap component (#1098) * add theme gif * add styled swap component image * add swap component before custom theme * add tutorial for custom themes in OCK * Feat: Registration Discount codes (#1084) * discount code temp * comments * BE: Proof of concept * mark/increment code as consumed * bad code * bad code * dry it up * remove test code * cleanup and fix * suspense * undo change * refactor: use internal transaction/capacities hooks for registration flow * refetch basename * fix: wrong name being used when reverseRecord is false * prefetch * ssr code instead of search params * add banner & code * Fix: Use correct chain for discoutn code (#1107) * use correct chain * use dynamic chain * Revert "[Tutorial] Apply custom theme to Swap component (#1098)" (#1111) This reverts commit c38fcab. --------- Co-authored-by: Pat <[email protected]>
Introducing Discount Codes for Basenames.
This PR is addresses two body of works.
1. Promo Code
Get the code from the url
?code=...
See
searchParams?.code
inapps/web/app/(basenames)/names/page.tsx
.Pass the code to the attestations hooks
Introducing
useDiscountCodeAttestations
, fetch data from a new endpoint:/api/proofs/discountCode
. This endpoints compare, validate & sign the code.From here the existing attestations logic handles the discount automatically.
2. RegisterName refactor
We've had issues with the register flow for Smart Wallet, which led to a small refactor.
This flow is the first one we built, and we've since introduced helpful hooks like
useWriteContractsWithLogs
anduseWriteContractWithReceipt
for better, safer tracking of web3 transactions.Changes to
RegistrationContext
To avoid rendering race condition and other state / logic mishaps, we moved all the shared logic and state to the Context. This includes
useRegisterNameCallback
,setYears
,price
, etc..Changes to
RegistrationForm
Since the context holds the logic and state, this greatly simplify this components.
Changes to
useRegisterNameCallback
This hook holds all the logic regarding initiating & tracking transactions, including error and analytics. This simplifies and consolidate Basename registration contract logic into one place.
Changes to
RegistrationProfileForm
Fix which name you are editing.