@@ -2,29 +2,21 @@ import React from 'react'
22import Maybe from 'folktale/maybe'
33import * as azimuth from 'azimuth-js'
44import * as ob from 'urbit-ob'
5+import * as n from '../lib/need'
56import { Row, Col, H1, P, Warning, CheckboxButton } from '../components/Base'
67
78import StatelessTransaction from '../components/StatelessTransaction'
8−import { BRIDGE_ERROR } from '../lib/error'
99import { attemptSeedDerivation } from '../lib/keys'
1010
1111import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
1212
13−import {
14− addressFromSecp256k1Public,
15− addHexPrefix
16−} from '../lib/wallet'
13+import { addHexPrefix } from '../lib/wallet'
1714
1815class SetKeys extends React.Component {
1916 constructor(props) {
2017 super(props)
2118
22− const point = props.pointCursor.matchWith({
23− Just: (shp) => shp.value,
24− Nothing: () => {
25− throw BRIDGE_ERROR.MISSING_POINT
26− }
27− })
19+ const point = n.needPointCursor(props);
2820
2921 this.state = {
3022 auth: '',
@@ -51,12 +43,7 @@ class SetKeys extends React.Component {
5143
5244 this.deriveSeed()
5345
54− const addr = props.wallet.matchWith({
55− Just: wal => wal.value.address,
56− Nothing: () => {
57− throw BRIDGE_ERROR.MISSING_WALLET
58− }
59− })
46+ const addr = n.needAddress(props);
6047
6148 this.determineManagementSeed(props.contracts.value, addr)
6249 }
@@ -101,19 +88,9 @@ class SetKeys extends React.Component {
10188 createUnsignedTxn() {
10289 const { state, props } = this
10390
104− const validContracts = props.contracts.matchWith({
105− Just: (cs) => cs.value,
106− Nothing: () => {
107− throw BRIDGE_ERROR.MISSING_CONTRACTS
108− }
109− })
91+ const validContracts = n.needContracts(props);
11092
111− const validPoint = props.pointCursor.matchWith({
112− Just: (shp) => shp.value,
113− Nothing: () => {
114− throw BRIDGE_ERROR.MISSING_POINT
115− }
116− })
93+ const validPoint = n.needPointCursor(props);
11794
11895 const hexRegExp = /[0-9A-Fa-f]{64}/g
11996
@@ -146,10 +123,7 @@ class SetKeys extends React.Component {
146123 state.networkSeed.length === 64
147124 && state.networkSeed.length === 64
148125
149− const pointDetails =
150− state.point in props.pointCache
151− ? props.pointCache[state.point]
152− : (() => { throw BRIDGE_ERROR.MISSING_POINT })()
126+ const pointDetails = n.needFromPointCache(props, state.point);
153127
154128 return (
155129 <Row>