on master help sign in
fix: move key constants to lib/keys
commitcd9ff18f897ba2dabbac428a25871c44beba93f7 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateWed 17 Jul 2019, 15:32 (7 years ago) parentfc27a5c
7 files changed+23−25
src/lib/constants.js−11 src/lib/keys.js+9−2 src/lib/reticket.js+6−6 src/lib/wallet.js−2 src/views/Admin/AdminNetworkingKeys.js+4−2 src/views/Point/Actions.js+2−1 src/views/Point/KeysAndMetadata.js+2−1
src/lib/constants.js−11
@@ -18,14 +18,6 @@ const GALAXY_ENTROPY_BITS = 384;
1818
1919const SEED_ENTROPY_BITS = 128;
2020
21−// the curve param for the network keys
22−const NETWORK_KEY_CURVE_PARAMETER = '42';
23−// the null result if a key is unset within azimuth
24−const ZERO_KEY =
25− '0x0000000000000000000000000000000000000000000000000000000000000000';
26−// the current crypto suite version
27−const CRYPTO_SUITE_VERSION = 1;
28−
2921//TODO move into azimuth-js
3022const GAS_LIMITS = {
3123 SPAWN: 250000,
@@ -96,7 +88,4 @@ export {
9688 GALAXY_ENTROPY_BITS,
9789 SEED_ENTROPY_BITS,
9890 ZOD,
99− NETWORK_KEY_CURVE_PARAMETER,
100− ZERO_KEY,
101− CRYPTO_SUITE_VERSION,
10291};
src/lib/keys.js+9−2
@@ -5,8 +5,15 @@ import * as noun from '../nockjs/noun';
55import * as serial from '../nockjs/serial';
66import * as kg from 'urbit-key-generation/dist';
77
8−import { eqAddr, addHexPrefix, CURVE_ZERO_ADDR } from './wallet';
9−import { NETWORK_KEY_CURVE_PARAMETER } from './constants';
8+import { eqAddr, addHexPrefix } from './wallet';
9+
10+// the curve param for the network keys
11+export const NETWORK_KEY_CURVE_PARAMETER = '42';
12+// the current crypto suite version
13+export const CRYPTO_SUITE_VERSION = 1;
14+
15+export const CURVE_ZERO_ADDR =
16+ '0x0000000000000000000000000000000000000000000000000000000000000000';
1017
1118// ctsy joemfb
1219const b64 = buf => {
src/lib/reticket.js+6−6
@@ -3,14 +3,14 @@ import * as azimuth from 'azimuth-js';
33import * as tank from './tank';
44
55import { hexify } from './txn';
6−import { deriveNetworkSeedFromUrbitWallet, deriveNetworkKeys } from './keys';
7−import { addHexPrefix } from './wallet';
8−import { sendAndAwaitAll } from './txn';
96import {
10− GAS_LIMITS,
11− DEFAULT_GAS_PRICE_GWEI,
7+ deriveNetworkSeedFromUrbitWallet,
8+ deriveNetworkKeys,
129 CRYPTO_SUITE_VERSION,
13−} from './constants';
10+} from './keys';
11+import { addHexPrefix } from './wallet';
12+import { sendAndAwaitAll } from './txn';
13+import { GAS_LIMITS, DEFAULT_GAS_PRICE_GWEI } from './constants';
1414import { toWei } from 'web3-utils';
1515
1616// the initial network key revision is always 1
src/lib/wallet.js−2
@@ -10,8 +10,6 @@ import { isAddress } from 'web3-utils';
1010export const DEFAULT_HD_PATH = "m/44'/60'/0'/0/0";
1111export const ETH_ZERO_ADDR = '0x0000000000000000000000000000000000000000';
1212export const ETH_ZERO_ADDR_SHORT = '0x0';
13−export const CURVE_ZERO_ADDR =
14− '0x0000000000000000000000000000000000000000000000000000000000000000';
1513
1614export const WALLET_TYPES = {
1715 MNEMONIC: Symbol('MNEMONIC'),
src/views/Admin/AdminNetworkingKeys.js+4−2
@@ -23,10 +23,12 @@ import {
2323 segmentNetworkKey,
2424 attemptNetworkSeedDerivation,
2525 deriveNetworkKeys,
26+ CRYPTO_SUITE_VERSION,
27+ CURVE_ZERO_ADDR,
2628} from 'lib/keys';
2729import { formatDotsWithTime } from 'lib/dateFormat';
2830import useEthereumTransaction from 'lib/useEthereumTransaction';
29−import { GAS_LIMITS, ZERO_KEY, CRYPTO_SUITE_VERSION } from 'lib/constants';
31+import { GAS_LIMITS } from 'lib/constants';
3032import { addHexPrefix } from 'lib/wallet';
3133
3234import ViewHeader from 'components/ViewHeader';
@@ -39,7 +41,7 @@ import NoticeBox from 'components/NoticeBox';
3941import { useHexInput, useCheckboxInput } from 'lib/useInputs';
4042
4143const chainKeyProp = name => d =>
42− d[name] === ZERO_KEY ? Nothing() : Just(d[name]);
44+ d[name] === CURVE_ZERO_ADDR ? Nothing() : Just(d[name]);
4345
4446const renderNetworkKey = key => {
4547 const segments = segmentNetworkKey(key);
src/views/Point/Actions.js+2−1
@@ -2,7 +2,7 @@ import React from 'react';
22import { azimuth } from 'azimuth-js';
33import * as need from '../../lib/need';
44
5−import { CURVE_ZERO_ADDR, isZeroAddress, eqAddr } from '../../lib/wallet';
5+import { isZeroAddress, eqAddr } from '../../lib/wallet';
66import { H2, P } from '../../components/old/Base';
77import { Button } from '../../components/old/Base';
88import { ROUTE_NAMES } from '../../lib/routeNames';
@@ -11,6 +11,7 @@ import { useWallet } from '../../store/wallet';
1111import { Grid } from 'indigo-react';
1212import { usePointCursor } from 'store/pointCursor';
1313import { usePointCache } from 'store/pointCache';
14+import { CURVE_ZERO_ADDR } from 'lib/keys';
1415
1516const isPlanet = point =>
1617 azimuth.getPointSize(point) === azimuth.PointSize.Planet;
src/views/Point/KeysAndMetadata.js+2−1
@@ -1,8 +1,9 @@
11import React from 'react';
22import { H2, H4 } from '../../components/old/Base';
33
4−import { CURVE_ZERO_ADDR, isZeroAddress } from '../../lib/wallet';
4+import { isZeroAddress } from '../../lib/wallet';
55import { Grid } from 'indigo-react';
6+import { CURVE_ZERO_ADDR } from 'lib/keys';
67
78const renderAddress = addr =>
89 isZeroAddress(addr) ? (