The following code:
const AeSDK = require(’@aeternity/aepp-sdk’);
const Universal = AeSDK.Universal;
const Node = AeSDK.Node;
const keypair = {
publicKey: 'top',
secretKey: 'secret'
};
var client = null;
async function init() {
const network = {
url: 'http://localhost:3001',
internalUrl: 'http://localhost:3001/internal',
networkId: "ae_devnet",
compilerUrl: 'http://localhost:3080'
};
const node = await Node({
url: network.url,
internalUrl: network.internalUrl,
forceCompatibility: true
});
client = await Universal({
nodes: [{
name: 'ANY_NAME',
instance: node
}],
accounts: [AeSDK.MemoryAccount({
keypair
})],
nativeMode: true,
networkId: network.networkId,
compilerUrl: network.compilerUrl,
forceCompatibility: true
});
console.log(client);
}
async function deployContract(_name, _source, _arguments, amount) {
await init();
console.log('Compiling');
const contract = await client.getContractInstance(_source);
console.log(contract);
const deployed = await contract.deploy();
console.log(deployed);
return deployed;
}
results in the error: Compiler not defined. I have seen several forum posts about this error and the solution was to add compilerUrl on the client. However, despite having done that I still get this error.
What am I doing wrong?