on master help sign in
invite: throw error if logged in with mnemonic key
commitf3545aa779fe20ec90d807021ebebc37ea7d30f0 authoryosoyubik <yosoyubik@gmail.com> dateThu 23 Sep 2021, 10:10 (5 years ago) parent4349bf9
3 files changed+14−1
src/lib/useRoller.ts+6 src/lib/utils/roller.ts+6−1 src/views/Invite/Cohort.js+2
src/lib/useRoller.ts+6
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
22import * as azimuth from 'azimuth-js';
33import * as need from 'lib/need';
44import * as ob from 'urbit-ob';
5+import { Just } from 'folktale/maybe';
56
67import { Invite } from 'lib/types/Invite';
78import { convertToInt } from './convertToInt';
@@ -141,6 +142,11 @@ export default function useRoller() {
141142 throw new Error('Internal Error: Missing Contracts/Web3/Wallet');
142143 }
143144
145+ if (Just.hasInstance(authMnemonic)) {
146+ throw new Error(
147+ "Auth key Error: A management mnemonic can't create invite codes"
148+ );
149+ }
144150 const planets: UnspawnedPoints = await api.getUnspawned(_point);
145151 const starInfo = await api.getPoint(_point);
146152
src/lib/utils/roller.ts+6−1
@@ -1,6 +1,6 @@
11import { signTransactionHash } from 'lib/authToken';
22import { Invite } from 'lib/types/Invite';
3−import { Just } from 'folktale/maybe';
3+import { Just, Nothing } from 'folktale/maybe';
44import { randomHex } from 'web3-utils';
55import {
66 attemptNetworkSeedDerivation,
@@ -89,6 +89,11 @@ export const configureKeys = async (
8989 authToken,
9090 revision: 1,
9191 });
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+ }
9297
9398 const seed = Just.hasInstance(networkSeed)
9499 ? networkSeed.value
src/views/Invite/Cohort.js+2
@@ -154,6 +154,8 @@ export default function InviteCohort() {
154154 getPendingTransactions(point);
155155 pop();
156156 } catch (error) {
157+ console.log(error);
158+ // TODO: error is not used anywhere on the UI
157159 setError(error);
158160 } finally {
159161 setLoading(false);