1import { Just, Nothing } from 'folktale/maybe';
2import React from 'react';
3import { Button } from '../components/old/Base';
11} from '../components/old/Base';
12import { Row, Col, H1, P } from '../components/old/Base';
14import { randomPatq, compose } from '../lib/lib';
15import { ROUTE_NAMES } from '../lib/routeNames';
16import { withHistory } from '../store/history';
17import { urbitWalletFromTicket } from '../lib/wallet';
18import { withWallet } from '../store/wallet';
20class Ticket extends React.Component {
31 this.pointPlaceholder = randomPatq(4);
32 this.ticketPlaceholder = randomPatq(8);
34 this.handleTicketInput = this.handleTicketInput.bind(this);
35 this.handlePassphraseInput = this.handlePassphraseInput.bind(this);
36 this.handlePointNameInput = this.handlePointNameInput.bind(this);
39 handleTicketInput(ticket) {
40 this.setState({ ticket });
43 handlePassphraseInput(passphrase) {
44 this.setState({ passphrase });
47 handlePointNameInput(pointName) {
48 if (pointName.length < 15) {
49 this.setState({ pointName });
53 async walletFromTicket(ticket, pointName, passphrase) {
58 const uhdw = await urbitWalletFromTicket(ticket, pointName, passphrase);
59 this.props.setUrbitWallet(Just(uhdw));
67 const { history, wallet } = this.props;
68 const { ticket, pointName, passphrase } = this.state;
70 const phPoint = this.pointPlaceholder;
71 const phTick = this.ticketPlaceholder;
76 <H1>{'Authenticate'}</H1>
79 {`Please enter your point and Urbit master ticket here. This information is written on your Urbit HD paper wallets.`}
85 prop-format="innerLabel"
88 placeholder={`e.g. ${phPoint}`}
90 onChange={this.handlePointNameInput}>
91 <InnerLabel>{'Point'}</InnerLabel>
93 className={'tr-0 mt-05 mr-0 abs'}
101 className="mono mt-8"
103 prop-format="innerLabel"
106 placeholder={`e.g. ${phTick}`}
108 onChange={this.handleTicketInput}>
109 <InnerLabel>{'Ticket'}</InnerLabel>
113 {'If your wallet requires a passphrase, you may enter it below.'}
119 prop-format="innerLabel"
124 onChange={this.handlePassphraseInput}>
125 <InnerLabel>{'Passphrase'}</InnerLabel>
130 prop-size={'lg wide'}
131 disabled={this.state.isUnlocking || Just.hasInstance(wallet)}
133 this.walletFromTicket(ticket, pointName, passphrase)
135 <span className="relative">
136 {this.state.isUnlocking && <span className="btn-spinner" />}
143 prop-size={'xl wide'}
144 disabled={Nothing.hasInstance(wallet)}
145 onClick={() => history.popAndPush(ROUTE_NAMES.SHIPS)}>
154export default compose(
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list