Skip to content
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2debe33
Added provider selector
RyRy79261 Apr 28, 2021
2fd9d60
Reworked app.tsx
RyRy79261 Apr 28, 2021
57a21f4
Working on adaptors
RyRy79261 Apr 30, 2021
b19ab3b
Working on new interfaces
RyRy79261 May 6, 2021
d8220b1
EVM wired
RyRy79261 May 7, 2021
5724715
Merge branch 'main' into feat/chain-adapters-68
RyRy79261 May 7, 2021
cb8bed2
Compiles now
RyRy79261 May 10, 2021
a575cbd
Merge branch 'feat/chain-adapters-68' of github.com:ChainSafe/chainbr…
RyRy79261 May 10, 2021
b758c7e
Tinkering
RyRy79261 May 10, 2021
630b3b7
Refactored home adapter to context (#73)
RyRy79261 May 24, 2021
f4289f3
Updating comments
RyRy79261 May 26, 2021
6e27838
Polkadot...
RyRy79261 May 27, 2021
23c0b4a
Balance fetched
RyRy79261 May 27, 2021
7d9d9b1
Selecting token
RyRy79261 May 27, 2021
7c09fff
Transfer sub to evm works
RyRy79261 May 27, 2021
de45a50
Added test listener logic
RyRy79261 May 27, 2021
e3ebcdf
Web3 issues
RyRy79261 May 28, 2021
361d44e
Revert
RyRy79261 May 28, 2021
8cb033b
Web3 eish
RyRy79261 May 28, 2021
6de6685
fix EVM home chain
FSM1 May 31, 2021
f5f211a
setup for GETH chainId 5
FSM1 Jun 1, 2021
7f81f4b
Present state
RyRy79261 Jun 1, 2021
6e5adef
Unsubscribe logic
RyRy79261 Jun 1, 2021
86402c8
update onbaord to latest version
FSM1 Jun 2, 2021
1ed6552
Init mutex
RyRy79261 Jun 2, 2021
2c6b8e0
Merge branch 'feat/chain-adapters-68' of github.com:ChainSafe/chainbr…
RyRy79261 Jun 2, 2021
27a8373
Mutex test
RyRy79261 Jun 2, 2021
c56ae6c
Block status not reported
RyRy79261 Jun 2, 2021
d7df802
Fixed cycle in evm
RyRy79261 Jun 2, 2021
91386d8
Removed consoles
RyRy79261 Jun 3, 2021
4a960e2
step 1
Tbaut Jun 3, 2021
165ed8c
fix typo
FSM1 Jun 3, 2021
cdfeda2
add substrate destination event handlers
FSM1 Jun 3, 2021
8864b93
cleanup
Tbaut Jun 3, 2021
b3d0406
Update src/Modules/TransferActiveModal.tsx
Tbaut Jun 3, 2021
a766c12
substrate address formatting
FSM1 Jun 3, 2021
9971d7e
Cleared
RyRy79261 Jun 4, 2021
c5b83aa
Added disconnect
RyRy79261 Jun 4, 2021
8906d4f
Resolved
RyRy79261 Jun 4, 2021
27fcb57
Token values matching
RyRy79261 Jun 4, 2021
9027175
Reset functionall
RyRy79261 Jun 4, 2021
5f16ed1
Removed keyring
RyRy79261 Jun 4, 2021
877d9d6
Merge remote-tracking branch 'origin/main' into feat/chain-adapters-68
FSM1 Jun 8, 2021
59414ef
Merge branch 'feat/chain-adapters-68' into tbaut/status
FSM1 Jun 8, 2021
8229030
auto set destination network
FSM1 Jun 8, 2021
a3f8bb7
Spruced
RyRy79261 Jun 8, 2021
56799f1
clean up config, add validation, add more readme
FSM1 Jun 9, 2021
efad8dd
Adapter modularity refactor (#77)
ansermino Jun 14, 2021
21ad0f9
update readme and config
FSM1 Jun 15, 2021
225c887
update readme, clean up Chainbridge API
FSM1 Jun 15, 2021
7e6cf09
fix relayer config and substrate deposit decimals
FSM1 Jun 15, 2021
b70cda0
use correct BN lib
FSM1 Jun 15, 2021
3bf6b1e
make adaptors dynamic
FSM1 Jun 16, 2021
9136d65
update readme
FSM1 Jun 16, 2021
32291fc
clear all warnings
FSM1 Jun 16, 2021
d47430e
fix package json scripts typo
FSM1 Jun 16, 2021
951d7f5
make function name generic
FSM1 Jun 16, 2021
c9a7423
update readme
FSM1 Jun 16, 2021
48e5b87
Apply suggestions from code review
FSM1 Jun 17, 2021
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
10 changes: 10 additions & 0 deletions craco.config.js → craco.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ module.exports = {
}),
],
},
module: {
rules: [
...webpackConfig.module.rules,
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
},
],
},
devtool: "source-map",
}),
},
Expand Down
17 changes: 17 additions & 0 deletions docker-compose-substrate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2020 ChainSafe Systems
# SPDX-License-Identifier: LGPL-3.0-only

version: "3"
services:
geth1:
image: "chainsafe/chainbridge-geth:20200505131100-5586a65"
container_name: geth1
ports:
- "8545:8545"

sub-chain:
image: "chainsafe/chainbridge-substrate-chain:v1.3.0"
container_name: sub-chain
command: chainbridge-substrate-chain --dev --alice --ws-external --rpc-external
ports:
- "9944:9944"
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@
"@babel/core": "^7.12.3",
"@babel/runtime": "^7.12.1",
"@chainsafe/chainbridge-contracts": "1.0.5",
"@chainsafe/web3-context": "1.2.0",
"@chainsafe/common-components": "1.0.26",
"@chainsafe/web3-context": "1.2.0",
"@chainsafe/common-theme": "1.0.10",
"@material-ui/styles": "4.10.0",
"@polkadot/api": "3.11.1",
"@polkadot/extension-dapp": "0.37.1",
"@polkadot/keyring": "5.6.3",
"@polkadot/networks": "5.6.3",
"@polkadot/types": "3.9.3",
"@polkadot/ui-keyring": "0.69.1",
"@polkadot/ui-settings": "0.69.1",
"@polkadot/util": "5.6.3",
"@polkadot/util-crypto": "5.6.3",
"@sentry/react": "^5.26.0",
"@types/history": "^4.7.8",
"bnc-onboard": "1.19.2",
"bnc-onboard": "1.26.1",
"clsx": "^1.1.1",
"dayjs": "^1.9.1",
"ethers": "5.0.32",
Expand All @@ -25,6 +34,7 @@
"yup": "^0.29.3"
},
"devDependencies": {
"@polkadot/typegen": "^4.11.2",
"@sentry/cli": "1.58.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.0.4",
Expand Down Expand Up @@ -52,8 +62,10 @@
"clean:dist": "rm -rf ./*/**/dist && rm -rf ./*/**/build && rm -rf ./*/**/storybook-static",
"clean": "yarn clean:dependencies && yarn clean:dist",
"prettier": "prettier --config .prettierrc 'packages/**/src/**/*.{ts,tsx,js,jsx,md}' --write",
"start:tunnel": "./ngrok http https://localhost:3000"
"start:tunnel": "./ngrok http https://localhost:3000",
"start:substrate": "docker-compose -f ./docker-compose-substrate.yml up -V"
},
"cracoConfig": "./craco.config.cjs",
"eslintConfig": {
"extends": "react-app"
},
Expand Down
27 changes: 27 additions & 0 deletions relayer-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"chains": [
{
"name": "eth",
"type": "ethereum",
"id": "0",
"endpoint": "ws://localhost:8545",
"from": "0xff93B45308FD417dF303D6515aB04D9e89a750Ca",
"opts": {
"bridge": "0x62877dDCd49aD22f5eDfc6ac108e9a4b5D2bD88B",
"erc20Handler": "0x3167776db165D8eA0f51790CA2bbf44Db5105ADF",
"erc721Handler": "0x3f709398808af36ADBA86ACC617FeB7F5B7B193E",
"genericHandler": "0x2B6Ab4b880A45a07d83Cf4d664Df4Ab85705Bc07",
"gasLimit": "1000000",
"maxGasPrice": "20000000"
}
},
{
"name": "sub",
"type": "substrate",
"id": "1",
"endpoint": "ws://localhost:9944",
"from": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
"opts": {}
}
]
}
38 changes: 24 additions & 14 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import Routes from "./Components/Routes";
import { lightTheme } from "./Themes/LightTheme";
import { ChainbridgeProvider } from "./Contexts/ChainbridgeContext";
import AppWrapper from "./Layouts/AppWrapper";
import { Web3Provider } from "@chainsafe/web3-context";
import { NetworkManagerProvider } from "./Contexts/NetworkManagerContext";
import { chainbridgeConfig } from "./chainbridgeConfig";
import { Web3Provider } from "@chainsafe/web3-context";
import { utils } from "ethers";
import "@chainsafe/common-theme/dist/font-faces.css";

Expand All @@ -29,11 +30,16 @@ if (

const App: React.FC<{}> = () => {
const tokens = chainbridgeConfig.chains.reduce((tca, bc) => {
return {
...tca,
[bc.networkId]: bc.tokens,
};
if (bc.networkId) {
return {
...tca,
[bc.networkId]: bc.tokens,
};
} else {
return tca;
}
}, {});

return (
<ErrorBoundary
fallback={({ error, componentStack, eventId, resetError }) => (
Expand All @@ -59,28 +65,32 @@ const App: React.FC<{}> = () => {
<ToasterProvider autoDismiss>
<Web3Provider
tokensToWatch={tokens}
networkIds={[5]}
onboardConfig={{
dappId: process.env.REACT_APP_BLOCKNATIVE_DAPP_ID,
walletSelect: {
wallets: [{ walletName: "metamask", preferred: true }],
},
subscriptions: {
network: (network) => console.log("chainId: ", network),
network: (network) =>
network && console.log("chainId: ", network),
balance: (amount) =>
console.log("balance: ", utils.formatEther(amount)),
amount && console.log("balance: ", utils.formatEther(amount)),
},
}}
checkNetwork={false}
gasPricePollingInterval={120}
gasPriceSetting="fast"
>
<ChainbridgeProvider>
<Router>
<AppWrapper>
<Routes />
</AppWrapper>
</Router>
</ChainbridgeProvider>
<NetworkManagerProvider>
<ChainbridgeProvider>
<Router>
<AppWrapper>
<Routes />
</AppWrapper>
</Router>
</ChainbridgeProvider>
</NetworkManagerProvider>
</Web3Provider>
</ToasterProvider>
</ThemeSwitcher>
Expand Down
18 changes: 11 additions & 7 deletions src/Components/Custom/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ interface IAddressInput extends FormikTextInputProps {
classNames?: {
input?: string;
};
sendToSameAccountHelper?: boolean;
}

const AddressInput: React.FC<IAddressInput> = ({
Expand All @@ -44,6 +45,7 @@ const AddressInput: React.FC<IAddressInput> = ({
label,
labelClassName,
captionMessage,
sendToSameAccountHelper = false,
...rest
}: IAddressInput) => {
const classes = useStyles();
Expand Down Expand Up @@ -83,13 +85,15 @@ const AddressInput: React.FC<IAddressInput> = ({
disabled={stored !== undefined}
/>
</div>
<div className={classes.checkbox}>
<CheckboxInput
label="I want to send funds to my address"
value={stored !== undefined}
onChange={() => toggleReceiver()}
/>
</div>
{sendToSameAccountHelper && (
<div className={classes.checkbox}>
<CheckboxInput
label="I want to send funds to my address"
value={stored !== undefined}
onChange={() => toggleReceiver()}
/>
</div>
)}
</section>
);
};
Expand Down
9 changes: 8 additions & 1 deletion src/Components/Custom/TokenSelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const TokenSelectInput: React.FC<ITokenSelectInput> = ({
sync,
...rest
}: ITokenSelectInput) => {
const [field] = useField(name);
const [field, , helpers] = useField(name);
const labelParsed = tokens[field.value]
? `${label} ${tokens[field.value]?.balance} ${tokens[field.value]?.symbol}`
: "Please select token";
Expand All @@ -35,6 +35,13 @@ const TokenSelectInput: React.FC<ITokenSelectInput> = ({
// eslint-disable-next-line
}, [field]);

useEffect(() => {
// If there is only one token, auto select
if (Object.keys(tokens).length === 1 && field.value === "") {
helpers.setValue(Object.keys(tokens)[0]);
}
}, [tokens, helpers, field.value]);

return (
<FormikSelectInput
name={name}
Expand Down
Loading