on master help sign in
Fix learn more url, gas price, galaxy placeholder, l2 spawn proxy (#838)
2f34953Will Galebach
src/components/L2/Headers/L2BackHeader.tsx+1−4
@@ -54,8 +54,6 @@ const L2BackHeader = ({
54 getEthBalance();
54 getEthBalance();
55 }, [currentL2, setEthBalance, wallet, web3]);
55 }, [currentL2, setEthBalance, wallet, web3]);
56
56
57− const hasBalance = Number(ethBalance.toString()) !== 0;
58−
59 return (
57 return (
60 <Row className={`l2-back-header ${className}`}>
58 <Row className={`l2-back-header ${className}`}>
61 <HeaderButton icon="ChevronWest" onClick={goBack} />
59 <HeaderButton icon="ChevronWest" onClick={goBack} />
@@ -65,8 +63,7 @@ const L2BackHeader = ({
65 {nextRoll}
63 {nextRoll}
66 </Row>
64 </Row>
67 ) : (
65 ) : (
68− !hideBalance &&
66+ !hideBalance && (
69− hasBalance && (
70 <Row className="eth-balance">
67 <Row className="eth-balance">
71 <Wallet className="wallet-icon" />
68 <Wallet className="wallet-icon" />
72 <Box>{ethBalance.toString()} ETH</Box>
69 <Box>{ethBalance.toString()} ETH</Box>
src/form/Inputs.tsx+8−1
@@ -19,6 +19,7 @@ import {
19 StatelessTextInputProps,
19 StatelessTextInputProps,
20} from '@tlon/indigo-react';
20} from '@tlon/indigo-react';
21
21
22+const PLACEHOLDER_GALAXY = '~pel';
22const PLACEHOLDER_STAR = '~sampel';
23const PLACEHOLDER_STAR = '~sampel';
23const PLACEHOLDER_PLANET = '~sampel-ponnym';
24const PLACEHOLDER_PLANET = '~sampel-ponnym';
24const PLACEHOLDER_HD_PATH = DEFAULT_HD_PATH;
25const PLACEHOLDER_HD_PATH = DEFAULT_HD_PATH;
@@ -123,7 +124,13 @@ export function PointInput({ name, size = 4, ...rest }) {
123 type="text"
124 type="text"
124 label="Urbit ID"
125 label="Urbit ID"
125 name={name}
126 name={name}
127+ placeholder={
128+ size === 1
129+ ? PLACEHOLDER_GALAXY
130+ : size === 2
131+ ? PLACEHOLDER_STAR
126− placeholder={size === 4 ? PLACEHOLDER_PLANET : PLACEHOLDER_STAR}
132+ : PLACEHOLDER_PLANET
133+ }
127 autoCapitalize="none"
134 autoCapitalize="none"
128 autoComplete="off"
135 autoComplete="off"
129 autoCorrect="off"
136 autoCorrect="off"
src/lib/getSuggestedGasPrice.js+1−1
@@ -5,7 +5,7 @@ import { formatWait } from 'components/L2/Dropdowns/FeeDropdown';
5// ethgasstation returns values in floating point, one order of magitude
5// ethgasstation returns values in floating point, one order of magitude
6// more than gwei. see: https://docs.ethgasstation.info
6// more than gwei. see: https://docs.ethgasstation.info
7// we don't want to charge users more than the gas tank funds
7// we don't want to charge users more than the gas tank funds
8−const minGas = gas => Math.min(Math.ceil(gas / 10), MAX_GAS_PRICE_GWEI);
8+const minGas = gas => Math.min(Math.ceil(gas), MAX_GAS_PRICE_GWEI);
9
9
10export const defaultGasValues = value => ({
10export const defaultGasValues = value => ({
11 fast: {
11 fast: {
src/lib/proxy.js+2−2
@@ -40,9 +40,9 @@ export const proxyTypeToL1TxnType = proxyType => {
40export const proxyTypeToHumanDescription = proxyType => {
40export const proxyTypeToHumanDescription = proxyType => {
41 switch (proxyType) {
41 switch (proxyType) {
42 case PROXY_TYPE.MANAGEMENT:
42 case PROXY_TYPE.MANAGEMENT:
43− return 'Your management key can configure networking settings (network keys and sponsorship)';
43+ return 'Your management key can configure networking settings (network keys and sponsorship).';
44 case PROXY_TYPE.SPAWN:
44 case PROXY_TYPE.SPAWN:
45− return 'Your spawn key can spawn points.';
45+ return 'Your spawn key can spawn points on your behalf.';
46 case PROXY_TYPE.TRANSFER:
46 case PROXY_TYPE.TRANSFER:
47 return 'Your transfer key can transfer this point.';
47 return 'Your transfer key can transfer this point.';
48 case PROXY_TYPE.VOTING:
48 case PROXY_TYPE.VOTING:
src/views/AcceptTransfer.tsx+1−1
@@ -115,7 +115,7 @@ export default function AcceptTransfer() {
115 inset
115 inset
116 className="cancel-transfer"
116 className="cancel-transfer"
117 hideBack
117 hideBack
118− header={<L2BackHeader hideBalance back={goBack} />}>
118+ header={<L2BackHeader hideBalance={point.isL2} back={goBack} />}>
119 <Window>
119 <Window>
120 <HeaderPane>
120 <HeaderPane>
121 <Row className="header-row">
121 <Row className="header-row">
src/views/Invite/Cohort.tsx+2−2
@@ -372,7 +372,7 @@ export default function InviteCohort() {
372 <Box className="mb6" lineHeight="1.4em">
372 <Box className="mb6" lineHeight="1.4em">
373 Note: you will have to sign <strong>4</strong> transactions
373 Note: you will have to sign <strong>4</strong> transactions
374 per invite, for a total of <strong>{4 * numInvites}</strong>{' '}
374 per invite, for a total of <strong>{4 * numInvites}</strong>{' '}
375− signatures
375+ signatures.
376 </Box>
376 </Box>
377 )}
377 )}
378 </Box>
378 </Box>
@@ -429,7 +429,7 @@ export default function InviteCohort() {
429 inset
429 inset
430 className="cohort"
430 className="cohort"
431 hideBack
431 hideBack
432− header={<L2BackHeader hideBalance />}>
432+ header={<L2BackHeader hideBalance={point.isL2Spawn} />}>
433 <Window>
433 <Window>
434 <HeaderPane>
434 <HeaderPane>
435 {!hasInvites ? (
435 {!hasInvites ? (
src/views/Point/IssueChild.tsx+1−1
@@ -227,7 +227,7 @@ export default function IssueChild() {
227 hideBack
227 hideBack
228 inset
228 inset
229 className="issue-child"
229 className="issue-child"
230− header={<L2BackHeader hideBalance={false} back={pop} />}>
230+ header={<L2BackHeader hideBalance={point.isL2Spawn} back={pop} />}>
231 <Window className="id-issue-child">
231 <Window className="id-issue-child">
232 <HeaderPane>
232 <HeaderPane>
233 <Row>
233 <Row>
src/views/Point/MigrateL2.tsx+1−1
@@ -281,7 +281,7 @@ export default function MigrateL2() {
281 className="bold"
281 className="bold"
282 target="_blank"
282 target="_blank"
283 rel="noreferrer"
283 rel="noreferrer"
284− href="https://urbit-org-9l0a6849p-urbit.vercel.app/docs/azimuth/l2/layer2">
284+ href="https://urbit.org/docs/azimuth/l2/layer2">
285 Learn More
285 Learn More
286 </a>
286 </a>
287 </Box>
287 </Box>
src/views/Point/UrbitOS.js+1−1
@@ -10,7 +10,7 @@ import L2BackHeader from 'components/L2/Headers/L2BackHeader';
10
10
11import UrbitOSHome from '../UrbitOS/Home';
11import UrbitOSHome from '../UrbitOS/Home';
12import UrbitOSNetworkKeys from '../UrbitOS/NetworkKeys.tsx';
12import UrbitOSNetworkKeys from '../UrbitOS/NetworkKeys.tsx';
13−import UrbitOSChangeSponsor from '../UrbitOS/ChangeSponsor';
13+import UrbitOSChangeSponsor from '../UrbitOS/ChangeSponsor.tsx';
14
14
15const NAMES = {
15const NAMES = {
16 HOME: 'HOME',
16 HOME: 'HOME',
src/views/UrbitID/Home.tsx+18−24
@@ -6,7 +6,7 @@ import { Box, Button, Icon, Row } from '@tlon/indigo-react';
6import { useLocalRouter } from 'lib/LocalRouter';
6import { useLocalRouter } from 'lib/LocalRouter';
7import { PROXY_TYPE } from 'lib/proxy';
7import { PROXY_TYPE } from 'lib/proxy';
8import { convertToInt } from 'lib/convertToInt';
8import { convertToInt } from 'lib/convertToInt';
9−import { ETH_ZERO_ADDR, MASTER_TICKET_TOOLTIP } from 'lib/constants';
9+import { DUMMY_L2_ADDRESS, ETH_ZERO_ADDR, MASTER_TICKET_TOOLTIP } from 'lib/constants';
10import { abbreviateAddress } from 'lib/utils/address';
10import { abbreviateAddress } from 'lib/utils/address';
11import { downloadWallet } from 'lib/invite';
11import { downloadWallet } from 'lib/invite';
12import useKeyfileGenerator from 'lib/useKeyfileGenerator';
12import useKeyfileGenerator from 'lib/useKeyfileGenerator';
@@ -63,7 +63,8 @@ export default function UrbitIDHome() {
63 const goTransfer = useCallback(() => push(names.TRANSFER), [names, push]);
63 const goTransfer = useCallback(() => push(names.TRANSFER), [names, push]);
64
64
65 const noManagement = point.managementProxy === ETH_ZERO_ADDR;
65 const noManagement = point.managementProxy === ETH_ZERO_ADDR;
66+ const noSpawn =
66− const noSpawn = point.spawnProxy === ETH_ZERO_ADDR;
67+ point.spawnProxy === ETH_ZERO_ADDR || point.spawnProxy === DUMMY_L2_ADDRESS;
67
68
68 return (
69 return (
69 <Window className="id-home">
70 <Window className="id-home">
@@ -131,30 +132,23 @@ export default function UrbitIDHome() {
131 <Box>
132 <Box>
132 <Box>Spawn Proxy Address</Box>
133 <Box>Spawn Proxy Address</Box>
133 <div className="mt1 mono black subtitle">
134 <div className="mt1 mono black subtitle">
134− {noSpawn
135− ? point.isL2Spawn
136− ? 'Layer 2'
137− : 'Unset'
138− : abbreviateAddress(point.spawnProxy)}
135+ {noSpawn ? 'Unset' : abbreviateAddress(point.spawnProxy)}
139 </div>
136 </div>
140 </Box>
137 </Box>
141− {point.isL2Spawn ? (
138+ <Row>
142− <LayerIndicator size="lg" layer={2} />
139+ {point.isL2Spawn && <LayerIndicator size="lg" layer={2} />}
143− ) : (
144− <Row>
145− <Button
140+ <Button
146− className="secondary"
141+ className="secondary"
147− onClick={() => goSetProxy(PROXY_TYPE.SPAWN)}>
142+ onClick={() => goSetProxy(PROXY_TYPE.SPAWN)}>
148− {noSpawn ? 'Set' : 'Change'}
143+ {noSpawn ? 'Set' : 'Change'}
149− </Button>
144+ </Button>
150− {!noSpawn && (
145+ {!noSpawn && (
151− <CopiableWithTooltip
146+ <CopiableWithTooltip
152− text={point.spawnProxy}
147+ text={point.spawnProxy}
153− className="copy-button"
148+ className="copy-button"
154− />
149+ />
155− )}
150+ )}
156− </Row>
151+ </Row>
157− )}
158 </Row>
152 </Row>
159 )}
153 )}
160
154
src/views/UrbitID/SetProxy.js+5−3
@@ -38,6 +38,8 @@ import HeaderPane from 'components/L2/Window/HeaderPane';
38import BodyPane from 'components/L2/Window/BodyPane';
38import BodyPane from 'components/L2/Window/BodyPane';
39import { Row } from '@tlon/indigo-react';
39import { Row } from '@tlon/indigo-react';
40
40
41+import './SetProxy.scss';
42+
41const getL2ProxyName = proxy =>
43const getL2ProxyName = proxy =>
42 proxy === PROXY_TYPE.MANAGEMENT
44 proxy === PROXY_TYPE.MANAGEMENT
43 ? 'manage'
45 ? 'manage'
@@ -248,7 +250,7 @@ export default function SetProxy() {
248 }, [completed, properProxyType]);
250 }, [completed, properProxyType]);
249
251
250 return (
252 return (
251− <Window>
253+ <Window className="set-proxy">
252 <HeaderPane>
254 <HeaderPane>
253 <Row className="header-row">
255 <Row className="header-row">
254 <h5>{header}</h5>
256 <h5>{header}</h5>
@@ -258,13 +260,13 @@ export default function SetProxy() {
258 <Grid className="w-full">
260 <Grid className="w-full">
259 {!completed && (
261 {!completed && (
260 <>
262 <>
261− <Grid.Item full as={Text} className="mb4 f5 gray4">
263+ <Grid.Item full as={Text} className="mb4 f5">
262 {proxyTypeToHumanDescription(data.proxyType)}
264 {proxyTypeToHumanDescription(data.proxyType)}
263 </Grid.Item>
265 </Grid.Item>
264 <Grid.Item
266 <Grid.Item
265 full
267 full
266 as={Text}
268 as={Text}
267− className={cn('f6', {
269+ className={cn('f5', {
268 green3: completed,
270 green3: completed,
269 })}>
271 })}>
270 Current
272 Current
src/views/UrbitID/SetProxy.scss+2−50
@@ -1,57 +1,9 @@
1@import 'style/shared/variables.scss';
1@import 'style/shared/variables.scss';
2
2
3−.cohort {
3+.set-proxy.window {
4− font-size: 14px;
5−
6− .number-emphasis {
7− background-color: $light-gray;
8− border-radius: $small-border-radius;
9− margin: 0 4px;
10− }
11−
12 .body-pane {
4 .body-pane {
13− min-height: 212px;
5+ .f5 {
14− justify-content: space-between;
15− font-size: 14px;
16−
17− &.center {
18− justify-content: center;
19− }
20−
21− .content {
22− width: 100%;
23 font-size: 14px;
6 font-size: 14px;
24− line-height: 24px;
25−
26− &.center {
27− text-align: center;
28− margin-top: 20px;
29− width: 320px;
30− margin: auto;
31− }
32−
33 }
7 }
34−
35−
36− }
37−
38−.set-proxy {
39− border-radius: $medium-border-radius;
40− width: 100%;
41− height: 32px;
42− font-size: 14px;
43− background-color: black;
44− color: white;
45− font-family: 'Inter', -apple-system, BlinkMacSystemFont, Roboto, Helvetica,
46− Arial, sans-serif, 'Apple Color Emoji';
47− border: none;
48− margin-top: 8px;
49− padding: 8px;
50−
51− &.loading {
52− background-color: $dark-gray;
53 }
8 }
54}
9}
55−
56−
57−}
src/views/UrbitID/UrbitID.scss+4
@@ -13,5 +13,9 @@
13 }
13 }
14 }
14 }
15 }
15 }
16+
17+ .layer-indicator {
18+ margin-right: 0px;
19+ }
16 }
20 }
17}
21}
src/views/UrbitOS/ChangeSponsor.js → src/views/UrbitOS/ChangeSponsor.tsxrenamed+30−27
@@ -29,39 +29,39 @@ import HeaderPane from 'components/L2/Window/HeaderPane';
29import BodyPane from 'components/L2/Window/BodyPane';
29import BodyPane from 'components/L2/Window/BodyPane';
30
30
31function useChangeSponsor() {
31function useChangeSponsor() {
32− const { contracts } = useNetwork();
32+ const { contracts }: any = useNetwork();
33− const { pointCursor } = usePointCursor();
33+ const { pointCursor }: any = usePointCursor();
34− const { syncExtras } = usePointCache();
34+ const { syncExtras }: any = usePointCache();
35
35
36 const _contracts = need.contracts(contracts);
36 const _contracts = need.contracts(contracts);
37 const point = need.point(pointCursor);
37 const point = need.point(pointCursor);
38
38
39 return useEthereumTransaction(
39 return useEthereumTransaction(
40+ useCallback(
40− useCallback(sponsor => ecliptic.escape(_contracts, point, sponsor), [
41+ (sponsor: number) => ecliptic.escape(_contracts, point, sponsor),
41− point,
42− _contracts,
42+ [point, _contracts]
43− ]),
43+ ),
44 useCallback(() => {
44 useCallback(() => {
45 syncExtras(point);
45 syncExtras(point);
46 }, [syncExtras, point])
46 }, [syncExtras, point])
47 );
47 );
48}
48}
49
49
50−function ChangeSponsor({ onDone }) {
50+function ChangeSponsor({ onDone }: { onDone: Function }) {
51− const { contracts } = useNetwork();
51+ const { contracts }: any = useNetwork();
52− const { pop } = useHistory();
52+ const { pop }: any = useHistory();
53 const { changeSponsor, checkForUpdates } = useRoller();
53 const { changeSponsor, checkForUpdates } = useRoller();
54 const { point, setLoading } = useRollerStore();
54 const { point, setLoading } = useRollerStore();
55
55
56 const _contracts = need.contracts(contracts);
56 const _contracts = need.contracts(contracts);
57 const { construct, unconstruct, inputsLocked, bind } = useChangeSponsor();
57 const { construct, unconstruct, inputsLocked, bind } = useChangeSponsor();
58
58
59− const [newSponsor, setNewSponsor] = useState();
59+ const [newSponsor, setNewSponsor] = useState<number | undefined>();
60
60
61 const requestNewSponsor = useCallback(async () => {
61 const requestNewSponsor = useCallback(async () => {
62 if (newSponsor !== undefined) {
62 if (newSponsor !== undefined) {
63 setLoading(true);
63 setLoading(true);
64− await changeSponsor(newSponsor);
64+ await changeSponsor(newSponsor!);
65 checkForUpdates({
65 checkForUpdates({
66 point: point.value,
66 point: point.value,
67 message: `${point.patp} has requested ${ob.patp(
67 message: `${point.patp} has requested ${ob.patp(
@@ -123,6 +123,8 @@ function ChangeSponsor({ onDone }) {
123
123
124 const buttonText = 'Request New Sponsor';
124 const buttonText = 'Request New Sponsor';
125
125
126+ const size = point.isStar ? 1 : 2;
127+
126 return (
128 return (
127 <Window>
129 <Window>
128 <HeaderPane>
130 <HeaderPane>
@@ -141,7 +143,7 @@ function ChangeSponsor({ onDone }) {
141 disabled={inputsLocked}
143 disabled={inputsLocked}
142 label="New sponsor"
144 label="New sponsor"
143 className="mv4"
145 className="mv4"
144− size={2}
146+ size={size}
145 />
147 />
146 <Grid.Item full as={FormError} />
148 <Grid.Item full as={FormError} />
147 {point.isL2 ? (
149 {point.isL2 ? (
@@ -171,9 +173,9 @@ function ChangeSponsor({ onDone }) {
171}
173}
172
174
173function useCancelEscape() {
175function useCancelEscape() {
174− const { contracts } = useNetwork();
176+ const { contracts }: any = useNetwork();
175− const { pointCursor } = usePointCursor();
177+ const { pointCursor }: any = usePointCursor();
176− const { syncExtras } = usePointCache();
178+ const { syncExtras }: any = usePointCache();
177
179
178 const _contracts = need.contracts(contracts);
180 const _contracts = need.contracts(contracts);
179 const point = need.point(pointCursor);
181 const point = need.point(pointCursor);
@@ -187,11 +189,11 @@ function useCancelEscape() {
187 );
189 );
188}
190}
189
191
190−function CurrentEscape({ onDone }) {
192+function CurrentEscape({ onDone }: { onDone: Function }) {
191 const { construct, bind } = useCancelEscape();
193 const { construct, bind } = useCancelEscape();
192 const { point } = useRollerStore();
194 const { point } = useRollerStore();
193
195
194− const { pop } = useHistory();
196+ const { pop }: any = useHistory();
195 const { cancelEscape, checkForUpdates } = useRoller();
197 const { cancelEscape, checkForUpdates } = useRoller();
196 const {
198 const {
197 point: { isL2 },
199 point: { isL2 },
@@ -205,14 +207,15 @@ function CurrentEscape({ onDone }) {
205 }, [construct]);
207 }, [construct]);
206
208
207 const cancelRequest = useCallback(async () => {
209 const cancelRequest = useCallback(async () => {
208− if (newSponsor !== undefined) {
209− setLoading(true);
210+ setLoading(true);
210− await cancelEscape(newSponsor);
211+ await cancelEscape();
212+ checkForUpdates({
213+ point: point.value,
211− checkForUpdates(point.value, `${point.patp}'s sponsor change cancelled`);
214+ message: `${point.patp}'s sponsor change cancelled`,
215+ });
212− setLoading(false);
216+ setLoading(false);
213− pop();
217+ pop();
214− }
215− }, [point, newSponsor, cancelEscape, setLoading, checkForUpdates, pop]);
218+ }, [point, cancelEscape, setLoading, checkForUpdates, pop]);
216
219
217 const buttonText = 'Cancel Request';
220 const buttonText = 'Cancel Request';
218
221
@@ -253,7 +256,7 @@ function CurrentEscape({ onDone }) {
253}
256}
254
257
255export default function UrbitOSChangeSponsor() {
258export default function UrbitOSChangeSponsor() {
256− const { pop } = useHistory();
259+ const { pop }: any = useHistory();
257 const { point } = useRollerStore();
260 const { point } = useRollerStore();
258
261
259 const [requested, setRequested] = useState(point.escapeRequested);
262 const [requested, setRequested] = useState(point.escapeRequested);