diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 42adb44..301e978 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,7 @@ version: 2 updates: - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" + interval: 'weekly' diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..1b84369 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-10-27 - Svelte Keyed Loops +**Learning:** Svelte `{#each}` loops iterating over dynamic keys (e.g. `Object.keys`) without a keyed identifier can lead to inefficient DOM updates and state corruption in child components. +**Action:** Always verify `{#each}` loops use a unique key, especially when rendering stateful components or when the list order/content changes frequently. diff --git a/src/components/DomainPayment.svelte b/src/components/DomainPayment.svelte index ac131ee..e04970d 100644 --- a/src/components/DomainPayment.svelte +++ b/src/components/DomainPayment.svelte @@ -102,7 +102,11 @@

{domainName}

- addYears(-1)} disabled={years === 1 || feesApproved} aria-label="remove-year"> + addYears(-1)} + disabled={years === 1 || feesApproved} + aria-label="remove-year" + > {years} {yearsLabel} @@ -111,7 +115,7 @@
-
+

Payment token

diff --git a/src/lib/sdk.ts b/src/lib/sdk.ts index 5480675..3690a64 100644 --- a/src/lib/sdk.ts +++ b/src/lib/sdk.ts @@ -22,4 +22,4 @@ export const profileRecords = [ RecordClassEnum.Price ].map((v) => RecordClassEnum[v]); -export const getValidator = (klass: string) => getRecordValidator(getRecordClassFrom(klass)) +export const getValidator = (klass: string) => getRecordValidator(getRecordClassFrom(klass)); diff --git a/src/lib/server/index.ts b/src/lib/server/index.ts index d776b94..d87bace 100644 --- a/src/lib/server/index.ts +++ b/src/lib/server/index.ts @@ -57,5 +57,4 @@ export const getStats = async (): Promise => { }; }; - export const apiError = (message: string, status = 400) => json({ error: message }, { status }); diff --git a/src/lib/types.ts b/src/lib/types.ts index 1d202e1..b57ab3e 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -42,8 +42,8 @@ export interface DomainPaymentParams { } export interface DomainFeesResponse { - feesLabel: number - fees: string - symbol: string - address: string + feesLabel: number; + fees: string; + symbol: string; + address: string; } diff --git a/src/lib/url.ts b/src/lib/url.ts index ede74eb..710d0a9 100644 --- a/src/lib/url.ts +++ b/src/lib/url.ts @@ -8,12 +8,11 @@ export const explorerAddressUrl = (address: string) => { if (address.startsWith('00')) // Account url += `/accounts/${address}/assets`; - else - // Contract - url += `/contracts/${address}`; + // Contract + else url += `/contracts/${address}`; - return url -} + return url; +}; export const bridgeUrl = `${config.browserUrl}/bridge`; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index e491643..a5e8638 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -201,5 +201,4 @@ align-items: center; height: 100%; } - diff --git a/src/routes/api/register/[name]/fees/[coin]/+server.ts b/src/routes/api/register/[name]/fees/[coin]/+server.ts index 72763fd..af646a0 100644 --- a/src/routes/api/register/[name]/fees/[coin]/+server.ts +++ b/src/routes/api/register/[name]/fees/[coin]/+server.ts @@ -4,14 +4,17 @@ import { json } from '@sveltejs/kit'; import type { DomainFeesResponse } from 'src/lib/types'; export async function GET({ params: { name, coin } }) { - return handleError(async () => { - const validCoins = metaNamesSdk.config.byoc.map(byoc => byoc.symbol.toString()) - if (!(validCoins.includes(coin))) return apiError('Invalid coin'); + return handleError(async () => { + const validCoins = metaNamesSdk.config.byoc.map((byoc) => byoc.symbol.toString()); + if (!validCoins.includes(coin)) return apiError('Invalid coin'); - const normalizedDomain = metaNamesSdk.domainRepository.domainValidator.normalize(name) - const domainFees = await metaNamesSdk.domainRepository.calculateMintFees(normalizedDomain, coin as BYOCSymbol); - const fees = { ...domainFees, fees: domainFees.fees.toString() } + const normalizedDomain = metaNamesSdk.domainRepository.domainValidator.normalize(name); + const domainFees = await metaNamesSdk.domainRepository.calculateMintFees( + normalizedDomain, + coin as BYOCSymbol + ); + const fees = { ...domainFees, fees: domainFees.fees.toString() }; - return json(fees); - }); + return json(fees); + }); } diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte index 8b9fd1d..7f29073 100644 --- a/src/routes/profile/+page.svelte +++ b/src/routes/profile/+page.svelte @@ -74,7 +74,6 @@