on master help sign in
Clean up compiler warnings
8286dd7Fang
src/bridge/components/StatelessTransaction.js+1−2
@@ -15,7 +15,6 @@ import * as tank from '../lib/tank'
15
15
16import {
16import {
17 sendSignedTransaction,
17 sendSignedTransaction,
18− waitForTransactionConfirm,
19 fromWei,
18 fromWei,
20 toWei,
19 toWei,
21 hexify,
20 hexify,
@@ -195,7 +194,7 @@ class StatelessTransaction extends React.Component {
195 try {
194 try {
196 this.setState({ txStatus: SUBMISSION_STATES.PREPARING });
195 this.setState({ txStatus: SUBMISSION_STATES.PREPARING });
197 const res = await props.beforeSend(stx);
196 const res = await props.beforeSend(stx);
198− if (res === false) throw 'beforeSend disallowed sending';
197+ if (res === false) throw new Error('beforeSend disallowed sending');
199 } catch (e) {
198 } catch (e) {
200 console.log('beforeSend error', e);
199 console.log('beforeSend error', e);
201 this.setState({
200 this.setState({
src/bridge/lib/invite.js−8
@@ -1,16 +1,10 @@
1−import lodash from 'lodash'
2import { Just, Nothing } from 'folktale/maybe'
1import { Just, Nothing } from 'folktale/maybe'
3import Tx from 'ethereumjs-tx'
2import Tx from 'ethereumjs-tx'
4
3
5import * as azimuth from 'azimuth-js'
4import * as azimuth from 'azimuth-js'
6−import * as more from 'more-entropy'
7−import * as ob from 'urbit-ob'
8import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
5import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
9import * as wg from '../../walletgen/lib/lib.js'
6import * as wg from '../../walletgen/lib/lib.js'
10import * as tank from './tank'
7import * as tank from './tank'
11−import { MIN_STAR, MIN_PLANET, SEED_ENTROPY_BITS,
12− GALAXY_ENTROPY_BITS, STAR_ENTROPY_BITS, PLANET_ENTROPY_BITS,
13− } from '../../walletgen/lib/constants'
14
8
15import JSZip from 'jszip'
9import JSZip from 'jszip'
16import saveAs from 'file-saver'
10import saveAs from 'file-saver'
@@ -27,8 +21,6 @@ import {
27 WALLET_NAMES
21 WALLET_NAMES
28} from './wallet'
22} from './wallet'
29
23
30−const SEED_LENGTH_BYTES = SEED_ENTROPY_BITS / 8
31−
32const INVITE_STAGES = {
24const INVITE_STAGES = {
33 INVITE_LOGIN: "invite login",
25 INVITE_LOGIN: "invite login",
34 INVITE_WALLET: "invite wallet",
26 INVITE_WALLET: "invite wallet",
src/bridge/lib/txn.js−1
@@ -1,6 +1,5 @@
1import * as ob from 'urbit-ob'
1import * as ob from 'urbit-ob'
2import { Just } from 'folktale/maybe'
2import { Just } from 'folktale/maybe'
3−import { Ok, Error } from 'folktale/result'
4import Tx from 'ethereumjs-tx'
3import Tx from 'ethereumjs-tx'
5import { toWei, fromWei, toHex } from 'web3-utils'
4import { toWei, fromWei, toHex } from 'web3-utils'
6
5
src/bridge/views/InvitesManage.js+4−2
@@ -96,11 +96,13 @@ class InvitesManage extends React.Component {
96 }
96 }
97
97
98 updatePoolSize(who, size) {
98 updatePoolSize(who, size) {
99− this.state.cachedPoolSizes[who] = size;
99+ const cache = this.state.cachedPoolSizes;
100+ cache[who] = size;
101+ this.setState({ cachedPoolSizes: cache });
100 const target = this.state.targetPlanet;
102 const target = this.state.targetPlanet;
101 const match = Just.hasInstance(target) ? (who === target.value) : false;
103 const match = Just.hasInstance(target) ? (who === target.value) : false;
102 if (match) {
104 if (match) {
103− this.setState({currentPoolSize:Just(size)});
105+ this.setState({ currentPoolSize:Just(size) });
104 }
106 }
105 }
107 }
106
108
src/bridge/views/InvitesSend.js+9−14
@@ -1,14 +1,10 @@
1import { Just, Nothing } from 'folktale/maybe'
1import { Just, Nothing } from 'folktale/maybe'
2import React from 'react'
2import React from 'react'
3−import * as ob from 'urbit-ob'
4import * as azimuth from 'azimuth-js'
3import * as azimuth from 'azimuth-js'
5
4
6import { BRIDGE_ERROR } from '../lib/error'
5import { BRIDGE_ERROR } from '../lib/error'
7import { hasReceived, sendMail } from '../lib/inviteMail'
6import { hasReceived, sendMail } from '../lib/inviteMail'
8−import { Row, Col, Warning, Button, H1, H3,
9− Input, InnerLabel
10−} from '../components/Base'
7+import { Row, Col, Button, Input } from '../components/Base'
11−import StatelessTransaction from '../components/StatelessTransaction'
12import { addressFromSecp256k1Public } from '../lib/wallet'
8import { addressFromSecp256k1Public } from '../lib/wallet'
13
9
14// for wallet generation
10// for wallet generation
@@ -19,14 +15,13 @@ import {
19 signTransaction,
15 signTransaction,
20 sendSignedTransaction,
16 sendSignedTransaction,
21 waitForTransactionConfirm,
17 waitForTransactionConfirm,
22− isTransactionConfirmed,
23 hexify
18 hexify
24} from '../lib/txn'
19} from '../lib/txn'
25import * as tank from '../lib/tank'
20import * as tank from '../lib/tank'
26
21
27−const GAS_PRICE = 20000000000; // we pay the premium for faster ux
22+const GAS_PRICE_GWEI = 20; // we pay the premium for faster ux
28const GAS_LIMIT = 500000; //TODO fine-tune
23const GAS_LIMIT = 500000; //TODO fine-tune
29−const INVITE_COST = (GAS_PRICE * GAS_LIMIT);
24+const INVITE_COST = (GAS_PRICE_GWEI * 1000000000 * GAS_LIMIT);
30
25
31const STATUS = {
26const STATUS = {
32 INPUT: 'Generate invites',
27 INPUT: 'Generate invites',
@@ -162,13 +157,13 @@ class InvitesSend extends React.Component {
162 const signedTx = await signTransaction({
157 const signedTx = await signTransaction({
163 ...this.props,
158 ...this.props,
164 txn: Just(inviteTx),
159 txn: Just(inviteTx),
165− gasPrice: '20', //TODO
160+ gasPrice: GAS_PRICE_GWEI.toString(),
166− gasLimit: '600000', //TODO
161+ gasLimit: GAS_LIMIT.toString(),
167 nonce: nonce + i,
162 nonce: nonce + i,
168 chainId: chainId,
163 chainId: chainId,
169 setStx: () => {}
164 setStx: () => {}
170 });
165 });
171− const rawTx = '0x'+signedTx.serialize().toString('hex');
166+ const rawTx = hexify(signedTx.serialize());
172
167
173 invites.push({recipient, ticket: wallet.ticket, signedTx, rawTx });
168 invites.push({recipient, ticket: wallet.ticket, signedTx, rawTx });
174 this.setEmailStatus(i, EMAIL_STATUS.DONE);
169 this.setEmailStatus(i, EMAIL_STATUS.DONE);
@@ -234,8 +229,9 @@ class InvitesSend extends React.Component {
234 }
229 }
235
230
236 setEmailStatus(i, status) {
231 setEmailStatus(i, status) {
232+ const targets = this.state.targets;
237− this.state.targets[i].status = Just(status);
233+ targets[i].status = Just(status);
238− this.setState({ targets: this.state.targets });
234+ this.setState({ targets });
239 }
235 }
240
236
241 askForFunding(address, minBalance, balance) {
237 askForFunding(address, minBalance, balance) {
@@ -282,7 +278,6 @@ class InvitesSend extends React.Component {
282
278
283 addTarget() {
279 addTarget() {
284 let targets = this.state.targets;
280 let targets = this.state.targets;
285− let i = targets.length;
286 targets.push({ email: '', hasReceived: Nothing(), status: Nothing() });
281 targets.push({ email: '', hasReceived: Nothing(), status: Nothing() });
287 this.setState({ targets });
282 this.setState({ targets });
288 }
283 }
src/bridge/views/IssueChild.js+6−8
@@ -3,9 +3,11 @@ import React from 'react'
3import { azimuth, ecliptic } from 'azimuth-js'
3import { azimuth, ecliptic } from 'azimuth-js'
4import * as ob from 'urbit-ob'
4import * as ob from 'urbit-ob'
5
5
6+import {
6−import { Row, Col, H1, P, Anchor } from '../components/Base'
7+ Row, Col, H1, P, Anchor,
7−import { Button, ShowBlockie, ValidatedSigil } from '../components/Base'
8+ ShowBlockie, ValidatedSigil,
8−import { PointInput, AddressInput, InnerLabel } from '../components/Base'
9+ PointInput, AddressInput, InnerLabel
10+} from '../components/Base'
9
11
10import StatelessTransaction from '../components/StatelessTransaction'
12import StatelessTransaction from '../components/StatelessTransaction'
11
13
@@ -14,11 +16,7 @@ import { BRIDGE_ERROR } from '../lib/error'
14import { getSpawnCandidate } from '../lib/child'
16import { getSpawnCandidate } from '../lib/child'
15import { canDecodePatp } from '../lib/txn'
17import { canDecodePatp } from '../lib/txn'
16
18
17−import {
18− ETH_ZERO_ADDR,
19− isValidAddress,
19+import { isValidAddress } from '../lib/wallet'
20− eqAddr
21−} from '../lib/wallet'
22
20
23const setFind = (set, pred) => {
21const setFind = (set, pred) => {
24 for (const e of set) {
22 for (const e of set) {
src/bridge/views/Point.js+1−1
@@ -73,7 +73,7 @@ class Point extends React.Component {
73 render() {
73 render() {
74
74
75 const {
75 const {
76− web3, popRoute, pushRoute, wallet, contracts,
76+ web3, popRoute, pushRoute, wallet,
77 setPointCursor, pointCursor, pointCache
77 setPointCursor, pointCursor, pointCache
78 } = this.props;
78 } = this.props;
79
79
src/bridge/views/Point/Actions.js+1−1
@@ -18,7 +18,7 @@ const isStar = point =>
18
18
19const Actions = (props) => {
19const Actions = (props) => {
20 const {
20 const {
21− pushRoute, online, wallet, delegatedSending,
21+ pushRoute, online, wallet,
22 point, pointDetails, invites
22 point, pointDetails, invites
23 } = props
23 } = props
24
24