1import { useMemo } from 'react';
2import { isValidAddress } from './wallet';
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// & as = ~ship // who to send the invite as
10// & ship = ~ship // what planet to send as the invite
11// & email = ex@amp.le // email to send the invite code to
14// & lock = linear | conditional // which lockup contract, defaults to linear
15// & from = 0x1234abcd // ethereum address to accept transfer from
19 TAKE_LOCKUP: 'takeLockup',
22const useFlowCommand = () => {
23 const flow = useMemo(() => {
26 window.location.search
30 if ('' === arg) return;
31 const pam = arg.split('=');
32 flow[pam[0]] = pam.length <= 1 ? true : decodeURIComponent(pam[1]);
35 if (typeof flow === 'object') {
37 case COMMANDS.TAKE_LOCKUP:
38 flow.lock = flow.lock || 'linear';
40 (flow.lock !== 'linear' && flow.lock !== 'conditional') ||
41 !isValidAddress(flow.from)
48 console.log('unrecognized kind of flow:', flow.kind);
49 // eslint-disable-next-line no-fallthrough
64export { 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