import { atom, selector } from "recoil"; export const isConnectedState = atom({ key: "isConnectedState", default: false, }); export const selfPeerIdState = atom({ key: "selfPeerIdState", default: null, }); export const relayState = atom({ key: "relayState", default: null, }); export const serviceIdState = atom({ key: "serviceIdState", default: null, }); export const wasmState = atom({ key: "serviceState", default: "QmSvjkzXbXYwFXcWuFWqFdksvQDgpCeADNxkgkfzCLA4rk", }); export const rpcAddrState = atom({ key: "rpcAddrState", default: null, }); export const fileCIDState = atom({ key: "fileCIDState", default: "QmSvjkzXbXYwFXcWuFWqFdksvQDgpCeADNxkgkfzCLA4rk", }); export const fileSizeState = atom({ key: "fileSizeState", default: null, }); export const fileSizeCIDState = atom({ key: "fileSizeCIDState", default: null, }); export const gotRpcAddrState = selector({ key: "getRpcAddrState", get: ({ get }) => { const rpcAddr = get(rpcAddrState); return rpcAddr !== null; }, }); export const isDeployedState = selector({ key: "isDeployedState", get: ({ get }) => { const serviceId = get(serviceIdState); return serviceId !== null; }, }); export const hasResultState = selector({ key: "hasResultState", get: ({ get }) => { const fileSize = get(fileSizeState); return fileSize !== null; }, });