Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c7adb65
Add default for IPFS config
area Sep 10, 2020
6fedec1
Support xdai provider
area Sep 11, 2020
679b51b
Switch to colonyJS fork that supports xdai
area Sep 11, 2020
90cd03e
Published colonyJS that supports xDai
area Sep 11, 2020
4cd4737
Revert "Fix: `CreateColonyWizard` `stepFunction` args order"
area Sep 11, 2020
a2c0a74
Revert "Update: `StepColonyName` copy"
area Sep 11, 2020
7849032
Revert "Fix: `CreateColonyWizard` correctly fetch user from props"
area Sep 11, 2020
f1861d2
Revert "Fix: `CreateColonyWizard` prevent line skipping the flow"
area Sep 11, 2020
e4059f5
Revert "Refactor: `StepColonyName` disable confirm name button"
area Sep 11, 2020
bef6ce4
Revert "Refactor: `CreateColonyWizard` segment out the user flow"
area Sep 11, 2020
ddab4c0
Add ENS patch required for xDAI
area Sep 11, 2020
d8882f7
Update: `ENS` lib fallback domain to reflect xDAI
rdig Sep 14, 2020
047ed62
Refactor: User/Colony wizard to reflect xDai domain
rdig Sep 14, 2020
7d32b45
Refactor: admin/core components reflect xDai domain
rdig Sep 14, 2020
0fc3d98
Fix: monkey patch `getProvider` TS type check
rdig Sep 14, 2020
fb400a4
Update: bump app version to `xdai` release
rdig Sep 14, 2020
796cc7b
Renamed: ETH to xDAI Token
rdig Sep 14, 2020
f290f15
Rename: Ethereum -> xDai Chain
rdig Sep 14, 2020
78c2ffe
Remove: unused env variables
rdig Sep 14, 2020
73e84c6
Bump: app version to `3.1.0` on the xdai release path
rdig Sep 14, 2020
f0d8648
Add skill tree for xdai
area Sep 15, 2020
a070ec5
Add: wire xdai task skills tree
rdig Sep 15, 2020
2184dc9
Rename: Etherscan references to Blockscout
rdig Sep 15, 2020
9f776cf
Refactor: etherscan link util into a more generalized ver
rdig Sep 15, 2020
fd71808
Remove: un-needed network name props
rdig Sep 15, 2020
af7f4ba
Add: monkey-patch fixed gas costs for the xdai network
rdig Sep 15, 2020
3a30963
Add: monkey-patch `getEthToUsd` to have parity on xdai
rdig Sep 15, 2020
d7ab308
Add: `TokenInfo` constants for the various networks
rdig Sep 24, 2020
1687d5e
Refactor: `token` resolvers to adapt to networks
rdig Sep 24, 2020
49506c4
Refactored: use xdai network var from colonyJS
rdig Sep 16, 2020
3620b2c
Fix: `getBlockExplorerLink` use mainnet var from colonyJS
rdig Sep 28, 2020
e1efe6c
Refactor: estimage transaction gas cost saga
rdig Sep 16, 2020
9f26e23
Refactor: skills tree selection to use colonyJS networks
rdig Sep 17, 2020
f7e831e
Refactor: export default network token from `constants`
rdig Sep 17, 2020
860730e
Add: default network info constants
rdig Sep 18, 2020
5528143
Refactor: get all default network values from `constants`
rdig Sep 18, 2020
c7d2f3f
Refactor: display ENS domain based on current network
rdig Sep 28, 2020
c7c654a
Add: links to token explorers based on networks
rdig Sep 28, 2020
dd574b5
Add: block explorer name based on current network
rdig Sep 28, 2020
ed4e162
Revert: app to network agnostic versioning scheme
rdig Sep 28, 2020
300b3b2
Support the Xdai Fork
area Oct 2, 2020
0843dec
Update: `colonyServer` lib to the `1.4.0` release
rdig Nov 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
# rinkeby, trufflepig
LOADER=trufflepig

# local, goerli, mainnet
NETWORK=local

# verbose logger
VERBOSE=true

# ethplorer key (use `freekey` for rate limited dev trial)
ETHPLORER_API_KEY=freekey

# Add a key to not be rate limited with INFURA
# INFURA_ID=

Expand Down
182 changes: 91 additions & 91 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"engines": {
"node": ">=12.19.0 <13"
},
"version": "3.0.2",
"version": "3.1.0",
"description": "",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -128,7 +128,7 @@
},
"dependencies": {
"@apollo/client": "^3.0.2",
"@colony/colony-js": "^2.0.2",
"@colony/colony-js": "^2.1.0-xdai.3",
"@colony/redux-promise-listener": "^1.2.0",
"@formatjs/intl-pluralrules": "^1.5.7",
"@formatjs/intl-relativetimeformat": "^4.5.14",
Expand Down
13 changes: 7 additions & 6 deletions src/data/resolvers/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ import { AddressZero } from 'ethers/constants';
import { ClientType, ColonyClient } from '@colony/colony-js';

import { Context, ContextModule } from '~context/index';
import { COLONY_TOTAL_BALANCE_DOMAIN_ID } from '~constants';
import {
COLONY_TOTAL_BALANCE_DOMAIN_ID,
DEFAULT_NETWORK_TOKEN,
} from '~constants';
import { TokenInfo, TokenInfoDocument } from '~data/index';
import { Address } from '~types/index';
import { createAddress, isAddress } from '~utils/web3';
import { getTokenDecimalsWithFallback } from '~utils/tokens';

const ETHER_INFO = Object.freeze({
const TOKEN_INFO = Object.freeze({
id: AddressZero,
address: AddressZero,
name: 'Ether',
symbol: 'ETH',
decimals: 18,
verified: true,
iconHash: '',
...DEFAULT_NETWORK_TOKEN,
});

// Token data is used a lot and never change. They require a custom cache
Expand Down Expand Up @@ -64,7 +65,7 @@ const getTokenData = async (
return {
__typename: 'Token',
verified: true,
...ETHER_INFO,
...TOKEN_INFO,
};
}

Expand Down
2 changes: 0 additions & 2 deletions src/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ namespace NodeJS {
interface ProcessEnv {
NODE_ENV: 'development' | 'production';
COLONY_NETWORK_ENS_NAME: string;
LOADER: string;
NETWORK: string;
PINNING_ROOM: string;
ETHPLORER_API_KEY: string;
INFURA_ID: string;
VERSION: string;
}
Expand Down
10 changes: 10 additions & 0 deletions src/immutable/GasPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ export interface GasPricesProps {
network?: BigNumber;
suggested?: BigNumber;
suggestedWait?: number;
/**
* On xdai the gas price of 1 gwei will always work, so for now, we're setting it manually
*/
fixed?: BigNumber;
fixedWait?: number;
timestamp?: number;
}

Expand All @@ -22,6 +27,11 @@ const defaultValues: DefaultValues<GasPricesProps> = {
network: undefined,
suggested: undefined,
suggestedWait: undefined,
/**
* 1 Gwei converted into wei
*/
fixed: new BigNumber('1000000000'),
fixedWait: 5,
timestamp: undefined,
};

Expand Down
6 changes: 3 additions & 3 deletions src/lib/ENS/ENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Address, ENSName } from '~types/index';
import { createAddress, isAddress } from '~utils/web3';

const COLONY_NETWORK_ENS_NAME =
process.env.COLONY_NETWORK_ENS_NAME || 'joincolony.eth';
process.env.COLONY_NETWORK_ENS_NAME || 'joincolony.colonyxdai';
const EXTERNAL_PREFIX = '$';

class ENS {
Expand Down Expand Up @@ -77,7 +77,7 @@ class ENS {
}

// eslint-disable-next-line max-len
const ensName = await networkClient.lookupRegisteredENSDomainWithGoerliPatch(
const ensName = await networkClient.lookupRegisteredENSDomainWithNetworkPatches(
address,
);

Expand All @@ -100,7 +100,7 @@ class ENS {
return !address;
}

/* Returns an Ethereum address, when given the human-readable name */
/* Returns an xDai Chain address, when given the human-readable name */
async getAddress(
domain: string,
networkClient: ColonyNetworkClient,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ipfs/IPFSNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const configMap = {
};

class IPFSNode {
static getIpfsConfig = configMap[NETWORK];
static getIpfsConfig = configMap[NETWORK] || configMap.mainnet;

_ipfs: IPFS;

Expand Down
63 changes: 62 additions & 1 deletion src/modules/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
export const DEFAULT_NETWORK = process.env.NETWORK || 'goerli';
import { Network } from '@colony/colony-js';

export type TokenInfo = {
name: string;
symbol: string;
decimals?: number;
};

export type NetworkInfo = {
name: string;
description?: string;
displayENSDomain?: string;
/**
* Used just to display references to the current networks's
*/
blockExplorerName?: string;
/**
* Link to a token list from the current network's block explorer.
* This will just be used for information messages and tooltips.
* We actually linking to it we have a method that generates the
* link programatically: `getBlockExplorerLink()`
*/
tokenExplorerLink?: string;
};

export const DEFAULT_NETWORK = process.env.NETWORK || Network.Goerli;
export const COLONY_TOTAL_BALANCE_DOMAIN_ID = 0;
export const DEFAULT_TOKEN_DECIMALS = 18;

Expand All @@ -7,3 +32,39 @@ export enum ROLES_COMMUNITY {
admin = 'role.admin',
member = 'role.member',
}

export const XDAI_TOKEN: TokenInfo = {
name: 'XDAI Token',
symbol: 'XDAI',
decimals: 18,
};

export const ETHER_TOKEN: TokenInfo = {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
};

export const XDAI_NETWORK: NetworkInfo = {
name: 'xDai Chain',
displayENSDomain: 'joincolony.colonyxdai',
blockExplorerName: 'Blockscout',
tokenExplorerLink: 'https://blockscout.com/poa/xdai/tokens',
};

export const ETHEREUM_NETWORK: NetworkInfo = {
name: 'Ethereum',
blockExplorerName: 'Etherscan',
displayENSDomain: 'joincolony.eth',
tokenExplorerLink: 'https://etherscan.io/tokens',
};

export const DEFAULT_NETWORK_TOKEN =
DEFAULT_NETWORK === Network.Xdai || DEFAULT_NETWORK === Network.XdaiFork
? XDAI_TOKEN
: ETHER_TOKEN;

export const DEFAULT_NETWORK_INFO =
DEFAULT_NETWORK === Network.Xdai || DEFAULT_NETWORK === Network.XdaiFork
? XDAI_NETWORK
: ETHEREUM_NETWORK;
10 changes: 5 additions & 5 deletions src/modules/core/components/Fields/Input/Input.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Form } from '../';
initialValues={{ input: '' }}
initialErrors={{ input: 'Wrong!' }}
touched={{ input: true }}
validate={{ input: 'Wrong!' }}
validate={{ input: 'Wrong!' }}
>
<Input
elementOnly
Expand Down Expand Up @@ -71,7 +71,7 @@ import { Form } from '../';
initialValues={{ input: '' }}
initialErrors={{ input: 'Wrong!' }}
touched={{ input: true }}
validate={{ input: 'Wrong!' }}
validate={{ input: 'Wrong!' }}
>
<Input
name="input"
Expand Down Expand Up @@ -135,7 +135,7 @@ import { Form } from '../';
initialValues={{ input: '' }}
initialErrors={{ input: 'Wrong!' }}
touched={{ input: true }}
validate={{ input: 'Wrong!' }}
validate={{ input: 'Wrong!' }}
>
<Input
appearance={{ direction: 'horizontal' }}
Expand All @@ -158,7 +158,7 @@ import { Form } from '../';
appearance={{ colorSchema: 'dark' }}
name="input"
placeholder="I'm dark!"
label="Dark label"
label="Dark label"
/>
</Form>
```
Expand Down Expand Up @@ -219,7 +219,7 @@ import { Form } from '../';
initialValues={{ input: '' }}
initialErrors={{ input: 'Wrong!' }}
touched={{ input: true }}
validate={{ input: 'Wrong!' }}
validate={{ input: 'Wrong!' }}
>
<Input
appearance={{ theme: 'underlined', direction: 'horizontal' }}
Expand Down
11 changes: 9 additions & 2 deletions src/modules/core/components/InfoPopover/TokenInfoPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import CopyableAddress from '~core/CopyableAddress';
import TokenLink from '~core/TokenLink';
import TokenIcon from '~dashboard/HookedTokenIcon';
import { AnyToken } from '~data/index';
import { DEFAULT_NETWORK_INFO } from '~constants';

import styles from './InfoPopover.css';

Expand All @@ -15,7 +16,7 @@ const MSG = defineMessages({
},
viewOnEtherscan: {
id: 'InfoPopover.TokenInfoPopover.viewOnEtherscan',
defaultMessage: 'View on Etherscan',
defaultMessage: 'View on {blockExplorerName}',
},
});

Expand Down Expand Up @@ -56,7 +57,13 @@ const TokenInfoPopover = ({ token, isTokenNative }: Props) => {
)}
</div>
<div className={styles.section}>
<TokenLink tokenAddress={address} text={MSG.viewOnEtherscan} />
<TokenLink
tokenAddress={address}
text={MSG.viewOnEtherscan}
textValues={{
blockExplorerName: DEFAULT_NETWORK_INFO.blockExplorerName,
}}
/>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/core/components/Numeral/AbbreviatedNumeral.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useIntl } from 'react-intl';
import type { Unit } from '~utils/web3';

interface Props extends HTMLAttributes<HTMLSpanElement> {
/** When dealing with ethereum units */
/** When dealing with xDai chain units */
ethUnit?: Unit;
/** Disallow children */
children?: never;
Expand Down
17 changes: 3 additions & 14 deletions src/modules/core/components/TokenLink/TokenLink.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { MessageDescriptor } from 'react-intl';
import React from 'react';

import { DEFAULT_NETWORK } from '~constants';
import ExternalLink from '~core/ExternalLink';
import { SimpleMessageValues } from '~types/index';
import { getEtherscanLink } from '~utils/external';
import { getBlockExplorerLink } from '~utils/external';

interface Props {
/*
Expand All @@ -16,9 +15,6 @@ interface Props {
/** Address of the token to link to */
tokenAddress: string;

/** Optionally override current network */
network?: string;

/** A string or a `messageDescriptor` that make up the link's text. Defaults to `tokenAddress`. */
text?: MessageDescriptor | string;

Expand All @@ -28,17 +24,10 @@ interface Props {

const displayName = 'TokenLink';

const TokenLink = ({
className,
tokenAddress,
network = DEFAULT_NETWORK,
text,
textValues,
}: Props) => (
const TokenLink = ({ className, tokenAddress, text, textValues }: Props) => (
<ExternalLink
className={className}
href={getEtherscanLink({
network,
href={getBlockExplorerLink({
linkType: 'token',
addressOrHash: tokenAddress,
})}
Expand Down
17 changes: 3 additions & 14 deletions src/modules/core/components/TransactionLink/TransactionLink.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { MessageDescriptor } from 'react-intl';
import React from 'react';

import { DEFAULT_NETWORK } from '~constants';
import ExternalLink from '~core/ExternalLink';
import { SimpleMessageValues } from '~types/index';
import { getEtherscanLink } from '~utils/external';
import { getBlockExplorerLink } from '~utils/external';

interface Props {
/*
Expand All @@ -16,9 +15,6 @@ interface Props {
/** Transaction hash */
hash: string;

/** Optionally override current network */
network?: string;

/** A string or a `messageDescriptor` that make up the link's text. Defaults to `hash`. */
text?: MessageDescriptor | string;

Expand All @@ -28,17 +24,10 @@ interface Props {

const displayName = 'TransactionLink';

const TransactionLink = ({
className,
hash,
network = DEFAULT_NETWORK,
text,
textValues,
}: Props) => (
const TransactionLink = ({ className, hash, text, textValues }: Props) => (
<ExternalLink
className={className}
href={getEtherscanLink({
network,
href={getBlockExplorerLink({
linkType: 'tx',
addressOrHash: hash,
})}
Expand Down
Loading