@@ -49,10 +49,7 @@ class StatelessTransaction extends React.Component {
49 this.setGasLimit = this.setGasLimit.bind(this)
49 this.setGasLimit = this.setGasLimit.bind(this)
50 this.rangeChange = this.rangeChange.bind(this)
50 this.rangeChange = this.rangeChange.bind(this)
51 this.toggleGasDetails = this.toggleGasDetails.bind(this)
51 this.toggleGasDetails = this.toggleGasDetails.bind(this)
52− this.toggleChainDropdown = this.toggleChainDropdown.bind(this)
52+ this.handleChainUpdate = this.handleChainUpdate.bind(this)
53− this.closeChainDropdown = this.closeChainDropdown.bind(this)
54− this.selectChain = this.selectChain.bind(this)
55− this.openCustomChain = this.openCustomChain.bind(this)
58 componentDidMount() {
55 componentDidMount() {
@@ -113,31 +110,17 @@ class StatelessTransaction extends React.Component {
116− openCustomChain() {
113+ handleChainUpdate(chainId) {
114+ if (chainId === "custom") {
117− this.setState({
115+ this.setState({
118− chainDropdownOpen: false,
119− customChain: true
116+ customChain: true
123− toggleChainDropdown() {
125− chainDropdownOpen: !this.state.chainDropdownOpen
129− closeChainDropdown() {
130− this.setState({
119+ this.setState({
131− chainDropdownOpen: false
120+ customChain: false,
135− selectChain(chainId) {
137− chainId,
121+ chainId
138− chainDropdownOpen: false,
122+ })
143 setUserApproval(){
126 setUserApproval(){
@@ -219,14 +202,54 @@ class StatelessTransaction extends React.Component {
219 this.submit()
202 this.submit()
205+ getChainTitle(chainId) {
212+ "1337": "Geth private chains - 1337",
221+ title: this.getChainTitle("1"),
224+ title: this.getChainTitle("2"),
227+ title: this.getChainTitle("3"),
230+ title: this.getChainTitle("4"),
233+ title: this.getChainTitle("42"),
236+ title: this.getChainTitle("1337"),
239+ title: this.getChainTitle("custom"),
222 render() {
244 render() {
223 const { web3, canGenerate } = this.props
245 const { web3, canGenerate } = this.props
224 const { gasPrice, gasLimit, nonce, chainId,
246 const { gasPrice, gasLimit, nonce, chainId,
225 txn, stx, userApproval, showGasDetails,
247 txn, stx, userApproval, showGasDetails,
226 customChain, chainDropdownOpen } = this.state
248 customChain, chainDropdownOpen } = this.state
228− const { setNonce, setChainId, setGasLimit, setGasPrice, toggleGasDetails,
250+ const { setNonce, setChainId, setGasLimit, setGasPrice,
229− setUserApproval, sendTxn, createUnsignedTxn, selectChain } = this
251+ toggleGasDetails, setUserApproval, sendTxn, createUnsignedTxn,
252+ selectChain, handleChainUpdate } = this
231 const { state } = this
254 const { state } = this
@@ -234,6 +257,8 @@ class StatelessTransaction extends React.Component {
234 const canApprove = Just.hasInstance(stx)
257 const canApprove = Just.hasInstance(stx)
235 const canSend = Just.hasInstance(stx) && userApproval === true
258 const canSend = Just.hasInstance(stx) && userApproval === true
260+ const chainOptions = this.getChainOptions()
237 const generateButtonColor =
262 const generateButtonColor =
238 Nothing.hasInstance(txn)
263 Nothing.hasInstance(txn)
@@ -340,66 +365,16 @@ class StatelessTransaction extends React.Component {
340 </InnerLabel>
365 </InnerLabel>
343− const chainDialogueTitle = customChain ? "Custom" : chainId
368+ const chainDialogueTitle = customChain ? "Custom" : this.getChainTitle(chainId)
344 const chainDialogue =
369 const chainDialogue =
345 <InnerLabelDropdown
370 <InnerLabelDropdown
346 className={'mt-6'}
371 className={'mt-6'}
347− handleToggle={this.toggleChainDropdown}
348− handleClose={this.closeChainDropdown}
349 fullWidth={true}
372 fullWidth={true}
350− isOpen={chainDropdownOpen}
351 title={'Chain ID'}
373 title={'Chain ID'}
374+ options={chainOptions}
375+ handleUpdate={handleChainUpdate}
352 currentSelectionTitle={chainDialogueTitle}
376 currentSelectionTitle={chainDialogueTitle}
355− isSelected={ false }
356− onClick={() => selectChain("1")}
363− onClick={() => selectChain("2")}
370− onClick={() => selectChain("3")}
377− onClick={() => selectChain("4")}
384− onClick={() => selectChain("42")}
391− onClick={() => selectChain("1337")}
393− {'1337 - Geth private chains'}
398− onClick={this.openCustomChain}
403 </InnerLabelDropdown>
378 </InnerLabelDropdown>
405 const customChainDialogue = !customChain ? null :
380 const customChainDialogue = !customChain ? null :