@@ -1,7 +1,7 @@
1import Maybe from 'folktale/maybe'
1import Maybe from 'folktale/maybe'
2import React from 'react'
2import React from 'react'
3import * as azimuth from 'azimuth-js'
3import * as azimuth from 'azimuth-js'
4−import { Row, Col, H1, P, InnerLabel, ShowBlockie, Anchor } from '../components/Base'
4+import { Row, Col, H1, P, InnerLabel, ShowBlockie, Anchor, HorizontalSelector } from '../components/Base'
5import { AddressInput } from '../components/Base'
5import { AddressInput } from '../components/Base'
6import * as ob from 'urbit-ob'
6import * as ob from 'urbit-ob'
@@ -46,13 +46,23 @@ class SetProxy extends React.Component {
46 this.state = {
46 this.state = {
47 proxyAddress: '',
47 proxyAddress: '',
48 issuingPoint: issuingPoint,
48 issuingPoint: issuingPoint,
51 this.statelessRef = React.createRef();
52 this.statelessRef = React.createRef();
53+ this.handleSetUnset = this.handleSetUnset.bind(this);
52 this.handleAddressInput = this.handleAddressInput.bind(this)
54 this.handleAddressInput = this.handleAddressInput.bind(this)
53 this.createUnsignedTxn = this.createUnsignedTxn.bind(this)
55 this.createUnsignedTxn = this.createUnsignedTxn.bind(this)
58+ handleSetUnset(selected) {
59+ const set = (selected === 'set');
62+ proxyAddress: set ? '' : '0x0000000000000000000000000000000000000000'
56 handleAddressInput(proxyAddress) {
66 handleAddressInput(proxyAddress) {
57 this.setState({ proxyAddress })
67 this.setState({ proxyAddress })
@@ -116,42 +126,61 @@ class SetProxy extends React.Component {
117 const ucFirst = w => w.charAt(0).toUpperCase() + w.slice(1);
127 const ucFirst = w => w.charAt(0).toUpperCase() + w.slice(1);
130+ { title: 'Set', value: 'set' },
131+ { title: 'Unset', value: 'unset' }
134+ const titleVerb = this.state.setProxy ? 'Set' : 'Unset';
136+ let addressInput = null;
137+ if (this.state.setProxy) {
139+ <P className='mt-8'>
141+ 'Please provide an Ethereum address to act as the ' +
142+ `${renderedProxyType} proxy. You can also use Wallet ` +
143+ 'Generator to generate a keypair.'
148+ className='mono mt-8'
150+ prop-format='innerLabel'
151+ placeholder={ `e.g. 0x84295d5e054d8cff5a22428b195f5a1615bd644f` }
152+ value={ state.proxyAddress }
153+ onChange={ v => this.handleAddressInput(v) }>
154+ <InnerLabel>{ 'Proxy Address' }</InnerLabel>
155+ <ShowBlockie className={'mt-1'} address={state.proxyAddress} />
161+ prop-disabled={!isValidAddress(state.proxyAddress) || !esvisible}
163+ href={`https://${esdomain}/address/${state.proxyAddress}`}>
164+ {'View on Etherscan ↗'}
124− { `Set ${ucFirst(renderedProxyType)} Proxy For ` }
173+ { `${titleVerb} ${ucFirst(renderedProxyType)} Proxy For ` }
125 <code>{ `${ob.patp(state.issuingPoint)}` }</code>
174 <code>{ `${ob.patp(state.issuingPoint)}` }</code>
128− <P>
177+ <HorizontalSelector
129− {
178+ options={setUnset}
130− 'Please provide an Ethereum address to act as the ' +
131− `${renderedProxyType} proxy. You can also use Wallet ` +
132− 'Generator to generate a keypair.'
137− className='mono mt-8'
139− prop-format='innerLabel'
140− placeholder={ `e.g. 0x84295d5e054d8cff5a22428b195f5a1615bd644f` }
141− value={ state.proxyAddress }
142− onChange={ v => this.handleAddressInput(v) }>
179+ onChange={this.handleSetUnset}
143− <InnerLabel>{ 'Proxy Address' }</InnerLabel>
180+ className='mt-8'
144− <ShowBlockie className={'mt-1'} address={state.proxyAddress} />
181+ />
146−
183+ { addressInput }
150− prop-disabled={!isValidAddress(state.proxyAddress) || !esvisible}
152− href={`https://${esdomain}/address/${state.proxyAddress}`}>
153− {'View on Etherscan ↗'}
156 <StatelessTransaction
185 <StatelessTransaction
157 // Upper scope
186 // Upper scope