0
let treasury: Record<string, string> = {};
treasury.firstWallet = "0xEA91B5E687a490380C52d264D5d36558d79F4188".toLowerCase()

for (let wallet in treasury) { ...

With this code I am getting the below, with a little red arrow between 'wallet' and 'in', and a '; expected' under 'wallet'

Compile subgraphERROR TS1110: Type expected.

   for (let wallet in treasury) {

So what's wrong with this and what's the proper way to do this?

Steve
  • 4,457
  • 12
  • 48
  • 89

1 Answers1

1

AssemblyScript doesn't have dynamic objects. But you can use Map

const treasury: Map<string, string> = new Map()
  .set("firstWallet", "0xea91b5e687a490380c52d264d5d36558d79f4188")
  .set("secondWallet", "0xea91b5e687a490380c52d264d5d36558d79f4188")

const wallets = treasury.values();
for (let i = 0, len = wallets.length; i < len; i++) {
  let wallet = wallets[i];
  // ...
}
MaxGraey
  • 351
  • 2
  • 6
  • Thank you @MaxGraevy. My VSCode doesn't recognize Map. Do you happen to know what library or version I need in my package.json to make this available? – Steve Oct 03 '22 at 13:40