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 5c83a00
Showing 1 changed file with 4 additions and 1 deletion.
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 5c83a00

Please sign in to comment.