Load contract APIs from hardhat artifacts #215
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,24 +1,18 @@
|
|||||||
const fs = require('fs');
|
const fs = require("fs");
|
||||||
const path = require('path');
|
const path = require("path");
|
||||||
|
|
||||||
const contractsPath = path.join(__dirname, '..', 'build', 'contracts');
|
const contractsPath = path.join(__dirname, "..", "artifacts", "contracts");
|
||||||
const libPath = path.join(__dirname, '..', 'lib');
|
const libPath = path.join(__dirname, "..", "lib");
|
||||||
const abisPath = path.join(libPath, 'abis');
|
const abisPath = path.join(libPath, "abis");
|
||||||
|
|
||||||
const files = [
|
const files = ["Contributor", "Contribution", "Token", "Reimbursement"];
|
||||||
'Contributor',
|
|
||||||
'Contribution',
|
|
||||||
'Kernel',
|
|
||||||
'Proposal',
|
|
||||||
'Token',
|
|
||||||
'Reimbursement',
|
|
||||||
'ACL'
|
|
||||||
];
|
|
||||||
|
|
||||||
files.forEach((fileName) => {
|
files.forEach((fileName) => {
|
||||||
let file = require(`${contractsPath}/${fileName}.json`);
|
let file = require(`${contractsPath}/${fileName}.sol/${fileName}.json`);
|
||||||
let abiFile = path.join(abisPath, `${fileName}.json`);
|
let abiFile = path.join(abisPath, `${fileName}.json`);
|
||||||
fs.writeFileSync(abiFile, JSON.stringify(file.abi));
|
fs.writeFileSync(abiFile, JSON.stringify(file.abi));
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Don't forget to reaload the JSON files from your application; i.e. restart kredits-web");
|
console.log(
|
||||||
|
"Don't forget to reaload the JSON files from your application; i.e. restart kredits-web"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user