diff --git a/src/components/admin-lte/configure/index.js b/src/components/admin-lte/configure/index.js index d1b5878..bc2d247 100644 --- a/src/components/admin-lte/configure/index.js +++ b/src/components/admin-lte/configure/index.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types' import { Content, Row, Col, Box, Inputs, Button } from 'adminlte-2-react' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import BchWallet from 'minimal-slp-wallet' - +import Servers from './servers' const { Text } = Inputs let _this @@ -104,6 +104,11 @@ class Configure extends React.Component { + ) } @@ -130,13 +135,19 @@ class Configure extends React.Component { async handleUpdateJWT () { try { - const { mnemonic } = _this.props.walletInfo + const { mnemonic, selectedServer } = _this.props.walletInfo const apiToken = _this.state.JWT // Update instance with JWT if (mnemonic && apiToken) { + const bchjsOptions = { apiToken: apiToken } + if (selectedServer) { + bchjsOptions.restURL = selectedServer + } + + console.log('bchjs options : ', bchjsOptions) const bchWalletLib = new _this.BchWallet(mnemonic) - bchWalletLib.bchjs = new bchWalletLib.BCHJS({ apiToken: apiToken }) + bchWalletLib.bchjs = new bchWalletLib.BCHJS(bchjsOptions) _this.props.setBchWallet(bchWalletLib) } diff --git a/src/components/admin-lte/configure/servers.js b/src/components/admin-lte/configure/servers.js new file mode 100644 index 0000000..207d20b --- /dev/null +++ b/src/components/admin-lte/configure/servers.js @@ -0,0 +1,271 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { Row, Col, Box, Inputs, Button } from 'adminlte-2-react' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import BchWallet from 'minimal-slp-wallet' + +const { Text, Select } = Inputs + +let _this +class Servers extends React.Component { + constructor (props) { + super(props) + + _this = this + + this.state = { + selectOptions: [], + errMsg: '', + selectedServer: '', + showAddField: false, + newServer: '' + } + _this.BchWallet = BchWallet + } + + render () { + return ( + + + + + +

+ + Back End Server +

+ + + + {_this.state.showAddField ? ( + + } + /> + ) : ( +