@@ -7,11 +7,9 @@ import { Just } from 'folktale/maybe';
8import { Invite } from 'lib/types/Invite';
8import { Invite } from 'lib/types/Invite';
9import { convertToInt } from './convertToInt';
9import { convertToInt } from './convertToInt';
10−import { ensureHexPrefix } from 'form/formatters';
11import { isDevelopment, isRopsten } from './flags';
10import { isDevelopment, isRopsten } from './flags';
12import { hasPoint, generateInviteWallet } from './utils/roller';
11import { hasPoint, generateInviteWallet } from './utils/roller';
13import { ROLLER_HOSTS } from './constants';
12import { ROLLER_HOSTS } from './constants';
14−import { signTransactionHash } from './authToken';
16import { useNetwork } from 'store/network';
14import { useNetwork } from 'store/network';
17import { usePointCursor } from 'store/pointCursor';
15import { usePointCursor } from 'store/pointCursor';
@@ -33,9 +31,8 @@ import {
33import { isPlanet } from './utils/point';
31import { isPlanet } from './utils/point';
37− CRYPTO_SUITE_VERSION,
38 deriveNetworkSeedFromUrbitWallet,
34 deriveNetworkSeedFromUrbitWallet,
35+ attemptNetworkSeedDerivation,
39} from 'lib/keys';
36} from 'lib/keys';
@@ -46,8 +43,6 @@ import {
47 EthAddress,
44 EthAddress,
48 UnspawnedPoints,
45 UnspawnedPoints,
51 SpawnParams,
46 SpawnParams,
53} from '@urbit/roller-api';
48} from '@urbit/roller-api';
@@ -69,7 +64,7 @@ function isShipNumber(ship: number | string | undefined): ship is number {
71export default function useRoller() {
66export default function useRoller() {
72− const { wallet, authToken, authMnemonic }: any = useWallet();
67+ const { wallet, authToken, authMnemonic, urbitWallet }: any = useWallet();
73 const { pointCursor }: any = usePointCursor();
68 const { pointCursor }: any = usePointCursor();
74 const { web3, contracts }: any = useNetwork();
69 const { web3, contracts }: any = useNetwork();
75 const allPoints: any = usePointCache();
70 const allPoints: any = usePointCache();
@@ -201,13 +196,17 @@ export default function useRoller() {
202 increaseNonce(_point, operator.proxy!);
197 increaseNonce(_point, operator.proxy!);
199+ const networkSeed = await deriveNetworkSeedFromUrbitWallet(
204 const configureKeysRequest = await configureKeys(
203 const configureKeysRequest = await configureKeys(
208 operator.proxy!,
207 operator.proxy!,
210− inviteWallet
209+ networkSeed
213 const setManagementProxyRequest = await registerProxyAddress(
212 const setManagementProxyRequest = await registerProxyAddress(
@@ -423,32 +422,41 @@ export default function useRoller() {
423 customNetworkSeed,
422 customNetworkSeed,
424 }: ConfigureKeysParams) => {
423 }: ConfigureKeysParams) => {
425 const _point = need.point(pointCursor);
424 const _point = need.point(pointCursor);
425+ const azimuthPoint = await api.getPoint(_point);
426 const _wallet = wallet.getOrElse(null);
426 const _wallet = wallet.getOrElse(null);
427− console.log(_point, _wallet);
427+ const _details = getDetails(_point);
428− if (!_wallet) {
428+ if (!_wallet || !_details) {
429 // not using need because we want a custom error
429 // not using need because we want a custom error
430− throw new Error('Internal Error: Missing Wallet');
430+ throw new Error('Internal Error: Missing Wallet/Details');
433 const pointDetails = nonces[_point];
433 const pointDetails = nonces[_point];
434 const operator =
434 const operator =
435 getManagementNonce(pointDetails, _wallet.address) ||
435 getManagementNonce(pointDetails, _wallet.address) ||
436 getOwnerNonce(pointDetails, _wallet.address);
436 getOwnerNonce(pointDetails, _wallet.address);
438 if (operator === undefined)
437 if (operator === undefined)
439 throw new Error("Error: Address doesn't match proxy");
438 throw new Error("Error: Address doesn't match proxy");
440− const networkRevision = convertToInt(pointDetails.network.keys.life, 10);
439+ const networkRevision = convertToInt(azimuthPoint.network.keys.life, 10);
441 const nextRevision = networkRevision + 1;
440 const nextRevision = networkRevision + 1;
441+ const networkSeed = customNetworkSeed
443+ : await attemptNetworkSeedDerivation({
442− console.log('nextRevision', nextRevision);
450+ revision: nextRevision,
443 const txHash = await configureKeys(
452 const txHash = await configureKeys(
447 operator.proxy!,
456 operator.proxy!,
448 operator.nonce!,
457 operator.nonce!,
449− _wallet,
458+ networkSeed,
450− nextRevision,
459+ breach
453 const pendingTx = await api.getPendingTx(txHash);
461 const pendingTx = await api.getPendingTx(txHash);
@@ -484,18 +492,19 @@ export default function useRoller() {
484 const nonce = operator.nonce!;
492 const nonce = operator.nonce!;
486 // 1. Update networking keys
494 // 1. Update networking keys
487− // TODO: extract this to a useRoller#configureKeys function?
488 const networkRevision = convertToInt(azimuthPoint.network.keys.life, 10);
495 const networkRevision = convertToInt(azimuthPoint.network.keys.life, 10);
489 const nextRevision = networkRevision + 1;
496 const nextRevision = networkRevision + 1;
490−
497+ const networkSeed = await deriveNetworkSeedFromUrbitWallet(
491 const configureKeysRequest = await configureKeys(
501 const configureKeysRequest = await configureKeys(
493 fromWallet,
503 fromWallet,
495 operator.proxy!,
505 operator.proxy!,
497− toWallet,
507+ networkSeed
501 // TODO: not needed? next time we operate with this point we will login, and get
510 // TODO: not needed? next time we operate with this point we will login, and get