15 lines
401 B
TypeScript
15 lines
401 B
TypeScript
import { selector } from 'recoil'
|
|
import { RPCClient } from '../lib/rpcClient'
|
|
import { rpcHTTPEndpoint, rpcWebSocketEndpoint } from './settings'
|
|
|
|
export const rpcClientState = selector({
|
|
key: 'rpcClientState',
|
|
get: ({ get }) =>
|
|
new RPCClient(
|
|
get(rpcHTTPEndpoint),
|
|
get(rpcWebSocketEndpoint),
|
|
localStorage.getItem('token') ?? ''
|
|
),
|
|
dangerouslyAllowMutability: true,
|
|
})
|