on master help sign in
- Fix most ESLint warnings
643f715Chris Johnson
src/Root.js+1−1
@@ -5,7 +5,7 @@ import _ from 'lodash'
5
5
6import Bridge from './bridge/Bridge'
6import Bridge from './bridge/Bridge'
7import Walletgen from './walletgen/Walletgen'
7import Walletgen from './walletgen/Walletgen'
8−import { AppNavigation } from './common/components/AppNavigation'
8+// import { AppNavigation } from './common/components/AppNavigation'
9
9
10import './common/style/index.css'
10import './common/style/index.css'
11import './bridge/style/index.css'
11import './bridge/style/index.css'
src/bridge/components/Header.js+1−1
@@ -1,7 +1,7 @@
1import React from 'react'
1import React from 'react'
2import { Button, Chevron } from '../components/Base'
2import { Button, Chevron } from '../components/Base'
3
3
4−import { renderRoute, ROUTE_NAMES } from '../lib/router'
4+import { renderRoute } from '../lib/router'
5import { isLast } from '../lib/lib'
5import { isLast } from '../lib/lib'
6
6
7const Crumbs = (props) => {
7const Crumbs = (props) => {
src/bridge/lib/invite.js+9−28
@@ -7,32 +7,25 @@ import * as more from 'more-entropy'
7import * as ob from 'urbit-ob'
7import * as ob from 'urbit-ob'
8import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
8import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
9import * as tank from './tank'
9import * as tank from './tank'
10−import { MAX_GALAXY, MIN_STAR, MAX_STAR, MIN_PLANET,
10+import { MIN_STAR, MIN_PLANET, SEED_ENTROPY_BITS,
11 GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
11 GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
12− SEED_ENTROPY_BITS,
13− GEN_STATES
14 } from '../../walletgen/lib/constants'
12 } from '../../walletgen/lib/constants'
15
13
16import JSZip from 'jszip'
14import JSZip from 'jszip'
17import saveAs from 'file-saver'
15import saveAs from 'file-saver'
18
16
19import {
17import {
20− signTransaction,
21− sendSignedTransaction,
22 waitForTransactionConfirm,
18 waitForTransactionConfirm,
23 isTransactionConfirmed
19 isTransactionConfirmed
24} from './txn'
20} from './txn'
25import { BRIDGE_ERROR } from './error'
21import { BRIDGE_ERROR } from './error'
26−import { attemptSeedDerivation, genKey } from './keys'
22+import { attemptSeedDerivation } from './keys'
27import {
23import {
28− EthereumWallet,
29 addressFromSecp256k1Public,
24 addressFromSecp256k1Public,
30− urbitWalletFromTicket,
31 addHexPrefix,
25 addHexPrefix,
32 WALLET_NAMES
26 WALLET_NAMES
33} from './wallet'
27} from './wallet'
34
28
35−const NEXT_STEP_NUM = 6;
36const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
29const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
37
30
38const INVITE_STAGES = {
31const INVITE_STAGES = {
@@ -173,7 +166,7 @@ async function downloadWallet(paper) {
173}
166}
174
167
175async function startTransactions(args) {
168async function startTransactions(args) {
176− let { realPointM, web3M, contractsM, realTicket,
169+ let { realPointM, web3M, contractsM,
177 inviteWalletM, realWalletM, setUrbitWallet, updateProgress } = args
170 inviteWalletM, realWalletM, setUrbitWallet, updateProgress } = args
178
171
179 if (Nothing.hasInstance(web3M)) {
172 if (Nothing.hasInstance(web3M)) {
@@ -191,10 +184,12 @@ async function startTransactions(args) {
191 }
184 }
192 const inviteWallet = inviteWalletM.value;
185 const inviteWallet = inviteWalletM.value;
193
186
194− // if (Nothing.hasInstance(realWalletM)) {
187+ if (Nothing.hasInstance(realWalletM)) {
195− // throw BRIDGE_ERROR.MISSING_WALLET;
188+ throw BRIDGE_ERROR.MISSING_WALLET;
196− // }
189+ }
197− // const realWallet = realWalletM.value;
190+ const realWallet = realWalletM.value;
191+
192+ // const realWallet = await urbitWalletFromTicket(args.realTicket, point);
198
193
199 if (Nothing.hasInstance(realPointM)) {
194 if (Nothing.hasInstance(realPointM)) {
200 throw BRIDGE_ERROR.MISSING_POINT;
195 throw BRIDGE_ERROR.MISSING_POINT;
@@ -204,8 +199,6 @@ async function startTransactions(args) {
204 const inviteAddress = addressFromSecp256k1Public(inviteWallet.publicKey);
199 const inviteAddress = addressFromSecp256k1Public(inviteWallet.publicKey);
205 console.log('working as', inviteAddress);
200 console.log('working as', inviteAddress);
206
201
207− const realWallet = await urbitWalletFromTicket(realTicket, point);
208−
209 // transfer from invite wallet to new wallet
202 // transfer from invite wallet to new wallet
210
203
211 let transferTx = azimuth.ecliptic.transferPoint(contracts, point, realWallet.ownership.keys.address);
204 let transferTx = azimuth.ecliptic.transferPoint(contracts, point, realWallet.ownership.keys.address);
@@ -428,18 +421,6 @@ async function sendAndAwaitConfirm(web3, signedTxs) {
428 }));
421 }));
429}
422}
430
423
431−function awaitForResult(desired, retryTime, func) {
432− return new Promise((resolve, reject) => {
433− const retry = async () => {
434− const result = await func();
435− console.log('result vs desired', result, desired);
436− if (result === desired) resolve();
437− else setTimeout(retry, retryTime);
438− };
439− retry();
440− });
441−}
442−
443function askForFunding(address, amount, current, updateProgress) {
424function askForFunding(address, amount, current, updateProgress) {
444 updateProgress({
425 updateProgress({
445 type: "notify",
426 type: "notify",
src/bridge/lib/txn.js−1
@@ -2,7 +2,6 @@ import * as ob from 'urbit-ob'
2import { Just } from 'folktale/maybe'
2import { Just } from 'folktale/maybe'
3import { Ok, Error } from 'folktale/result'
3import { Ok, Error } from 'folktale/result'
4import Tx from 'ethereumjs-tx'
4import Tx from 'ethereumjs-tx'
5−import Web3 from 'web3'
6import { toWei, fromWei, toHex } from 'web3-utils'
5import { toWei, fromWei, toHex } from 'web3-utils'
7
6
8import { BRIDGE_ERROR } from '../lib/error'
7import { BRIDGE_ERROR } from '../lib/error'
src/bridge/views/InviteTicket.js+2−13
@@ -1,13 +1,10 @@
1import { Just, Nothing } from 'folktale/maybe'
1import { Just, Nothing } from 'folktale/maybe'
2import React from 'react'
2import React from 'react'
3−import { InnerLabel, ValidatedSigil, PointInput, Warning, Input, TicketInput,
3+import { InnerLabel, Warning, TicketInput,
4− VerifyTicketInput, Button, Row, Col, H1, P, Passport } from '../components/Base'
4+ VerifyTicketInput, Button, Row, Col, Passport } from '../components/Base'
5−import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
6−import * as ob from 'urbit-ob'
7import * as azimuth from 'azimuth-js'
5import * as azimuth from 'azimuth-js'
8
6
9import { randomPatq } from '../lib/lib'
7import { randomPatq } from '../lib/lib'
10−import { simpleValidatorWrapper } from '../lib/validators'
11import { ROUTE_NAMES } from '../lib/router'
8import { ROUTE_NAMES } from '../lib/router'
12import { DEFAULT_HD_PATH, urbitWalletFromTicket,
9import { DEFAULT_HD_PATH, urbitWalletFromTicket,
13 walletFromMnemonic, addressFromSecp256k1Public } from '../lib/wallet'
10 walletFromMnemonic, addressFromSecp256k1Public } from '../lib/wallet'
@@ -252,11 +249,6 @@ class InviteTicket extends React.Component {
252 }
249 }
253 : stage === INVITE_STAGES.INVITE_VERIFY
250 : stage === INVITE_STAGES.INVITE_VERIFY
254 ? () => {
251 ? () => {
255− const realTicket = realWallet.matchWith({
256− Just: w => w.value.ticket,
257− Nothing: null
258− })
259−
260 this.setState({
252 this.setState({
261 stage: INVITE_STAGES.INVITE_TRANSACTIONS,
253 stage: INVITE_STAGES.INVITE_TRANSACTIONS,
262 walletStates: this.state.walletStates.concat(WALLET_STATES.TRANSACTIONS)
254 walletStates: this.state.walletStates.concat(WALLET_STATES.TRANSACTIONS)
@@ -329,9 +321,6 @@ class InviteTicket extends React.Component {
329 }
321 }
330
322
331 render() {
323 render() {
332− const { wallet } = this.props
333− const { inviteTicket } = this.state
334−
335 let stageDisplay = this.getStageDisplay()
324 let stageDisplay = this.getStageDisplay()
336 let stageText = this.getStageText()
325 let stageText = this.getStageText()
337 let ticketElem = this.getTicketElement()
326 let ticketElem = this.getTicketElement()
src/bridge/views/InvitesManage.js+2−15
@@ -1,24 +1,11 @@
1import { Just, Nothing } from 'folktale/maybe'
1import { Just, Nothing } from 'folktale/maybe'
2import React from 'react'
2import React from 'react'
3−import { pour } from 'sigil-js'
4import * as ob from 'urbit-ob'
3import * as ob from 'urbit-ob'
5import * as azimuth from 'azimuth-js'
4import * as azimuth from 'azimuth-js'
6
5
7−import {
8− EthereumWallet,
9− addressFromSecp256k1Public,
10− urbitWalletFromTicket,
11− addHexPrefix,
12− WALLET_NAMES
13−} from '../lib/wallet'
14−
15−import ReactSVGComponents from '../components/ReactSVGComponents'
16−import KeysAndMetadata from './Point/KeysAndMetadata'
17−import Actions from './Point/Actions'
18import { BRIDGE_ERROR } from '../lib/error'
6import { BRIDGE_ERROR } from '../lib/error'
19−import { Row, Col, Warning, Button, H1, H3, Input,
7+import { Row, Col, Warning, Input,
20− PointInput, InnerLabel, ValidatedSigil
8+ PointInput, InnerLabel, ValidatedSigil } from '../components/Base'
21−} from '../components/Base'
22import StatelessTransaction from '../components/StatelessTransaction'
9import StatelessTransaction from '../components/StatelessTransaction'
23
10
24
11
src/bridge/views/InvitesSend.js+2−27
@@ -1,40 +1,16 @@
1import { Just, Nothing } from 'folktale/maybe'
1import { Just, Nothing } from 'folktale/maybe'
2import React from 'react'
2import React from 'react'
3−import { pour } from 'sigil-js'
4import * as ob from 'urbit-ob'
3import * as ob from 'urbit-ob'
5import * as azimuth from 'azimuth-js'
4import * as azimuth from 'azimuth-js'
6
5
7−import {
8− EthereumWallet,
9− addressFromSecp256k1Public,
10− urbitWalletFromTicket,
11− addHexPrefix,
12− WALLET_NAMES
13−} from '../lib/wallet'
14−
15−import ReactSVGComponents from '../components/ReactSVGComponents'
16−import KeysAndMetadata from './Point/KeysAndMetadata'
17−import Actions from './Point/Actions'
18import { BRIDGE_ERROR } from '../lib/error'
6import { BRIDGE_ERROR } from '../lib/error'
19import { sendMail } from '../lib/inviteMail'
7import { sendMail } from '../lib/inviteMail'
20−import { Row, Col, Warning, Button, H1, H3,
21− Input, InnerLabel
22−} from '../components/Base'
8+import { Row, Col, Input, InnerLabel } from '../components/Base'
23import StatelessTransaction from '../components/StatelessTransaction'
9import StatelessTransaction from '../components/StatelessTransaction'
24
10
25// for wallet generation
11// for wallet generation
26import * as wg from '../../walletgen/lib/lib'
12import * as wg from '../../walletgen/lib/lib'
27
13
28−// for transaction generation and signing
29−import {
30− signTransaction,
31− sendSignedTransaction,
32− waitForTransactionConfirm,
33− isTransactionConfirmed
34−} from '../lib/txn'
35−import * as tank from '../lib/tank'
36−import Tx from 'ethereumjs-tx'
37−
38class InvitesSend extends React.Component {
14class InvitesSend extends React.Component {
39
15
40 constructor(props) {
16 constructor(props) {
@@ -165,14 +141,13 @@ class InvitesSend extends React.Component {
165 }
141 }
166
142
167 render() {
143 render() {
168−
169 const inviteStatus = this.state.invitesAvailable.matchWith({
144 const inviteStatus = this.state.invitesAvailable.matchWith({
170 Nothing: () => 'Loading...',
145 Nothing: () => 'Loading...',
171 Just: (invites) => {
146 Just: (invites) => {
172 let res = `${invites.value} invites available`;
147 let res = `${invites.value} invites available`;
173 return res + this.state.fromPool.matchWith({
148 return res + this.state.fromPool.matchWith({
174 Nothing: () => '',
149 Nothing: () => '',
175− Just: (pool) => (pool.value == this.point)
150+ Just: (pool) => (pool.value === this.point)
176 ? ''
151 ? ''
177 : ` (from ${ob.patp(pool.value)})`
152 : ` (from ${ob.patp(pool.value)})`
178 });
153 });
src/bridge/views/Shards.js+1−1
@@ -14,7 +14,7 @@ import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
14import * as ob from 'urbit-ob'
14import * as ob from 'urbit-ob'
15
15
16import { ROUTE_NAMES } from '../lib/router'
16import { ROUTE_NAMES } from '../lib/router'
17−import { DEFAULT_HD_PATH, urbitWalletFromTicket } from '../lib/wallet'
17+import { urbitWalletFromTicket } from '../lib/wallet'
18
18
19const placeholder = (len) => {
19const placeholder = (len) => {
20 let bytes = window.crypto.getRandomValues(new Uint8Array(len))
20 let bytes = window.crypto.getRandomValues(new Uint8Array(len))
src/bridge/views/Ticket.js+1−3
@@ -10,12 +10,10 @@ import {
10 InputCaption
10 InputCaption
11 } from '../components/Base'
11 } from '../components/Base'
12import { Row, Col, H1, P } from '../components/Base'
12import { Row, Col, H1, P } from '../components/Base'
13−import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
14−import * as ob from 'urbit-ob'
15
13
16import { randomPatq } from '../lib/lib'
14import { randomPatq } from '../lib/lib'
17import { ROUTE_NAMES } from '../lib/router'
15import { ROUTE_NAMES } from '../lib/router'
18−import { DEFAULT_HD_PATH, urbitWalletFromTicket } from '../lib/wallet'
16+import { urbitWalletFromTicket } from '../lib/wallet'
19
17
20class Ticket extends React.Component {
18class Ticket extends React.Component {
21
19
src/walletgen/lib/lib.js+1−3
@@ -4,10 +4,8 @@ import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
4import * as more from 'more-entropy'
4import * as more from 'more-entropy'
5import lodash from 'lodash'
5import lodash from 'lodash'
6import {
6import {
7− MAX_GALAXY, MIN_STAR, MAX_STAR, MIN_PLANET,
7+ MIN_STAR, MIN_PLANET, SEED_ENTROPY_BITS,
8 GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
8 GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
9− SEED_ENTROPY_BITS,
10− GEN_STATES
11} from './constants'
9} from './constants'
12
10
13const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
11const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
src/walletgen/views/Generate.js+1−9
@@ -1,6 +1,4 @@
1import React from 'react'
1import React from 'react'
2−import * as more from 'more-entropy'
3−import lodash from 'lodash'
4import * as sigil from 'sigil-js'
2import * as sigil from 'sigil-js'
5import ob from 'urbit-ob'
3import ob from 'urbit-ob'
6import classnames from 'classnames'
4import classnames from 'classnames'
@@ -11,16 +9,10 @@ import Button from '../components/Button'
11import ReactSVGComponents from '../components/ReactSVGComponents'
9import ReactSVGComponents from '../components/ReactSVGComponents'
12import PaperCollateralRenderer from 'PaperCollateralRenderer'
10import PaperCollateralRenderer from 'PaperCollateralRenderer'
13
11
14−import { MAX_GALAXY, MIN_STAR, MAX_STAR, MIN_PLANET,
12+import { MAX_GALAXY, MIN_STAR, MAX_STAR, GEN_STATES } from '../lib/constants'
15− GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
16− SEED_ENTROPY_BITS,
17− GEN_STATES
18− } from '../lib/constants'
19
13
20−const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
21const NEXT_STEP_NUM = 6;
14const NEXT_STEP_NUM = 6;
22
15
23−
24const shipInfo = ship => {
16const shipInfo = ship => {
25 const name = ob.patp(ship)
17 const name = ob.patp(ship)
26 const sig = sigil.pour({
18 const sig = sigil.pour({