Skip to content

Commit

Permalink
In dev mode initially connect to Aptos network.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirWill committed May 20, 2022
1 parent 0d2e56c commit 50c735a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
7 changes: 4 additions & 3 deletions SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Before the first run, be sure to build these packages.
Pay attention to the version of nodejs in each project for build.

### Run main build
- Install all dependencies `yarn' in root.
- Install all dependencies `yarn` in root.
- Run `yarn setup` for run lavamoat registry.
- If it first usage, or you added new dependency in code - run `lavamoat:auto` for generating new lock file for every dependency in project. It's a long operation (5-7-10 minutes)
- Run `yarn start` for development
- If it first usage, or you added new dependency in code - run `yarn lavamoat:auto` for generating new lock file for every dependency in project. It's a long operation (5-7-10 minutes)
- For debugging you should install globally `yarn global add remotedev-server`
- Run `yarn start:dev` for development
- For more see Readme file.
23 changes: 15 additions & 8 deletions app/scripts/controllers/network/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ import {
createSwappableProxy,
createEventEmitterProxy,
} from 'swappable-obj-proxy';
import PontemQuery from '@pontem/pontem-query';
import {
RINKEBY,
APTOS,
APTOS_CHAIN_ID,
MAINNET,
DEFAULT_PROVIDER_TYPES,
NETWORK_TYPE_RPC,
NETWORK_TYPE_TO_ID_MAP,
MAINNET_CHAIN_ID,
RINKEBY_CHAIN_ID,
INFURA_BLOCKED_KEY, CHAIN_ID_TO_RPC_URL_MAP, CHAIN_ID_TO_TYPE_MAP,
INFURA_BLOCKED_KEY,
CHAIN_ID_TO_RPC_URL_MAP,
CHAIN_ID_TO_TYPE_MAP,
} from '../../../../shared/constants/network';
import { SECOND } from '../../../../shared/constants/time';
import {
Expand All @@ -28,7 +31,6 @@ import createMetamaskMiddleware from './createMetamaskMiddleware';
import createInfuraClient from './createInfuraClient';
import createJsonRpcClient from './createJsonRpcClient';
import createAptosRestClient from './createAptosRestClient';
import PontemQuery from '@pontem/pontem-query';

const env = process.env.METAMASK_ENV;
const fetchWithTimeout = getFetchWithTimeout(SECOND * 30);
Expand All @@ -42,7 +44,7 @@ if (process.env.IN_TEST) {
nickname: 'Localhost 8545',
};
} else if (process.env.METAMASK_DEBUG || env === 'test') {
defaultProviderConfigOpts = { type: RINKEBY, chainId: RINKEBY_CHAIN_ID };
defaultProviderConfigOpts = { type: APTOS, chainId: APTOS_CHAIN_ID };
} else {
defaultProviderConfigOpts = { type: MAINNET, chainId: MAINNET_CHAIN_ID };
}
Expand Down Expand Up @@ -400,19 +402,24 @@ export default class NetworkController extends EventEmitter {
const predefinedRpcUrl = rpcUrl || CHAIN_ID_TO_RPC_URL_MAP[chainId];
const network = CHAIN_ID_TO_TYPE_MAP[chainId]

if(!predefinedRpcUrl) {
if (!predefinedRpcUrl) {
throw new Error(
`NetworkController - _configureProvider - rpc url is undefined. Network: "${type}". Chain ID: "${chainId}"`,
);
}

if(!network) {
if (!network) {
throw new Error(
`NetworkController - _configureProvider - network is undefined. Network: "${type}". Chain ID: "${chainId}"`,
);
}

console.log('[Pontem.NetworkController._configureProvider]', { rpcUrl: predefinedRpcUrl, type, chainId, network })
console.log('[Pontem.NetworkController._configureProvider]', {
rpcUrl: predefinedRpcUrl,
type,
chainId,
network,
});
this._configureStandardProvider(predefinedRpcUrl, chainId, network);

// if (isInfura) {
Expand Down
12 changes: 5 additions & 7 deletions shared/constants/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ export const RINKEBY = 'rinkeby';
export const KOVAN = 'kovan';
export const MAINNET = 'mainnet';
export const GOERLI = 'goerli';
export const APTOS = 'aptos'
export const PONTEM = 'pontem'
export const APTOS = 'aptos';
export const PONTEM = 'pontem';
export const LOCALHOST = 'localhost';
export const NETWORK_TYPE_RPC = 'rpc';

Expand Down Expand Up @@ -61,8 +61,8 @@ export const MAINNET_RPC_URL = getRpcUrl({ network: MAINNET });
export const GOERLI_RPC_URL = getRpcUrl({ network: GOERLI });
export const LOCALHOST_RPC_URL = 'http://localhost:8545';

export const APTOS_SYMBOL = 'APTOS'
export const PONTEM_SYMBOL = 'PONTEM'
export const APTOS_SYMBOL = 'APTOS';
export const PONTEM_SYMBOL = 'PONTEM';
export const ETH_SYMBOL = 'ETH';
export const WETH_SYMBOL = 'WETH';
export const TEST_ETH_SYMBOL = 'TESTETH';
Expand All @@ -83,9 +83,7 @@ export const AVAX_TOKEN_IMAGE_URL = './images/avax-token.png';
export const INFURA_PROVIDER_TYPES = [];
export const DEFAULT_PROVIDER_TYPES = [APTOS, PONTEM];

export const TEST_CHAINS = [
LOCALHOST_CHAIN_ID,
];
export const TEST_CHAINS = [LOCALHOST_CHAIN_ID];

/**
* Map of all build-in Infura networks to their network and chain IDs.
Expand Down

0 comments on commit 50c735a

Please sign in to comment.