on master help sign in
fix: move key constants to lib/keys
cd9ff18Matt Condon (shrugs)
src/lib/constants.js−11
@@ -18,14 +18,6 @@ const GALAXY_ENTROPY_BITS = 384;
18
18
19const SEED_ENTROPY_BITS = 128;
19const SEED_ENTROPY_BITS = 128;
20
20
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−
29//TODO move into azimuth-js
21//TODO move into azimuth-js
30const GAS_LIMITS = {
22const GAS_LIMITS = {
31 SPAWN: 250000,
23 SPAWN: 250000,
@@ -96,7 +88,4 @@ export {
96 GALAXY_ENTROPY_BITS,
88 GALAXY_ENTROPY_BITS,
97 SEED_ENTROPY_BITS,
89 SEED_ENTROPY_BITS,
98 ZOD,
90 ZOD,
99− NETWORK_KEY_CURVE_PARAMETER,
100− ZERO_KEY,
101− CRYPTO_SUITE_VERSION,
102};
91};
src/lib/keys.js+9−2
@@ -5,8 +5,15 @@ import * as noun from '../nockjs/noun';
5import * as serial from '../nockjs/serial';
5import * as serial from '../nockjs/serial';
6import * as kg from 'urbit-key-generation/dist';
6import * as kg from 'urbit-key-generation/dist';
7
7
8−import { eqAddr, addHexPrefix, CURVE_ZERO_ADDR } from './wallet';
8+import { eqAddr, addHexPrefix } from './wallet';
9+
10+// the curve param for the network keys
9−import { NETWORK_KEY_CURVE_PARAMETER } from './constants';
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';
10
17
11// ctsy joemfb
18// ctsy joemfb
12const b64 = buf => {
19const b64 = buf => {
src/lib/reticket.js+6−6
@@ -3,14 +3,14 @@ import * as azimuth from 'azimuth-js';
3import * as tank from './tank';
3import * as tank from './tank';
4
4
5import { hexify } from './txn';
5import { hexify } from './txn';
6−import { deriveNetworkSeedFromUrbitWallet, deriveNetworkKeys } from './keys';
7−import { addHexPrefix } from './wallet';
8−import { sendAndAwaitAll } from './txn';
9import {
6import {
10− GAS_LIMITS,
7+ deriveNetworkSeedFromUrbitWallet,
11− DEFAULT_GAS_PRICE_GWEI,
8+ deriveNetworkKeys,
12 CRYPTO_SUITE_VERSION,
9 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';
14import { toWei } from 'web3-utils';
14import { toWei } from 'web3-utils';
15
15
16// the initial network key revision is always 1
16// the initial network key revision is always 1
src/lib/wallet.js−2
@@ -10,8 +10,6 @@ import { isAddress } from 'web3-utils';
10export const DEFAULT_HD_PATH = "m/44'/60'/0'/0/0";
10export const DEFAULT_HD_PATH = "m/44'/60'/0'/0/0";
11export const ETH_ZERO_ADDR = '0x0000000000000000000000000000000000000000';
11export const ETH_ZERO_ADDR = '0x0000000000000000000000000000000000000000';
12export const ETH_ZERO_ADDR_SHORT = '0x0';
12export const ETH_ZERO_ADDR_SHORT = '0x0';
13−export const CURVE_ZERO_ADDR =
14− '0x0000000000000000000000000000000000000000000000000000000000000000';
15
13
16export const WALLET_TYPES = {
14export const WALLET_TYPES = {
17 MNEMONIC: Symbol('MNEMONIC'),
15 MNEMONIC: Symbol('MNEMONIC'),
src/views/Admin/AdminNetworkingKeys.js+4−2
@@ -23,10 +23,12 @@ import {
23 segmentNetworkKey,
23 segmentNetworkKey,
24 attemptNetworkSeedDerivation,
24 attemptNetworkSeedDerivation,
25 deriveNetworkKeys,
25 deriveNetworkKeys,
26+ CRYPTO_SUITE_VERSION,
27+ CURVE_ZERO_ADDR,
26} from 'lib/keys';
28} from 'lib/keys';
27import { formatDotsWithTime } from 'lib/dateFormat';
29import { formatDotsWithTime } from 'lib/dateFormat';
28import useEthereumTransaction from 'lib/useEthereumTransaction';
30import useEthereumTransaction from 'lib/useEthereumTransaction';
29−import { GAS_LIMITS, ZERO_KEY, CRYPTO_SUITE_VERSION } from 'lib/constants';
31+import { GAS_LIMITS } from 'lib/constants';
30import { addHexPrefix } from 'lib/wallet';
32import { addHexPrefix } from 'lib/wallet';
31
33
32import ViewHeader from 'components/ViewHeader';
34import ViewHeader from 'components/ViewHeader';
@@ -39,7 +41,7 @@ import NoticeBox from 'components/NoticeBox';
39import { useHexInput, useCheckboxInput } from 'lib/useInputs';
41import { useHexInput, useCheckboxInput } from 'lib/useInputs';
40
42
41const chainKeyProp = name => d =>
43const chainKeyProp = name => d =>
42− d[name] === ZERO_KEY ? Nothing() : Just(d[name]);
44+ d[name] === CURVE_ZERO_ADDR ? Nothing() : Just(d[name]);
43
45
44const renderNetworkKey = key => {
46const renderNetworkKey = key => {
45 const segments = segmentNetworkKey(key);
47 const segments = segmentNetworkKey(key);
src/views/Point/Actions.js+2−1
@@ -2,7 +2,7 @@ import React from 'react';
2import { azimuth } from 'azimuth-js';
2import { azimuth } from 'azimuth-js';
3import * as need from '../../lib/need';
3import * as need from '../../lib/need';
4
4
5−import { CURVE_ZERO_ADDR, isZeroAddress, eqAddr } from '../../lib/wallet';
5+import { isZeroAddress, eqAddr } from '../../lib/wallet';
6import { H2, P } from '../../components/old/Base';
6import { H2, P } from '../../components/old/Base';
7import { Button } from '../../components/old/Base';
7import { Button } from '../../components/old/Base';
8import { ROUTE_NAMES } from '../../lib/routeNames';
8import { ROUTE_NAMES } from '../../lib/routeNames';
@@ -11,6 +11,7 @@ import { useWallet } from '../../store/wallet';
11import { Grid } from 'indigo-react';
11import { Grid } from 'indigo-react';
12import { usePointCursor } from 'store/pointCursor';
12import { usePointCursor } from 'store/pointCursor';
13import { usePointCache } from 'store/pointCache';
13import { usePointCache } from 'store/pointCache';
14+import { CURVE_ZERO_ADDR } from 'lib/keys';
14
15
15const isPlanet = point =>
16const isPlanet = point =>
16 azimuth.getPointSize(point) === azimuth.PointSize.Planet;
17 azimuth.getPointSize(point) === azimuth.PointSize.Planet;
src/views/Point/KeysAndMetadata.js+2−1
@@ -1,8 +1,9 @@
1import React from 'react';
1import React from 'react';
2import { H2, H4 } from '../../components/old/Base';
2import { H2, H4 } from '../../components/old/Base';
3
3
4−import { CURVE_ZERO_ADDR, isZeroAddress } from '../../lib/wallet';
4+import { isZeroAddress } from '../../lib/wallet';
5import { Grid } from 'indigo-react';
5import { Grid } from 'indigo-react';
6+import { CURVE_ZERO_ADDR } from 'lib/keys';
6
7
7const renderAddress = addr =>
8const renderAddress = addr =>
8 isZeroAddress(addr) ? (
9 isZeroAddress(addr) ? (