Skip to content

Commit ed097a7

Browse files
committed
migrate hub v0.10 + fonts
1 parent 9933a64 commit ed097a7

26 files changed

+2284
-282
lines changed

drizzle.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'drizzle-kit'
22

33
export default defineConfig({
4-
schema: './server/database/schema.ts',
5-
out: './server/database/migrations',
4+
schema: './server/db/schema.ts',
5+
out: './server/db/migrations',
66
dialect: 'sqlite',
77
})

nuxt.config.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import { description, name, version } from './package.json'
1010
// https://nuxt.com/docs/api/configuration/nuxt-config
1111
export default defineNuxtConfig({
1212
devtools: { enabled: true },
13-
modules: ['@vueuse/nuxt', '@unocss/nuxt', '@nuxtjs/color-mode', '@nuxt/eslint', '@nuxthub/core', '@nuxt/image', 'reka-ui/nuxt', 'nuxt-safe-runtime-config'],
13+
modules: ['@vueuse/nuxt', '@unocss/nuxt', '@nuxtjs/color-mode', '@nuxt/eslint', '@nuxthub/core', '@nuxt/image', '@nuxt/fonts', 'reka-ui/nuxt', 'nuxt-safe-runtime-config'],
1414

1515
hub: {
16-
database: true,
16+
db: 'sqlite',
1717
blob: true,
1818
cache: true,
1919
},
@@ -137,6 +137,12 @@ export default defineNuxtConfig({
137137
colorMode: {
138138
classSuffix: '',
139139
},
140+
fonts: {
141+
families: [
142+
{ name: 'Mulish', weights: [400, 600, 700] },
143+
{ name: 'Fira Code', weights: [400] },
144+
],
145+
},
140146

141147
nitro: {
142148
preset: 'cloudflare_module',
@@ -145,8 +151,8 @@ export default defineNuxtConfig({
145151
tasks: true,
146152
},
147153
scheduledTasks: {
148-
// Hourly sync: fetch missing epochs and update validator snapshots
149-
'0 * * * *': ['sync:epochs', 'sync:snapshot'],
154+
// 12-hour sync: fetch missing epochs and update validator snapshots
155+
'0 */12 * * *': ['sync:epochs', 'sync:snapshot'],
150156
},
151157
openAPI: {
152158
meta: { title: name, description, version },

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"@antfu/ni": "catalog:",
5555
"@iconify-json/tabler": "catalog:",
5656
"@nuxt/eslint": "catalog:",
57+
"@nuxt/fonts": "catalog:",
5758
"@nuxt/image": "catalog:",
5859
"@nuxtjs/color-mode": "catalog:",
5960
"@types/node": "catalog:",

pnpm-lock.yaml

Lines changed: 2112 additions & 192 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ catalog:
88
'@nimiq/core': ^2.1.1
99
'@nimiq/utils': ^0.12.4
1010
'@nuxt/eslint': ^1.7.1
11+
'@nuxt/fonts': ^0.13.0
1112
'@nuxt/image': ^1.10.0
12-
'@nuxthub/core': ^0.9.0
13+
'@nuxthub/core': ^0.10.6
1314
'@nuxtjs/color-mode': ^3.5.2
1415
'@tanstack/vue-table': ^8.21.3
1516
'@types/node': ^24.1.0

server/api/[version]/distribution.get.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import { posSupplyAt } from '@nimiq/utils/supply-calculator'
22
import { not, sql } from 'drizzle-orm'
33
import { initRpcClient } from 'nimiq-rpc-client-ts/client'
44
import { getLatestBlock } from 'nimiq-rpc-client-ts/http'
5+
import { getRpcUrl } from '~~/server/utils/rpc'
56

67
export default defineCachedEventHandler(async () => {
7-
if (!useRuntimeConfig().albatrossRpcNodeUrl)
8+
const rpcUrl = getRpcUrl()
9+
if (!rpcUrl)
810
throw createError('No Albatross RPC Node URL')
9-
initRpcClient({ url: useRuntimeConfig().albatrossRpcNodeUrl })
11+
initRpcClient({ url: rpcUrl })
1012
const db = useDrizzle()
1113

1214
const result = await db.select({

server/api/[version]/status.get.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { initRpcClient } from 'nimiq-rpc-client-ts/client'
22
import { getBlockNumber } from 'nimiq-rpc-client-ts/http'
33
import { getRange } from 'nimiq-validator-trustscore/range'
4+
import { getRpcUrl } from '~~/server/utils/rpc'
45

56
/**
67
* This endpoint returns the status of the API:
@@ -22,9 +23,10 @@ import { getRange } from 'nimiq-validator-trustscore/range'
2223
*/
2324

2425
export default defineCachedEventHandler(async () => {
25-
if (!useRuntimeConfig().albatrossRpcNodeUrl)
26+
const rpcUrl = getRpcUrl()
27+
if (!rpcUrl)
2628
throw createError('No Albatross RPC Node URL')
27-
initRpcClient({ url: useRuntimeConfig().albatrossRpcNodeUrl })
29+
initRpcClient({ url: rpcUrl })
2830

2931
const { nimiqNetwork: network } = useRuntimeConfig().public
3032

server/api/[version]/validators/[address].get.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ import { ValidationUtils } from '@nimiq/utils/validation-utils'
22
import { initRpcClient } from 'nimiq-rpc-client-ts/client'
33
import { z } from 'zod'
44
import { getRange } from '~~/packages/nimiq-validator-trustscore/src/range'
5+
import { getRpcUrl } from '~~/server/utils/rpc'
56

67
const paramsSchema = z.object({
78
address: z.string(),
89
})
910

1011
export default defineEventHandler(async (event) => {
11-
if (!useRuntimeConfig().albatrossRpcNodeUrl)
12+
const rpcUrl = getRpcUrl()
13+
if (!rpcUrl)
1214
throw createError('No Albatross RPC Node URL')
13-
initRpcClient({ url: useRuntimeConfig().albatrossRpcNodeUrl })
15+
initRpcClient({ url: rpcUrl })
1416
const { address } = await getValidatedRouterParams(event, paramsSchema.parse, { decode: true })
1517
const isValid = ValidationUtils.isValidAddress(address)
1618
if (!isValid)

server/api/[version]/validators/index.get.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import type { FetchValidatorsOptions } from '~~/server/utils/validators'
22
import { initRpcClient } from 'nimiq-rpc-client-ts/client'
33
import { getRange } from '~~/packages/nimiq-validator-trustscore/src/range'
4+
import { getRpcUrl } from '~~/server/utils/rpc'
45
import { cachedFetchValidators, fetchValidators } from '~~/server/utils/validators'
56

67
export default defineEventHandler(async (event) => {
78
const queryParams = await getValidatedQuery(event, mainQuerySchema.parse)
89

9-
initRpcClient({ url: useRuntimeConfig().albatrossRpcNodeUrl })
10+
const rpcUrl = getRpcUrl()
11+
if (!rpcUrl)
12+
throw createError('No Albatross RPC Node URL')
13+
initRpcClient({ url: rpcUrl })
1014
const { nimiqNetwork: network } = useRuntimeConfig().public
1115

1216
const [rangeSuccess, errorRange, range] = await getRange({ network })
File renamed without changes.

0 commit comments

Comments
 (0)