on master help sign in
Fix 'view on Etherscan' links throughout.
61a1023Jared Tobin
src/views/AcceptTransfer.js+11−2
@@ -7,6 +7,7 @@ import * as ob from 'urbit-ob'
7
7
8import StatelessTransaction from '../components/StatelessTransaction'
8import StatelessTransaction from '../components/StatelessTransaction'
9import { BRIDGE_ERROR } from '../lib/error'
9import { BRIDGE_ERROR } from '../lib/error'
10+import { NETWORK_NAMES } from '../lib/network'
10import { ROUTE_NAMES } from '../lib/router'
11import { ROUTE_NAMES } from '../lib/router'
11
12
12import {
13import {
@@ -263,6 +264,14 @@ class AcceptTransfer extends React.Component {
263 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
264 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
264 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
265 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
265
266
267+ const esvisible =
268+ props.networkType === NETWORK_NAMES.ROPSTEN ||
269+ props.networkType === NETWORK_NAMES.MAINNET
270+
271+ const esdomain =
272+ props.networkType === NETWORK_NAMES.ROPSTEN
273+ ? "ropsten.etherscan.io"
274+ : "etherscan.io"
266
275
267 return (
276 return (
268 <Row>
277 <Row>
@@ -290,9 +299,9 @@ class AcceptTransfer extends React.Component {
290 <Anchor
299 <Anchor
291 className={'mt-1 sm'}
300 className={'mt-1 sm'}
292 prop-size='sm'
301 prop-size='sm'
293− prop-disabled={!isValidAddress(state.receivingAddress)}
302+ prop-disabled={!isValidAddress(state.receivingAddress) || !esvisible}
294 target={'_blank'}
303 target={'_blank'}
295− href={`https://etherscan.io/address/${state.receivingAddress}`}>
304+ href={`https://${esdomain}/address/${state.receivingAddress}`}>
296 {'View on Etherscan ↗'}
305 {'View on Etherscan ↗'}
297 </Anchor>
306 </Anchor>
298
307
src/views/CreateGalaxy.js+12−2
@@ -10,6 +10,8 @@ import StatelessTransaction from '../components/StatelessTransaction'
10
10
11import { BRIDGE_ERROR } from '../lib/error'
11import { BRIDGE_ERROR } from '../lib/error'
12
12
13+import { NETWORK_NAMES } from '../lib/network'
14+
13import {
15import {
14 sendSignedTransaction,
16 sendSignedTransaction,
15 getTxnInfo,
17 getTxnInfo,
@@ -179,6 +181,14 @@ class CreateGalaxy extends React.Component {
179 const validAddress = isValidAddress(state.galaxyOwner)
181 const validAddress = isValidAddress(state.galaxyOwner)
180 const validGalaxy = isValidGalaxy(state.galaxyName)
182 const validGalaxy = isValidGalaxy(state.galaxyName)
181
183
184+ const esvisible =
185+ props.networkType === NETWORK_NAMES.ROPSTEN ||
186+ props.networkType === NETWORK_NAMES.MAINNET
187+
188+ const esdomain =
189+ props.networkType === NETWORK_NAMES.ROPSTEN
190+ ? "ropsten.etherscan.io"
191+ : "etherscan.io"
182
192
183 return (
193 return (
184 <Row>
194 <Row>
@@ -225,9 +235,9 @@ class CreateGalaxy extends React.Component {
225 <Anchor
235 <Anchor
226 className={'mt-1'}
236 className={'mt-1'}
227 prop-size={'sm'}
237 prop-size={'sm'}
228− prop-disabled={!validAddress}
238+ prop-disabled={!validAddress || !esvisible}
229 target={'_blank'}
239 target={'_blank'}
230− href={`https://etherscan.io/address/${state.galaxyOwner}`}>
240+ href={`https://${esdomain}/address/${state.galaxyOwner}`}>
231 {'View on Etherscan ↗'}
241 {'View on Etherscan ↗'}
232 </Anchor>
242 </Anchor>
233
243
src/views/IssueChild.js+12−5
@@ -10,6 +10,7 @@ import { PointInput, AddressInput, InnerLabel } from '../components/Base'
10import StatelessTransaction from '../components/StatelessTransaction'
10import StatelessTransaction from '../components/StatelessTransaction'
11
11
12import { ROUTE_NAMES } from '../lib/router'
12import { ROUTE_NAMES } from '../lib/router'
13+import { NETWORK_NAMES } from '../lib/network'
13import { BRIDGE_ERROR } from '../lib/error'
14import { BRIDGE_ERROR } from '../lib/error'
14import { getSpawnCandidate } from '../lib/child'
15import { getSpawnCandidate } from '../lib/child'
15import {
16import {
@@ -337,8 +338,6 @@ class IssueChild extends React.Component {
337 render() {
338 render() {
338 const { props, state } = this
339 const { props, state } = this
339
340
340−
341−
342 const validAddress = isValidAddress(state.receivingAddress)
341 const validAddress = isValidAddress(state.receivingAddress)
343 const validPoint = canDecodePatp(state.desiredPoint)
342 const validPoint = canDecodePatp(state.desiredPoint)
344
343
@@ -354,11 +353,19 @@ class IssueChild extends React.Component {
354 }
353 }
355 })
354 })
356
355
357−
358 const canSign = !Maybe.Nothing.hasInstance(state.txn)
356 const canSign = !Maybe.Nothing.hasInstance(state.txn)
359 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
357 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
360 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
358 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
361
359
360+ const esvisible =
361+ props.networkType === NETWORK_NAMES.ROPSTEN ||
362+ props.networkType === NETWORK_NAMES.MAINNET
363+
364+ const esdomain =
365+ props.networkType === NETWORK_NAMES.ROPSTEN
366+ ? "ropsten.etherscan.io"
367+ : "etherscan.io"
368+
362 return (
369 return (
363 <Row>
370 <Row>
364 <Col>
371 <Col>
@@ -433,9 +440,9 @@ class IssueChild extends React.Component {
433 <Anchor
440 <Anchor
434 className={'mt-1'}
441 className={'mt-1'}
435 prop-size={'sm'}
442 prop-size={'sm'}
436− prop-disabled={!isValidAddress(state.receivingAddress)}
443+ prop-disabled={!isValidAddress(state.receivingAddress) || !esvisible}
437 target={'_blank'}
444 target={'_blank'}
438− href={`https://etherscan.io/address/${state.receivingAddress}`}>
445+ href={`https://${esdomain}/address/${state.receivingAddress}`}>
439 {'View on Etherscan ↗'}
446 {'View on Etherscan ↗'}
440 </Anchor>
447 </Anchor>
441
448
src/views/SentTransaction.js+42−12
@@ -4,7 +4,36 @@ import { Button } from '../components/Base'
4
4
5import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
5import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
6
6
7+import { NETWORK_NAMES } from '../lib/network'
8+
7−const Success = (props) =>
9+const Success = (props) => {
10+
11+ const esvisible =
12+ props.networkType === NETWORK_NAMES.ROPSTEN ||
13+ props.networkType === NETWORK_NAMES.MAINNET
14+
15+ const esdomain =
16+ props.networkType === NETWORK_NAMES.ROPSTEN
17+ ? "ropsten.etherscan.io"
18+ : "etherscan.io"
19+
20+ const esmessage =
21+ esvisible === true
22+ ? "If you’d like to keep track of it, click the Etherscan link below."
23+ : ''
24+
25+ const esanchor =
26+ esvisible === false
27+ ? <div />
28+ : <Anchor
29+ className={'mb-4 mt-1'}
30+ prop-size={'sm'}
31+ target={'_blank'}
32+ href={`https://${esdomain}/tx/${props.hash}`}>
33+ {'View on Etherscan ↗'}
34+ </Anchor>
35+
36+ return (
8 <Row>
37 <Row>
9 <Col>
38 <Col>
10 <H1>{ 'Your Transaction was Sent' }</H1>
39 <H1>{ 'Your Transaction was Sent' }</H1>
@@ -12,8 +41,7 @@ const Success = (props) =>
12 <P>
41 <P>
13 {
42 {
14 `We sent your transaction to the chain. It can take some time to
43 `We sent your transaction to the chain. It can take some time to
15− execute, especially if the network is busy. If you’d like to keep
44+ execute, especially if the network is busy. ${esmessage}`
16− track of it, click the Etherscan link below.`
17 }
45 }
18 </P>
46 </P>
19
47
@@ -21,15 +49,13 @@ const Success = (props) =>
21 <P>
49 <P>
22 { props.hash }
50 { props.hash }
23 </P>
51 </P>
24− <Anchor
52+
25− className={'mb-4 mt-1'}
53+ { esanchor }
26− prop-size={'sm'}
54+
27− target={'_blank'}
28− href={`https://etherscan.io/tx/${props.hash}`}>
29− {'View on Etherscan ↗'}
30− </Anchor>
31 </Col>
55 </Col>
32 </Row>
56 </Row>
57+ )
58+}
33
59
34const Failure = (props) =>
60const Failure = (props) =>
35
61
@@ -50,7 +76,7 @@ const Failure = (props) =>
50 </Row>
76 </Row>
51
77
52const SentTransaction = (props) => {
78const SentTransaction = (props) => {
53− const { web3, txnCursor, popRoute } = props
79+ const { web3, txnCursor, networkType, popRoute } = props
54 const { setPointCursor, pointCursor } = props
80 const { setPointCursor, pointCursor } = props
55
81
56 const w3 = web3.matchWith({
82 const w3 = web3.matchWith({
@@ -65,7 +91,11 @@ const SentTransaction = (props) => {
65
91
66 const body = result.matchWith({
92 const body = result.matchWith({
67 Error: message => <Failure web3={ w3 } message={ message.value } />,
93 Error: message => <Failure web3={ w3 } message={ message.value } />,
94+ Ok: txn =>
95+ <Success
68− Ok: txn => <Success hash={ txn.value.transactionHash } />
96+ hash={ txn.value.transactionHash }
97+ networkType={ networkType }
98+ />
69 })
99 })
70
100
71 const ok =
101 const ok =
src/views/SetProxy.js+12−2
@@ -8,6 +8,8 @@ import * as ob from 'urbit-ob'
8import { PROXY_TYPE, renderProxyType } from '../lib/proxy'
8import { PROXY_TYPE, renderProxyType } from '../lib/proxy'
9import { BRIDGE_ERROR } from '../lib/error'
9import { BRIDGE_ERROR } from '../lib/error'
10
10
11+import { NETWORK_NAMES } from '../lib/network'
12+
11import StatelessTransaction from '../components/StatelessTransaction'
13import StatelessTransaction from '../components/StatelessTransaction'
12
14
13import { ROUTE_NAMES } from '../lib/router'
15import { ROUTE_NAMES } from '../lib/router'
@@ -274,6 +276,14 @@ class SetProxy extends React.Component {
274 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
276 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
275 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
277 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
276
278
279+ const esvisible =
280+ props.networkType === NETWORK_NAMES.ROPSTEN ||
281+ props.networkType === NETWORK_NAMES.MAINNET
282+
283+ const esdomain =
284+ props.networkType === NETWORK_NAMES.ROPSTEN
285+ ? "ropsten.etherscan.io"
286+ : "etherscan.io"
277
287
278 const ucFirst = w => w.charAt(0).toUpperCase() + w.slice(1);
288 const ucFirst = w => w.charAt(0).toUpperCase() + w.slice(1);
279
289
@@ -308,9 +318,9 @@ class SetProxy extends React.Component {
308 <Anchor
318 <Anchor
309 className={'mt-1'}
319 className={'mt-1'}
310 prop-size={'sm'}
320 prop-size={'sm'}
311− disabled={!isValidAddress(state.proxyAddress)}
321+ prop-disabled={!isValidAddress(state.proxyAddress) || !esvisible}
312 target={'_blank'}
322 target={'_blank'}
313− href={`https://etherscan.io/address/${state.proxyAddress}`}>
323+ href={`https://${esdomain}/address/${state.proxyAddress}`}>
314 {'View on Etherscan ↗'}
324 {'View on Etherscan ↗'}
315 </Anchor>
325 </Anchor>
316
326
src/views/Transfer.js+12−2
@@ -8,6 +8,7 @@ import { AddressInput, Warning, H3 } from '../components/Base'
8import StatelessTransaction from '../components/StatelessTransaction'
8import StatelessTransaction from '../components/StatelessTransaction'
9
9
10import { BRIDGE_ERROR } from '../lib/error'
10import { BRIDGE_ERROR } from '../lib/error'
11+import { NETWORK_NAMES } from '../lib/network'
11import { ROUTE_NAMES } from '../lib/router'
12import { ROUTE_NAMES } from '../lib/router'
12
13
13import {
14import {
@@ -250,6 +251,15 @@ class Transfer extends React.Component {
250 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
251 const canApprove = !Maybe.Nothing.hasInstance(state.stx)
251 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
252 const canSend = !Maybe.Nothing.hasInstance(state.stx) && state.userApproval === true
252
253
254+ const esvisible =
255+ props.networkType === NETWORK_NAMES.ROPSTEN ||
256+ props.networkType === NETWORK_NAMES.MAINNET
257+
258+ const esdomain =
259+ props.networkType === NETWORK_NAMES.ROPSTEN
260+ ? "ropsten.etherscan.io"
261+ : "etherscan.io"
262+
253 return (
263 return (
254 <Row>
264 <Row>
255 <Col>
265 <Col>
@@ -280,9 +290,9 @@ class Transfer extends React.Component {
280 <Anchor
290 <Anchor
281 className={'mt-1'}
291 className={'mt-1'}
282 prop-size={'s'}
292 prop-size={'s'}
283− disabled={!isValidAddress(state.receivingAddress)}
293+ prop-disabled={!isValidAddress(state.receivingAddress) || !esvisible}
284 target={'_blank'}
294 target={'_blank'}
285− href={`https://etherscan.io/address/${state.receivingAddress}`}>
295+ href={`https://${esdomain}/address/${state.receivingAddress}`}>
286 {'View on Etherscan ↗'}
296 {'View on Etherscan ↗'}
287 </Anchor>
297 </Anchor>
288
298