pull/3406/head
filip mertens 2 years ago committed by Aniket
parent 1638dc3eef
commit 2fd680644f
  1. 18
      apps/etherscan/.babelrc
  2. 4
      apps/etherscan/src/app/RemixPlugin.tsx
  3. 4
      apps/etherscan/src/app/app.tsx
  4. 5
      apps/etherscan/src/app/utils/utilities.ts
  5. 4
      apps/etherscan/src/app/utils/verify.ts
  6. 2
      apps/etherscan/src/app/views/ReceiptsView.tsx
  7. 104
      apps/etherscan/webpack.config.js

@ -1,13 +1,9 @@
{
"presets": [
[
"@nrwl/react/babel", {
"runtime": "automatic"
}
]
],
"plugins": [
"presets": ["@babel/preset-env", ["@babel/preset-react",
{"runtime": "automatic"}
]],
"plugins": ["@babel/plugin-proposal-class-properties", "@babel/plugin-transform-runtime", "@babel/plugin-proposal-nullish-coalescing-operator"],
"ignore": [
"**/node_modules/**"
]
}
}

@ -23,9 +23,7 @@ export class RemixClient extends PluginClient {
const etherscanApi = getEtherScanApi(network)
const receiptStatus = await getReceiptStatus(receiptGuid, apiKey, etherscanApi)
return {
status: receiptStatus.status,
message: receiptStatus.message,
result: receiptStatus.result,
message: receiptStatus.result,
succeed: receiptStatus.status === '0' ? false : true
}
} catch (e: any){

@ -89,7 +89,7 @@ const App = () => {
})
if (receiptsNotVerified.length > 0) {
let timer1 = setInterval(() => {
const timer1 = setInterval(() => {
for (const item in receiptsNotVerified) {
}
@ -106,7 +106,7 @@ const App = () => {
apiKey,
getEtherScanApi(network)
)
if (status === "Pass - Verified") {
if (status.result === "Pass - Verified") {
const newReceipts = receipts.map((currentReceipt: Receipt) => {
if (currentReceipt.guid === item.guid) {
return {

@ -2,6 +2,11 @@ import { PluginClient } from "@remixproject/plugin"
import axios from 'axios'
type RemixClient = PluginClient
/*
status: 0=Error, 1=Pass
message: OK, NOTOK
result: explanation
*/
export type receiptStatus = {
result: string
message: string

@ -90,6 +90,8 @@ export const verify = async (
const response = await axios.post(etherscanApi, body)
const { message, result, status } = await response.data
console.log("response", response.data)
if (message === "OK" && status === "1") {
resetAfter10Seconds(client, setResults)
const receiptStatus = await getReceiptStatus(
@ -100,7 +102,7 @@ export const verify = async (
const returnValue = {
guid: result,
status: receiptStatus,
status: receiptStatus.result,
message: `Verification process started correctly. Receipt GUID ${result}`,
succeed: true
}

@ -30,7 +30,7 @@ export const ReceiptsView: React.FC = () => {
apiKey,
etherscanApi
)
setResults(result)
setResults(result.result)
} catch (error: any) {
setResults(error.message)
}

@ -1,28 +1,82 @@
const nxWebpack = require('@nrwl/react/plugins/webpack')
module.exports = config => {
const nxWebpackConfig = nxWebpack(config)
const webpackConfig = {
...nxWebpackConfig,
resolve : {
...nxWebpackConfig.resolve,
fallback: {
...nxWebpackConfig.resolve.fallback,
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"stream": require.resolve("stream-browserify"),
"zlib": require.resolve("browserify-zlib"),
},
}
const { composePlugins, withNx } = require('@nrwl/webpack')
const webpack = require('webpack')
const TerserPlugin = require("terser-webpack-plugin")
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin")
// Nx plugins for webpack.
module.exports = composePlugins(withNx(), (config) => {
// Update the webpack config as needed here.
// e.g. `config.plugins.push(new MyPlugin())`
// add fallback for node modules
config.resolve.fallback = {
...config.resolve.fallback,
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"path": require.resolve("path-browserify"),
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"constants": require.resolve("constants-browserify"),
"os": false, //require.resolve("os-browserify/browser"),
"timers": false, // require.resolve("timers-browserify"),
"zlib": require.resolve("browserify-zlib"),
"fs": false,
"module": false,
"tls": false,
"net": false,
"readline": false,
"child_process": false,
"buffer": require.resolve("buffer/"),
"vm": require.resolve('vm-browserify'),
}
if (process.env.NODE_ENV === 'production') {
return {
...webpackConfig,
mode: 'production',
devtool: 'source-map',
}
} else {
return webpackConfig
// add externals
config.externals = {
...config.externals,
solc: 'solc',
}
}
// add public path
config.output.publicPath = '/'
// add copy & provide plugin
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
url: ['url', 'URL'],
process: 'process/browser',
})
)
// souce-map loader
config.module.rules.push({
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre"
})
config.ignoreWarnings = [/Failed to parse source map/] // ignore source-map-loader warnings
// set minimizer
config.optimization.minimizer = [
new TerserPlugin({
parallel: true,
terserOptions: {
ecma: 2015,
compress: false,
mangle: false,
format: {
comments: false,
},
},
extractComments: false,
}),
new CssMinimizerPlugin(),
];
return config;
});
Loading…
Cancel
Save