1import { useMemo } from 'react';
2import { isValidAddress } from './utils/address';
4// looks into the GET parameters and attempts to construct a "flow" object,
5// which would indicate bridge is to be used for one specific flow.
6// expects to find any of the following sets of parameters, varying by kind.
9// & lock = linear | conditional // which lockup contract, defaults to linear
10// & from = 0x1234abcd // ethereum address to accept transfer from
13// & utx = somebase64string
19 TAKE_LOCKUP: 'takeLockup',
24const useFlowCommand = () => {
25 const flow = useMemo(() => {
28 window.location.search
32 if ('' === arg) return;
33 const pam = arg.split('=');
34 flow[pam[0]] = pam.length <= 1 ? true : decodeURIComponent(pam[1]);
37 if (typeof flow === 'object') {
39 case COMMANDS.TAKE_LOCKUP:
40 flow.lock = flow.lock || 'linear';
42 (flow.lock !== 'linear' && flow.lock !== 'conditional') ||
43 !isValidAddress(flow.from)
49 case COMMANDS.BITCOIN:
61 console.log('unrecognized kind of flow:', flow.kind);
62 // eslint-disable-next-line no-fallthrough
77export { COMMANDS, useFlowCommand };
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