Hardhat-abi-exporter Plugin

Hello!
I tried to Export Ethereum smart contract ABIs on compilation via Hardhat by adding hardhat-abi-exporter Plugin as their guide, but it’s giving me an error unExpected token ‘:’.
here is my hardhat config

/**
 * @type import('hardhat/config').HardhatUserConfig
 */

require('@nomiclabs/hardhat-ethers');
require('hardhat-abi-exporter');

// Change private keys accordingly - ONLY FOR DEMOSTRATION PURPOSES - PLEASE STORE PRIVATE KEYS IN A SAFE PLACE
// Export your private key as
//       export PRIVKEY=0x.....
const privateKey = process.env.PRIVKEY;
const privateKeyDev =
   '0x99b3c12287537e38c90a9219d4cb074a89a16e9cdb20bf85728ebd97c343e342';
abiExporter: {
	path: "./abi",
	clear: false,
	flat: true,
	// only: [],
	// except: []
}

module.exports = {
   defaultNetwork: 'hardhat',

   networks: {
      hardhat: {},

      moonbase: {
         url: 'https://rpc.testnet.moonbeam.network',
         accounts: [privateKey],
         chainId: 1287,
      },
      dev: {
         url: 'http://127.0.0.1:9933',
         accounts: [privateKeyDev],
         network_id: '1281',
         chainId: 1281,
      },
   },
   solidity: {
      compilers: [
         {
            version: '0.5.16',
            settings: {
               optimizer: {
                  enabled: true,
                  runs: 200,
               },
            },
         },
         {
            version: '0.6.6',
            settings: {
               optimizer: {
                  enabled: true,
                  runs: 200,
               },
            },
         },
      ],
   },
   paths: {
      sources: './contracts',
      cache: './cache',
      artifacts: './artifacts',
   },
   mocha: {
      timeout: 20000,
   },
};

The error should tell you what line it's triggered so you can find where to fix it.

It’s in hardhat.config.js:18 clear: false, ^ , but I don’t see any errors in this line.

This should go inside the module.exports = { } object.

1 Like

Awesome, I really appreciate your help, thank you very much.