on master help sign in
invite: throw error if logged in with mnemonic key
f3545aayosoyubik
src/lib/useRoller.ts+6
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
2import * as azimuth from 'azimuth-js';
2import * as azimuth from 'azimuth-js';
3import * as need from 'lib/need';
3import * as need from 'lib/need';
4import * as ob from 'urbit-ob';
4import * as ob from 'urbit-ob';
5+import { Just } from 'folktale/maybe';
5
6
6import { Invite } from 'lib/types/Invite';
7import { Invite } from 'lib/types/Invite';
7import { convertToInt } from './convertToInt';
8import { convertToInt } from './convertToInt';
@@ -141,6 +142,11 @@ export default function useRoller() {
141 throw new Error('Internal Error: Missing Contracts/Web3/Wallet');
142 throw new Error('Internal Error: Missing Contracts/Web3/Wallet');
142 }
143 }
143
144
145+ if (Just.hasInstance(authMnemonic)) {
146+ throw new Error(
147+ "Auth key Error: A management mnemonic can't create invite codes"
148+ );
149+ }
144 const planets: UnspawnedPoints = await api.getUnspawned(_point);
150 const planets: UnspawnedPoints = await api.getUnspawned(_point);
145 const starInfo = await api.getPoint(_point);
151 const starInfo = await api.getPoint(_point);
146
152
src/lib/utils/roller.ts+6−1
@@ -1,6 +1,6 @@
1import { signTransactionHash } from 'lib/authToken';
1import { signTransactionHash } from 'lib/authToken';
2import { Invite } from 'lib/types/Invite';
2import { Invite } from 'lib/types/Invite';
3−import { Just } from 'folktale/maybe';
3+import { Just, Nothing } from 'folktale/maybe';
4import { randomHex } from 'web3-utils';
4import { randomHex } from 'web3-utils';
5import {
5import {
6 attemptNetworkSeedDerivation,
6 attemptNetworkSeedDerivation,
@@ -89,6 +89,11 @@ export const configureKeys = async (
89 authToken,
89 authToken,
90 revision: 1,
90 revision: 1,
91 });
91 });
92+ // TODO: do something here?
93+ if (Nothing.hasInstance(networkSeed)) {
94+ console.log("Network key Error: couldn't derive network keys");
95+ // throw new Error("Network key Error: couldn't derive network keys");
96+ }
92
97
93 const seed = Just.hasInstance(networkSeed)
98 const seed = Just.hasInstance(networkSeed)
94 ? networkSeed.value
99 ? networkSeed.value
src/views/Invite/Cohort.js+2
@@ -154,6 +154,8 @@ export default function InviteCohort() {
154 getPendingTransactions(point);
154 getPendingTransactions(point);
155 pop();
155 pop();
156 } catch (error) {
156 } catch (error) {
157+ console.log(error);
158+ // TODO: error is not used anywhere on the UI
157 setError(error);
159 setError(error);
158 } finally {
160 } finally {
159 setLoading(false);
161 setLoading(false);