1import { Options } from '@urbit/roller-api';
2import { useMemo } from 'react';
3import { ROLLER_HOSTS, ROLLER_PATH } from './constants';
4import { convertToInt } from './convertToInt';
5import { isMainnet, isGoerli, providedRollerOptions } from './flags';
12 | 'postmessageiframe';
15 * This hook produces a Roller API options config based on the runtime env.
17 * By default, it uses the hardcoded values from constants.ts, but optionally
18 * a consumer of Bridge can provide a custom host, port, and transport type to
19 * override these settings.
21 * @returns options (type Options from @urbit/roller-api)
23export const useRollerOptions = () => {
28 } = providedRollerOptions;
30 const options: Options = useMemo(() => {
32 (providedType as TransportType | undefined) ||
33 (isMainnet || isGoerli ? 'https' : 'http');
37 ? ROLLER_HOSTS.MAINNET
40 : ROLLER_HOSTS.LOCAL);
42 (providedPort && convertToInt(providedPort, 10)) ||
43 (isMainnet || isGoerli ? 443 : 8080);
44 const path = ROLLER_PATH;
54 }, [providedHost, providedPort, providedType]);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list