I have index.js
const { WalletServer } = require('cardano-wallet-js');
// first you need to docker compose to get a access point to the blockchain
// curl the access point
// curl http://localhost:8090/v2/network/information
// your-server-host?
// {port} 8090
let walletServer = WalletServer.init('http://localhost:8090/v2');
let information = await walletServer.getNetworkInformation();
console.log(information);
var start = async function() {
let information = await walletServer.getNetworkInformation();
console.log(information);
}
I run the script as node index.js and I get a error it says a Syntax Error wait and I have docker compose up as wallet service. This is straight from cardano developer docs. Feel like I am missing something.
PS E:\JubliantMarket\jubilant-market\Front-end\demo\src\CardanoWallet> node index.js
E:\JubliantMarket\jubilant-market\Front-end\demo\src\CardanoWallet\index.js:12
let information = await walletServer.getNetworkInformation();
^^^^^
SyntaxError: await is only valid in async function
at wrapSafe (internal/modules/cjs/loader.js:984:16)
at Module._compile (internal/modules/cjs/loader.js:1032:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47