Im currently developing a dApp and want to connect it with the sync2 wallet. Since there is no support for dart im trying to use js functions in a js file in in the web-folder like this:
function checkBalance(value) {
const connex = new Connex({
node: 'http://3.71.71.72:8669/',
network: 'test'
})
const queryAcc = value
const acc = connex.thor.account(queryAcc)
acc.get().then(accInfo => {
const vet = accInfo.balance / 1e18 // +" VET"
return vet
})
}
I then call it in flutter with
var a = js.context.callMethod("checkBalance",
["0x70aE85A2fF6030366F512DbcD60Be3828139b498"]);
The problem is (as far as i can tell) that i cant create the Connex Object ("Could not find name 'Connex'. Did you mean 'connex'?ts(2570)" if i hover over Connex)
I have included connex in index.html like this:
<script src="https://unpkg.com/@vechain/connex@2" ></script>
Why does that not work?