Я получаю эту ошибку при развертывании кода в Ropsten Tes tnet
SyntaxError: Неожиданный токен u в JSON в позиции 0
deploy. js:
const HDWalletProvider = require("truffle-hdwallet-provider");
const Web3 = require("web3");
const { interface, bytecode } = require("./compile.js");
const provider = new HDWalletProvider (
"https://ropsten.infura.io/v3/b2e9ef3a616c45f3b8b9a64ed3714848"
);
const web3 = new Web3(provider);
const deploy = async ()=> {
const accounts = await web3.eth.getAccounts();
console.log(accounts);
console.log("Contract is deployed by the manager with address: ", accounts[0]);
const result = await new web3.eth.Contract(JSON.parse(interface))
.deploy({data: "0x" + bytecode})
.send({gas: "2000000", from: accounts[0]})
console.log("Contract deployed to address", result.options.address);
}
deploy();
Вот компиляция. js:
const path = require('path');
const fs = require('fs');
const solc = require('solc');
const helloPath = path.resolve(__dirname, 'contracts', 'Lottery.sol');
const source = fs.readFileSync(helloPath, 'UTF-8');
var input = {
language: 'Solidity',
sources: {
'Lottery.sol' : {
content: source
}
},
settings: {
outputSelection: {
'*': {
'*': [ '*' ]
}
}
}
};
module.exports = JSON.parse(solc.compile(JSON.stringify(input)));
Не знаете, как решить эту проблему Пожалуйста, помогите, как решить эту проблему
Спасибо & С уважением!