Skip to content

feat: basename renewals #2227

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

feat: basename renewals #2227

wants to merge 6 commits into from

Conversation

brendan-defi
Copy link
Collaborator

What changed? Why?

Notes to reviewers

How has it been tested?

Have you tested the following pages?

BaseWeb

  • [] base.org
  • [] base.org/names
  • [] base.org/builders
  • [] base.org/ecosystem
  • [] base.org/name/jesse
  • [] base.org/manage-names
  • [] base.org/resources

BaseDocs

  • [] docs.base.org
  • [] docs sub-pages

Copy link

vercel bot commented Apr 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
base-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2025 8:58pm
web-base-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2025 8:58pm

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Apr 18, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

// Params
const normalizedName = normalizeEnsDomainName(name);
const { basePrice, premiumPrice } = useRentPrice(normalizedName, years);
const totalPrice = basePrice + premiumPrice;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A renewal will only ever use the base price. Premiums are only used when a name is being registered and might be in a dutch auction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, i'll either only use baseprice here or see if we have a hook that only pulls baseprice

Comment on lines 31 to 33
function secondsInYears(years: number): bigint {
const secondsPerYear = 365.25 * 24 * 60 * 60; // .25 accounting for leap years
return BigInt(Math.round(years * secondsPerYear));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to swap this call out to the shared util?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, there are a bunch to dedupe, i'll handle that once we get the renewals working

@brendan-defi brendan-defi force-pushed the feat/renew-basenames branch from 43ebd3a to d6dfc2f Compare April 18, 2025 20:49
Comment on lines +102 to +111
return Promise.resolve();
},
reverseRecord: false,
setReverseRecord: function () {
return undefined;
},
hasExistingBasename: false,
registerNameIsPending: false,
registerNameError: null,
code: undefined,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add all empty values to default context

@@ -28,7 +39,7 @@ export function useRegisterNameCallback(
years: number,
discountKey?: `0x${string}`,
validationData?: `0x${string}`,
) {
): UseRegisterNameCallbackReturnType {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix type issue

@@ -61,7 +72,7 @@ export function useRegisterNameCallback(
transactionStatus: registerNameStatus,
transactionIsLoading: registerNameIsLoading,
transactionError: registerNameError,
} = useWriteContractWithReceipt({
} = useWriteContractWithReceipt<typeof REGISTER_CONTRACT_ABI, 'register'>({
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix type issue

Comment on lines +40 to +50
type ContractFunctionPayableInfo<TAbi extends Abi, TFunctionName extends string> = Extract<
TAbi[number],
{ name: TFunctionName; stateMutability: string }
>['stateMutability'] extends 'payable'
? { value: bigint | undefined }
: { value?: never };

type WriteContractParameters<
TAbi extends Abi = Abi,
TFunctionName extends string = string,
> = ContractFunctionParameters & ContractFunctionPayableInfo<TAbi, TFunctionName>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add value parameter to methods with stateMutability: payable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base web review To be reviewed by the Base web team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants