Skip to content

Commit

Permalink
chore: check url rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Aug 16, 2024
1 parent add7687 commit 6aea349
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ export default defineNuxtConfig({
},

runtimeConfig: {
// Set in .env
rpcUrl: '',
rpcUrl: process.env.NUXT_RPC_URL || '',
public: {
nimiqNetwork: '',
nimiqNetwork: process.env.NUXT_PUBLIC_NIMIQ_NETWORK || '',
}
},

Expand All @@ -48,6 +47,7 @@ export default defineNuxtConfig({
},

nitro: {
minify: false,
esbuild: {
options: {
target: 'esnext',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@nimiq/core": "2.0.0-next.23.0",
"@nuxt/eslint": "^0.5.0",
"@nuxthub/core": "^0.7.1",
"@nuxthub/core": "^0.7.2",
"@unovis/ts": "^1.4.4",
"@unovis/vue": "^1.4.4",
"@vueuse/core": "^10.11.1",
Expand Down
5 changes: 4 additions & 1 deletion server/utils/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ export async function getClient() {

// TODO Use this rpc client app-wide
export async function getRpcClient() {
const url = useRuntimeConfig().rpcUrl
if (!url)
throw new Error('Missing RPC URL in runtime config')
if (!rpcClient) {
rpcClient = new NimiqRPCClient(new URL(useRuntimeConfig().rpcUrl))
rpcClient = new NimiqRPCClient(new URL(url))
}
return rpcClient
}

0 comments on commit 6aea349

Please sign in to comment.