@@ -2,29 +2,21 @@ import React from 'react'
2import Maybe from 'folktale/maybe'
2import Maybe from 'folktale/maybe'
3import * as azimuth from 'azimuth-js'
3import * as azimuth from 'azimuth-js'
4import * as ob from 'urbit-ob'
4import * as ob from 'urbit-ob'
5+import * as n from '../lib/need'
5import { Row, Col, H1, P, Warning, CheckboxButton } from '../components/Base'
6import { Row, Col, H1, P, Warning, CheckboxButton } from '../components/Base'
7import StatelessTransaction from '../components/StatelessTransaction'
8import StatelessTransaction from '../components/StatelessTransaction'
8−import { BRIDGE_ERROR } from '../lib/error'
9import { attemptSeedDerivation } from '../lib/keys'
9import { attemptSeedDerivation } from '../lib/keys'
11import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
11import * as kg from '../../../node_modules/urbit-key-generation/dist/index'
14− addressFromSecp256k1Public,
16−} from '../lib/wallet'
13+import { addHexPrefix } from '../lib/wallet'
18class SetKeys extends React.Component {
15class SetKeys extends React.Component {
19 constructor(props) {
16 constructor(props) {
20 super(props)
17 super(props)
22− const point = props.pointCursor.matchWith({
19+ const point = n.needPointCursor(props);
23− Just: (shp) => shp.value,
25− throw BRIDGE_ERROR.MISSING_POINT
29 this.state = {
21 this.state = {
@@ -51,12 +43,7 @@ class SetKeys extends React.Component {
52 this.deriveSeed()
44 this.deriveSeed()
54− const addr = props.wallet.matchWith({
46+ const addr = n.needAddress(props);
55− Just: wal => wal.value.address,
57− throw BRIDGE_ERROR.MISSING_WALLET
61 this.determineManagementSeed(props.contracts.value, addr)
48 this.determineManagementSeed(props.contracts.value, addr)
@@ -101,19 +88,9 @@ class SetKeys extends React.Component {
101 createUnsignedTxn() {
88 createUnsignedTxn() {
102 const { state, props } = this
89 const { state, props } = this
104− const validContracts = props.contracts.matchWith({
91+ const validContracts = n.needContracts(props);
105− Just: (cs) => cs.value,
107− throw BRIDGE_ERROR.MISSING_CONTRACTS
111− const validPoint = props.pointCursor.matchWith({
93+ const validPoint = n.needPointCursor(props);
112− Just: (shp) => shp.value,
114− throw BRIDGE_ERROR.MISSING_POINT
118 const hexRegExp = /[0-9A-Fa-f]{64}/g
95 const hexRegExp = /[0-9A-Fa-f]{64}/g
@@ -146,10 +123,7 @@ class SetKeys extends React.Component {
146 state.networkSeed.length === 64
123 state.networkSeed.length === 64
147 && state.networkSeed.length === 64
124 && state.networkSeed.length === 64
149− const pointDetails =
126+ const pointDetails = n.needFromPointCache(props, state.point);
150− state.point in props.pointCache
151− ? props.pointCache[state.point]
152− : (() => { throw BRIDGE_ERROR.MISSING_POINT })()