Transpile for status app (#70)

This commit is contained in:
Szymon Szlachtowicz 2021-06-29 11:15:27 +02:00 committed by GitHub
parent 2947309074
commit 6f240edf0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -7,8 +7,14 @@ import { MockContract } from '@status-community-dapp/contracts/abi'
export function useContracts() {
const { config } = useConfig()
const { chainId } = useEthers()
let votingContract = new Contract('0x0000000000000000000000000000000000000000', new Interface(MockContract.abi))
return {
votingContract: new Contract(config.contracts[chainId ?? 3].votingContract, new Interface(MockContract.abi)),
if (chainId) {
const chainConfig = config.contracts[chainId]
if (chainConfig) {
votingContract = new Contract(chainConfig.votingContract, new Interface(MockContract.abi))
}
}
return { votingContract }
}

View File

@ -26,7 +26,6 @@ module.exports = (env) => {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
@ -36,7 +35,7 @@ module.exports = (env) => {
'@babel/preset-typescript',
[
'@babel/preset-env',
{ targets: { browsers: '> 5%, not IE <= 11' } },
{ targets: { browsers: 'chrome 77' } },
],
'@babel/preset-react',
],